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

View File

@ -1,19 +1,8 @@
{ config, pkgs, lib, ... }: { { config, pkgs, lib, ... }: {
users.users."${config.user}" = { # macOS user users.users."${config.user}" = { # macOS user
home = "/Users/${config.user}"; home = config.homePath;
shell = pkgs.zsh; # Default shell 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-manager.users.${config.user} = {
home.sessionVariables = { 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 ; Disables the notice about an available update on exit
disable_update_notice = true disable_update_notice = true
; Set install directory ; Set install directory
install_dir = /home/${config.user}/media/games install_dir = ${config.homePath}/media/games
; Make output quiet ; Make output quiet
log_level = error log_level = error
''; '';

View File

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

View File

@ -68,7 +68,7 @@
mu.enable = false; mu.enable = false;
notmuch.enable = false; notmuch.enable = false;
passwordCommand = 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 builtins.toString ./mailpass.age
}"; }";
smtp = { smtp = {

View File

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