Commit b6f7d1c8 authored by Robert Hensing's avatar Robert Hensing
Browse files

nixos/tmpfiles: fix layer inversion

The nix module uses tmpfiles, not the other way around.
Move definitions so that tmpfiles does not depend on the nix module.
This makes the tmpfiles module usable without loading a nix module.
parent 71715110
Loading
Loading
Loading
Loading
+89 −78
Original line number Diff line number Diff line
@@ -297,7 +297,17 @@ in

  ###### implementation

  config = lib.mkIf (cfg.enable && nixPackage.pname != "lix") {
  config = lib.mkMerge [
    (lib.mkIf cfg.enable {
      systemd.tmpfiles.rules = [
        "d  /nix/var                           0755 root root - -"
        "L+ /nix/var/nix/gcroots/booted-system 0755 root root - /run/booted-system"
        # Boot-time cleanup
        "R! /nix/var/nix/gcroots/tmp           -    -    -    - -"
        "R! /nix/var/nix/temproots             -    -    -    - -"
      ];
    })
    (lib.mkIf (cfg.enable && nixPackage.pname != "lix") {
      environment.systemPackages = [
        nixPackage
        pkgs.nix-info
@@ -385,6 +395,7 @@ in

      # Legacy configuration conversion.
      nix.settings.sandbox-fallback = false;
  };
    })
  ];

}
+0 −8
Original line number Diff line number Diff line
@@ -350,19 +350,11 @@ in
      "d  /var/db                            0755 root root - -"
      "L  /var/lock                          -    -    -    - ../run/lock"
    ]
    ++ lib.optionals config.nix.enable [
      "d  /nix/var                           0755 root root - -"
      "L+ /nix/var/nix/gcroots/booted-system 0755 root root - /run/booted-system"
    ]
    # Boot-time cleanup
    ++ [
      "R! /etc/group.lock                    -    -    -    - -"
      "R! /etc/passwd.lock                   -    -    -    - -"
      "R! /etc/shadow.lock                   -    -    -    - -"
    ]
    ++ lib.optionals config.nix.enable [
      "R! /nix/var/nix/gcroots/tmp           -    -    -    - -"
      "R! /nix/var/nix/temproots             -    -    -    - -"
    ];

    boot.initrd.systemd = {