From f202f8c12c41424470cf730c71e7f1f032452e90 Mon Sep 17 00:00:00 2001 From: Jack O'Sullivan Date: Thu, 16 Nov 2023 21:42:30 +0000 Subject: [PATCH] Update nixosConfigurations to reference a preferred default config --- devshell/commands.nix | 2 +- flake.nix | 3 +-- .../colony/vms/shill/containers/chatterbox.nix | 3 ++- .../vms/shill/containers/colony-psql.nix | 3 ++- .../vms/shill/containers/jackflix/default.nix | 3 ++- .../vms/shill/containers/middleman/default.nix | 3 ++- .../colony/vms/shill/containers/object.nix | 3 ++- .../boxes/colony/vms/shill/containers/toot.nix | 3 ++- .../vms/shill/containers/vaultwarden.nix | 3 ++- .../kelder/containers/acquisition/default.nix | 3 ++- .../boxes/kelder/containers/spoder/default.nix | 3 ++- nixos/default.nix | 1 + nixos/installer.nix | 3 ++- nixos/modules/build.nix | 18 +++++++++--------- 14 files changed, 32 insertions(+), 22 deletions(-) diff --git a/devshell/commands.nix b/devshell/commands.nix index 016782d..91559f4 100644 --- a/devshell/commands.nix +++ b/devshell/commands.nix @@ -89,7 +89,7 @@ in name = "build-iso"; category = "tasks"; help = "Build NixOS configuration into an ISO"; - command = ''nix build "''${@:2}" ".#nixosConfigurations.\"$1\".config.my.buildAs.iso"''; + command = ''nix build "''${@:2}" ".#nixfiles.config.nixos.systems.\"$1\".configuration.config.my.buildAs.iso"''; } { name = "build-home"; diff --git a/flake.nix b/flake.nix index 10d68c1..63dcf08 100644 --- a/flake.nix +++ b/flake.nix @@ -153,7 +153,7 @@ nixosModules = nixfiles.config.nixos.modules; homeModules = nixfiles.config.home-manager.modules; - nixosConfigurations = mapAttrs (_: s: s.configuration) nixfiles.config.nixos.systems; + nixosConfigurations = mapAttrs (_: s: s.rendered) nixfiles.config.nixos.systems; homeConfigurations = mapAttrs (_: s: s.configuration) nixfiles.config.home-manager.homes; deploy = nixfiles.config.deploy-rs.rendered; @@ -199,6 +199,5 @@ packages = flattenTree (import ./pkgs { inherit lib pkgs; }); devShells.default = shell; - devShell = shell; })); } diff --git a/nixos/boxes/colony/vms/shill/containers/chatterbox.nix b/nixos/boxes/colony/vms/shill/containers/chatterbox.nix index 240895d..6e97f35 100644 --- a/nixos/boxes/colony/vms/shill/containers/chatterbox.nix +++ b/nixos/boxes/colony/vms/shill/containers/chatterbox.nix @@ -5,9 +5,10 @@ let inherit (lib.my.c.colony) domain prefixes; in { - nixos.systems.chatterbox = { + nixos.systems.chatterbox = { config, ... }: { system = "x86_64-linux"; nixpkgs = "mine"; + rendered = config.configuration.config.my.asContainer; assignments = { internal = { diff --git a/nixos/boxes/colony/vms/shill/containers/colony-psql.nix b/nixos/boxes/colony/vms/shill/containers/colony-psql.nix index 7fd8446..b864061 100644 --- a/nixos/boxes/colony/vms/shill/containers/colony-psql.nix +++ b/nixos/boxes/colony/vms/shill/containers/colony-psql.nix @@ -4,9 +4,10 @@ let inherit (lib.my.c.colony) domain prefixes; in { - nixos.systems.colony-psql = { + nixos.systems.colony-psql = { config, ... }: { system = "x86_64-linux"; nixpkgs = "mine"; + rendered = config.configuration.config.my.asContainer; assignments = { internal = { diff --git a/nixos/boxes/colony/vms/shill/containers/jackflix/default.nix b/nixos/boxes/colony/vms/shill/containers/jackflix/default.nix index 98f816c..90ed3ca 100644 --- a/nixos/boxes/colony/vms/shill/containers/jackflix/default.nix +++ b/nixos/boxes/colony/vms/shill/containers/jackflix/default.nix @@ -4,9 +4,10 @@ let inherit (lib.my.c.colony) domain prefixes; in { - nixos.systems.jackflix = { + nixos.systems.jackflix = { config, ... }: { system = "x86_64-linux"; nixpkgs = "mine"; + rendered = config.configuration.config.my.asContainer; assignments = { internal = { diff --git a/nixos/boxes/colony/vms/shill/containers/middleman/default.nix b/nixos/boxes/colony/vms/shill/containers/middleman/default.nix index f9c7a77..230f6bb 100644 --- a/nixos/boxes/colony/vms/shill/containers/middleman/default.nix +++ b/nixos/boxes/colony/vms/shill/containers/middleman/default.nix @@ -5,9 +5,10 @@ let inherit (lib.my.c.colony) domain prefixes; in { - nixos.systems.middleman = { + nixos.systems.middleman = { config, ... }: { system = "x86_64-linux"; nixpkgs = "mine"; + rendered = config.configuration.config.my.asContainer; assignments = { internal = { diff --git a/nixos/boxes/colony/vms/shill/containers/object.nix b/nixos/boxes/colony/vms/shill/containers/object.nix index 7fc2714..0aa0d75 100644 --- a/nixos/boxes/colony/vms/shill/containers/object.nix +++ b/nixos/boxes/colony/vms/shill/containers/object.nix @@ -4,9 +4,10 @@ let inherit (lib.my.c.colony) domain prefixes; in { - nixos.systems.object = { + nixos.systems.object = { config, ... }: { system = "x86_64-linux"; nixpkgs = "mine"; + rendered = config.configuration.config.my.asContainer; assignments = { internal = { diff --git a/nixos/boxes/colony/vms/shill/containers/toot.nix b/nixos/boxes/colony/vms/shill/containers/toot.nix index f4e5576..9bec2b2 100644 --- a/nixos/boxes/colony/vms/shill/containers/toot.nix +++ b/nixos/boxes/colony/vms/shill/containers/toot.nix @@ -4,9 +4,10 @@ let inherit (lib.my.c.colony) domain prefixes; in { - nixos.systems.toot = { + nixos.systems.toot = { config, ... }: { system = "x86_64-linux"; nixpkgs = "mine"; + rendered = config.configuration.config.my.asContainer; assignments = { internal = { diff --git a/nixos/boxes/colony/vms/shill/containers/vaultwarden.nix b/nixos/boxes/colony/vms/shill/containers/vaultwarden.nix index 27cfea0..0a1cd92 100644 --- a/nixos/boxes/colony/vms/shill/containers/vaultwarden.nix +++ b/nixos/boxes/colony/vms/shill/containers/vaultwarden.nix @@ -4,9 +4,10 @@ let inherit (lib.my.c.colony) domain prefixes; in { - nixos.systems.vaultwarden = { + nixos.systems.vaultwarden = { config, ... }: { system = "x86_64-linux"; nixpkgs = "mine"; + rendered = config.configuration.config.my.asContainer; assignments = { internal = { diff --git a/nixos/boxes/kelder/containers/acquisition/default.nix b/nixos/boxes/kelder/containers/acquisition/default.nix index 383d95c..edb7ea7 100644 --- a/nixos/boxes/kelder/containers/acquisition/default.nix +++ b/nixos/boxes/kelder/containers/acquisition/default.nix @@ -4,9 +4,10 @@ let inherit (lib.my.c.kelder) domain prefixes; in { - nixos.systems.kelder-acquisition = { + nixos.systems.kelder-acquisition = { config, ...}: { system = "x86_64-linux"; nixpkgs = "mine"; + rendered = config.configuration.config.my.asContainer; assignments = { internal = { diff --git a/nixos/boxes/kelder/containers/spoder/default.nix b/nixos/boxes/kelder/containers/spoder/default.nix index f98f8b3..8d03e07 100644 --- a/nixos/boxes/kelder/containers/spoder/default.nix +++ b/nixos/boxes/kelder/containers/spoder/default.nix @@ -5,9 +5,10 @@ let inherit (lib.my.c.kelder) domain prefixes; in { - nixos.systems.kelder-spoder = { + nixos.systems.kelder-spoder = { config, ... }: { system = "x86_64-linux"; nixpkgs = "mine"; + rendered = config.configuration.config.my.asContainer; assignments = { internal = { diff --git a/nixos/default.nix b/nixos/default.nix index 4821b08..d55eaec 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -164,6 +164,7 @@ let }); }; }; + rendered = mkOpt' unspecified config'.configuration "Final NixOS modules system output."; }; config = { diff --git a/nixos/installer.nix b/nixos/installer.nix index c3b590d..c8ab8c3 100644 --- a/nixos/installer.nix +++ b/nixos/installer.nix @@ -1,8 +1,9 @@ { - nixos.systems.installer = { + nixos.systems.installer = { config, ... }: { system = "x86_64-linux"; nixpkgs = "unstable"; docCustom = false; + rendered = config.configuration.config.my.asISO; configuration = { lib, pkgs, modulesPath, config, ... }: diff --git a/nixos/modules/build.nix b/nixos/modules/build.nix index a28b736..cede807 100644 --- a/nixos/modules/build.nix +++ b/nixos/modules/build.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, extendModules, modulesPath, baseModules, options, config, ... }: +{ lib, pkgs, extendModules, modulesPath, options, config, ... }: let inherit (lib) recursiveUpdate mkOption mkDefault mkIf mkMerge flatten optional; inherit (lib.my) mkBoolOpt' dummyOption; @@ -43,15 +43,15 @@ let ]; }; - mkAsOpt = ext: desc: mkOption { - inherit (ext) type; - default = { }; + mkAsOpt = ext: desc: with lib.types; mkOption { + type = unspecified; + default = ext; visible = "shallow"; description = "Configuration as ${desc}."; }; in { - options = with lib.types; { + options = { my = { build = { isDevVM = mkBoolOpt' false "Whether the system is a development VM."; @@ -92,10 +92,10 @@ in my = { buildAs = { # The meta.mainProgram should probably be set upstream but oh well... - devVM = recursiveUpdate config.my.asDevVM.system.build.vm { meta.mainProgram = "run-${config.system.name}-vm"; }; - iso = config.my.asISO.system.build.isoImage; - container = config.my.asContainer.system.build.toplevel; - kexecTree = config.my.asKexecTree.system.build.kexecTree; + devVM = recursiveUpdate config.my.asDevVM.config.system.build.vm { meta.mainProgram = "run-${config.system.name}-vm"; }; + iso = config.my.asISO.config.system.build.isoImage; + container = config.my.asContainer.config.system.build.toplevel; + kexecTree = config.my.asKexecTree.config.system.build.kexecTree; }; }; };