diff --git a/modules/programs/bash.nix b/modules/programs/bash.nix index 6adcbd94..c87413fa 100644 --- a/modules/programs/bash.nix +++ b/modules/programs/bash.nix @@ -6,6 +6,8 @@ let cfg = config.programs.bash; + profileDir = if config.nixosSubmodule then "${config.home.path}" else "$HOME/.nix-profile"; + in { @@ -183,7 +185,7 @@ in home.file.".profile".text = '' # -*- mode: sh -*- - . "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" + . "${profileDir}/etc/profile.d/hm-session-vars.sh" ${sessionVarsStr} diff --git a/modules/programs/info.nix b/modules/programs/info.nix index 4f3f1e56..8ac0ca4d 100644 --- a/modules/programs/info.nix +++ b/modules/programs/info.nix @@ -28,8 +28,10 @@ let dag = config.lib.dag; + profileDir = if config.nixosSubmodule then "${config.home.path}" else "$HOME/.nix-profile"; + # Indexes info files found in this location - homeInfoPath = "$HOME/.nix-profile/share/info"; + homeInfoPath = "${profileDir}/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 c07e8a74..e0f87d71 100644 --- a/modules/programs/zsh.nix +++ b/modules/programs/zsh.nix @@ -19,6 +19,8 @@ let zdotdir = "$HOME/" + cfg.dotDir; + profileDir = if config.nixosSubmodule then "${config.home.path}" else "$HOME/.nix-profile"; + historyModule = types.submodule ({ config, ... }: { options = { size = mkOption { @@ -302,7 +304,7 @@ in } # Environment variables - . "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" + . "${profileDir}/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 e01211b5..d3801794 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" + (if config.nixosSubmodule then "${config.home.path}" else "${config.home.homeDirectory}/.nix-profile") cfg.iconTheme.package ] ++ optional useCustomTheme hicolorTheme.package; diff --git a/modules/services/flameshot.nix b/modules/services/flameshot.nix index 7c259d43..d5b35983 100644 --- a/modules/services/flameshot.nix +++ b/modules/services/flameshot.nix @@ -6,6 +6,7 @@ let cfg = config.services.flameshot; package = pkgs.flameshot; + profileDir = if config.nixosSubmodule then "${config.home.path}" else "%h/.nix-profile"; in @@ -33,7 +34,7 @@ in }; Service = { - Environment = "PATH=%h/.nix-profile/bin"; + Environment = "PATH=${profileDir}/bin"; ExecStart = "${package}/bin/flameshot"; Restart = "on-abort"; }; diff --git a/modules/services/owncloud-client.nix b/modules/services/owncloud-client.nix index 353e0136..f5c7fd3e 100644 --- a/modules/services/owncloud-client.nix +++ b/modules/services/owncloud-client.nix @@ -2,7 +2,11 @@ with lib; -{ +let + + profileDir = if config.nixosSubmodule then "${config.home.path}" else "%h/.nix-profile"; + +in { options = { services.owncloud-client = { enable = mkEnableOption "Owncloud Client"; @@ -18,7 +22,7 @@ with lib; }; Service = { - Environment = "PATH=%h/.nix-profile/bin"; + Environment = "PATH=${profileDir}/bin"; ExecStart = "${pkgs.owncloud-client}/bin/owncloud"; }; diff --git a/modules/services/syncthing.nix b/modules/services/syncthing.nix index 11511725..398969ad 100644 --- a/modules/services/syncthing.nix +++ b/modules/services/syncthing.nix @@ -1,8 +1,11 @@ { config, lib, pkgs, ... }: with lib; +let -{ + profileDir = if config.nixosSubmodule then "${config.home.path}" else "%h/.nix-profile"; + +in { meta.maintainers = [ maintainers.rycee ]; options = { @@ -54,7 +57,7 @@ with lib; }; Service = { - Environment = "PATH=%h/.nix-profile/bin"; + Environment = "PATH=${profileDir}/bin"; ExecStart = "${pkgs.qsyncthingtray}/bin/QSyncthingTray"; }; diff --git a/modules/xsession.nix b/modules/xsession.nix index 3bce4506..78a086b9 100644 --- a/modules/xsession.nix +++ b/modules/xsession.nix @@ -5,6 +5,7 @@ with lib; let cfg = config.xsession; + profileDir = if config.nixosSubmodule then "${config.home.path}" else "$HOME/.nix-profile"; in @@ -82,7 +83,7 @@ in }; home.file.".xprofile".text = '' - . "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" + . "${profileDir}/etc/profile.d/hm-session-vars.sh" if [[ -e "$HOME/.profile" ]]; then . "$HOME/.profile"