summary refs log tree commit diff
path: root/nixos/modules/misc/locate.nix
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-10-08 21:45:42 +0200
committerEelco Dolstra <edolstra@gmail.com>2019-10-08 21:45:42 +0200
commitb407822b8563186fed3b7527d9c8ae06e29af030 (patch)
tree6b21d5ac20533b47c2fdf4205e8bba98a3a748fb /nixos/modules/misc/locate.nix
parent4466427a32f0ac7e4994ae4b52f1c2b85b53b999 (diff)
downloadnixpkgs-b407822b8563186fed3b7527d9c8ae06e29af030.tar
nixpkgs-b407822b8563186fed3b7527d9c8ae06e29af030.tar.gz
nixpkgs-b407822b8563186fed3b7527d9c8ae06e29af030.tar.bz2
nixpkgs-b407822b8563186fed3b7527d9c8ae06e29af030.tar.lz
nixpkgs-b407822b8563186fed3b7527d9c8ae06e29af030.tar.xz
nixpkgs-b407822b8563186fed3b7527d9c8ae06e29af030.tar.zst
nixpkgs-b407822b8563186fed3b7527d9c8ae06e29af030.zip
locate.nix: Don't create /var/cache
Fixes

  setting up tmpfiles
  [/etc/tmpfiles.d/var.conf:19] Duplicate line for path "/var/cache", ignoring.
Diffstat (limited to 'nixos/modules/misc/locate.nix')
-rw-r--r--nixos/modules/misc/locate.nix5
1 files changed, 4 insertions, 1 deletions
diff --git a/nixos/modules/misc/locate.nix b/nixos/modules/misc/locate.nix
index 449149e4bb6..737ed5c0a3f 100644
--- a/nixos/modules/misc/locate.nix
+++ b/nixos/modules/misc/locate.nix
@@ -128,7 +128,10 @@ in {
 
     # directory creation needs to be separated from main service
     # because ReadWritePaths fails when the directory doesn't already exist
-    systemd.tmpfiles.rules = [ "d ${dirOf cfg.output} 0755 root root -" ];
+    systemd.tmpfiles.rules =
+      let dir = dirOf cfg.output; in
+      mkIf (dir != "/var/cache")
+        [ "d ${dir} 0755 root root -" ];
 
     systemd.services.update-locatedb =
       { description = "Update Locate Database";