summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--flake.lock36
-rw-r--r--flake.nix51
-rw-r--r--user/settings/pin.nix4
3 files changed, 63 insertions, 28 deletions
diff --git a/flake.lock b/flake.lock
index ba7f2f5c..e7ba6924 100644
--- a/flake.lock
+++ b/flake.lock
@@ -156,7 +156,8 @@
         "nix-index-database": "nix-index-database",
         "nixos-hardware": "nixos-hardware",
         "nixpkgs": "nixpkgs",
-        "secrets": "secrets"
+        "secrets": "secrets",
+        "utils": "utils"
       }
     },
     "secrets": {
@@ -189,6 +190,39 @@
         "repo": "default",
         "type": "github"
       }
+    },
+    "systems_2": {
+      "locked": {
+        "lastModified": 1681028828,
+        "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+        "owner": "nix-systems",
+        "repo": "default",
+        "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nix-systems",
+        "repo": "default",
+        "type": "github"
+      }
+    },
+    "utils": {
+      "inputs": {
+        "systems": "systems_2"
+      },
+      "locked": {
+        "lastModified": 1710146030,
+        "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
     }
   },
   "root": "root",
diff --git a/flake.nix b/flake.nix
index 2895d65d..b89941a7 100644
--- a/flake.nix
+++ b/flake.nix
@@ -13,26 +13,31 @@
     secrets = {
       flake = false;
     };
+    utils.url = "github:numtide/flake-utils";
   };
 
   outputs =
+    inputs@
     { self
-    , darwin
-    , emacs-overlay
-    , home-manager
+    , utils
     , nixpkgs
-    , nix-index-database
     , nixos-hardware
+    , home-manager
+    , darwin
+    , nix-index-database
     , secrets
+    , emacs-overlay
     , ...
-    } @ attrs:
+    }:
     let
-      darwinSystem = "aarch64-darwin";
-      darwinPkgs = nixpkgs.legacyPackages.${darwinSystem};
-      nixosSystem = "x86_64-linux";
-      nixosPkgs = nixpkgs.legacyPackages.${nixosSystem};
-      aarch64LinuxSystem = "aarch64-linux";
-      aarch64LinuxPackages = nixpkgs.legacyPackages.${aarch64LinuxSystem};
+      mkHomeConfiguration = { modules, system }: home-manager.lib.homeManagerConfiguration {
+        pkgs = import nixpkgs { inherit system; };
+
+        inherit modules;
+        extraSpecialArgs = {
+          inherit inputs system;
+        };
+      };
     in
     {
       nixosConfigurations.prefect = nixpkgs.lib.nixosSystem {
@@ -48,16 +53,15 @@
         ]);
       };
       nixosConfigurations.nanopi = nixpkgs.lib.nixosSystem {
-        system = aarch64LinuxSystem;
+        system = utils.lib.system.aarch64-linux;
         modules = [ ./nanopi.nix ];
       };
       darwinConfigurations.mba = darwin.lib.darwinSystem {
-        system = darwinSystem;
+        system = utils.lib.system.aarch64-darwin;
         modules = [ ./system/mba.nix ];
       };
-      homeConfigurations."alan@mba" = home-manager.lib.homeManagerConfiguration {
-        pkgs = darwinPkgs;
-        extraSpecialArgs = { inherit attrs; };
+      homeConfigurations."alan@mba" = mkHomeConfiguration {
+        system = utils.lib.system.aarch64-darwin;
         modules = [
           ./user/mba.nix
           nix-index-database.hmModules.nix-index
@@ -66,9 +70,8 @@
           ({ nixpkgs.overlays = [ emacs-overlay.overlay ]; })
         ];
       };
-      homeConfigurations."alan@prefect" = home-manager.lib.homeManagerConfiguration {
-        pkgs = nixosPkgs;
-        extraSpecialArgs = { inherit attrs; };
+      homeConfigurations."alan@prefect" = mkHomeConfiguration {
+        system = utils.lib.system.x86_64-linux;
         modules = [
           ./user/prefect.nix
           nix-index-database.hmModules.nix-index
@@ -77,18 +80,16 @@
           ({ nixpkgs.overlays = [ emacs-overlay.overlay ]; })
         ];
       };
-      homeConfigurations."alan@nanopi" = home-manager.lib.homeManagerConfiguration {
-        pkgs = aarch64LinuxPackages;
-        extraSpecialArgs = { inherit attrs; };
+      homeConfigurations."alan@nanopi" = mkHomeConfiguration {
+        system = utils.lib.system.aarch64-linux;
         modules = [
           ./user/nanopi.nix
           nix-index-database.hmModules.nix-index
           (secrets + "/default.nix")
         ];
       };
-      homeConfigurations."alan@pappel" = home-manager.lib.homeManagerConfiguration {
-        pkgs = nixosPkgs;
-        extraSpecialArgs = { inherit attrs; };
+      homeConfigurations."alan@linde" = mkHomeConfiguration {
+        system = utils.lib.system.aarch64-linux;
         modules = [
           ./user/server.nix
           nix-index-database.hmModules.nix-index
diff --git a/user/settings/pin.nix b/user/settings/pin.nix
index 7ce0858b..ab7c8b3e 100644
--- a/user/settings/pin.nix
+++ b/user/settings/pin.nix
@@ -1,6 +1,6 @@
-{ attrs, ... }:
+{ inputs, ... }:
 let
-  inherit (attrs) nixpkgs;
+  inherit (inputs) nixpkgs;
 in
 {
   nix = {