zaphyra's git: nixfiles

zaphyra's nixfiles

commit b5f9af82b1002a11c90d71cc85afffcec477d477
parent b38373d12931818aa44927056aef39acc2a7a58e
Author: Katja Ramona Sophie Kwast (zaphyra) <git@zaphyra.eu>
Date: Thu, 21 Aug 2025 21:22:59 +0200

improve xdg-directory-specification compliance
9 files changed, 48 insertions(+), 28 deletions(-)
diff --git a/config/home-manager/common/programs/gpg.nix b/config/home-manager/common/programs/gpg.nix
@@ -1,4 +1,5 @@
 {
+  config,
   inputs,
   pkgs,
   ...

@@ -7,6 +8,7 @@
 {
   config = {
     programs.gpg = {
+      homedir = "${config.xdg.dataHome}/gnupg";
       scdaemonSettings = {
         disable-ccid = true;
       };
diff --git a/config/home-manager/zaphyra/configure/xdg.nix b/config/home-manager/zaphyra/configure/xdg.nix
@@ -1,9 +1,11 @@
-{ ... }:
+{ config, ... }:
 
 {
 
   home.preferXdgDirectories = true;
 
+  gtk.gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc";
+
   xdg = {
     enable = true;
     mime.enable = true;
diff --git a/config/home-manager/zaphyra/programs/gpg.nix b/config/home-manager/zaphyra/programs/gpg.nix
@@ -9,10 +9,6 @@
   home = {
     packages = [ pkgs.pcsctools ];
 
-    sessionVariables = {
-      GNUPGHOME = lib.mkForce "$HOME/.gnupg";
-    };
-
     shellAliases = {
       gpg-card-relearn = "gpg-connect-agent 'scd serialno' 'learn --force' /bye";
     };
diff --git a/config/home-manager/zaphyra/programs/password-store.nix b/config/home-manager/zaphyra/programs/password-store.nix
@@ -4,9 +4,6 @@
 
   home = {
     packages = [ pkgs.pwgen ];
-    sessionVariables = {
-      PASSWORD_STORE_DIR = lib.mkForce "\$HOME/.local/share/password-store";
-    };
   };
 
   programs = {
diff --git a/config/home-manager/zaphyra/programs/shellUtilities.nix b/config/home-manager/zaphyra/programs/shellUtilities.nix
@@ -1,4 +1,4 @@
-{ pkgs, ... }:
+{ config, pkgs, ... }:
 
 {
 

@@ -21,6 +21,8 @@
     backgrounditems = ''bgiparser -f  "$HOME/Library/Application Support/com.apple.backgroundtaskmanagementagent/backgrounditems.btm" -c'';
 
     zzz = (if pkgs.stdenv.isLinux then "sleep 1 && systemctl suspend" else "pmset sleepnow");
+
+    wget = "wget --hsts-file=\"${config.xdg.dataHome}/wget-hsts\"";
   };
 
   home.packages =
diff --git a/config/home-manager/zaphyra/programs/thunderbird.nix b/config/home-manager/zaphyra/programs/thunderbird.nix
@@ -1,4 +1,5 @@
 {
+  systemConfig,
   config,
   pkgs,
   lib,

@@ -21,7 +22,12 @@
     Service = {
       Environment = "PATH=" + (lib.makeBinPath [
         "/run/wrappers"
-        "/home/${config.home.username}/.nix-profile"
+        (
+          if !systemConfig.nix.settings.use-xdg-base-directories then
+            "/home/${config.home.username}/.nix-profile"
+          else
+            "/home/${config.home.username}/.local/state/nix/profile"
+        )
         "/nix/var/nix/profiles/default"
         "/run/current-system/sw"
       ]);
diff --git a/config/home-manager/zaphyra/services/easyeffects.nix b/config/home-manager/zaphyra/services/easyeffects.nix
@@ -9,10 +9,18 @@
     Unit.PartOf = [ "graphical-session.target" ];
 
     Service = {
-      Environment = "PATH=/run/wrappers/bin:/home/zaphyra/.nix-profile/bin:/etc/profiles/per-user/zaphyra/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin";
       ExecStart = "${pkgs.easyeffects}/bin/easyeffects --gapplication-service";
       Restart = "always";
       RestartSec = 5;
+      Environment = "PATH=" + (lib.makeBinPath (with pkgs; [
+        (
+          if !config.nix.settings.use-xdg-base-directories then
+            "/home/${config.home.username}/.nix-profile"
+          else
+            "/home/${config.home.username}/.local/state/nix/profile/bin"
+        )
+        "/run/current-system/sw"
+      ]));
     };
 
     Install.WantedBy = [ "graphical-session.target" ];
diff --git a/config/nixos/modules/nix/enable.nix b/config/nixos/modules/nix/enable.nix
@@ -31,6 +31,7 @@ in
         settings = {
           nix-path = config.nix.nixPath;
           trusted-users = [ "@wheel" ];
+          use-xdg-base-directories = true;
           experimental-features = [
             "flakes"
             "nix-command"
diff --git a/config/nixos/modules/programs/shellUtilities.nix b/config/nixos/modules/programs/shellUtilities.nix
@@ -19,23 +19,29 @@ in
   };
 
   config = lib.mkIf cfg.enable {
-    environment.systemPackages = with pkgs; [
-      age
-      eza
-      file
-      gnupg
-      helix
-      nmap
-      nvd
-      openssh
-      openssl
-      p7zip
-      progress
-      screen
-      sops
-      unzip
-      rsync
-    ];
+    environment = {
+      variables = {
+        HISTFILE = "\"\${XDG_STATE_HOME}\"/bash/history";
+      };
+
+      systemPackages = with pkgs; [
+        age
+        eza
+        file
+        gnupg
+        helix
+        nmap
+        nvd
+        openssh
+        openssl
+        p7zip
+        progress
+        screen
+        sops
+        unzip
+        rsync
+      ];
+    };
 
     programs = {
       bat.enable = true;