diff --git a/modules/home-environment.nix b/modules/home-environment.nix index c6fc345d7..ae0e4ad57 100644 --- a/modules/home-environment.nix +++ b/modules/home-environment.nix @@ -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; }; diff --git a/modules/misc/fontconfig.nix b/modules/misc/fontconfig.nix index e76e135eb..9ad8b195f 100644 --- a/modules/misc/fontconfig.nix +++ b/modules/misc/fontconfig.nix @@ -33,8 +33,8 @@ in - ~/.nix-profile/lib/X11/fonts - ~/.nix-profile/share/fonts + ${config.home.profileDirectory}/lib/X11/fonts + ${config.home.profileDirectory}/share/fonts ''; }; diff --git a/modules/programs/bash.nix b/modules/programs/bash.nix index 830e832e1..d8359c12f 100644 --- a/modules/programs/bash.nix +++ b/modules/programs/bash.nix @@ -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} diff --git a/modules/programs/info.nix b/modules/programs/info.nix index 4f3f1e567..93dcaf474 100644 --- a/modules/programs/info.nix +++ b/modules/programs/info.nix @@ -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` diff --git a/modules/programs/zsh.nix b/modules/programs/zsh.nix index 6253d2a77..f4605fc65 100644 --- a/modules/programs/zsh.nix +++ b/modules/programs/zsh.nix @@ -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 '' diff --git a/modules/services/dunst.nix b/modules/services/dunst.nix index e01211b57..1273ef39d 100644 --- a/modules/services/dunst.nix +++ b/modules/services/dunst.nix @@ -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; diff --git a/modules/services/flameshot.nix b/modules/services/flameshot.nix index 7c259d43a..d4cf90d59 100644 --- a/modules/services/flameshot.nix +++ b/modules/services/flameshot.nix @@ -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"; }; diff --git a/modules/services/kdeconnect.nix b/modules/services/kdeconnect.nix index b0983bbe3..a953c4ab8 100644 --- a/modules/services/kdeconnect.nix +++ b/modules/services/kdeconnect.nix @@ -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"; }; diff --git a/modules/services/mpd.nix b/modules/services/mpd.nix index 5cc581176..822d2fe39 100644 --- a/modules/services/mpd.nix +++ b/modules/services/mpd.nix @@ -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}'"''; diff --git a/modules/services/owncloud-client.nix b/modules/services/owncloud-client.nix index 353e0136c..d98a508f0 100644 --- a/modules/services/owncloud-client.nix +++ b/modules/services/owncloud-client.nix @@ -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"; }; diff --git a/modules/services/syncthing.nix b/modules/services/syncthing.nix index 115117251..7fc556c52 100644 --- a/modules/services/syncthing.nix +++ b/modules/services/syncthing.nix @@ -54,7 +54,7 @@ with lib; }; Service = { - Environment = "PATH=%h/.nix-profile/bin"; + Environment = "PATH=${config.home.profileDirectory}/bin"; ExecStart = "${pkgs.qsyncthingtray}/bin/QSyncthingTray"; }; diff --git a/modules/xsession.nix b/modules/xsession.nix index 816a1aa9f..d55118e41 100644 --- a/modules/xsession.nix +++ b/modules/xsession.nix @@ -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"