zaphyra's git: nixfiles

zaphyra's nixfiles

commit 80e3814f6d372a7a71818366a5f5fd5ddac8da8d
parent 30486ac65c89dd0009ba41cd55cdb1be7e1f61e5
Author: Katja Ramona Sophie Kwast (zaphyra) <git@zaphyra.eu>
Date: Wed, 22 Jul 2026 21:49:26 +0200

default: now has a `self` equivalent!
16 files changed, 58 insertions(+), 42 deletions(-)
diff --git a/default.nix b/default.nix
@@ -1,9 +1,21 @@
 let
-  defaultSystem = if (builtins ? currentSystem) then builtins.currentSystem else "x86_64-linux";
+  impureEval = builtins ? currentSystem;
+  defaultSystem = if impureEval then builtins.currentSystem else "x86_64-linux";
 
+  self =
+    (import ./.)
+    // (
+      if impureEval then
+        (fetchGit {
+          name = "nixosConfig";
+          url = ./.;
+        })
+      else
+        { outPath = ./.; }
+    );
   npins = import ./npins;
   overlays = import ./overlays { inherit npins; };
-  nixosConfigurations = import ./machines { inherit lib npins; };
+  nixosConfigurations = import ./machines { inherit npins lib self; };
   lib = (import "${npins.nixpkgs}/lib").extend (
     final: prev: {
       zpha = import ./lib {

@@ -16,15 +28,16 @@ let
 in
 {
 
-  outPath = ./.;
-
   inherit
+    self
     npins
     lib
     overlays
     nixosConfigurations
     ;
 
+  resources = import ./resources { inherit lib; };
+  sopsSecrets = import ./secrets { inherit lib; };
   nixosModules = import ./nixosModules { inherit lib; };
 
   formatter =
diff --git a/machines/default.nix b/machines/default.nix
@@ -1,6 +1,7 @@
 {
   lib ? import "${(import ../npins).nixpkgs}/lib",
   npins ? import ../npins,
+  self ? import ../.,
   ...
 }:
 

@@ -26,9 +27,11 @@
     overlays = import ../overlays { inherit npins; };
 
     specialArgs = {
-      inherit npins machines nixosConfigurations;
-      resources = import ../resources { inherit npins lib; };
-      sopsSecrets = import ../secrets { inherit npins lib; };
+      inherit
+        self
+        machines
+        nixosConfigurations
+        ;
     };
 
     nixosConfigurations = lib.flip builtins.mapAttrs machines (

@@ -40,6 +43,7 @@
         system = machineConfig.system;
 
         specialArgs = specialArgs // {
+          inherit machines;
           machineConfig = machineConfig // {
             inherit machineName;
           };
diff --git a/nixosModules/common/configure/boot.nix b/nixosModules/common/configure/boot.nix
@@ -1,5 +1,5 @@
 {
-  npins,
+  self,
   lib,
   config,
   pkgs,

@@ -8,7 +8,7 @@
 let
   inherit (lib) types;
   cfg = config.common.configure.boot;
-  lanzaboote = import npins.lanzaboote {
+  lanzaboote = import self.npins.lanzaboote {
     inherit pkgs;
   };
 
diff --git a/nixosModules/common/configure/nix.nix b/nixosModules/common/configure/nix.nix
@@ -1,5 +1,5 @@
 {
-  npins,
+  self,
   config,
   lib,
   pkgs,

@@ -12,13 +12,13 @@
 
   imports =
     (lib.mkIf config.common.nix.enable [
-      (import "${npins.lixModule}/module.nix" { lix = null; })
+      (import "${self.npins.lixModule}/module.nix" { lix = null; })
     ]).content;
 
   config = lib.mkIf config.common.configure.nix.enable (
     let
-      NIXPKGS_PATH = lib.cleanSource npins.nixpkgs;
-      NIXPKGS_UNSTABLE_PATH = lib.cleanSource npins.nixpkgsUnstable;
+      NIXPKGS_PATH = lib.cleanSource self.npins.nixpkgs;
+      NIXPKGS_UNSTABLE_PATH = lib.cleanSource self.npins.nixpkgsUnstable;
 
     in
     {
diff --git a/nixosModules/common/configure/persist.nix b/nixosModules/common/configure/persist.nix
@@ -1,5 +1,5 @@
 {
-  npins,
+  self,
   config,
   lib,
   pkgs,

@@ -76,7 +76,7 @@ in
 
   imports =
     (lib.mkIf cfg.enable [
-      "${npins.preservation}/module.nix"
+      "${self.npins.preservation}/module.nix"
     ]).content;
 
   config = lib.mkMerge [
diff --git a/nixosModules/common/configure/sops.nix b/nixosModules/common/configure/sops.nix
@@ -1,6 +1,5 @@
 {
-  sopsSecrets,
-  npins,
+  self,
   config,
   lib,
   ...

@@ -12,11 +11,11 @@
 
   imports =
     (lib.mkIf config.common.configure.sops.enable [
-      "${npins.sopsNix}/modules/sops"
+      "${self.npins.sopsNix}/modules/sops"
     ]).content;
 
   config = lib.mkIf config.common.configure.sops.enable {
-    sops.defaultSopsFile = sopsSecrets.${config.networking.hostName};
+    sops.defaultSopsFile = self.sopsSecrets.${config.networking.hostName};
   };
 
 }
diff --git a/nixosModules/common/users/zaphyra.nix b/nixosModules/common/users/zaphyra.nix
@@ -1,5 +1,5 @@
 {
-  sopsSecrets,
+  self,
   config,
   lib,
   pkgs,

@@ -15,7 +15,7 @@
 
     sops.secrets.zaphyraPassword = {
       neededForUsers = true;
-      sopsFile = sopsSecrets.common;
+      sopsFile = self.sopsSecrets.common;
     };
 
     users.users.zaphyra = {
diff --git a/nixosModules/zpha/configure/mailServer.nix b/nixosModules/zpha/configure/mailServer.nix
@@ -1,6 +1,5 @@
 {
-  npins,
-  sopsSecrets,
+  self,
   machineConfig,
   config,
   lib,

@@ -14,7 +13,7 @@
 
   imports =
     (lib.mkIf config.zpha.configure.mailServer.enable [
-      (import npins.simpleNixosMailserver)
+      (import self.npins.simpleNixosMailserver)
     ]).content;
 
   config = lib.mkIf config.zpha.configure.mailServer.enable (

@@ -125,7 +124,7 @@
         "mailPasswords/gts@zaphyra.eu" = { };
         "mailPasswords/vaultwarden@zaphyra.eu" = { };
         "sieveScripts/katja@zaphyra.eu.sieve" = {
-          sopsFile = sopsSecrets.zaphyra.sieve;
+          sopsFile = self.sopsSecrets.zaphyra.sieve;
           key = "katja@zaphyra.eu";
           restartUnits = [ "dovecot2.service" ];
           owner = "virtualMail";
diff --git a/nixosModules/zpha/configure/networkManagerProfiles.nix b/nixosModules/zpha/configure/networkManagerProfiles.nix
@@ -1,5 +1,5 @@
 {
-  sopsSecrets,
+  self,
   config,
   lib,
   ...

@@ -11,8 +11,8 @@
 
   config = lib.mkIf config.zpha.configure.networkManagerProfiles.enable {
     sops.secrets = {
-      "environments/networkManagerProfiles/zaphyraPhone".sopsFile = sopsSecrets.common;
-      "environments/networkManagerProfiles/grogHome".sopsFile = sopsSecrets.common;
+      "environments/networkManagerProfiles/zaphyraPhone".sopsFile = self.sopsSecrets.common;
+      "environments/networkManagerProfiles/grogHome".sopsFile = self.sopsSecrets.common;
     };
 
     networking.networkmanager.ensureProfiles = {
diff --git a/nixosModules/zpha/profiles/zaphyra.nix b/nixosModules/zpha/profiles/zaphyra.nix
@@ -1,5 +1,5 @@
 {
-  npins,
+  self,
   pkgs,
   lib,
   config,

@@ -17,7 +17,7 @@ in
 
   imports =
     (lib.mkIf cfg.enable [
-      "${npins.nixMaid}/src/nixos"
+      "${self.npins.nixMaid}/src/nixos"
     ]).content;
 
   config = lib.mkIf cfg.enable {
diff --git a/nixosModules/zpha/programs/firefox.nix b/nixosModules/zpha/programs/firefox.nix
@@ -1,8 +1,8 @@
 {
+  self,
   config,
   lib,
   pkgs,
-  npins,
   ...
 }:
 

@@ -20,7 +20,7 @@
       environment.sessionVariables.BROWSER = "firefox";
 
       file.xdg_config = {
-        "mozilla/firefox/gnome-theme".source = npins.firefoxGnomeTheme;
+        "mozilla/firefox/gnome-theme".source = self.npins.firefoxGnomeTheme;
         "mozilla/firefox/zaphyra/chrome/userChrome.css".text = ''
           @import "../../gnome-theme/theme/gnome-theme.css";
         '';
diff --git a/nixosModules/zpha/programs/niri/enable.nix b/nixosModules/zpha/programs/niri/enable.nix
@@ -1,16 +1,16 @@
 {
+  self,
   lib,
   pkgs,
   config,
-  npins,
   ...
 }:
 let
   inherit (lib) types;
   cfg = config.zpha.programs.niri;
 
-  niri-nix = import "${npins.niri-nix}/lib" {
-    self = npins.niri-nix;
+  niri-nix = import "${self.npins.niri-nix}/lib" {
+    self = self.npins.niri-nix;
     inherit lib;
     nixpkgs.legacyPackages."${pkgs.stdenv.hostPlatform.system}" = pkgs;
   };
diff --git a/nixosModules/zpha/programs/shaderbg.nix b/nixosModules/zpha/programs/shaderbg.nix
@@ -1,5 +1,5 @@
 {
-  resources,
+  self,
   config,
   lib,
   pkgs,

@@ -27,7 +27,7 @@
           ExecStart = lib.escapeShellArgs [
             (lib.getExe pkgs.zpha.shaderbg)
             "*"
-            resources.shaders."background1.frag"
+            self.resources.shaders."background1.frag"
           ];
         };
       };
diff --git a/nixosModules/zpha/programs/swaylock.nix b/nixosModules/zpha/programs/swaylock.nix
@@ -1,5 +1,5 @@
 {
-  resources,
+  self,
   config,
   lib,
   pkgs,

@@ -36,7 +36,9 @@ in
       show-failed-attempts = true;
       fingerprint = false;
 
-      command = "${lib.getExe pkgs.zpha.shaderbg} '*' --fps 10 ${resources.shaders."background1.frag"}";
+      command = "${lib.getExe pkgs.zpha.shaderbg} '*' --fps 10 ${
+        self.resources.shaders."background1.frag"
+      }";
 
       # image = "/home/zaphyra/Pictures/Backgrounds/lock.png";
       # scaling = "fit";
diff --git a/nixosModules/zpha/programs/thunderbird.nix b/nixosModules/zpha/programs/thunderbird.nix
@@ -2,7 +2,6 @@
   config,
   lib,
   pkgs,
-  npins,
   ...
 }:
 
diff --git a/nixosModules/zpha/websites/things.zaphyra.eu.nix b/nixosModules/zpha/websites/things.zaphyra.eu.nix
@@ -1,5 +1,5 @@
 {
-  npins,
+  self,
   config,
   lib,
   pkgs,

@@ -12,7 +12,7 @@
 
   imports =
     (lib.mkIf config.zpha.websites."things.zaphyra.eu".enable [
-      "${npins.things}/nixosModule.nix"
+      "${self.npins.things}/nixosModule.nix"
     ]).content;
 
   config = lib.mkIf config.zpha.websites."things.zaphyra.eu".enable {