Personal Nix setup
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add XDG module

+82 -19
+1
home/base/default.nix
··· 6 6 ./git.nix 7 7 ./shell.nix 8 8 ./tmux.nix 9 + ./xdg.nix 9 10 ]; 10 11 }
+10 -6
home/base/gpg.nix
··· 3 3 with lib; 4 4 let 5 5 cfg = config.modules.gpg; 6 - home = config.home.homeDirectory; 6 + home = "${config.xdg.dataHome}/gnupg"; 7 7 in { 8 8 options.modules.gpg = { 9 9 enable = mkOption { ··· 16 16 config = mkIf cfg.enable { 17 17 modules.git.signingKey = mkDefault "303B6A9A312AA035"; 18 18 19 + home.sessionVariables = { 20 + GNUPGHOME = home; 21 + }; 22 + 19 23 age.secrets."pubring.kbx" = { 20 24 symlink = true; 21 - path = "${home}/.gnupg/pubring.kbx"; 25 + path = "${home}/pubring.kbx"; 22 26 file = ./encrypt/pubring.kbx.age; 23 27 }; 24 28 25 29 age.secrets."75EF1DBB30A59CFB56BCE06A88CCF363DA63B1A7.key" = { 26 30 symlink = true; 27 - path = "${home}/.gnupg/private-keys-v1.d/75EF1DBB30A59CFB56BCE06A88CCF363DA63B1A7.key"; 31 + path = "${home}/private-keys-v1.d/75EF1DBB30A59CFB56BCE06A88CCF363DA63B1A7.key"; 28 32 file = ./encrypt/75EF1DBB30A59CFB56BCE06A88CCF363DA63B1A7.key.age; 29 33 }; 30 34 31 35 age.secrets."E2BFF19637FDC25A02F45583176FAD1ED1F6BDD6.key" = { 32 36 symlink = true; 33 - path = "${home}/.gnupg/private-keys-v1.d/E2BFF19637FDC25A02F45583176FAD1ED1F6BDD6.key"; 37 + path = "${home}/private-keys-v1.d/E2BFF19637FDC25A02F45583176FAD1ED1F6BDD6.key"; 34 38 file = ./encrypt/E2BFF19637FDC25A02F45583176FAD1ED1F6BDD6.key.age; 35 39 }; 36 40 37 41 age.secrets."CA84692E3CC846C8EC7272468E962B63FC599E49.key" = { 38 42 symlink = true; 39 - path = "${home}/.gnupg/private-keys-v1.d/CA84692E3CC846C8EC7272468E962B63FC599E49.key"; 43 + path = "${home}/private-keys-v1.d/CA84692E3CC846C8EC7272468E962B63FC599E49.key"; 40 44 file = ./encrypt/CA84692E3CC846C8EC7272468E962B63FC599E49.key.age; 41 45 }; 42 46 43 - home.file.".gnupg/sshcontrol".text = '' 47 + xdg.dataFile."gnupg/sshcontrol".text = '' 44 48 E2BFF19637FDC25A02F45583176FAD1ED1F6BDD6 45 49 75EF1DBB30A59CFB56BCE06A88CCF363DA63B1A7 46 50 '';
+8 -1
home/base/shell.nix
··· 13 13 }; 14 14 15 15 config = mkIf cfg.enable { 16 - programs.zsh = { 16 + programs.zsh = rec { 17 17 enable = true; 18 18 enableCompletion = true; 19 19 enableVteIntegration = true; 20 20 autosuggestion.enable = true; 21 21 syntaxHighlighting.enable = true; 22 + dotDir = ".config/zsh"; 22 23 shellAliases = { 23 24 ls = "ls --color=auto"; 24 25 ll = "ls -l"; 25 26 wx = "wezmux"; 26 27 http = "xh"; 27 28 }; 29 + history = { 30 + append = true; 31 + expireDuplicatesFirst = true; 32 + path = "${config.xdg.stateHome}/zsh/zsh_history"; 33 + }; 28 34 sessionVariables = { 29 35 KEYTIMEOUT = "1"; 30 36 VIM_MODE_TRACK_KEYMAP = "no"; ··· 35 41 PURE_GIT_UP_ARROW = " "; 36 42 PURE_GIT_DOWN_ARROW = " "; 37 43 PURE_GIT_STASH_SYMBOL = " "; 44 + ZDOTDIR = "${config.xdg.configHome}/zsh"; 38 45 }; 39 46 plugins = [ 40 47 {
+36
home/base/xdg.nix
··· 1 + { lib, helpers, config, pkgs, ... }: 2 + 3 + with lib; 4 + let 5 + cfg = config.modules.xdg; 6 + in { 7 + options = { 8 + modules.xdg = { 9 + enable = mkOption { 10 + default = true; 11 + description = "XDG Configuration"; 12 + type = types.bool; 13 + }; 14 + }; 15 + xdg.runtimeDir = mkOption { 16 + type = types.nullOr types.string; 17 + default = if helpers.isDarwin then "$(mktemp -d --suffix=$UID)" else null; 18 + apply = (val: if val != null then (toString val) else null); 19 + }; 20 + }; 21 + 22 + config = mkIf cfg.enable { 23 + xdg = { 24 + enable = true; 25 + userDirs.enable = mkDefault helpers.isLinux; 26 + systemDirs.data = mkIf helpers.isLinux [ 27 + "/usr/share" 28 + "/usr/local/share" 29 + ]; 30 + }; 31 + 32 + home.sessionVariables = { 33 + XDG_RUNTIME_DIR = optionalString (config.xdg.runtimeDir != null) config.xdg.runtimeDir; 34 + }; 35 + }; 36 + }
+21 -12
home/development/js.nix
··· 3 3 with lib; 4 4 let 5 5 cfg = config.modules.development; 6 - home = config.home.homeDirectory; 6 + NPMRC_PATH = "${config.xdg.configHome}/npm/npmrc"; 7 + BUNFIG_PATH = "${config.xdg.configHome}/.bunfig.toml"; 8 + BUN_HOME = "${config.xdg.dataHome}/bun"; 9 + PNPM_HOME = "${config.xdg.dataHome}/pnpm"; 7 10 in { 8 11 options.modules.development.js = { 9 12 enable = mkOption { ··· 20 23 }; 21 24 22 25 config = mkIf cfg.js.enable { 23 - age.secrets."npmrc" = { 26 + age.secrets."${NPMRC_PATH}" = { 24 27 symlink = true; 25 - path = "${home}/.npmrc"; 28 + path = "${NPMRC_PATH}"; 26 29 file = ./encrypt/npmrc.age; 27 30 }; 28 31 29 32 home.sessionPath = [ 30 33 "./node_modules/.bin" 31 - "$HOME/.local/share/pnpm" 32 - ]; 34 + PNPM_HOME 35 + ] ++ optionals cfg.js.bun [ BUN_HOME ]; 33 36 34 37 home.sessionVariables = { 35 - PNPM_HOME = "$HOME/.local/share/pnpm"; 36 - BUN_RUNTIME_TRANSPILER_CACHE_PATH = mkIf cfg.js.bun "$HOME/.cache/bun/install/cache/@t@"; 37 - COREPACK_ENABLE_AUTO_PIN = "0"; 38 + inherit PNPM_HOME; 39 + BUN_RUNTIME_TRANSPILER_CACHE_PATH = mkIf cfg.js.bun "${config.xdg.cacheHome}/bun/install/cache/@t@"; 40 + NODE_REPL_HISTORY = "${config.xdg.stateHome}/node_repl_history"; 41 + NPM_CONFIG_USERCONFIG = "${NPMRC_PATH}"; 42 + NPM_CONFIG_CACHE = "${config.xdg.cacheHome}/npm"; 43 + NPM_CONFIG_TMP = "${config.xdg.runtimeDir}/npm"; 44 + VOLTA_HOME = "${config.xdg.dataHome}/volta"; 45 + 46 + COREPACK_ENABLE_AUTO_PIN = "0"; # disable corepack creating packageManager entries 38 47 }; 39 48 40 49 home.file.".yarnrc".text = '' 41 50 disable-self-update-check true 42 51 ''; 43 52 44 - home.file.".bunfig.toml".text = mkIf cfg.js.bun '' 53 + home.file."${BUNFIG_PATH}".text = mkIf cfg.js.bun '' 45 54 telemetry = false 46 55 47 56 [install] 48 57 auto = "disable" 49 - globalDir = "~/.local/share/bun/global" 50 - globalBinDir = "~/.local/share/bun" 58 + globalDir = "${BUN_HOME}/global" 59 + globalBinDir = "${BUN_HOME}" 51 60 52 61 [install.cache] 53 - dir = "~/.cache/bun/install/cache" 62 + dir = "${config.xdg.cacheHome}/bun" 54 63 ''; 55 64 56 65 home.packages = with pkgs; [
+4
home/development/react-native.nix
··· 69 69 home.packages = with pkgs; [] 70 70 ++ optionals cfg.react-native.cocoapods [ cocoapods ] 71 71 ++ optionals cfg.react-native.fastlane [ fastlane ]; 72 + home.sessionVariables = { 73 + CP_HOME_DIR = mkIf cfg.react-native.cocoapods "$XDG_DATA_HOME/cocoapods"; 74 + }; 72 75 }) 73 76 74 77 (mkIf cfg.react-native.android-sdk { ··· 83 86 JAVA_HOME = pkgs.jdk.home; 84 87 ANDROID_USER_HOME = "${config.xdg.stateHome}/android"; 85 88 ANDROID_AVD_HOME = "${ANDROID_USER_HOME}/avd"; 89 + GRADLE_USER_HOME = "${config.xdg.dataHome}/gradle"; 86 90 }; 87 91 88 92 android-sdk = {
+2
modules/base/nix-config.nix
··· 19 19 flake-registry = ""; 20 20 # Workaround for https://github.com/NixOS/nix/issues/9574 21 21 nix-path = config.nix.nixPath; 22 + # Use xdg spec for .nix-defexpr 23 + use-xdg-base-directories = true; 22 24 # binary caches 23 25 substituters = [ 24 26 "https://cache.nixos.org"