nixos: add backup file extension and verbosity options

This commit is contained in:
Tobias Happ 2019-08-08 18:24:08 +02:00 committed by Robert Helgesson
parent db0dfb4b08
commit 9cc30b18f7
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -23,6 +23,14 @@ let
}; };
}); });
serviceEnvironment =
optionalAttrs (cfg.backupFileExtension != null) {
HOME_MANAGER_BACKUP_EXT = cfg.backupFileExtension;
}
// optionalAttrs cfg.verbose {
VERBOSE = "1";
};
in in
{ {
@ -33,6 +41,18 @@ in
<option>users.users.&lt;name?&gt;.packages</option> option. <option>users.users.&lt;name?&gt;.packages</option> option.
''; '';
backupFileExtension = mkOption {
type = types.nullOr types.str;
default = null;
example = "backup";
description = ''
On activation move existing files by appending the given
file extension rather than exiting with an error.
'';
};
verbose = mkEnableOption "verbose output on activation";
users = mkOption { users = mkOption {
type = types.attrsOf hmModule; type = types.attrsOf hmModule;
default = {}; default = {};
@ -70,6 +90,8 @@ in
wants = [ "nix-daemon.socket" ]; wants = [ "nix-daemon.socket" ];
after = [ "nix-daemon.socket" ]; after = [ "nix-daemon.socket" ];
environment = serviceEnvironment;
serviceConfig = { serviceConfig = {
User = usercfg.home.username; User = usercfg.home.username;
Type = "oneshot"; Type = "oneshot";