diff --git a/hosts/common.nix b/hosts/common.nix index 3b0de86..72a04ec 100644 --- a/hosts/common.nix +++ b/hosts/common.nix @@ -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; diff --git a/modules/darwin/user.nix b/modules/darwin/user.nix index 50b63b3..278325f 100644 --- a/modules/darwin/user.nix +++ b/modules/darwin/user.nix @@ -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 - }"; - }; - - }; - } diff --git a/modules/editor/notes.nix b/modules/editor/notes.nix index 6d07d70..c357723 100644 --- a/modules/editor/notes.nix +++ b/modules/editor/notes.nix @@ -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"; }; }; diff --git a/modules/gaming/legendary.nix b/modules/gaming/legendary.nix index 4daba2f..11269bc 100644 --- a/modules/gaming/legendary.nix +++ b/modules/gaming/legendary.nix @@ -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 ''; diff --git a/modules/graphical/i3.nix b/modules/graphical/i3.nix index 91e79d3..2a22d2e 100644 --- a/modules/graphical/i3.nix +++ b/modules/graphical/i3.nix @@ -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 diff --git a/modules/mail/himalaya.nix b/modules/mail/himalaya.nix index ae67b25..f8e7475 100644 --- a/modules/mail/himalaya.nix +++ b/modules/mail/himalaya.nix @@ -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 = { diff --git a/modules/shell/fzf.nix b/modules/shell/fzf.nix index faaa307..2e3d099 100644 --- a/modules/shell/fzf.nix +++ b/modules/shell/fzf.nix @@ -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 ''; };