kexec-installer: add virtual and noninteractive variants for smaller images

Co-Authored-By: Jean-François Roche <jfroche@pyxel.be>
This commit is contained in:
tilpner 2023-04-13 22:08:30 +02:00
parent cba1cd58d3
commit c48cb331ea
No known key found for this signature in database
3 changed files with 50 additions and 4 deletions

View file

@ -17,14 +17,24 @@
in { in {
packages = forAllSystems (system: let packages = forAllSystems (system: let
netboot = nixpkgs: (import (nixpkgs + "/nixos/release.nix") {}).netboot.${system}; netboot = nixpkgs: (import (nixpkgs + "/nixos/release.nix") {}).netboot.${system};
kexec-installer = nixpkgs: (nixpkgs.legacyPackages.${system}.nixos [self.nixosModules.kexec-installer]).config.system.build.kexecTarball; kexec-installer = nixpkgs: modules: (nixpkgs.legacyPackages.${system}.nixos (modules ++ [self.nixosModules.kexec-installer])).config.system.build.kexecTarball;
in { in {
netboot-nixos-unstable = netboot nixos-unstable; netboot-nixos-unstable = netboot nixos-unstable;
netboot-nixos-2211 = netboot nixos-2211; netboot-nixos-2211 = netboot nixos-2211;
kexec-installer-nixos-unstable = kexec-installer nixos-unstable; kexec-installer-nixos-unstable = kexec-installer nixos-unstable [];
kexec-installer-nixos-2211 = kexec-installer nixos-2211; kexec-installer-nixos-2211 = kexec-installer nixos-2211 [];
kexec-installer-nixos-unstable-noninteractive = kexec-installer nixos-unstable [ self.nixosModules.noninteractive ];
kexec-installer-nixos-2211-noninteractive = kexec-installer nixos-2211 [ self.nixosModules.noninteractive ];
kexec-installer-nixos-unstable-virtual-noninteractive = kexec-installer nixos-unstable [ self.nixosModules.noninteractive self.nixosModules.virtual ];
kexec-installer-nixos-2211-virtual-noninteractive = kexec-installer nixos-2211 [ self.nixosModules.noninteractive self.nixosModules.virtual ];
}); });
nixosModules.kexec-installer = import ./nix/kexec-installer/module.nix; nixosModules = {
kexec-installer = ./nix/kexec-installer/module.nix;
noninteractive = ./nix/noninteractive.nix;
virtual = ./nix/virtual.nix;
};
checks.x86_64-linux = let checks.x86_64-linux = let
pkgs = nixos-unstable.legacyPackages.x86_64-linux; pkgs = nixos-unstable.legacyPackages.x86_64-linux;
in { in {

31
nix/noninteractive.nix Normal file
View file

@ -0,0 +1,31 @@
# This module optimizes for non-interactive deployments by remove some store paths
# which are primarily useful for interactive installations.
{ config, lib, ... }: {
disabledModules = [
# This module adds values to multiple lists (systemPackages, supportedFilesystems)
# which are impossible/unpractical to remove, so we disable the entire module.
"profiles/base.nix"
];
# among others, this prevents carrying a stdenv with gcc in the image
system.extraDependencies = lib.mkForce [];
# prevents texinfoInteractive
documentation.enable = lib.mkForce false;
# prevents shipping nixpkgs, unnecessary if system is evaluated externally
nix.registry = lib.mkForce {};
# would pull in nano
programs.nano.syntaxHighlight = lib.mkForce false;
# prevents nano, rsync, strace
environment.defaultPackages = lib.mkForce [];
# zfs support is accidentally disabled by excluding base.nix, re-enable it
boot = {
kernelModules = [ "zfs" ];
extraModulePackages = [ config.boot.kernelPackages.zfs ];
};
}

5
nix/virtual.nix Normal file
View file

@ -0,0 +1,5 @@
# This module optimizes for deployments to virtualized hosts.
{ lib, ... }: {
hardware.enableRedistributableFirmware = lib.mkForce false;
}