{ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; lix-module = { url = "https://git.lix.systems/lix-project/nixos-module/archive/2.92.0-3.tar.gz"; inputs.nixpkgs.follows = "nixpkgs"; }; home-manager = { url = "github:nix-community/home-manager/release-25.05"; inputs.nixpkgs.follows = "nixpkgs"; }; nixos-apple-silicon = { url = "github:nix-community/nixos-apple-silicon"; inputs.nixpkgs.follows = "nixpkgs-unstable"; }; agenix = { url = "github:ryantm/agenix"; inputs.nixpkgs.follows = "nixpkgs"; inputs.home-manager.follows = "home-manager"; }; nix-vscode-extensions = { url = "github:nix-community/nix-vscode-extensions"; inputs.nixpkgs.follows = "nixpkgs-unstable"; }; nixpkgs-esp-dev = { url = "github:mirrexagon/nixpkgs-esp-dev"; inputs.nixpkgs.follows = "nixpkgs-unstable"; }; flake-compat.url = "github:edolstra/flake-compat"; }; outputs = inputs@{ self, nixpkgs, nixpkgs-unstable, lix-module, nixos-apple-silicon, agenix, home-manager, nix-vscode-extensions, nixpkgs-esp-dev, ... }: let systems = { x86 = "x86_64-linux"; arm = "aarch64-linux"; }; machines = with systems; [ { name = "graphite"; system = x86; } { name = "moissanite"; system = arm; } { name = "bismuth"; system = x86; } { name = "serpentine"; system = x86; } ]; overlays = [ lix-module.overlays.default nixos-apple-silicon.overlays.default # unused on non-asahi machines agenix.overlays.default nix-vscode-extensions.overlays.default nixpkgs-esp-dev.overlays.default (import ./overlay.nix) ]; packageSetsForSystem = system: let commonPkgsInputs = { inherit system; config = import ./config.nix; }; in rec { pkgs = import nixpkgs (commonPkgsInputs // { inherit overlays; }); unstablePkgs = import nixpkgs-unstable commonPkgsInputs; auxiliaryPkgs = import ./pkgs { inherit pkgs unstablePkgs nixpkgs nixpkgs-unstable ; }; }; inherit (nixpkgs) lib; in { nixosConfigurations = lib.mergeAttrsList ( map ( machine: let packageSets = packageSetsForSystem machine.system; specialArgs = inputs // packageSets // { me = machine; }; in { ${machine.name} = lib.nixosSystem { inherit (machine) system; inherit specialArgs; modules = [ ./machines/${machine.name} home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; home-manager.backupFileExtension = "hm-backup"; home-manager.extraSpecialArgs = specialArgs; home-manager.users.mel = import ./machines/${machine.name}/home.nix; } lix-module.nixosModules.default agenix.nixosModules.default ]; }; } ) machines ); # compatibility wrapper for nixos-option legacyPackages = lib.genAttrs (lib.attrValues systems) ( system: let packageSets = packageSetsForSystem system; in with packageSets; pkgs.recurseIntoAttrs pkgs ); }; }