krebs.git: move assert to etcDir's type
This commit is contained in:
parent
567800c98e
commit
a431e036e3
|
@ -63,7 +63,11 @@ let
|
|||
description = "Directory used to store repositories.";
|
||||
};
|
||||
etcDir = mkOption {
|
||||
type = types.str;
|
||||
type = mkOptionType {
|
||||
name = "${types.absolute-pathname.name} starting with `/etc/'";
|
||||
check = x: types.absolute-pathname.check x && hasPrefix "/etc/" x;
|
||||
merge = mergeOneOption;
|
||||
};
|
||||
default = "/etc/git";
|
||||
};
|
||||
repos = mkOption {
|
||||
|
@ -314,7 +318,7 @@ let
|
|||
system.activationScripts.git-init = "${init-script}";
|
||||
|
||||
# TODO maybe put all scripts here and then use PATH?
|
||||
environment.etc."${etc-base}".source =
|
||||
environment.etc.${removePrefix "/etc/" cfg.etcDir}.source =
|
||||
scriptFarm "git-ssh-authorizers" {
|
||||
authorize-command = makeAuthorizeScript (map (rule: [
|
||||
(map getName (toList rule.user))
|
||||
|
@ -642,9 +646,5 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
etc-base =
|
||||
assert (hasPrefix "/etc/" cfg.etcDir);
|
||||
removePrefix "/etc/" cfg.etcDir;
|
||||
|
||||
in
|
||||
out
|
||||
|
|
Loading…
Reference in a new issue