{ description = "Homelab v5 Nixos Server Configurations"; inputs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-25.11"; nixpkgs-unstable.url = "github:nixos/nixpkgs?ref=nixos-unstable"; sops-nix = { url = "github:Mic92/sops-nix"; inputs.nixpkgs.follows = "nixpkgs-unstable"; }; alerttonotify = { url = "git+https://git.t-juice.club/torjus/alerttonotify?ref=master"; inputs.nixpkgs.follows = "nixpkgs-unstable"; }; labmon = { url = "git+https://git.t-juice.club/torjus/labmon?ref=master"; inputs.nixpkgs.follows = "nixpkgs-unstable"; }; nixos-exporter = { url = "git+https://git.t-juice.club/torjus/nixos-exporter"; inputs.nixpkgs.follows = "nixpkgs-unstable"; }; }; outputs = { self, nixpkgs, nixpkgs-unstable, sops-nix, alerttonotify, labmon, nixos-exporter, ... }@inputs: let system = "x86_64-linux"; overlay-unstable = final: prev: { unstable = import nixpkgs-unstable { inherit system; config.allowUnfree = true; }; }; commonOverlays = [ overlay-unstable alerttonotify.overlays.default labmon.overlays.default ]; # Common modules applied to all hosts commonModules = [ ( { config, pkgs, ... }: { nixpkgs.overlays = commonOverlays; system.configurationRevision = self.rev or self.dirtyRev or "dirty"; } ) sops-nix.nixosModules.sops nixos-exporter.nixosModules.default ./modules/homelab ]; allSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f { pkgs = import nixpkgs { inherit system; }; }); in { nixosConfigurations = { ns1 = nixpkgs.lib.nixosSystem { inherit system; specialArgs = { inherit inputs self sops-nix; }; modules = commonModules ++ [ ./hosts/ns1 ]; }; ns2 = nixpkgs.lib.nixosSystem { inherit system; specialArgs = { inherit inputs self sops-nix; }; modules = commonModules ++ [ ./hosts/ns2 ]; }; ha1 = nixpkgs.lib.nixosSystem { inherit system; specialArgs = { inherit inputs self sops-nix; }; modules = commonModules ++ [ ./hosts/ha1 ]; }; template1 = nixpkgs.lib.nixosSystem { inherit system; specialArgs = { inherit inputs self sops-nix; }; modules = commonModules ++ [ ./hosts/template ]; }; template2 = nixpkgs.lib.nixosSystem { inherit system; specialArgs = { inherit inputs self sops-nix; }; modules = commonModules ++ [ ./hosts/template2 ]; }; http-proxy = nixpkgs.lib.nixosSystem { inherit system; specialArgs = { inherit inputs self sops-nix; }; modules = commonModules ++ [ ./hosts/http-proxy ]; }; ca = nixpkgs.lib.nixosSystem { inherit system; specialArgs = { inherit inputs self sops-nix; }; modules = commonModules ++ [ ./hosts/ca ]; }; monitoring01 = nixpkgs.lib.nixosSystem { inherit system; specialArgs = { inherit inputs self sops-nix; }; modules = commonModules ++ [ ./hosts/monitoring01 labmon.nixosModules.labmon ]; }; jelly01 = nixpkgs.lib.nixosSystem { inherit system; specialArgs = { inherit inputs self sops-nix; }; modules = commonModules ++ [ ./hosts/jelly01 ]; }; nix-cache01 = nixpkgs.lib.nixosSystem { inherit system; specialArgs = { inherit inputs self sops-nix; }; modules = commonModules ++ [ ./hosts/nix-cache01 ]; }; pgdb1 = nixpkgs.lib.nixosSystem { inherit system; specialArgs = { inherit inputs self sops-nix; }; modules = commonModules ++ [ ./hosts/pgdb1 ]; }; nats1 = nixpkgs.lib.nixosSystem { inherit system; specialArgs = { inherit inputs self sops-nix; }; modules = commonModules ++ [ ./hosts/nats1 ]; }; testvm01 = nixpkgs.lib.nixosSystem { inherit system; specialArgs = { inherit inputs self sops-nix; }; modules = commonModules ++ [ ./hosts/testvm01 ]; }; vault01 = nixpkgs.lib.nixosSystem { inherit system; specialArgs = { inherit inputs self sops-nix; }; modules = commonModules ++ [ ./hosts/vault01 ]; }; vaulttest01 = nixpkgs.lib.nixosSystem { inherit system; specialArgs = { inherit inputs self sops-nix; }; modules = commonModules ++ [ ./hosts/vaulttest01 ]; }; }; packages = forAllSystems ( { pkgs }: { create-host = pkgs.callPackage ./scripts/create-host { }; vault-fetch = pkgs.callPackage ./scripts/vault-fetch { }; } ); devShells = forAllSystems ( { pkgs }: { default = pkgs.mkShell { packages = with pkgs; [ ansible opentofu openbao (pkgs.callPackage ./scripts/create-host { }) ]; }; } ); }; }