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.";
};
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 {
type = languageSubModule;
default = {};
@ -249,6 +260,8 @@ in
home.username = mkDefault (builtins.getEnv "USER");
home.homeDirectory = mkDefault (builtins.getEnv "HOME");
home.profileDirectory = cfg.homeDirectory + "/.nix-profile";
home.sessionVariables =
let
maybeSet = n: v: optionalAttrs (v != null) { ${n} = v; };

View file

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

View file

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

View file

@ -29,7 +29,7 @@ let
dag = config.lib.dag;
# 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
# includes the curses `info` program. We also use `install-info`

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -93,7 +93,7 @@ in
};
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
. "$HOME/.profile"