Compare commits
3 commits
master
...
nixos-modu
Author | SHA1 | Date | |
---|---|---|---|
259c3db689 | |||
4b7809efff | |||
127e28c7d8 |
|
@ -269,7 +269,10 @@ in
|
|||
home.username = mkDefault (builtins.getEnv "USER");
|
||||
home.homeDirectory = mkDefault (builtins.getEnv "HOME");
|
||||
|
||||
home.profileDirectory = cfg.homeDirectory + "/.nix-profile";
|
||||
home.profileDirectory =
|
||||
if config.submoduleSupport.enable
|
||||
then config.home.path
|
||||
else cfg.homeDirectory + "/.nix-profile";
|
||||
|
||||
home.sessionVariables =
|
||||
let
|
||||
|
@ -307,9 +310,31 @@ in
|
|||
home.activation.writeBoundary = dag.entryAnywhere "";
|
||||
|
||||
# Install packages to the user environment.
|
||||
home.activation.installPackages = dag.entryAfter ["writeBoundary"] ''
|
||||
$DRY_RUN_CMD nix-env -i ${cfg.path}
|
||||
'';
|
||||
#
|
||||
# Note, if we are running as a NixOS module then we cannot rely on
|
||||
# `nix-env -i` because our target may not allow modification of
|
||||
# the Nix store. We will instead use the
|
||||
# `users.users.<name?>.packages` NixOS option. We still need this
|
||||
# activation command, however, since some modules need to ensure
|
||||
# that their activation commands are run after packages are
|
||||
# guaranteed to be installed.
|
||||
#
|
||||
# In case the user has moved from a user-install of Home Manager
|
||||
# to one managed through the NixOS module we attempt to uninstall
|
||||
# the `home-manager-path` package if it is installed.
|
||||
home.activation.installPackages = dag.entryAfter ["writeBoundary"] (
|
||||
if config.submoduleSupport.enable
|
||||
then
|
||||
''
|
||||
if nix-env -q | grep '^home-manager-path$'; then
|
||||
nix-env -e home-manager-path
|
||||
fi
|
||||
''
|
||||
else
|
||||
''
|
||||
$DRY_RUN_CMD nix-env -i ${cfg.path}
|
||||
''
|
||||
);
|
||||
|
||||
home.activationPackage =
|
||||
let
|
||||
|
|
|
@ -28,14 +28,32 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enableProfileFonts {
|
||||
xdg.configFile."fontconfig/conf.d/10-nix-profile-fonts.conf".text = ''
|
||||
<?xml version='1.0'?>
|
||||
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
||||
<fontconfig>
|
||||
<dir>${config.home.profileDirectory}/lib/X11/fonts</dir>
|
||||
<dir>${config.home.profileDirectory}/share/fonts</dir>
|
||||
</fontconfig>
|
||||
'';
|
||||
};
|
||||
config = mkMerge [
|
||||
(mkIf cfg.enableProfileFonts {
|
||||
xdg.configFile."fontconfig/conf.d/10-nix-profile-fonts.conf".text = ''
|
||||
<?xml version='1.0'?>
|
||||
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
||||
<fontconfig>
|
||||
<dir>${config.home.profileDirectory}/lib/X11/fonts</dir>
|
||||
<dir>${config.home.profileDirectory}/share/fonts</dir>
|
||||
</fontconfig>
|
||||
'';
|
||||
})
|
||||
|
||||
# If we are inside a NixOS system configuration then packages are
|
||||
# installed through the NixOS `users.users.<name?>.packages`
|
||||
# option. Unfortunately fontconfig does not know about the
|
||||
# per-user installation directory so we have to add that directory
|
||||
# in a extra configuration file.
|
||||
(mkIf config.submoduleSupport.enable {
|
||||
xdg.configFile."fontconfig/conf.d/10-nix-per-user-fonts.conf".text = ''
|
||||
<?xml version='1.0'?>
|
||||
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
||||
<fontconfig>
|
||||
<dir>/etc/profiles/per-user/${config.home.username}/lib/X11/fonts</dir>
|
||||
<dir>/etc/profiles/per-user/${config.home.username}/share/fonts</dir>
|
||||
</fontconfig>
|
||||
'';
|
||||
})
|
||||
];
|
||||
}
|
||||
|
|
|
@ -30,6 +30,10 @@ in
|
|||
};
|
||||
|
||||
config = mkIf (cfg.users != {}) {
|
||||
users.users = mapAttrs (username: usercfg: {
|
||||
packages = usercfg.home.packages;
|
||||
}) cfg.users;
|
||||
|
||||
systemd.services = mapAttrs' (username: usercfg:
|
||||
nameValuePair ("home-manager-${utils.escapeSystemdPath username}") {
|
||||
description = "Home Manager environment for ${username}";
|
||||
|
|
Loading…
Reference in a new issue