This commit is contained in:
2026-01-03 15:15:59 +00:00
parent 9f96b6dd71
commit 1650823a73

View File

@@ -41,11 +41,17 @@
outputs = inputs @ {flake-parts, ...}: outputs = inputs @ {flake-parts, ...}:
flake-parts.lib.mkFlake {inherit inputs;} ( flake-parts.lib.mkFlake {inherit inputs;} (
let let
inherit (inputs.nixpkgs) lib;
constants = import ./lib/constants.nix; constants = import ./lib/constants.nix;
user = constants.user; inherit (constants) user;
darwinHosts = ["chidi" "jason"]; darwinHosts = ["chidi" "jason"];
nixosHosts = ["michael" "tahani"]; nixosHosts = ["michael" "tahani"];
overlays = import ./overlays {inherit inputs;}; overlays = import ./overlays {inherit inputs;};
nixpkgsConfig = hostPlatform: {
nixpkgs = {inherit hostPlatform overlays;};
};
in { in {
systems = [ systems = [
"x86_64-linux" "x86_64-linux"
@@ -53,27 +59,23 @@
]; ];
flake.darwinConfigurations = flake.darwinConfigurations =
inputs.nixpkgs.lib.genAttrs darwinHosts ( lib.genAttrs darwinHosts (
hostname: hostname:
inputs.darwin.lib.darwinSystem { inputs.darwin.lib.darwinSystem {
specialArgs = { specialArgs = {inherit inputs user hostname constants;};
inherit inputs user hostname constants;
};
modules = [ modules = [
inputs.home-manager.darwinModules.home-manager inputs.home-manager.darwinModules.home-manager
inputs.nix-homebrew.darwinModules.nix-homebrew inputs.nix-homebrew.darwinModules.nix-homebrew
(nixpkgsConfig "aarch64-darwin")
{ {
nixpkgs.hostPlatform = "aarch64-darwin";
nixpkgs.overlays = overlays;
nix-homebrew = { nix-homebrew = {
inherit user; inherit user;
enable = true; enable = true;
mutableTaps = true;
taps = { taps = {
"homebrew/homebrew-core" = inputs.homebrew-core; "homebrew/homebrew-core" = inputs.homebrew-core;
"homebrew/homebrew-cask" = inputs.homebrew-cask; "homebrew/homebrew-cask" = inputs.homebrew-cask;
}; };
mutableTaps = true;
}; };
} }
./hosts/${hostname} ./hosts/${hostname}
@@ -82,18 +84,13 @@
); );
flake.nixosConfigurations = flake.nixosConfigurations =
inputs.nixpkgs.lib.genAttrs nixosHosts ( lib.genAttrs nixosHosts (
hostname: hostname:
inputs.nixpkgs.lib.nixosSystem { lib.nixosSystem {
specialArgs = { specialArgs = {inherit inputs user hostname constants;};
inherit inputs user hostname constants;
};
modules = [ modules = [
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
{ (nixpkgsConfig "x86_64-linux")
nixpkgs.hostPlatform = "x86_64-linux";
nixpkgs.overlays = overlays;
}
./hosts/${hostname} ./hosts/${hostname}
]; ];
} }
@@ -106,7 +103,7 @@
specialArgs = {inherit inputs user constants;}; specialArgs = {inherit inputs user constants;};
}; };
} }
// inputs.nixpkgs.lib.genAttrs nixosHosts ( // lib.genAttrs nixosHosts (
hostname: { hostname: {
deployment = { deployment = {
targetHost = hostname; targetHost = hostname;
@@ -114,11 +111,8 @@
}; };
imports = [ imports = [
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
{ (nixpkgsConfig "x86_64-linux")
nixpkgs.hostPlatform = "x86_64-linux"; {_module.args.hostname = hostname;}
nixpkgs.overlays = overlays;
_module.args.hostname = hostname;
}
./hosts/${hostname} ./hosts/${hostname}
]; ];
} }
@@ -128,9 +122,7 @@
pgbackrest = ./modules/pgbackrest.nix; pgbackrest = ./modules/pgbackrest.nix;
}; };
flake.lib = { flake.lib = {inherit constants;};
constants = import ./lib/constants.nix;
};
perSystem = { perSystem = {
pkgs, pkgs,
@@ -153,14 +145,7 @@
"rollback" "rollback"
]; ];
in { in {
apps = apps = pkgs.lib.genAttrs appNames mkApp;
builtins.listToAttrs (
map (n: {
name = n;
value = mkApp n;
})
appNames
);
}; };
} }
); );