Fix path to profile dir when using as nixos submodule

This commit is contained in:
Malte Brandy 2018-05-31 20:14:55 +02:00
parent 13b6955460
commit 3c6f3c29d6
No known key found for this signature in database
GPG key ID: 226A2D41EF5378C9
8 changed files with 25 additions and 10 deletions

View file

@ -6,6 +6,8 @@ let
cfg = config.programs.bash; cfg = config.programs.bash;
profileDir = if config.nixosSubmodule then "${config.home.path}" else "$HOME/.nix-profile";
in in
{ {
@ -183,7 +185,7 @@ in
home.file.".profile".text = '' home.file.".profile".text = ''
# -*- mode: sh -*- # -*- mode: sh -*-
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" . "${profileDir}/etc/profile.d/hm-session-vars.sh"
${sessionVarsStr} ${sessionVarsStr}

View file

@ -28,8 +28,10 @@ let
dag = config.lib.dag; dag = config.lib.dag;
profileDir = if config.nixosSubmodule then "${config.home.path}" else "$HOME/.nix-profile";
# Indexes info files found in this location # 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 # 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

@ -19,6 +19,8 @@ let
zdotdir = "$HOME/" + cfg.dotDir; zdotdir = "$HOME/" + cfg.dotDir;
profileDir = if config.nixosSubmodule then "${config.home.path}" else "$HOME/.nix-profile";
historyModule = types.submodule ({ config, ... }: { historyModule = types.submodule ({ config, ... }: {
options = { options = {
size = mkOption { size = mkOption {
@ -302,7 +304,7 @@ in
} }
# Environment variables # Environment variables
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" . "${profileDir}/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" (if config.nixosSubmodule then "${config.home.path}" else "${config.home.homeDirectory}/.nix-profile")
cfg.iconTheme.package cfg.iconTheme.package
] ++ optional useCustomTheme hicolorTheme.package; ] ++ optional useCustomTheme hicolorTheme.package;

View file

@ -6,6 +6,7 @@ let
cfg = config.services.flameshot; cfg = config.services.flameshot;
package = pkgs.flameshot; package = pkgs.flameshot;
profileDir = if config.nixosSubmodule then "${config.home.path}" else "%h/.nix-profile";
in in
@ -33,7 +34,7 @@ in
}; };
Service = { Service = {
Environment = "PATH=%h/.nix-profile/bin"; Environment = "PATH=${profileDir}/bin";
ExecStart = "${package}/bin/flameshot"; ExecStart = "${package}/bin/flameshot";
Restart = "on-abort"; Restart = "on-abort";
}; };

View file

@ -2,7 +2,11 @@
with lib; with lib;
{ let
profileDir = if config.nixosSubmodule then "${config.home.path}" else "%h/.nix-profile";
in {
options = { options = {
services.owncloud-client = { services.owncloud-client = {
enable = mkEnableOption "Owncloud Client"; enable = mkEnableOption "Owncloud Client";
@ -18,7 +22,7 @@ with lib;
}; };
Service = { Service = {
Environment = "PATH=%h/.nix-profile/bin"; Environment = "PATH=${profileDir}/bin";
ExecStart = "${pkgs.owncloud-client}/bin/owncloud"; ExecStart = "${pkgs.owncloud-client}/bin/owncloud";
}; };

View file

@ -1,8 +1,11 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with lib; with lib;
let
{ profileDir = if config.nixosSubmodule then "${config.home.path}" else "%h/.nix-profile";
in {
meta.maintainers = [ maintainers.rycee ]; meta.maintainers = [ maintainers.rycee ];
options = { options = {
@ -54,7 +57,7 @@ with lib;
}; };
Service = { Service = {
Environment = "PATH=%h/.nix-profile/bin"; Environment = "PATH=${profileDir}/bin";
ExecStart = "${pkgs.qsyncthingtray}/bin/QSyncthingTray"; ExecStart = "${pkgs.qsyncthingtray}/bin/QSyncthingTray";
}; };

View file

@ -5,6 +5,7 @@ with lib;
let let
cfg = config.xsession; cfg = config.xsession;
profileDir = if config.nixosSubmodule then "${config.home.path}" else "$HOME/.nix-profile";
in in
@ -82,7 +83,7 @@ in
}; };
home.file.".xprofile".text = '' 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 if [[ -e "$HOME/.profile" ]]; then
. "$HOME/.profile" . "$HOME/.profile"