From 250931a8fd58672a88760affe7dc0487d15fcb3f Mon Sep 17 00:00:00 2001
From: Dmitriy Pleshevskiy <dmitriy@pleshevski.ru>
Date: Thu, 6 Mar 2025 17:12:06 +0300
Subject: [PATCH] flake: dedup specialArgs

---
 flake.nix | 32 ++++++++++++--------------------
 1 file changed, 12 insertions(+), 20 deletions(-)

diff --git a/flake.nix b/flake.nix
index e10de30..7ef076b 100644
--- a/flake.nix
+++ b/flake.nix
@@ -73,6 +73,15 @@
         (hostname: { system, ... }: system == x86_64-darwin)
         hosts;
 
+      baseSpecialArgs = {
+        inherit inputs;
+        globalData = import ./data.nix;
+        usersPath = ./users;
+        hostsPath = ./hosts;
+        packagesPath = ./packages;
+        sharedPath = ./shared;
+      };
+
       mkDeploymentModule = { targetHost, system, ... }: ({ lib, ... }: {
         options.deployment = with lib; {
           system = mkOption {
@@ -93,10 +102,7 @@
         home-manager.backupFileExtension = "backup";
         home-manager.useGlobalPkgs = true;
         home-manager.useUserPackages = true;
-        home-manager.extraSpecialArgs = {
-          packagesPath = ./packages;
-          hostsPath = ./hosts;
-        };
+        home-manager.extraSpecialArgs = baseSpecialArgs;
         home-manager.sharedModules = [
           {
             imports = [
@@ -197,14 +203,7 @@
             nixpkgs.lib.nixosSystem {
               inherit system;
 
-              specialArgs = {
-                inherit inputs;
-                globalData = import ./data.nix;
-                usersPath = ./users;
-                hostsPath = ./hosts;
-                packagesPath = ./packages;
-                sharedPath = ./shared;
-              } // specialArgs;
+              specialArgs = baseSpecialArgs // specialArgs;
 
               modules =
                 (with inputs; [
@@ -231,14 +230,7 @@
                      , targetHost ? null
                      }:
             inputs.nix-darwin.lib.darwinSystem {
-              inputs = {
-                inherit inputs;
-                globalData = import ./data.nix;
-                usersPath = ./users;
-                hostsPath = ./hosts;
-                packagesPath = ./packages;
-                sharedPath = ./shared;
-              } // specialArgs;
+              specialArgs = baseSpecialArgs // specialArgs;
 
               modules =
                 (with inputs; [