feat: move all xdg settings into xdg.nix, handle npm
This commit is contained in:
parent
57cd5d5de9
commit
f5be57a71d
4 changed files with 49 additions and 35 deletions
|
@ -38,11 +38,6 @@ in {
|
||||||
|
|
||||||
programs.gpg = {
|
programs.gpg = {
|
||||||
enable = true;
|
enable = true;
|
||||||
# NOTE: yet another workaround for gpgme on Darwin, since Firefox isn't aware of $GNUPGHOME
|
|
||||||
homedir =
|
|
||||||
if isDarwin
|
|
||||||
then "${config.home.homeDirectory}/.gnupg"
|
|
||||||
else "${config.xdg.configHome}/gnupg";
|
|
||||||
scdaemonSettings."disable-ccid" = true;
|
scdaemonSettings."disable-ccid" = true;
|
||||||
settings = {
|
settings = {
|
||||||
# https://github.com/drduh/config/blob/master/gpg.conf
|
# https://github.com/drduh/config/blob/master/gpg.conf
|
||||||
|
|
|
@ -64,7 +64,7 @@ in {
|
||||||
'';
|
'';
|
||||||
|
|
||||||
envExtra = ''
|
envExtra = ''
|
||||||
export PATH="$PATH:${config.xdg.dataHome}/krew/bin"
|
export PATH="$PATH:${config.xdg.dataHome}/krew/bin:$GOPATH/bin";
|
||||||
export ZVM_INIT_MODE=sourcing
|
export ZVM_INIT_MODE=sourcing
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ in {
|
||||||
./apps/wezterm.nix
|
./apps/wezterm.nix
|
||||||
./apps/zsh.nix
|
./apps/zsh.nix
|
||||||
./secrets/sops.nix
|
./secrets/sops.nix
|
||||||
|
./xdg.nix
|
||||||
]
|
]
|
||||||
++ (
|
++ (
|
||||||
if secretsAvailable
|
if secretsAvailable
|
||||||
|
@ -69,42 +70,17 @@ in {
|
||||||
unstable.heroic
|
unstable.heroic
|
||||||
]);
|
]);
|
||||||
|
|
||||||
sessionVariables =
|
sessionVariables = lib.mkIf isDarwin {
|
||||||
{
|
|
||||||
CARGO_HOME = "${config.xdg.dataHome}/cargo";
|
|
||||||
CUDA_CACHE_PATH = "${config.xdg.dataHome}/nv";
|
|
||||||
DOCKER_CONFIG = "${config.xdg.configHome}/docker";
|
|
||||||
NPM_CONFIG_USERCONFIG = "${config.xdg.configHome}/npm/npmrc";
|
|
||||||
PATH = "$PATH:${config.xdg.dataHome}/krew/bin:$GOPATH/bin";
|
|
||||||
RUSTUP_HOME = "${config.xdg.dataHome}/rustup";
|
|
||||||
XCOMPOSECACHE = "${config.xdg.cacheHome}/X11/xcompose";
|
|
||||||
}
|
|
||||||
// (
|
|
||||||
if isDarwin
|
|
||||||
then {
|
|
||||||
SSH_AUTH_SOCK = "${config.programs.gpg.homedir}/S.gpg-agent.ssh";
|
SSH_AUTH_SOCK = "${config.programs.gpg.homedir}/S.gpg-agent.ssh";
|
||||||
}
|
};
|
||||||
else {}
|
|
||||||
);
|
|
||||||
|
|
||||||
stateVersion = "22.11";
|
stateVersion = "22.11";
|
||||||
};
|
};
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
home-manager.enable = true;
|
home-manager.enable = true;
|
||||||
go = {
|
go.enable = true;
|
||||||
enable = true;
|
|
||||||
goPath = "${config.xdg.dataHome}/go";
|
|
||||||
};
|
|
||||||
man.enable = true;
|
man.enable = true;
|
||||||
taskwarrior.enable = true;
|
taskwarrior.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
xdg = {
|
|
||||||
enable = true;
|
|
||||||
userDirs.enable = isLinux;
|
|
||||||
cacheHome = "${config.home.homeDirectory}/.cache";
|
|
||||||
configHome = "${config.home.homeDirectory}/.config";
|
|
||||||
dataHome = "${config.home.homeDirectory}/.local/share";
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
43
home/xdg.nix
Normal file
43
home/xdg.nix
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
# assortment of random bs that's needed
|
||||||
|
# to make apps use XDG directories
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (pkgs.stdenv.hostPlatform) isDarwin isLinux;
|
||||||
|
in {
|
||||||
|
home.sessionVariables = {
|
||||||
|
CARGO_HOME = "${config.xdg.dataHome}/cargo";
|
||||||
|
CUDA_CACHE_PATH = "${config.xdg.dataHome}/nv";
|
||||||
|
DOCKER_CONFIG = "${config.xdg.configHome}/docker";
|
||||||
|
GEM_HOME = "${config.xdg.dataHome}/gem";
|
||||||
|
GEM_SPEC_CACHE = "${config.xdg.cacheHome}/gem";
|
||||||
|
NPM_CONFIG_USERCONFIG = "${config.xdg.configHome}/npm/npmrc";
|
||||||
|
RUSTUP_HOME = "${config.xdg.dataHome}/rustup";
|
||||||
|
XCOMPOSECACHE = "${config.xdg.cacheHome}/X11/xcompose";
|
||||||
|
};
|
||||||
|
|
||||||
|
home.activation.npmrc_xdg = ''
|
||||||
|
export NPM_CONFIG_USERCONFIG="${config.home.sessionVariables.NPM_CONFIG_USERCONFIG}"
|
||||||
|
${pkgs.nodejs + "/bin/npm"} config set \
|
||||||
|
prefix="${config.xdg.dataHome}/npm" \
|
||||||
|
cache="${config.xdg.cacheHome}/npm" \
|
||||||
|
init-module="${config.xdg.configHome}/npm/config/npm-init.js"
|
||||||
|
'';
|
||||||
|
|
||||||
|
programs.go.goPath = ".local/share/go";
|
||||||
|
# NOTE: workaround for gpgme on Darwin, since GUI apps aren't aware of $GNUPGHOME
|
||||||
|
programs.gpg.homedir =
|
||||||
|
if isDarwin
|
||||||
|
then "${config.home.homeDirectory}/.gnupg"
|
||||||
|
else "${config.xdg.configHome}/gnupg";
|
||||||
|
|
||||||
|
xdg = {
|
||||||
|
enable = true;
|
||||||
|
userDirs.enable = isLinux;
|
||||||
|
cacheHome = "${config.home.homeDirectory}/.cache";
|
||||||
|
configHome = "${config.home.homeDirectory}/.config";
|
||||||
|
dataHome = "${config.home.homeDirectory}/.local/share";
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue