sane.{programs,user}.fs: pass fs values onto sane.fs unmerged
notably, this allows ~/.config/zsh/.zshrc to be specified by more than one location, and for the values to not overwrite one another
This commit is contained in:
parent
ad16e50081
commit
535bbd2c0b
|
@ -108,7 +108,7 @@ let
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
fs = mkOption {
|
fs = mkOption {
|
||||||
type = types.attrs;
|
type = types.attrsOf (types.coercedTo types.attrs (a: [ a ]) (types.listOf types.attrs));
|
||||||
default = {};
|
default = {};
|
||||||
description = "files to populate when this program is enabled";
|
description = "files to populate when this program is enabled";
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,16 +9,20 @@ let
|
||||||
userOptions = {
|
userOptions = {
|
||||||
options = {
|
options = {
|
||||||
fs = mkOption {
|
fs = mkOption {
|
||||||
type = types.attrs;
|
type = types.attrsOf (types.coercedTo types.attrs (a: [ a ]) (types.listOf types.attrs));
|
||||||
default = {};
|
default = {};
|
||||||
description = ''
|
description = ''
|
||||||
entries to pass onto `sane.fs` after prepending the user's home-dir to the path
|
entries to pass onto `sane.fs` after prepending the user's home-dir to the path
|
||||||
and marking them as wanted.
|
and marking them as wanted.
|
||||||
e.g. `sane.users.colin.fs."/.config/aerc" = X`
|
e.g. `sane.users.colin.fs."/.config/aerc" = X`
|
||||||
=> `sane.fs."/home/colin/.config/aerc" = { wantedBy = [ "multi-user.target"]; } // X;
|
=> `sane.fs."/home/colin/.config/aerc" = { wantedBy = [ "multi-user.target"]; } // X;
|
||||||
|
|
||||||
conventions are similar as to toplevel `sane.fs`. so `sane.users.foo.fs."/"` represents the home directory,
|
conventions are similar as to toplevel `sane.fs`. so `sane.users.foo.fs."/"` represents the home directory,
|
||||||
whereas every other entry is expected to *not* have a trailing slash.
|
whereas every other entry is expected to *not* have a trailing slash.
|
||||||
|
|
||||||
|
option merging happens inside `sane.fs`, so `sane.users.colin.fs."foo" = A` and `sane.fs."/home/colin/foo" = B`
|
||||||
|
behaves identically to `sane.fs."/home/colin/foo" = lib.mkMerge [ A B ];
|
||||||
|
(the unusual signature for this type is how we delay option merging)
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -85,10 +89,10 @@ let
|
||||||
name = path-lib.concat [ defn.home path ];
|
name = path-lib.concat [ defn.home path ];
|
||||||
inherit value;
|
inherit value;
|
||||||
});
|
});
|
||||||
makeWanted = lib.mapAttrs (n: v: {
|
makeWanted = lib.mapAttrs (_path: values: lib.mkMerge (values ++ [{
|
||||||
# default if not otherwise provided
|
# default if not otherwise provided
|
||||||
wantedBeforeBy = [ "multi-user.target" ];
|
wantedBeforeBy = lib.mkDefault [ "multi-user.target" ];
|
||||||
} // v);
|
}]));
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
sane.fs = makeWanted (prefixWithHome defn.fs);
|
sane.fs = makeWanted (prefixWithHome defn.fs);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user