forked from colin/nix-files
refactor: sane.programs.$foo.service: specify type concretely
This commit is contained in:
parent
f1d397940f
commit
9ba8ff738b
|
@ -216,7 +216,7 @@ let
|
|||
'';
|
||||
};
|
||||
services = mkOption {
|
||||
type = types.attrsOf types.anything; # options.sane.users.value.type;
|
||||
type = options.sane.user._options.services.type;
|
||||
default = {};
|
||||
description = ''
|
||||
user services to define if this package is enabled.
|
||||
|
|
|
@ -108,58 +108,56 @@ let
|
|||
];
|
||||
};
|
||||
});
|
||||
userOptions = {
|
||||
options = with lib; {
|
||||
fs = mkOption {
|
||||
# map to listOf attrs so that we can allow multiple assigners to the same path
|
||||
# w/o worrying about merging at this layer, and defer merging to modules/fs instead.
|
||||
type = types.attrsOf (types.coercedTo types.attrs (a: [ a ]) (types.listOf types.attrs));
|
||||
default = {};
|
||||
description = ''
|
||||
entries to pass onto `sane.fs` after prepending the user's home-dir to the path
|
||||
and marking them as wanted.
|
||||
e.g. `sane.users.colin.fs."/.config/aerc" = X`
|
||||
=> `sane.fs."/home/colin/.config/aerc" = { wantedBy = [ "multi-user.target"]; } // X;
|
||||
userOptions = with lib; {
|
||||
fs = mkOption {
|
||||
# map to listOf attrs so that we can allow multiple assigners to the same path
|
||||
# w/o worrying about merging at this layer, and defer merging to modules/fs instead.
|
||||
type = types.attrsOf (types.coercedTo types.attrs (a: [ a ]) (types.listOf types.attrs));
|
||||
default = {};
|
||||
description = ''
|
||||
entries to pass onto `sane.fs` after prepending the user's home-dir to the path
|
||||
and marking them as wanted.
|
||||
e.g. `sane.users.colin.fs."/.config/aerc" = 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,
|
||||
whereas every other entry is expected to *not* have a trailing slash.
|
||||
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.
|
||||
|
||||
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)
|
||||
'';
|
||||
};
|
||||
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)
|
||||
'';
|
||||
};
|
||||
|
||||
persist = mkOption {
|
||||
type = options.sane.persist.sys.type;
|
||||
default = {};
|
||||
description = ''
|
||||
entries to pass onto `sane.persist.sys` after prepending the user's home-dir to the path.
|
||||
'';
|
||||
};
|
||||
persist = mkOption {
|
||||
type = options.sane.persist.sys.type;
|
||||
default = {};
|
||||
description = ''
|
||||
entries to pass onto `sane.persist.sys` after prepending the user's home-dir to the path.
|
||||
'';
|
||||
};
|
||||
|
||||
environment = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = {};
|
||||
description = ''
|
||||
environment variables to place in user's shell profile.
|
||||
these end up in ~/.profile
|
||||
'';
|
||||
};
|
||||
environment = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = {};
|
||||
description = ''
|
||||
environment variables to place in user's shell profile.
|
||||
these end up in ~/.profile
|
||||
'';
|
||||
};
|
||||
|
||||
services = mkOption {
|
||||
type = types.attrsOf serviceType;
|
||||
default = {};
|
||||
description = ''
|
||||
services to define for this user.
|
||||
'';
|
||||
};
|
||||
services = mkOption {
|
||||
type = types.attrsOf serviceType;
|
||||
default = {};
|
||||
description = ''
|
||||
services to define for this user.
|
||||
'';
|
||||
};
|
||||
};
|
||||
userModule = let
|
||||
nixConfig = config;
|
||||
in with lib; types.submodule ({ name, config, ... }: {
|
||||
options = userOptions.options // {
|
||||
options = userOptions// {
|
||||
default = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
|
@ -335,11 +333,13 @@ in
|
|||
};
|
||||
|
||||
sane.user = mkOption {
|
||||
type = types.nullOr (types.submodule userOptions);
|
||||
type = types.nullOr (types.submodule { options = userOptions; });
|
||||
default = null;
|
||||
description = ''
|
||||
options to pass down to the default user
|
||||
'';
|
||||
} // {
|
||||
_options = userOptions;
|
||||
};
|
||||
|
||||
sane.defaultUser = mkOption {
|
||||
|
|
Loading…
Reference in New Issue
Block a user