{ outputs = { self, nixpkgs, ... }@inputs: let lib = import ./lib { inherit nixpkgs; }; inherit (lib) forEachSupportedSystem pkgsFor; commonModules = [ ./modules/common/environment.nix ./modules/common/nix.nix ./modules/common/nixpkgs.nix ./modules/common/programs.nix ]; darwinModules = [ ./modules/darwin/homebrew.nix ./modules/darwin/programs.nix ]; nixosModules = [ inputs.lanzaboote.nixosModules.lanzaboote ./modules/nixos/boot.nix ./modules/nixos/environment.nix ./modules/nixos/filesystems.nix ./modules/nixos/fonts.nix ./modules/nixos/hardware.nix ./modules/nixos/networking.nix ./modules/nixos/programs.nix ./modules/nixos/security.nix ./modules/nixos/services.nix ./modules/nixos/system.nix ]; systems = let inherit (inputs) home-manager lanzaboote nix-darwin nixpkgs ; inherit (nixpkgs.lib) flatten hasSuffix mkAliasOptionModule strings mkOption types ; systemFn = system: if hasSuffix "darwin" system then nix-darwin.lib.darwinSystem else if hasSuffix "linux" system then nixpkgs.lib.nixosSystem else throw "System: ${system} not supported."; homeModule = system: if hasSuffix "darwin" system then home-manager.darwinModules.home-manager else if hasSuffix "linux" system then home-manager.nixosModules.home-manager else throw "System: ${system} not supported."; in { mkSystem = system: { machine ? { }, modules ? [ ], specialArgs ? { }, }: systemFn system { inherit specialArgs; modules = flatten ( modules ++ [ ( if hasSuffix "darwin" system then home-manager.darwinModules.home-manager else if hasSuffix "linux" system then [ lanzaboote.nixosModules.lanzaboote ] else throw "System: ${system} not supported." ) { nixpkgs.hostPlatform = "${system}"; } { options.machine = { mainUser = mkOption { type = types.str; description = "The main user of the machine"; }; hostName = mkOption { type = types.str; description = "The name of the machine"; }; }; } { config.machine = machine; } ./modules/common/environment.nix ./modules/common/nix.nix ./modules/common/nixpkgs.nix ./modules/common/programs.nix ./machines/${machine.hostName}.nix ] ); }; }; in { nixosConfigurations."persephone" = systems.mkSystem "x86_64-linux" { machine = { hostName = "persephone"; mainUser = "pml"; }; modules = [ ./modules/nixos/boot.nix ./modules/nixos/environment.nix ./modules/nixos/filesystems.nix ./modules/nixos/fonts.nix ./modules/nixos/hardware.nix ./modules/nixos/networking.nix ./modules/nixos/programs.nix ./modules/nixos/security.nix ./modules/nixos/services.nix ./modules/nixos/system.nix ]; }; darwinConfigurations."hermes" = systems.mkSystem "aarch64-darwin" { machine = { hostName = "hermes"; mainUser = "pml"; }; modules = [ ./modules/darwin/homebrew.nix ./modules/darwin/programs.nix ]; }; devShells = forEachSupportedSystem ( { pkgs, system }: { default = pkgs.mkShellNoCC { packages = with pkgs; [ self.formatter.${system} nixd ]; }; } ); formatter = forEachSupportedSystem ({ pkgs, ... }: pkgs.nixfmt-rfc-style); }; inputs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-25.11"; nix-darwin.url = "github:nix-darwin/nix-darwin?ref=nix-darwin-25.11"; nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; home-manager.url = "github:nix-community/home-manager?ref=release-25.11"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; lanzaboote.url = "github:nix-community/lanzaboote?ref=master"; lanzaboote.inputs.nixpkgs.follows = "nixpkgs"; }; }