server10: build isos for host

This commit is contained in:
Sandro - 2024-01-06 17:23:46 +01:00
parent ea272005ec
commit e9a4c3de11
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5
3 changed files with 13 additions and 3 deletions

View File

@ -715,6 +715,13 @@
nixosModules = {
c3d2 = {
imports = [
# adds config.system.build.isoImage which can be used to build an iso for any system
# which is very useful to get its networking configuration
({ config, modulesPath, ... }: {
imports = lib.singleton "${modulesPath}/installer/cd-dvd/installation-cd-minimal.nix";
isoImage.edition = lib.mkForce config.networking.hostName;
})
c3d2-user-module.nixosModule
disko.nixosModules.disko
nixos-modules.nixosModule

View File

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ config, lib, options, pkgs, ... }:
{
imports = [
@ -13,7 +13,7 @@
};
boot = {
loader.grub = {
loader.grub = lib.mkIf (!options?isoImage) {
enable = true;
device = "/dev/sda";
};

View File

@ -1,4 +1,4 @@
{ self, config, lib, pkgs, ... }:
{ self, config, lib, options, pkgs, ... }:
{
options = with lib; {
c3d2.deployment.microvmBaseZfsDataset = mkOption {
@ -21,6 +21,9 @@
builtins.filter (name:
(self.nixosConfigurations.${name}.config.c3d2.deployment.server or null) == config.networking.hostName
) (builtins.attrNames self.nixosConfigurations);
# don't enable microvm host options in live iso's
host.enable = if (options?isoImage) then false else true;
};
systemd.services = {