nix: typo in comment
[sourcephile-nix.git] / nixos / modules / security / pass.nix
index 385c9c1fd6d0653d4b8e4c0c90309e46707258fd..294e5d9a6ae0add34bf8da7e8cc64ebed1f5cf0a 100644 (file)
@@ -1,11 +1,8 @@
 { pkgs, lib, config, ... }:
 let
-  inherit (builtins) head listToAttrs match split;
+  inherit (builtins) dirOf head listToAttrs match split;
   inherit (lib) types;
   inherit (config.security) pass;
-  dirname = p:
-    let dir = match "^(.+)/[^/]*$" p; in
-    if dir == [] then "." else head dir;
   escapeUnitName = name:
     lib.concatMapStrings (s: if lib.isList s then "-" else s)
     (split "[^a-zA-Z0-9_.\\-]+" name);
@@ -119,7 +116,6 @@ options.security.pass = {
   };
 };
 config = lib.mkIf (pass.secrets != {}) {
-  #systemd.tmpfiles.rules = [ "d /run/secrets 0755 root root -" ];
   systemd.services =
     lib.mapAttrs' (target: secret:
       lib.nameValuePair (lib.removeSuffix ".service" secret.service) {
@@ -148,9 +144,9 @@ config = lib.mkIf (pass.secrets != {}) {
           Environment = "GNUPGHOME=${secret.gnupgHome}";
           PrivateTmp = true;
           RemainAfterExit = true;
-          WorkingDirectory = dirname secret.gnupgHome;
+          WorkingDirectory = dirOf secret.gnupgHome;
         } // lib.optionalAttrs (match "^/.*" target == null) {
-          RuntimeDirectory = lib.removePrefix "/run/" (dirname secret.path);
+          RuntimeDirectory = lib.removePrefix "/run/" (dirOf secret.path);
           RuntimeDirectoryMode = "711";
           RuntimeDirectoryPreserve = false;
         };