Unverified Commit 3c247e4d authored by github-actions[bot]'s avatar github-actions[bot] Committed by GitHub
Browse files

Merge staging-next into staging

parents aba5c086 968bf02d
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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
+56 −15
Original line number Diff line number Diff line
@@ -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

{
@@ -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')
+10 −1
Original line number Diff line number Diff line
@@ -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" [
@@ -652,6 +656,8 @@ let
          "DNSDefaultRoute"
          "NTP"
          "IPForward"
          "IPv4Forwarding"
          "IPv6Forwarding"
          "IPMasquerade"
          "IPv6PrivacyExtensions"
          "IPv6AcceptRA"
@@ -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)
@@ -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;
+1 −0
Original line number Diff line number Diff line
@@ -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
+14 −0
Original line number Diff line number Diff line
@@ -37,6 +37,8 @@ let
      "cryptsetup.target"
      "cryptsetup-pre.target"
      "remote-cryptsetup.target"
    ] ++ optionals cfg.package.withTpm2Tss [
      "tpm2.target"
    ] ++ [
      "sigpwr.target"
      "timers.target"
@@ -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"
@@ -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 [
@@ -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