1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-23 19:49:45 +01:00

Parametrize path to profile directory

This commit is contained in:
Malte Brandy 2018-07-29 18:15:50 +02:00 committed by Robert Helgesson
parent 93ef6aefce
commit c18b1328a5
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
12 changed files with 27 additions and 14 deletions

View file

@ -121,6 +121,17 @@ in
description = "The user's home directory."; description = "The user's home directory.";
}; };
home.profileDirectory = mkOption {
type = types.path;
defaultText = "~/.nix-profile";
internal = true;
readOnly = true;
description = ''
The profile directory where Home Manager generations are
installed.
'';
};
home.language = mkOption { home.language = mkOption {
type = languageSubModule; type = languageSubModule;
default = {}; default = {};
@ -249,6 +260,8 @@ in
home.username = mkDefault (builtins.getEnv "USER"); home.username = mkDefault (builtins.getEnv "USER");
home.homeDirectory = mkDefault (builtins.getEnv "HOME"); home.homeDirectory = mkDefault (builtins.getEnv "HOME");
home.profileDirectory = cfg.homeDirectory + "/.nix-profile";
home.sessionVariables = home.sessionVariables =
let let
maybeSet = n: v: optionalAttrs (v != null) { ${n} = v; }; maybeSet = n: v: optionalAttrs (v != null) { ${n} = v; };

View file

@ -33,8 +33,8 @@ in
<?xml version='1.0'?> <?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig> <fontconfig>
<dir>~/.nix-profile/lib/X11/fonts</dir> <dir>${config.home.profileDirectory}/lib/X11/fonts</dir>
<dir>~/.nix-profile/share/fonts</dir> <dir>${config.home.profileDirectory}/share/fonts</dir>
</fontconfig> </fontconfig>
''; '';
}; };

View file

@ -182,7 +182,7 @@ in
home.file.".profile".text = '' home.file.".profile".text = ''
# -*- mode: sh -*- # -*- mode: sh -*-
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" . "${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh"
${sessionVarsStr} ${sessionVarsStr}

View file

@ -29,7 +29,7 @@ let
dag = config.lib.dag; dag = config.lib.dag;
# Indexes info files found in this location # Indexes info files found in this location
homeInfoPath = "$HOME/.nix-profile/share/info"; homeInfoPath = "${config.home.profileDirectory}/share/info";
# Installs this package -- the interactive just means that it # Installs this package -- the interactive just means that it
# includes the curses `info` program. We also use `install-info` # includes the curses `info` program. We also use `install-info`

View file

@ -314,7 +314,7 @@ in
} }
# Environment variables # Environment variables
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" . "${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh"
${envVarsStr} ${envVarsStr}
${optionalString cfg.oh-my-zsh.enable '' ${optionalString cfg.oh-my-zsh.enable ''

View file

@ -99,7 +99,7 @@ in
basePaths = [ basePaths = [
"/run/current-system/sw" "/run/current-system/sw"
"${config.home.homeDirectory}/.nix-profile" config.home.profileDirectory
cfg.iconTheme.package cfg.iconTheme.package
] ++ optional useCustomTheme hicolorTheme.package; ] ++ optional useCustomTheme hicolorTheme.package;

View file

@ -33,7 +33,7 @@ in
}; };
Service = { Service = {
Environment = "PATH=%h/.nix-profile/bin"; Environment = "PATH=${config.home.profileDirectory}/bin";
ExecStart = "${package}/bin/flameshot"; ExecStart = "${package}/bin/flameshot";
Restart = "on-abort"; Restart = "on-abort";
}; };

View file

@ -41,7 +41,7 @@ in
}; };
Service = { Service = {
Environment = "PATH=%h/.nix-profile/bin"; Environment = "PATH=${config.home.profileDirectory}/bin";
ExecStart = "${package}/lib/libexec/kdeconnectd"; ExecStart = "${package}/lib/libexec/kdeconnectd";
Restart = "on-abort"; Restart = "on-abort";
}; };
@ -64,7 +64,7 @@ in
}; };
Service = { Service = {
Environment = "PATH=%h/.nix-profile/bin"; Environment = "PATH=${config.home.profileDirectory}/bin";
ExecStart = "${package}/bin/kdeconnect-indicator"; ExecStart = "${package}/bin/kdeconnect-indicator";
Restart = "on-abort"; Restart = "on-abort";
}; };

View file

@ -137,7 +137,7 @@ in {
}; };
Service = { Service = {
Environment = "PATH=%h/.nix-profile/bin"; Environment = "PATH=${config.home.profileDirectory}/bin";
ExecStart = "${pkgs.mpd}/bin/mpd --no-daemon ${mpdConf}"; ExecStart = "${pkgs.mpd}/bin/mpd --no-daemon ${mpdConf}";
Type = "notify"; Type = "notify";
ExecStartPre = ''${pkgs.bash}/bin/bash -c "${pkgs.coreutils}/bin/mkdir -p '${cfg.dataDir}' '${cfg.playlistDirectory}'"''; ExecStartPre = ''${pkgs.bash}/bin/bash -c "${pkgs.coreutils}/bin/mkdir -p '${cfg.dataDir}' '${cfg.playlistDirectory}'"'';

View file

@ -18,7 +18,7 @@ with lib;
}; };
Service = { Service = {
Environment = "PATH=%h/.nix-profile/bin"; Environment = "PATH=${config.home.profileDirectory}/bin";
ExecStart = "${pkgs.owncloud-client}/bin/owncloud"; ExecStart = "${pkgs.owncloud-client}/bin/owncloud";
}; };

View file

@ -54,7 +54,7 @@ with lib;
}; };
Service = { Service = {
Environment = "PATH=%h/.nix-profile/bin"; Environment = "PATH=${config.home.profileDirectory}/bin";
ExecStart = "${pkgs.qsyncthingtray}/bin/QSyncthingTray"; ExecStart = "${pkgs.qsyncthingtray}/bin/QSyncthingTray";
}; };

View file

@ -93,7 +93,7 @@ in
}; };
home.file.".xprofile".text = '' home.file.".xprofile".text = ''
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" . "${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh"
if [[ -e "$HOME/.profile" ]]; then if [[ -e "$HOME/.profile" ]]; then
. "$HOME/.profile" . "$HOME/.profile"