From 76b6b1097ccc134324d70be9e41362c6b4814305 Mon Sep 17 00:00:00 2001 From: stupidcomputer Date: Thu, 26 Dec 2024 16:19:59 -0600 Subject: [PATCH] clean up some things --- boxes/copernicus/default.nix | 4 +-- boxes/netbox/default.nix | 30 ++++++++++----------- flake.nix | 45 +++++++++++++++----------------- {modules => lib}/bootstrap.nix | 0 {modules => lib}/hosts.nix | 0 machines.nix => lib/machines.nix | 0 6 files changed, 37 insertions(+), 42 deletions(-) rename {modules => lib}/bootstrap.nix (100%) rename {modules => lib}/hosts.nix (100%) rename machines.nix => lib/machines.nix (100%) diff --git a/boxes/copernicus/default.nix b/boxes/copernicus/default.nix index 7bdcaed..8f46b90 100644 --- a/boxes/copernicus/default.nix +++ b/boxes/copernicus/default.nix @@ -6,8 +6,8 @@ ./nvidia.nix ./services ../../config/copernicus.nix - ../../modules/hosts.nix - ../../modules/bootstrap.nix + ../../lib/hosts.nix + ../../lib/bootstrap.nix ]; environment.systemPackages = with pkgs; [ diff --git a/boxes/netbox/default.nix b/boxes/netbox/default.nix index 0afe317..6b9f052 100644 --- a/boxes/netbox/default.nix +++ b/boxes/netbox/default.nix @@ -1,23 +1,21 @@ { lib, config, pkgs, machines, ... }: { - imports = - [ - ./hardware-configuration.nix - ../../modules/bootstrap.nix + imports = [ + ./hardware-configuration.nix + ../../lib/bootstrap.nix - ./radicale.nix - ./ssh.nix - ./gitea.nix - ./radicale.nix - ./vaultwarden.nix - ./sslh.nix - ./nginx.nix - ./franklincce.nix - ./wireguard.nix - ./nextcloud.nix - ./mail.nix - ]; + ./franklincce.nix + ./gitea.nix + ./mail.nix + ./nextcloud.nix + ./nginx.nix + ./radicale.nix + ./ssh.nix + ./sslh.nix + ./vaultwarden.nix + ./wireguard.nix + ]; nix = { optimise = { diff --git a/flake.nix b/flake.nix index 2923f2f..3fef63f 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - description = "rndusr's nixos flake"; + description = "stupidcomputer's nixos flake"; inputs = { # regular nixos stuff @@ -14,29 +14,26 @@ nixpkgs, simple-nixos-mailserver, ... - }@inputs: { - nixosConfigurations = { - netbox = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = { inherit inputs; } // { machines = import ./machines.nix; }; - modules = [ - ./boxes/netbox - ]; - }; - copernicus = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = { inherit inputs; } // { machines = import ./machines.nix; }; - modules = [ - ./boxes/copernicus - ]; - }; - aristotle = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = { inherit inputs; } // { machines = import ./machines.nix; }; - modules = [ - ./lappy/configuration.nix - ]; + }@inputs: let + mkSystem = modules: + nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + inherit inputs; + machines = import ./lib/machines.nix; + }; + inherit modules; + }; + generateNixosConfigurations = configurations: + builtins.listToAttrs ( + map (name: { + inherit name; + value = mkSystem [ (./boxes/. + "/${name}") ]; + }) configurations + ); + in { + nixosConfigurations = generateNixosConfigurations [ "netbox" "copernicus" ] // { + aristotle = mkSystem [ ./lappy/configuration.nix ]; }; }; - }; } diff --git a/modules/bootstrap.nix b/lib/bootstrap.nix similarity index 100% rename from modules/bootstrap.nix rename to lib/bootstrap.nix diff --git a/modules/hosts.nix b/lib/hosts.nix similarity index 100% rename from modules/hosts.nix rename to lib/hosts.nix diff --git a/machines.nix b/lib/machines.nix similarity index 100% rename from machines.nix rename to lib/machines.nix