1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-26 00:18:30 +02: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.";
};
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

@ -131,13 +131,13 @@ in {
After = [ "network.target" "sound.target" ];
Description = "Music Player Daemon";
};
Install = {
WantedBy = [ "default.target" ];
};
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"