diff options
author | lassulus <lassulus@lassul.us> | 2022-01-30 10:47:23 +0100 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2022-01-30 11:22:09 +0100 |
commit | 100b6fc2438db6ca2c7abe0ad525be3b1dd64895 (patch) | |
tree | edd2839758d8c5246622a999abb804230798d66c /lass/3modules/acl.nix | |
parent | 1fe702a0830ab1065bd993005b1230336cff7c62 (diff) |
move acl module to krebs
Diffstat (limited to 'lass/3modules/acl.nix')
-rw-r--r-- | lass/3modules/acl.nix | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/lass/3modules/acl.nix b/lass/3modules/acl.nix deleted file mode 100644 index 81eeae92..00000000 --- a/lass/3modules/acl.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ config, lib, pkgs, ... }: let - parents = dir: - if dir == "/" then - [ dir ] - else - [ dir ] ++ parents (builtins.dirOf dir) - ; -in { - options.lass.acl = lib.mkOption { - type = lib.types.attrsOf (lib.types.attrsOf (lib.types.submodule ({ config, ... }: { - options = { - rule = lib.mkOption { - type = lib.types.str; - default = config._module.args.name; - }; - default = lib.mkOption { - type = lib.types.bool; - default = !config.parents; - }; - recursive = lib.mkOption { - type = lib.types.bool; - default = !config.parents; - }; - parents = lib.mkOption { - type = lib.types.bool; - default = false; - description = '' - apply ACL to every parent folder - ''; - }; - }; - }))); - default = {}; - }; - config = lib.mkIf (config.lass.acl != {}) { - systemd.services = lib.mapAttrs' (path: rules: lib.nameValuePair "acl-${lib.replaceChars ["/"] ["_"] path}" { - wantedBy = [ "multi-user.target" ]; - path = [ - pkgs.acl - pkgs.coreutils - ]; - serviceConfig = { - ExecStart = pkgs.writers.writeDash "acl" (lib.concatStrings ( - lib.mapAttrsToList (_: rule: '' - setfacl -${lib.optionalString rule.recursive "R"}m ${rule.rule} ${path} - ${lib.optionalString rule.default "setfacl -${lib.optionalString rule.recursive "R"}dm ${rule.rule} ${path}"} - ${lib.optionalString rule.parents (lib.concatMapStringsSep "\n" (folder: "setfacl -m ${rule.rule} ${folder}") (parents path))} - '') rules - )); - RemainAfterExit = true; - Type = "simple"; - }; - }) config.lass.acl; - }; -} |