diff options
author | Vladimír Čunát <v@cunat.cz> | 2020-08-16 10:14:21 +0200 |
---|---|---|
committer | Vladimír Čunát <v@cunat.cz> | 2020-08-16 10:23:53 +0200 |
commit | 3937923f81b08de1e7f8593ca62d05b8337daaaf (patch) | |
tree | 5b8affb7e05ec16983e9e98478bdc7b2706173df /nixos/modules/system/boot/systemd.nix | |
parent | 3ab2bf69ce4394f99f5c512d95c26e6d44618786 (diff) | |
download | nixpkgs-3937923f81b08de1e7f8593ca62d05b8337daaaf.tar nixpkgs-3937923f81b08de1e7f8593ca62d05b8337daaaf.tar.gz nixpkgs-3937923f81b08de1e7f8593ca62d05b8337daaaf.tar.bz2 nixpkgs-3937923f81b08de1e7f8593ca62d05b8337daaaf.tar.lz nixpkgs-3937923f81b08de1e7f8593ca62d05b8337daaaf.tar.xz nixpkgs-3937923f81b08de1e7f8593ca62d05b8337daaaf.tar.zst nixpkgs-3937923f81b08de1e7f8593ca62d05b8337daaaf.zip |
nixos/systemd.tmpfiles.packages: fix an edge case
symlinkJoin can break (silently) when the passed paths contain symlinks to directories. This should work now. Down-side: when lib/tmpfiles.d doesn't exist for some passed package, the error message is a little less explicit, because we never get to the postBuild phase (and symlinkJoin doesn't provide a better way): /nix/store/HASH-NAME/lib/tmpfiles.d: No such file or directory Also, it seemed pointless to create symlinks for whole package trees and using only a part of the result (usually very small part).
Diffstat (limited to 'nixos/modules/system/boot/systemd.nix')
-rw-r--r-- | nixos/modules/system/boot/systemd.nix | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index d95f001a225..77a54de4ade 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -1012,18 +1012,18 @@ in "sysctl.d/50-coredump.conf".source = "${systemd}/example/sysctl.d/50-coredump.conf"; "sysctl.d/50-default.conf".source = "${systemd}/example/sysctl.d/50-default.conf"; - "tmpfiles.d".source = (pkgs.symlinkJoin { + "tmpfiles.d".source = pkgs.symlinkJoin { name = "tmpfiles.d"; - paths = cfg.tmpfiles.packages; + paths = map (p: p + "/lib/tmpfiles.d") cfg.tmpfiles.packages; postBuild = '' for i in $(cat $pathsPath); do - (test -d $i/lib/tmpfiles.d && test $(ls $i/lib/tmpfiles.d/*.conf | wc -l) -ge 1) || ( - echo "ERROR: The path $i was passed to systemd.tmpfiles.packages but either does not contain the folder lib/tmpfiles.d or if it contains that folder, there are no files ending in .conf in it." + (test -d "$i" && test $(ls "$i"/*.conf | wc -l) -ge 1) || ( + echo "ERROR: The path '$i' from systemd.tmpfiles.packages contains no *.conf files." exit 1 ) done ''; - }) + "/lib/tmpfiles.d"; + }; "systemd/system-generators" = { source = hooks "generators" cfg.generators; }; "systemd/system-shutdown" = { source = hooks "shutdown" cfg.shutdown; }; |