permown: fix flakify fuckups
This commit is contained in:
parent
0e6c1e2d94
commit
512232b72a
@ -1,4 +1,6 @@
|
|||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }: let
|
||||||
|
slib = import ../../lib/pure.nix { inherit lib; };
|
||||||
|
in
|
||||||
with lib; {
|
with lib; {
|
||||||
|
|
||||||
options.krebs.permown = mkOption {
|
options.krebs.permown = mkOption {
|
||||||
@ -16,7 +18,7 @@ with lib; {
|
|||||||
group = mkOption {
|
group = mkOption {
|
||||||
apply = x: if x == null then "" else x;
|
apply = x: if x == null then "" else x;
|
||||||
default = null;
|
default = null;
|
||||||
type = types.nullOr types.groupname;
|
type = types.nullOr slib.types.groupname;
|
||||||
};
|
};
|
||||||
keepGoing = mkOption {
|
keepGoing = mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
@ -28,15 +30,15 @@ with lib; {
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
owner = mkOption {
|
owner = mkOption {
|
||||||
type = types.username;
|
type = slib.types.username;
|
||||||
};
|
};
|
||||||
path = mkOption {
|
path = mkOption {
|
||||||
default = config._module.args.name;
|
default = config._module.args.name;
|
||||||
type = types.absolute-pathname;
|
type = slib.types.absolute-pathname;
|
||||||
};
|
};
|
||||||
umask = mkOption {
|
umask = mkOption {
|
||||||
default = "0027";
|
default = "0027";
|
||||||
type = types.file-mode;
|
type = slib.types.file-mode;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
@ -48,11 +50,11 @@ with lib; {
|
|||||||
|
|
||||||
system.activationScripts.permown = let
|
system.activationScripts.permown = let
|
||||||
mkdir = plan: /* sh */ ''
|
mkdir = plan: /* sh */ ''
|
||||||
${pkgs.coreutils}/bin/mkdir -p ${shell.escape plan.path}
|
${pkgs.coreutils}/bin/mkdir -p ${slib.shell.escape plan.path}
|
||||||
'';
|
'';
|
||||||
in concatMapStrings mkdir plans;
|
in concatMapStrings mkdir plans;
|
||||||
|
|
||||||
systemd.services = genAttrs' plans (plan: let
|
systemd.services = slib.genAttrs' plans (plan: let
|
||||||
continuable = command:
|
continuable = command:
|
||||||
if plan.keepGoing
|
if plan.keepGoing
|
||||||
then /* sh */ "{ ${command}; } || :"
|
then /* sh */ "{ ${command}; } || :"
|
||||||
|
Loading…
Reference in New Issue
Block a user