Loading nixos/lib/systemd-lib.nix +4 −0 Original line number Diff line number Diff line Loading @@ -169,6 +169,10 @@ in rec { optional (attr ? ${name} && !isInt attr.${name}) "Systemd ${group} field `${name}' is not an integer"; assertRemoved = name: see: group: attr: optional (attr ? ${name}) "Systemd ${group} field `${name}' has been removed. See ${see}"; checkUnitConfig = group: checks: attrs: let # We're applied at the top-level type (attrsOf unitOption), so the actual # unit options might contain attributes from mkOverride and mkIf that we need to Loading nixos/lib/systemd-types.nix +56 −15 Original line number Diff line number Diff line Loading @@ -45,12 +45,61 @@ let inherit (lib.types) attrsOf coercedTo enum lines listOf nullOr oneOf package path singleLineStr submodule ; initrdStorePathModule = { config, ... }: { options = { enable = (mkEnableOption "copying of this file and symlinking it") // { default = true; }; target = mkOption { type = nullOr path; description = '' Path of the symlink. ''; default = null; }; source = mkOption { type = path; description = "Path of the source file."; }; dlopen = { usePriority = mkOption { type = enum [ "required" "recommended" "suggested" ]; default = "recommended"; description = '' Priority of dlopen ELF notes to include. "required" is minimal, "recommended" includes "required", and "suggested" includes "recommended". See: https://systemd.io/ELF_DLOPEN_METADATA/ ''; }; features = mkOption { type = listOf singleLineStr; default = [ ]; description = '' Features to enable via dlopen ELF notes. These will be in addition to anything included via 'usePriority', regardless of their priority. ''; }; }; }; }; in { Loading Loading @@ -86,31 +135,23 @@ in automounts = listOf (submodule [ stage2AutomountOptions unitConfig automountConfig ]); initrdAutomounts = attrsOf (submodule [ stage1AutomountOptions unitConfig automountConfig ]); initrdStorePath = listOf (coercedTo (oneOf [ singleLineStr package ]) (source: { inherit source; }) (submodule initrdStorePathModule)); initrdContents = attrsOf (submodule ({ config, options, name, ... }: { imports = [ initrdStorePathModule ]; options = { enable = (mkEnableOption "copying of this file and symlinking it") // { default = true; }; target = mkOption { type = path; description = '' Path of the symlink. ''; default = name; }; text = mkOption { default = null; type = nullOr lines; description = "Text of the file."; }; source = mkOption { type = path; description = "Path of the source file."; }; }; config = { target = mkDefault name; source = mkIf (config.text != null) ( let name' = "initrd-" + baseNameOf name; in mkDerivedConfig options.text (pkgs.writeText name') Loading nixos/modules/system/boot/networkd.nix +10 −1 Original line number Diff line number Diff line Loading @@ -18,12 +18,16 @@ let "ManageForeignRoutes" "RouteTable" "IPv6PrivacyExtensions" "IPv4Forwarding" "IPv6Forwarding" ]) (assertValueOneOf "SpeedMeter" boolValues) (assertInt "SpeedMeterIntervalSec") (assertValueOneOf "ManageForeignRoutingPolicyRules" boolValues) (assertValueOneOf "ManageForeignRoutes" boolValues) (assertValueOneOf "IPv6PrivacyExtensions" (boolValues ++ ["prefer-public" "kernel"])) (assertValueOneOf "IPv4Forwarding" boolValues) (assertValueOneOf "IPv6Forwarding" boolValues) ]; sectionDHCPv4 = checkUnitConfig "DHCPv4" [ Loading Loading @@ -652,6 +656,8 @@ let "DNSDefaultRoute" "NTP" "IPForward" "IPv4Forwarding" "IPv6Forwarding" "IPMasquerade" "IPv6PrivacyExtensions" "IPv6AcceptRA" Loading Loading @@ -700,7 +706,9 @@ let (assertValueOneOf "LLDP" (boolValues ++ ["routers-only"])) (assertValueOneOf "EmitLLDP" (boolValues ++ ["nearest-bridge" "non-tpmr-bridge" "customer-bridge"])) (assertValueOneOf "DNSDefaultRoute" boolValues) (assertValueOneOf "IPForward" (boolValues ++ ["ipv4" "ipv6"])) (assertRemoved "IPForward" "IPv4Forwarding and IPv6Forwarding in systemd.network(5) and networkd.conf(5)") (assertValueOneOf "IPv4Forwarding" boolValues) (assertValueOneOf "IPv6Forwarding" boolValues) (assertValueOneOf "IPMasquerade" (boolValues ++ ["ipv4" "ipv6" "both"])) (assertValueOneOf "IPv6PrivacyExtensions" (boolValues ++ ["prefer-public" "kernel"])) (assertValueOneOf "IPv6AcceptRA" boolValues) Loading Loading @@ -2835,6 +2843,7 @@ let "systemd-networkd-wait-online.service" "systemd-networkd.service" "systemd-networkd.socket" "systemd-networkd-persistent-storage.service" ]; environment.etc."systemd/networkd.conf" = renderConfig cfg.config; Loading nixos/modules/system/boot/stage-1.nix +1 −0 Original line number Diff line number Diff line Loading @@ -131,6 +131,7 @@ let # Copy udev. copy_bin_and_libs ${udev}/bin/udevadm cp ${lib.getLib udev.kmod}/lib/libkmod.so* $out/lib copy_bin_and_libs ${udev}/lib/systemd/systemd-sysctl for BIN in ${udev}/lib/udev/*_id; do copy_bin_and_libs $BIN Loading nixos/modules/system/boot/systemd.nix +14 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,8 @@ let "cryptsetup.target" "cryptsetup-pre.target" "remote-cryptsetup.target" ] ++ optionals cfg.package.withTpm2Tss [ "tpm2.target" ] ++ [ "sigpwr.target" "timers.target" Loading Loading @@ -112,6 +114,7 @@ let "sleep.target" "hybrid-sleep.target" "systemd-hibernate.service" "systemd-hibernate-clear.service" "systemd-hybrid-sleep.service" "systemd-suspend.service" "systemd-suspend-then-hibernate.service" Loading @@ -136,6 +139,16 @@ let "systemd-ask-password-wall.path" "systemd-ask-password-wall.service" # Varlink APIs "systemd-bootctl@.service" "systemd-bootctl.socket" "systemd-creds@.service" "systemd-creds.socket" ] ++ lib.optional cfg.package.withTpm2Tss [ "systemd-pcrlock@.service" "systemd-pcrlock.socket" ] ++ [ # Slices / containers. "slices.target" ] ++ optionals cfg.package.withImportd [ Loading @@ -158,6 +171,7 @@ let ] ++ optionals cfg.package.withHostnamed [ "dbus-org.freedesktop.hostname1.service" "systemd-hostnamed.service" "systemd-hostnamed.socket" ] ++ optionals cfg.package.withPortabled [ "dbus-org.freedesktop.portable1.service" "systemd-portabled.service" Loading Loading
nixos/lib/systemd-lib.nix +4 −0 Original line number Diff line number Diff line Loading @@ -169,6 +169,10 @@ in rec { optional (attr ? ${name} && !isInt attr.${name}) "Systemd ${group} field `${name}' is not an integer"; assertRemoved = name: see: group: attr: optional (attr ? ${name}) "Systemd ${group} field `${name}' has been removed. See ${see}"; checkUnitConfig = group: checks: attrs: let # We're applied at the top-level type (attrsOf unitOption), so the actual # unit options might contain attributes from mkOverride and mkIf that we need to Loading
nixos/lib/systemd-types.nix +56 −15 Original line number Diff line number Diff line Loading @@ -45,12 +45,61 @@ let inherit (lib.types) attrsOf coercedTo enum lines listOf nullOr oneOf package path singleLineStr submodule ; initrdStorePathModule = { config, ... }: { options = { enable = (mkEnableOption "copying of this file and symlinking it") // { default = true; }; target = mkOption { type = nullOr path; description = '' Path of the symlink. ''; default = null; }; source = mkOption { type = path; description = "Path of the source file."; }; dlopen = { usePriority = mkOption { type = enum [ "required" "recommended" "suggested" ]; default = "recommended"; description = '' Priority of dlopen ELF notes to include. "required" is minimal, "recommended" includes "required", and "suggested" includes "recommended". See: https://systemd.io/ELF_DLOPEN_METADATA/ ''; }; features = mkOption { type = listOf singleLineStr; default = [ ]; description = '' Features to enable via dlopen ELF notes. These will be in addition to anything included via 'usePriority', regardless of their priority. ''; }; }; }; }; in { Loading Loading @@ -86,31 +135,23 @@ in automounts = listOf (submodule [ stage2AutomountOptions unitConfig automountConfig ]); initrdAutomounts = attrsOf (submodule [ stage1AutomountOptions unitConfig automountConfig ]); initrdStorePath = listOf (coercedTo (oneOf [ singleLineStr package ]) (source: { inherit source; }) (submodule initrdStorePathModule)); initrdContents = attrsOf (submodule ({ config, options, name, ... }: { imports = [ initrdStorePathModule ]; options = { enable = (mkEnableOption "copying of this file and symlinking it") // { default = true; }; target = mkOption { type = path; description = '' Path of the symlink. ''; default = name; }; text = mkOption { default = null; type = nullOr lines; description = "Text of the file."; }; source = mkOption { type = path; description = "Path of the source file."; }; }; config = { target = mkDefault name; source = mkIf (config.text != null) ( let name' = "initrd-" + baseNameOf name; in mkDerivedConfig options.text (pkgs.writeText name') Loading
nixos/modules/system/boot/networkd.nix +10 −1 Original line number Diff line number Diff line Loading @@ -18,12 +18,16 @@ let "ManageForeignRoutes" "RouteTable" "IPv6PrivacyExtensions" "IPv4Forwarding" "IPv6Forwarding" ]) (assertValueOneOf "SpeedMeter" boolValues) (assertInt "SpeedMeterIntervalSec") (assertValueOneOf "ManageForeignRoutingPolicyRules" boolValues) (assertValueOneOf "ManageForeignRoutes" boolValues) (assertValueOneOf "IPv6PrivacyExtensions" (boolValues ++ ["prefer-public" "kernel"])) (assertValueOneOf "IPv4Forwarding" boolValues) (assertValueOneOf "IPv6Forwarding" boolValues) ]; sectionDHCPv4 = checkUnitConfig "DHCPv4" [ Loading Loading @@ -652,6 +656,8 @@ let "DNSDefaultRoute" "NTP" "IPForward" "IPv4Forwarding" "IPv6Forwarding" "IPMasquerade" "IPv6PrivacyExtensions" "IPv6AcceptRA" Loading Loading @@ -700,7 +706,9 @@ let (assertValueOneOf "LLDP" (boolValues ++ ["routers-only"])) (assertValueOneOf "EmitLLDP" (boolValues ++ ["nearest-bridge" "non-tpmr-bridge" "customer-bridge"])) (assertValueOneOf "DNSDefaultRoute" boolValues) (assertValueOneOf "IPForward" (boolValues ++ ["ipv4" "ipv6"])) (assertRemoved "IPForward" "IPv4Forwarding and IPv6Forwarding in systemd.network(5) and networkd.conf(5)") (assertValueOneOf "IPv4Forwarding" boolValues) (assertValueOneOf "IPv6Forwarding" boolValues) (assertValueOneOf "IPMasquerade" (boolValues ++ ["ipv4" "ipv6" "both"])) (assertValueOneOf "IPv6PrivacyExtensions" (boolValues ++ ["prefer-public" "kernel"])) (assertValueOneOf "IPv6AcceptRA" boolValues) Loading Loading @@ -2835,6 +2843,7 @@ let "systemd-networkd-wait-online.service" "systemd-networkd.service" "systemd-networkd.socket" "systemd-networkd-persistent-storage.service" ]; environment.etc."systemd/networkd.conf" = renderConfig cfg.config; Loading
nixos/modules/system/boot/stage-1.nix +1 −0 Original line number Diff line number Diff line Loading @@ -131,6 +131,7 @@ let # Copy udev. copy_bin_and_libs ${udev}/bin/udevadm cp ${lib.getLib udev.kmod}/lib/libkmod.so* $out/lib copy_bin_and_libs ${udev}/lib/systemd/systemd-sysctl for BIN in ${udev}/lib/udev/*_id; do copy_bin_and_libs $BIN Loading
nixos/modules/system/boot/systemd.nix +14 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,8 @@ let "cryptsetup.target" "cryptsetup-pre.target" "remote-cryptsetup.target" ] ++ optionals cfg.package.withTpm2Tss [ "tpm2.target" ] ++ [ "sigpwr.target" "timers.target" Loading Loading @@ -112,6 +114,7 @@ let "sleep.target" "hybrid-sleep.target" "systemd-hibernate.service" "systemd-hibernate-clear.service" "systemd-hybrid-sleep.service" "systemd-suspend.service" "systemd-suspend-then-hibernate.service" Loading @@ -136,6 +139,16 @@ let "systemd-ask-password-wall.path" "systemd-ask-password-wall.service" # Varlink APIs "systemd-bootctl@.service" "systemd-bootctl.socket" "systemd-creds@.service" "systemd-creds.socket" ] ++ lib.optional cfg.package.withTpm2Tss [ "systemd-pcrlock@.service" "systemd-pcrlock.socket" ] ++ [ # Slices / containers. "slices.target" ] ++ optionals cfg.package.withImportd [ Loading @@ -158,6 +171,7 @@ let ] ++ optionals cfg.package.withHostnamed [ "dbus-org.freedesktop.hostname1.service" "systemd-hostnamed.service" "systemd-hostnamed.socket" ] ++ optionals cfg.package.withPortabled [ "dbus-org.freedesktop.portable1.service" "systemd-portabled.service" Loading