From b5e20d6a0b7d567be26660916c27f6d4c409abbd Mon Sep 17 00:00:00 2001 From: phaer Date: Thu, 5 Sep 2024 14:54:51 +0200 Subject: [PATCH 1/6] linode: use upstream linux-image.nix --- formats/linode.nix | 45 +++------------------------------------------ 1 file changed, 3 insertions(+), 42 deletions(-) diff --git a/formats/linode.nix b/formats/linode.nix index 8e5e92c6..cba601d5 100644 --- a/formats/linode.nix +++ b/formats/linode.nix @@ -6,13 +6,13 @@ ... }: { imports = [ - "${toString modulesPath}/profiles/qemu-guest.nix" + "${toString modulesPath}/virtualisation/linode-image.nix" ]; - formatAttr = "linode"; + formatAttr = "linodeImage"; fileExtension = ".img.gz"; - system.build.linode = import "${toString modulesPath}/../lib/make-disk-image.nix" { + system.build.linodeImage = import "${toString modulesPath}/../lib/make-disk-image.nix" { inherit lib config pkgs; partitionTableType = "none"; format = "raw"; @@ -21,47 +21,14 @@ ''; }; - # Set up filesystems according to Linode preference: - fileSystems."/" = { - device = "/dev/sda"; - fsType = "ext4"; - autoResize = true; - }; - - swapDevices = [{device = "/dev/sdb";}]; - # Enable LISH and Linode booting w/ GRUB boot = { - # Add kernel modules detected by nixos-generate-config: - initrd.availableKernelModules = [ - "virtio_pci" - "virtio_scsi" - "ahci" - "sd_mod" - ]; - growPartition = true; - # Set up LISH serial connection: - kernelParams = ["console=ttyS0,19200n8"]; - loader = { - # Increase timeout to allow LISH connection: - timeout = lib.mkForce 10; - grub = { - enable = true; - forceInstall = true; - device = "nodev"; fsIdentifier = "label"; - # Allow serial connection for GRUB to be able to use LISH: - extraConfig = '' - serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1; - terminal_input serial; - terminal_output serial - ''; - # Link /boot/grub2 to /boot/grub: extraInstallCommands = '' ${pkgs.coreutils}/bin/ln -fs /boot/grub /boot/grub2 @@ -78,17 +45,11 @@ # Install diagnostic tools for Linode support: environment.systemPackages = with pkgs; [ - inetutils - mtr - sysstat linode-cli ]; networking = { enableIPv6 = true; - tempAddresses = "disabled"; - useDHCP = true; - usePredictableInterfaceNames = false; interfaces.eth0 = { tempAddress = "disabled"; useDHCP = true; From 6682cf731c9b3083582a98f31d18932358ed4ee1 Mon Sep 17 00:00:00 2001 From: phaer Date: Thu, 5 Sep 2024 16:00:52 +0200 Subject: [PATCH 2/6] linodeImage: mkForce our system.build.linodeImage at least for now, to keep backwards-compat --- formats/linode.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/formats/linode.nix b/formats/linode.nix index cba601d5..6bdd222f 100644 --- a/formats/linode.nix +++ b/formats/linode.nix @@ -12,14 +12,14 @@ formatAttr = "linodeImage"; fileExtension = ".img.gz"; - system.build.linodeImage = import "${toString modulesPath}/../lib/make-disk-image.nix" { + system.build.linodeImage = lib.mkForce (import "${toString modulesPath}/../lib/make-disk-image.nix" { inherit lib config pkgs; partitionTableType = "none"; format = "raw"; postVM = '' ${pkgs.pigz}/bin/pigz -9 $out/nixos.img ''; - }; + }); # Enable LISH and Linode booting w/ GRUB boot = { From c38cf4bfdab5f38ed942dcb568c1294a065cd89b Mon Sep 17 00:00:00 2001 From: phaer Date: Thu, 5 Sep 2024 14:56:07 +0200 Subject: [PATCH 3/6] openstack: don't use nova-image.nix as it was dropped in 19.03: https://github.com/NixOS/nixpkgs/commit/d190b204f001d1446807f56eed99a73f8b89e244 --- formats/openstack.nix | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/formats/openstack.nix b/formats/openstack.nix index 4eeea9a1..91bd098e 100644 --- a/formats/openstack.nix +++ b/formats/openstack.nix @@ -1,17 +1,8 @@ { modulesPath, - lib, ... }: -if lib.pathExists "${toString modulesPath}/../maintainers/scripts/openstack/nova-image.nix" -then { - imports = [ - "${toString modulesPath}/../maintainers/scripts/openstack/nova-image.nix" - ]; - - formatAttr = "novaImage"; -} -else { +{ imports = [ "${toString modulesPath}/../maintainers/scripts/openstack/openstack-image.nix" ]; From 107bd670326dd6ecba0c9ffe4b6570a9613c3b7f Mon Sep 17 00:00:00 2001 From: phaer Date: Thu, 5 Sep 2024 15:01:55 +0200 Subject: [PATCH 4/6] docker: isContainer is defined in docker-image with same priority --- formats/docker.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/formats/docker.nix b/formats/docker.nix index 14765b76..2c74acb3 100644 --- a/formats/docker.nix +++ b/formats/docker.nix @@ -7,7 +7,6 @@ "${toString modulesPath}/virtualisation/docker-image.nix" ]; - boot.isContainer = true; boot.loader.grub.enable = lib.mkForce false; boot.loader.systemd-boot.enable = lib.mkForce false; services.journald.console = "/dev/console"; From a11970c7828b0df25c30acd879f05170d0a09b96 Mon Sep 17 00:00:00 2001 From: phaer Date: Thu, 5 Sep 2024 15:07:58 +0200 Subject: [PATCH 5/6] install-iso-hyperv: inherit from install-iso.nix --- formats/install-iso-hyperv.nix | 10 ++-------- formats/install-iso.nix | 1 - 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/formats/install-iso-hyperv.nix b/formats/install-iso-hyperv.nix index a49fe163..8ae73ce2 100644 --- a/formats/install-iso-hyperv.nix +++ b/formats/install-iso-hyperv.nix @@ -1,17 +1,11 @@ { - config, lib, - modulesPath, ... }: { imports = [ - "${toString modulesPath}/installer/cd-dvd/installation-cd-base.nix" + ./install-iso.nix ]; - # override installation-cd-base and enable wpa and sshd start at boot - systemd.services.sshd.wantedBy = lib.mkForce ["multi-user.target"]; + systemd.services.wpa_supplicant.wantedBy = lib.mkOverride 40 []; virtualisation.hypervGuest.enable = true; - - formatAttr = "isoImage"; - fileExtension = ".iso"; } diff --git a/formats/install-iso.nix b/formats/install-iso.nix index e7fbd05e..889e6e03 100644 --- a/formats/install-iso.nix +++ b/formats/install-iso.nix @@ -1,5 +1,4 @@ { - config, lib, modulesPath, ... From 85c198f7c06a69db30d4f04aca30630f391f89a6 Mon Sep 17 00:00:00 2001 From: phaer Date: Thu, 5 Sep 2024 15:10:43 +0200 Subject: [PATCH 6/6] iso: squashfsCompression defaults to zstd upstream zstd -Xcompression-level 19 --- formats/install-iso.nix | 3 --- formats/iso.nix | 4 ---- 2 files changed, 7 deletions(-) diff --git a/formats/install-iso.nix b/formats/install-iso.nix index 889e6e03..e55cdeb7 100644 --- a/formats/install-iso.nix +++ b/formats/install-iso.nix @@ -11,9 +11,6 @@ systemd.services.wpa_supplicant.wantedBy = lib.mkForce ["multi-user.target"]; systemd.services.sshd.wantedBy = lib.mkForce ["multi-user.target"]; - # Much faster than xz - isoImage.squashfsCompression = lib.mkDefault "zstd"; - formatAttr = "isoImage"; fileExtension = ".iso"; } diff --git a/formats/iso.nix b/formats/iso.nix index 1b1a232c..1bcb2c68 100644 --- a/formats/iso.nix +++ b/formats/iso.nix @@ -1,5 +1,4 @@ { - lib, modulesPath, ... }: { @@ -13,9 +12,6 @@ # USB booting isoImage.makeUsbBootable = true; - # Much faster than xz - isoImage.squashfsCompression = lib.mkDefault "zstd"; - formatAttr = "isoImage"; fileExtension = ".iso"; }