Skip to content

Commit

Permalink
Merge pull request #119398 from NixOS/staging-next
Browse files Browse the repository at this point in the history
Staging next
  • Loading branch information
FRidh committed Apr 25, 2021
2 parents 7217b9e + c648f7e commit 78af98a
Show file tree
Hide file tree
Showing 684 changed files with 6,306 additions and 3,759 deletions.
2 changes: 1 addition & 1 deletion doc/stdenv/cross-compilation.chapter.md
Expand Up @@ -123,7 +123,7 @@ depsBuildBuild = [ buildPackages.stdenv.cc ];

Add the following to your `mkDerivation` invocation.
```nix
doCheck = stdenv.hostPlatform == stdenv.buildPlatfrom;
doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
```

## Cross-building packages {#sec-cross-usage}
Expand Down
5 changes: 5 additions & 0 deletions lib/licenses.nix
Expand Up @@ -125,6 +125,11 @@ lib.mapAttrs (n: v: v // { shortName = n; }) ({
fullName = ''BSD 4-clause "Original" or "Old" License'';
};

bsdOriginalUC = spdx {
spdxId = "BSD-4-Clause-UC";
fullName = "BSD 4-Clause University of California-Specific";
};

bsdProtection = spdx {
spdxId = "BSD-Protection";
fullName = "BSD Protection License";
Expand Down
13 changes: 13 additions & 0 deletions lib/systems/default.nix
Expand Up @@ -112,6 +112,19 @@ rec {
aarch64 = "arm64";
}.${final.parsed.cpu.name} or final.parsed.cpu.name;

darwinPlatform =
if final.isMacOS then "macos"
else if final.isiOS then "ios"
else null;
# The canonical name for this attribute is darwinSdkVersion, but some
# platforms define the old name "sdkVer".
darwinSdkVersion = final.sdkVer or "10.12";
darwinMinVersion = final.darwinSdkVersion;
darwinMinVersionVariable =
if final.isMacOS then "MACOSX_DEPLOYMENT_TARGET"
else if final.isiOS then "IPHONEOS_DEPLOYMENT_TARGET"
else null;

emulator = pkgs: let
qemu-user = pkgs.qemu.override {
smartcardSupport = false;
Expand Down
2 changes: 2 additions & 0 deletions lib/systems/examples.nix
Expand Up @@ -217,6 +217,7 @@ rec {
sdkVer = "14.3";
xcodeVer = "12.3";
xcodePlatform = "iPhoneSimulator";
darwinPlatform = "ios-simulator";
useiOSPrebuilt = true;
};

Expand All @@ -226,6 +227,7 @@ rec {
sdkVer = "14.3";
xcodeVer = "12.3";
xcodePlatform = "iPhoneSimulator";
darwinPlatform = "ios-simulator";
useiOSPrebuilt = true;
};

Expand Down
3 changes: 3 additions & 0 deletions nixos/modules/module-list.nix
Expand Up @@ -701,6 +701,9 @@
./services/networking/iodine.nix
./services/networking/iperf3.nix
./services/networking/ircd-hybrid/default.nix
./services/networking/iscsi/initiator.nix
./services/networking/iscsi/root-initiator.nix
./services/networking/iscsi/target.nix
./services/networking/iwd.nix
./services/networking/jicofo.nix
./services/networking/jitsi-videobridge.nix
Expand Down
71 changes: 32 additions & 39 deletions nixos/modules/services/hardware/pcscd.nix
Expand Up @@ -10,60 +10,53 @@ let
paths = map (p: "${p}/pcsc/drivers") config.services.pcscd.plugins;
};

in {
in
{

###### interface

options = {
options.services.pcscd = {
enable = mkEnableOption "PCSC-Lite daemon";

services.pcscd = {
enable = mkEnableOption "PCSC-Lite daemon";

plugins = mkOption {
type = types.listOf types.package;
default = [ pkgs.ccid ];
defaultText = "[ pkgs.ccid ]";
example = literalExample "[ pkgs.pcsc-cyberjack ]";
description = "Plugin packages to be used for PCSC-Lite.";
};

readerConfig = mkOption {
type = types.lines;
default = "";
example = ''
FRIENDLYNAME "Some serial reader"
DEVICENAME /dev/ttyS0
LIBPATH /path/to/serial_reader.so
CHANNELID 1
'';
description = ''
Configuration for devices that aren't hotpluggable.
plugins = mkOption {
type = types.listOf types.package;
default = [ pkgs.ccid ];
defaultText = "[ pkgs.ccid ]";
example = literalExample "[ pkgs.pcsc-cyberjack ]";
description = "Plugin packages to be used for PCSC-Lite.";
};

See <citerefentry><refentrytitle>reader.conf</refentrytitle>
<manvolnum>5</manvolnum></citerefentry> for valid options.
'';
};
readerConfig = mkOption {
type = types.lines;
default = "";
example = ''
FRIENDLYNAME "Some serial reader"
DEVICENAME /dev/ttyS0
LIBPATH /path/to/serial_reader.so
CHANNELID 1
'';
description = ''
Configuration for devices that aren't hotpluggable.
See <citerefentry><refentrytitle>reader.conf</refentrytitle>
<manvolnum>5</manvolnum></citerefentry> for valid options.
'';
};
};

###### implementation

config = mkIf config.services.pcscd.enable {

systemd.sockets.pcscd = {
description = "PCSC-Lite Socket";
wantedBy = [ "sockets.target" ];
before = [ "multi-user.target" ];
socketConfig.ListenStream = "/run/pcscd/pcscd.comm";
};
environment.etc."reader.conf".source = cfgFile;

systemd.packages = [ (getBin pkgs.pcsclite) ];

systemd.sockets.pcscd.wantedBy = [ "sockets.target" ];

systemd.services.pcscd = {
description = "PCSC-Lite daemon";
environment.PCSCLITE_HP_DROPDIR = pluginEnv;
serviceConfig = {
ExecStart = "${getBin pkgs.pcsclite}/sbin/pcscd -f -x -c ${cfgFile}";
ExecReload = "${getBin pkgs.pcsclite}/sbin/pcscd -H";
};
restartTriggers = [ "/etc/reader.conf" ];
};
};
}
84 changes: 84 additions & 0 deletions nixos/modules/services/networking/iscsi/initiator.nix
@@ -0,0 +1,84 @@
{ config, lib, pkgs, ... }: with lib;
let
cfg = config.services.openiscsi;
in
{
options.services.openiscsi = with types; {
enable = mkEnableOption "the openiscsi iscsi daemon";
enableAutoLoginOut = mkEnableOption ''
automatic login and logout of all automatic targets.
You probably do not want this.
'';
discoverPortal = mkOption {
type = nullOr str;
default = null;
description = "Portal to discover targets on";
};
name = mkOption {
type = str;
description = "Name of this iscsi initiator";
example = "iqn.2020-08.org.linux-iscsi.initiatorhost:example";
};
package = mkOption {
type = package;
description = "openiscsi package to use";
default = pkgs.openiscsi;
defaultText = "pkgs.openiscsi";
};

extraConfig = mkOption {
type = str;
default = "";
description = "Lines to append to default iscsid.conf";
};

extraConfigFile = mkOption {
description = ''
Append an additional file's contents to /etc/iscsid.conf. Use a non-store path
and store passwords in this file.
'';
default = null;
type = nullOr str;
};
};

config = mkIf cfg.enable {
environment.etc."iscsi/iscsid.conf.fragment".source = pkgs.runCommand "iscsid.conf" {} ''
cat "${cfg.package}/etc/iscsi/iscsid.conf" > $out
cat << 'EOF' >> $out
${cfg.extraConfig}
${optionalString cfg.enableAutoLoginOut "node.startup = automatic"}
EOF
'';
environment.etc."iscsi/initiatorname.iscsi".text = "InitiatorName=${cfg.name}";

system.activationScripts.iscsid = let
extraCfgDumper = optionalString (cfg.extraConfigFile != null) ''
if [ -f "${cfg.extraConfigFile}" ]; then
printf "\n# The following is from ${cfg.extraConfigFile}:\n"
cat "${cfg.extraConfigFile}"
else
echo "Warning: services.openiscsi.extraConfigFile ${cfg.extraConfigFile} does not exist!" >&2
fi
'';
in ''
(
cat ${config.environment.etc."iscsi/iscsid.conf.fragment".source}
${extraCfgDumper}
) > /etc/iscsi/iscsid.conf
'';

systemd.packages = [ cfg.package ];

systemd.services."iscsid".wantedBy = [ "multi-user.target" ];
systemd.sockets."iscsid".wantedBy = [ "sockets.target" ];

systemd.services."iscsi" = mkIf cfg.enableAutoLoginOut {
wantedBy = [ "remote-fs.target" ];
serviceConfig.ExecStartPre = mkIf (cfg.discoverPortal != null) "${cfg.package}/bin/iscsiadm --mode discoverydb --type sendtargets --portal ${escapeShellArg cfg.discoverPortal} --discover";
};

environment.systemPackages = [ cfg.package ];
boot.kernelModules = [ "iscsi_tcp" ];
};
}

0 comments on commit 78af98a

Please sign in to comment.