replace manual home dir with config option

This commit is contained in:
Noah Masur 2022-06-20 08:39:41 -04:00
parent fdfc66c7ad
commit 5a43ad997f
7 changed files with 15 additions and 23 deletions

View File

@ -26,15 +26,18 @@
description = "Base16 color scheme";
};
};
dotfilesPath = let
homePath = if pkgs.stdenv.isDarwin then
homePath = mkOption {
type = types.path;
description = "Path of user's home directory.";
default = builtins.toPath (if pkgs.stdenv.isDarwin then
"/Users/${config.user}"
else
"/home/${config.user}";
in mkOption {
"/home/${config.user}");
};
dotfilesPath = mkOption {
type = types.path;
description = "Path of dotfiles repository.";
default = builtins.toPath "${homePath}/dev/personal/dotfiles";
default = config.homePath + "/dev/personal/dotfiles";
};
dotfilesRepo = mkOption {
type = types.str;

View File

@ -1,19 +1,8 @@
{ config, pkgs, lib, ... }: {
users.users."${config.user}" = { # macOS user
home = "/Users/${config.user}";
home = config.homePath;
shell = pkgs.zsh; # Default shell
};
home-manager.users.${config.user} = {
accounts.email.accounts.home = {
passwordCommand = lib.mkForce
"${pkgs.age}/bin/age --decrypt --identity /Users/${config.user}/.ssh/id_ed25519 ${
builtins.toString ./mailpass.age
}";
};
};
}

View File

@ -3,7 +3,7 @@
home-manager.users.${config.user} = {
home.sessionVariables = {
NOTES_PATH = "/home/${config.user}/dev/personal/notes";
NOTES_PATH = "${config.homePath}/dev/personal/notes";
};
};

View File

@ -23,7 +23,7 @@ in {
; Disables the notice about an available update on exit
disable_update_notice = true
; Set install directory
install_dir = /home/${config.user}/media/games
install_dir = ${config.homePath}/media/games
; Make output quiet
log_level = error
'';

View File

@ -246,7 +246,7 @@ in {
# Update lock screen cache only if cache is empty
home.activation.updateLockScreenCache =
let cacheDir = "/home/${config.user}/.cache/betterlockscreen/current";
let cacheDir = "${config.homePath}/.cache/betterlockscreen/current";
in config.home-manager.users.${config.user}.lib.dag.entryAfter
[ "writeBoundary" ] ''
if [ ! -d ${cacheDir} ] || [ -z "$(ls ${cacheDir})" ]; then

View File

@ -68,7 +68,7 @@
mu.enable = false;
notmuch.enable = false;
passwordCommand =
"${pkgs.age}/bin/age --decrypt --identity /home/${config.user}/.ssh/id_ed25519 ${
"${pkgs.age}/bin/age --decrypt --identity ${config.homePath}/.ssh/id_ed25519 ${
builtins.toString ./mailpass.age
}";
smtp = {

View File

@ -9,8 +9,8 @@
projects = {
description = "Jump to a project";
body = ''
set projdir (ls /home/${config.user}/dev/personal | fzf)
and cd /home/${config.user}/dev/personal/$projdir
set projdir (ls ${config.homePath}/dev/personal | fzf)
and cd ${config.homePath}/dev/personal/$projdir
and commandline -f execute
'';
};