mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
Apply nixfmt on many files
This commit is contained in:
parent
9799d3de2d
commit
45abf3d38a
177 changed files with 2850 additions and 3565 deletions
|
|
@ -10,8 +10,8 @@ let
|
|||
|
||||
hmModule = types.submoduleWith {
|
||||
specialArgs = { lib = extendedLib; };
|
||||
modules = [(
|
||||
{name, ...}: {
|
||||
modules = [
|
||||
({ name, ... }: {
|
||||
imports = import ../modules/modules.nix {
|
||||
inherit pkgs;
|
||||
lib = extendedLib;
|
||||
|
|
@ -23,27 +23,21 @@ let
|
|||
|
||||
# The per-user directory inside /etc/profiles is not known by
|
||||
# fontconfig by default.
|
||||
fonts.fontconfig.enable =
|
||||
cfg.useUserPackages && config.fonts.fontconfig.enable;
|
||||
fonts.fontconfig.enable = cfg.useUserPackages
|
||||
&& config.fonts.fontconfig.enable;
|
||||
|
||||
home.username = config.users.users.${name}.name;
|
||||
home.homeDirectory = config.users.users.${name}.home;
|
||||
};
|
||||
}
|
||||
)];
|
||||
})
|
||||
];
|
||||
};
|
||||
|
||||
serviceEnvironment =
|
||||
optionalAttrs (cfg.backupFileExtension != null) {
|
||||
HOME_MANAGER_BACKUP_EXT = cfg.backupFileExtension;
|
||||
}
|
||||
// optionalAttrs cfg.verbose {
|
||||
VERBOSE = "1";
|
||||
};
|
||||
serviceEnvironment = optionalAttrs (cfg.backupFileExtension != null) {
|
||||
HOME_MANAGER_BACKUP_EXT = cfg.backupFileExtension;
|
||||
} // optionalAttrs cfg.verbose { VERBOSE = "1"; };
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
home-manager = {
|
||||
useUserPackages = mkEnableOption ''
|
||||
|
|
@ -65,7 +59,7 @@ in
|
|||
|
||||
users = mkOption {
|
||||
type = types.attrsOf hmModule;
|
||||
default = {};
|
||||
default = { };
|
||||
description = ''
|
||||
Per-user Home Manager configuration.
|
||||
'';
|
||||
|
|
@ -73,57 +67,44 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config = mkIf (cfg.users != {}) {
|
||||
warnings =
|
||||
flatten (flip mapAttrsToList cfg.users (user: config:
|
||||
flip map config.warnings (warning:
|
||||
"${user} profile: ${warning}"
|
||||
)
|
||||
));
|
||||
config = mkIf (cfg.users != { }) {
|
||||
warnings = flatten (flip mapAttrsToList cfg.users (user: config:
|
||||
flip map config.warnings (warning: "${user} profile: ${warning}")));
|
||||
|
||||
assertions =
|
||||
flatten (flip mapAttrsToList cfg.users (user: config:
|
||||
flip map config.assertions (assertion:
|
||||
{
|
||||
inherit (assertion) assertion;
|
||||
message = "${user} profile: ${assertion.message}";
|
||||
}
|
||||
)
|
||||
));
|
||||
assertions = flatten (flip mapAttrsToList cfg.users (user: config:
|
||||
flip map config.assertions (assertion: {
|
||||
inherit (assertion) assertion;
|
||||
message = "${user} profile: ${assertion.message}";
|
||||
})));
|
||||
|
||||
users.users = mkIf cfg.useUserPackages (
|
||||
mapAttrs (username: usercfg: {
|
||||
packages = usercfg.home.packages;
|
||||
}) cfg.users
|
||||
);
|
||||
users.users = mkIf cfg.useUserPackages
|
||||
(mapAttrs (username: usercfg: { packages = usercfg.home.packages; })
|
||||
cfg.users);
|
||||
|
||||
systemd.services = mapAttrs' (_: usercfg:
|
||||
let
|
||||
username = usercfg.home.username;
|
||||
in
|
||||
nameValuePair ("home-manager-${utils.escapeSystemdPath username}") {
|
||||
description = "Home Manager environment for ${username}";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
wants = [ "nix-daemon.socket" ];
|
||||
after = [ "nix-daemon.socket" ];
|
||||
let username = usercfg.home.username;
|
||||
in nameValuePair ("home-manager-${utils.escapeSystemdPath username}") {
|
||||
description = "Home Manager environment for ${username}";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
wants = [ "nix-daemon.socket" ];
|
||||
after = [ "nix-daemon.socket" ];
|
||||
|
||||
environment = serviceEnvironment;
|
||||
environment = serviceEnvironment;
|
||||
|
||||
serviceConfig = {
|
||||
User = usercfg.home.username;
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = "yes";
|
||||
SyslogIdentifier = "hm-activate-${username}";
|
||||
serviceConfig = {
|
||||
User = usercfg.home.username;
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = "yes";
|
||||
SyslogIdentifier = "hm-activate-${username}";
|
||||
|
||||
# The activation script is run by a login shell to make sure
|
||||
# that the user is given a sane Nix environment.
|
||||
ExecStart = pkgs.writeScript "activate-${username}" ''
|
||||
#! ${pkgs.runtimeShell} -el
|
||||
echo Activating home-manager configuration for ${username}
|
||||
exec ${usercfg.home.activationPackage}/activate
|
||||
'';
|
||||
};
|
||||
}
|
||||
) cfg.users;
|
||||
# The activation script is run by a login shell to make sure
|
||||
# that the user is given a sane Nix environment.
|
||||
ExecStart = pkgs.writeScript "activate-${username}" ''
|
||||
#! ${pkgs.runtimeShell} -el
|
||||
echo Activating home-manager configuration for ${username}
|
||||
exec ${usercfg.home.activationPackage}/activate
|
||||
'';
|
||||
};
|
||||
}) cfg.users;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue