commit 9c5a18fbbc85393c3c47f3732502830833dacd7c
parent f5998589a332b0f681fd1a5bab272f3516184ab1
Author: Vincent Demeester <vincent@sbr.pm>
Date: Sun, 24 Feb 2019 13:27:11 +0100
Use config (home.* and xdg.*) instead of hardcoded values
The main reason is to have as less as possible harcoded value for the
home folder in case of the user is different from machine to machine.
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Diffstat:
8 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/modules/profiles/desktop.nix b/modules/profiles/desktop.nix
@@ -32,7 +32,7 @@ in
xsession = mkIf cfg.xsession.enable {
enable = true;
initExtra = ''
- ${pkgs.xlibs.xmodmap}/bin/xmodmap ~/.Xmodmap &
+ ${pkgs.xlibs.xmodmap}/bin/xmodmap ${config.home.homeDirectory}.Xmodmap &
'';
pointerCursor = {
package = pkgs.vanilla-dmz;
diff --git a/modules/profiles/dev.js.nix b/modules/profiles/dev.js.nix
@@ -17,7 +17,7 @@ in
config = mkIf cfg.enable (mkMerge [
{
home.file.".npmrc".text = ''
- prefix = ~/.local/npm
+ prefix = ${config.home.homeDirectory}/.local/npm
'';
home.packages = with pkgs; [
nodejs-10_x
@@ -26,7 +26,7 @@ in
}
(mkIf config.profiles.fish.enable {
xdg.configFile."fish/conf.d/js.fish".text = ''
- set -gx PATH $HOME/.local/npm/bin $PATH
+ set -gx PATH ${config.home.homeDirectory}/.local/npm/bin $PATH
'';
})
]);
diff --git a/modules/profiles/emacs.nix b/modules/profiles/emacs.nix
@@ -204,11 +204,11 @@ in
};
Service = {
Environment = ''
- PATH=/home/vincent/bin:/home/vincent/.local/npm/bin:/run/wrappers/bin:/etc/profiles/per-user/vincent/bin:${config.home.profileDirectory}/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin GOPATH=/home/vincent ASPELL_CONF=dict-dir=/home/vincent/.nix-profile/lib/aspell
+ PATH=${config.home.homeDirectory}/bin:${config.home.homeDirectory}/.local/npm/bin:/run/wrappers/bin:/etc/profiles/per-user/vincent/bin:${config.home.profileDirectory}/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin GOPATH=${config.home.homeDirectory} ASPELL_CONF=dict-dir=${config.home.homeDirectory}/.nix-profile/lib/aspell
'';
Type = "forking";
- ExecStart = "${pkgs.bash}/bin/bash -c 'source /etc/profile; exec /home/vincent/.nix-profile/bin/emacs --daemon'";
- ExecStop = "/home/vincent/.nix-profile/bin/emacsclient --eval (kill-emacs)";
+ ExecStart = "${pkgs.bash}/bin/bash -c 'source /etc/profile; exec ${config.home.homeDirectory}/.nix-profile/bin/emacs --daemon'";
+ ExecStop = "${config.home.homeDirectory}/.nix-profile/bin/emacsclient --eval (kill-emacs)";
Restart = "always";
};
Install = {
diff --git a/modules/profiles/git.nix b/modules/profiles/git.nix
@@ -118,32 +118,32 @@ in
includes = [
{
- path = "~/.config/git/config.d/redhat.gitconfig";
- condition = "gitdir:~/src/github.com/knative/";
+ path = "${config.xdg.configHome}/git/config.d/redhat.gitconfig";
+ condition = "gitdir:${config.home.homeDirectory}/src/github.com/knative/";
}
{
- path = "~/.config/git/config.d/redhat.gitconfig";
- condition = "gitdir:~/src/k8s.io/";
+ path = "${config.xdg.configHome}/git/config.d/redhat.gitconfig";
+ condition = "gitdir:${config.home.homeDirectory}/src/k8s.io/";
}
{
- path = "~/.config/git/config.d/redhat.gitconfig";
- condition = "gitdir:~/src/github.com/minishift/";
+ path = "${config.xdg.configHome}/git/config.d/redhat.gitconfig";
+ condition = "gitdir:${config.home.homeDirectory}/src/github.com/minishift/";
}
{
- path = "~/.config/git/config.d/redhat.gitconfig";
- condition = "gitdir:~/src/github.com/operator-framework/";
+ path = "${config.xdg.configHome}/git/config.d/redhat.gitconfig";
+ condition = "gitdir:${config.home.homeDirectory}/src/github.com/operator-framework/";
}
{
- path = "~/.config/git/config.d/redhat.gitconfig";
- condition = "gitdir:~/src/github.com/openshift/";
+ path = "${config.xdg.configHome}/git/config.d/redhat.gitconfig";
+ condition = "gitdir:${config.home.homeDirectory}/src/github.com/openshift/";
}
{
- path = "~/.config/git/config.d/redhat.gitconfig";
- condition = "gitdir:~/src/github.com/redhat-developer/";
+ path = "${config.xdg.configHome}/git/config.d/redhat.gitconfig";
+ condition = "gitdir:${config.home.homeDirectory}/src/github.com/redhat-developer/";
}
{
- path = "~/.config/git/config.d/redhat.gitconfig";
- condition = "gitdir:~/src/github.com/containers/";
+ path = "${config.xdg.configHome}/git/config.d/redhat.gitconfig";
+ condition = "gitdir:${config.home.homeDirectory}/src/github.com/containers/";
}
];
ignores = [
diff --git a/modules/profiles/i3.nix b/modules/profiles/i3.nix
@@ -62,7 +62,7 @@ in
};
random-background = {
enable = true;
- imageDirectory = "/home/vincent/desktop/pictures/wallpapers/Unsplashed";
+ imageDirectory = "${config.home.homeDirectory}/desktop/pictures/wallpapers/Unsplashed";
};
};
xdg.configFile."alacritty/alacritty.yml".source = ./assets/xorg/alacritty.yml;
diff --git a/modules/profiles/mails.nix b/modules/profiles/mails.nix
@@ -22,7 +22,7 @@ in
address = "vdemeest@redhat.com";
userName = "vdemeest@redhat.com";
realName = "Vincent Demeester";
- passwordCommand = "${pkgs.gnupg}/bin/gpg -q --for-your-eyes-only --no-tty --exit-on-status-write-error --batch --passphrase-file ~/sync/rh.pass -d ~/desktop/documents/rh.pass.gpg";
+ passwordCommand = "${pkgs.gnupg}/bin/gpg -q --for-your-eyes-only --no-tty --exit-on-status-write-error --batch --passphrase-file ${config.home.homeDirectory}/sync/rh.pass -d ${config.home.homeDirectory}/desktop/documents/rh.pass.gpg";
imap.host = "imap.gmail.com";
smtp.host = "smtp.gmail.com";
mbsync = {
@@ -45,7 +45,7 @@ in
address = "vinc.demeester@gmail.com";
userName = "vinc.demeester@gmail.com";
realName = "Vincent Demeester";
- passwordCommand = "${pkgs.gnupg}/bin/gpg -q --for-your-eyes-only --no-tty --exit-on-status-write-error --batch --passphrase-file ~/sync/perso.pass -d ~/desktop/documents/perso.pass.gpg";
+ passwordCommand = "${pkgs.gnupg}/bin/gpg -q --for-your-eyes-only --no-tty --exit-on-status-write-error --batch --passphrase-file ${config.home.homeDirectory}/sync/perso.pass -d ${config.home.homeDirectory}/desktop/documents/perso.pass.gpg";
imap.host = "imap.gmail.com";
smtp.host = "smtp.gmail.com";
mbsync = {
diff --git a/modules/profiles/ssh.nix b/modules/profiles/ssh.nix
@@ -21,8 +21,8 @@ in
serverAliveInterval = 60;
hashKnownHosts = true;
- userKnownHostsFile = "~/.config/ssh/known_hosts";
- controlPath = "~/.ssh/sockets/%u-%l-%r@%h:%p";
+ userKnownHostsFile = "${config.xdg.configHome}/ssh/known_hosts";
+ controlPath = "${config.home.homeDirectory}/.ssh/sockets/%u-%l-%r@%h:%p";
matchBlocks = {
"github.com" = {
diff --git a/modules/profiles/tmux.nix b/modules/profiles/tmux.nix
@@ -19,8 +19,8 @@ in
tmux
];
home.file.".tmux.conf".text = ''
- source-file $HOME/.config/tmux/tmux.conf
- set-environment -g TMUX_PLUGIN_MANAGER_PATH '$HOME/.config/tmux/plugins'
+ source-file ${config.xdg.configHome}/tmux/tmux.conf
+ set-environment -g TMUX_PLUGIN_MANAGER_PATH '${config.xdg.configHome}/tmux/plugins'
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'