From 993bb11a26a204f2f2ff0cb5223999aca47f7f88 Mon Sep 17 00:00:00 2001 From: jacekpoz Date: Thu, 15 Feb 2024 10:34:27 +0100 Subject: [PATCH] xdg-ninja --- hosts/niks/configuration.nix | 5 ---- hosts/niks/programs.nix | 1 + modules/cli/zsh.nix | 1 - modules/other/xdg.nix | 54 ++++++++++++++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 6 deletions(-) diff --git a/hosts/niks/configuration.nix b/hosts/niks/configuration.nix index d1a60b6..1ad3fb6 100644 --- a/hosts/niks/configuration.nix +++ b/hosts/niks/configuration.nix @@ -142,14 +142,9 @@ environment = { sessionVariables = { - GOPATH = "\$HOME/.local/share/go"; - MOZ_ENABLE_WAYLAND = "1"; MOZ_DRM_DEVICE = "/dev/dri/card0"; - HISTFILE = "\${XDG_STATE_HOME}/bash/history"; - CARGO_HOME = "\${XDG_DATA_HOME}/cargo"; - CHROME_EXECUTABLE = "${pkgs.ungoogled-chromium}/bin/chromium"; #NIXOS_OZONE_WL = "1"; diff --git a/hosts/niks/programs.nix b/hosts/niks/programs.nix index b24c0c5..5c208a4 100644 --- a/hosts/niks/programs.nix +++ b/hosts/niks/programs.nix @@ -202,6 +202,7 @@ httpie mangohud nix-index + xdg-ninja ]; }; } diff --git a/modules/cli/zsh.nix b/modules/cli/zsh.nix index 960bbf2..deee5d9 100644 --- a/modules/cli/zsh.nix +++ b/modules/cli/zsh.nix @@ -53,7 +53,6 @@ in { gs = "g stash"; n = "nix"; woman = "man"; - wget = "wget --hsts-file=\"${config.home-manager.users.${config'.username}.xdg.dataHome}/wget-hsts\""; open = "xdg-open"; ":q" = "exit"; } // cfg.extraAliases; diff --git a/modules/other/xdg.nix b/modules/other/xdg.nix index 06845d9..655278e 100644 --- a/modules/other/xdg.nix +++ b/modules/other/xdg.nix @@ -13,7 +13,61 @@ image_viewer = "imv.desktop"; text_editor = "nvim.desktop"; in { + + environment.sessionVariables = { + ANDROID_HOME = "${hmCfg.xdg.dataHome}/android"; + CARGO_HOME = "${hmCfg.xdg.dataHome}/cargo"; + DOTNET_CLI_HOME = "${hmCfg.xdg.dataHome}/dotnet"; + GOPATH = "${hmCfg.xdg.dataHome}/go"; + GNUPGHOME = "${hmCfg.xdg.dataHome}/gnupg"; + GRADLE_USER_HOME = "${hmCfg.xdg.dataHome}/gradle"; + HISTFILE = "${hmCfg.xdg.stateHome}/bash/history"; + MYSQL_HISTFILE = "${hmCfg.xdg.stateHome}/mysql/history"; + NPM_CONFIG_USERCONFIG = "${hmCfg.xdg.configHome}/npm/npmrc"; + NUGET_PACKAGES = "${hmCfg.xdg.cacheHome}/NuGetPackages"; + _JAVA_OPTIONS = "-Djava.util.prefs.userRoot=${hmCfg.xdg.configHome}/java"; + PARALLEL_HOME = "${hmCfg.xdg.configHome}/parallel"; + PYTHONSTARTUP = "${hmCfg.xdg.configHome}/python/pythonrc"; + RUSTUP_HOME = "${hmCfg.xdg.dataHome}/rustup"; + WINEPREFIX = "${hmCfg.xdg.dataHome}/wine"; + XAUTHORITY = "\$XDG_RUNTIME_DIR/Xauthority"; + }; + + myOptions.programs.zsh.extraAliases = { + gdb = "gdb -n -x ${hmCfg.xdg.configHome}/gdb/init"; + pidgin = "pidgin --config=${hmCfg.xdg.dataHome}/purple"; + svn = "svn --config-dir ${hmCfg.xdg.configHome}/subversion"; + wget = "wget --hsts-file=\"${hmCfg.xdg.dataHome}/wget-hsts\""; + }; + home-manager.users.${config'.username} = { + xdg.configFile."npm/npmrc".text = '' + prefix=${hmCfg.xdg.dataHome}/npm + cache=${hmCfg.xdg.cacheHome}/npm + tmp=\$XDG_RUNTIME_DIR/npm + init-module=${hmCfg.xdg.configHome}/npm/config/npm-init.js + ''; + + xdg.configFile."python/pythonrc".text = '' + import os + import atexit + import readline + + history = os.path.join(os.environ['XDG_CACHE_HOME'], 'python_history') + try: + readline.read_history_file(history) + except OSError: + pass + + def write_history(): + try: + readline.write_history_file(history) + except OSError: + pass + + atexit.register(write_history) + ''; + xdg = { cacheHome = "${hmCfg.home.homeDirectory}/.cache"; configHome = "${hmCfg.home.homeDirectory}/.config";