From 18b7cddaaa0283a3ccaafa5b2805635c39fead4b Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Mon, 18 Nov 2024 21:14:18 -0600 Subject: [PATCH 01/11] Fix Rawhide builds Ignore writing to the device if it is a zram Fixes #28 --- scripts/minimize.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/minimize.sh b/scripts/minimize.sh index 013f4e4..61a618d 100644 --- a/scripts/minimize.sh +++ b/scripts/minimize.sh @@ -21,10 +21,10 @@ elif [ -n "$swap_device_label" ]; then swap_device=$(readlink -f /dev/disk/by-label/"$swap_device_label") fi -if [ -n "${swap_device}" ] && [ -e "${swap_device}" ]; then +if [ -n "${swap_device}" ] && [ -e "${swap_device}" ] && [ "${swap_device}" != "/dev/zram"* ]; then sudo /sbin/swapoff "$swap_device" sudo dd if=/dev/zero of="$swap_device" bs=1M || : sudo /sbin/mkswap ${swap_device_label:+-L "$swap_device_label"} ${swap_device_uuid:+-U "$swap_device_uuid"} "$swap_device" fi -sleep 15 # Hyper-v seems to be super fast during boot \ No newline at end of file +sleep 15 # Hyper-v seems to be super fast during boot From e7d1b0f7bd5d0f5ac4ed5a85b0cea9cf2ca7a36c Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Mon, 18 Nov 2024 21:22:32 -0600 Subject: [PATCH 02/11] Apply nixfmt to the whole tree --- distros/almalinux/default.nix | 21 +- distros/alpine/default.nix | 21 +- distros/archlinux/default.nix | 12 +- distros/centos-stream/default.nix | 21 +- distros/centos/default.nix | 12 +- distros/debian/default.nix | 45 +- distros/default.nix | 22 +- distros/fedora/default.nix | 57 +-- distros/nixos/23.05/http/configuration.nix | 128 +++--- distros/nixos/23.05/http/flake.nix | 23 +- distros/nixos/23.05/http/ga-kvm.nix | 5 +- distros/nixos/23.05/http/ga-microsoft.nix | 6 +- distros/nixos/23.05/http/ga-oracle.nix | 12 +- distros/nixos/23.05/http/ga-qemu.nix | 6 +- distros/nixos/23.11/http/configuration.nix | 128 +++--- distros/nixos/23.11/http/flake.nix | 23 +- distros/nixos/23.11/http/ga-kvm.nix | 5 +- distros/nixos/23.11/http/ga-microsoft.nix | 6 +- distros/nixos/23.11/http/ga-oracle.nix | 12 +- distros/nixos/23.11/http/ga-qemu.nix | 6 +- distros/nixos/24.05/http/configuration.nix | 128 +++--- distros/nixos/24.05/http/flake.nix | 23 +- distros/nixos/24.05/http/ga-kvm.nix | 5 +- distros/nixos/24.05/http/ga-microsoft.nix | 6 +- distros/nixos/24.05/http/ga-oracle.nix | 8 +- distros/nixos/24.05/http/ga-qemu.nix | 6 +- distros/nixos/default.nix | 30 +- distros/opensuse/default.nix | 39 +- distros/rockylinux/default.nix | 21 +- distros/ubuntu/default.nix | 57 +-- flake.lock | 53 +-- flake.nix | 474 ++++++++++++--------- nix/cache.nix | 77 ++-- nix/validate.nix | 38 +- 34 files changed, 822 insertions(+), 714 deletions(-) mode change 120000 => 100644 distros/nixos/23.05/http/ga-kvm.nix mode change 120000 => 100644 distros/nixos/23.11/http/ga-kvm.nix mode change 120000 => 100644 distros/nixos/24.05/http/ga-kvm.nix diff --git a/distros/almalinux/default.nix b/distros/almalinux/default.nix index a0837c6..d17f358 100644 --- a/distros/almalinux/default.nix +++ b/distros/almalinux/default.nix @@ -1,9 +1,12 @@ -[ { - version = "8"; - arch = "amd64"; - eol = true; -} { - version = "9"; - arch = "amd64"; - eol = false; -} ] +[ + { + version = "8"; + arch = "amd64"; + eol = true; + } + { + version = "9"; + arch = "amd64"; + eol = false; + } +] diff --git a/distros/alpine/default.nix b/distros/alpine/default.nix index 1f4e7ce..97f022f 100644 --- a/distros/alpine/default.nix +++ b/distros/alpine/default.nix @@ -1,9 +1,12 @@ -[ { - version = "3.19.0"; - arch = "amd64"; - eol = false; -} { - version = "3.20"; - arch = "amd64"; - eol = false; -} ] +[ + { + version = "3.19.0"; + arch = "amd64"; + eol = false; + } + { + version = "3.20"; + arch = "amd64"; + eol = false; + } +] diff --git a/distros/archlinux/default.nix b/distros/archlinux/default.nix index 4fecf6e..cdad4cb 100644 --- a/distros/archlinux/default.nix +++ b/distros/archlinux/default.nix @@ -1,5 +1,7 @@ -[ { - version = "rolling"; - arch = "amd64"; - eol = false; -} ] +[ + { + version = "rolling"; + arch = "amd64"; + eol = false; + } +] diff --git a/distros/centos-stream/default.nix b/distros/centos-stream/default.nix index a0837c6..d17f358 100644 --- a/distros/centos-stream/default.nix +++ b/distros/centos-stream/default.nix @@ -1,9 +1,12 @@ -[ { - version = "8"; - arch = "amd64"; - eol = true; -} { - version = "9"; - arch = "amd64"; - eol = false; -} ] +[ + { + version = "8"; + arch = "amd64"; + eol = true; + } + { + version = "9"; + arch = "amd64"; + eol = false; + } +] diff --git a/distros/centos/default.nix b/distros/centos/default.nix index e8a0316..95ea1af 100644 --- a/distros/centos/default.nix +++ b/distros/centos/default.nix @@ -1,5 +1,7 @@ -[ { - version = "7"; - arch = "amd64"; - eol = true; -} ] +[ + { + version = "7"; + arch = "amd64"; + eol = true; + } +] diff --git a/distros/debian/default.nix b/distros/debian/default.nix index da2d6c8..faa6d88 100644 --- a/distros/debian/default.nix +++ b/distros/debian/default.nix @@ -1,20 +1,25 @@ -[ { - version = "9"; - arch = "amd64"; - eol = true; -} { - version = "10"; - arch = "amd64"; - eol = true; -} { - version = "11"; - arch = "amd64"; - eol = false; -} { - version = "12"; - arch = "amd64"; - eol = false; - exclude = [ - "virtualbox-iso" - ]; -} ] +[ + { + version = "9"; + arch = "amd64"; + eol = true; + } + { + version = "10"; + arch = "amd64"; + eol = true; + } + { + version = "11"; + arch = "amd64"; + eol = false; + } + { + version = "12"; + arch = "amd64"; + eol = false; + exclude = [ + "virtualbox-iso" + ]; + } +] diff --git a/distros/default.nix b/distros/default.nix index 0fd1bf5..0b6dbcf 100644 --- a/distros/default.nix +++ b/distros/default.nix @@ -1,13 +1,13 @@ { - almalinux = import ./almalinux; - alpine = import ./alpine; - archlinux = import ./archlinux; - centos = import ./centos; - centos-stream = import ./centos-stream; - debian = import ./debian; - fedora = import ./fedora; - nixos = import ./nixos; - opensuse = import ./opensuse; - rockylinux = import ./rockylinux; - ubuntu = import ./ubuntu; + almalinux = import ./almalinux; + alpine = import ./alpine; + archlinux = import ./archlinux; + centos = import ./centos; + centos-stream = import ./centos-stream; + debian = import ./debian; + fedora = import ./fedora; + nixos = import ./nixos; + opensuse = import ./opensuse; + rockylinux = import ./rockylinux; + ubuntu = import ./ubuntu; } diff --git a/distros/fedora/default.nix b/distros/fedora/default.nix index 1df116d..59e858b 100644 --- a/distros/fedora/default.nix +++ b/distros/fedora/default.nix @@ -1,25 +1,32 @@ -[ { - version = "37"; - arch = "amd64"; - eol = true; -} { - version = "38"; - arch = "amd64"; - eol = true; -} { - version = "39"; - arch = "amd64"; - eol = false; -} { - version = "40"; - arch = "amd64"; - eol = false; -} { - version = "41"; - arch = "amd64"; - eol = false; -} { - version = "rawhide"; - arch = "amd64"; - eol = false; -} ] +[ + { + version = "37"; + arch = "amd64"; + eol = true; + } + { + version = "38"; + arch = "amd64"; + eol = true; + } + { + version = "39"; + arch = "amd64"; + eol = false; + } + { + version = "40"; + arch = "amd64"; + eol = false; + } + { + version = "41"; + arch = "amd64"; + eol = false; + } + { + version = "rawhide"; + arch = "amd64"; + eol = false; + } +] diff --git a/distros/nixos/23.05/http/configuration.nix b/distros/nixos/23.05/http/configuration.nix index 6d769e0..3d96aa3 100644 --- a/distros/nixos/23.05/http/configuration.nix +++ b/distros/nixos/23.05/http/configuration.nix @@ -1,67 +1,75 @@ -{config, pkgs, lib, ...}: +{ + config, + pkgs, + lib, + ... +}: { - imports = [ - ./hardware-configuration.nix - ./guest-agent.nix - ]; + imports = [ + ./hardware-configuration.nix + ./guest-agent.nix + ]; - system.stateVersion = "23.05"; + system.stateVersion = "23.05"; - # Packages installed on the whole system - environment.systemPackages = with pkgs; [ - curl - nano - python3 - ]; - # Services that are running - services = { - openssh.enable = true; - #xserver.enable = true; - }; - # User setup - users.groups.vagrant = {}; - users.users.vagrant = { - isNormalUser = true; - group = "vagrant"; - extraGroups = [ "wheel" ]; - password = "vagrant"; - }; - security.sudo.extraRules = [ - { - users = [ "vagrant" ]; - groups = [ "vagrant" ]; - commands = [ - { command = "ALL"; options = [ "NOPASSWD" ]; } - ]; - } - ]; + # Packages installed on the whole system + environment.systemPackages = with pkgs; [ + curl + nano + python3 + ]; + # Services that are running + services = { + openssh.enable = true; + #xserver.enable = true; + }; + # User setup + users.groups.vagrant = { }; + users.users.vagrant = { + isNormalUser = true; + group = "vagrant"; + extraGroups = [ "wheel" ]; + password = "vagrant"; + }; + security.sudo.extraRules = [ + { + users = [ "vagrant" ]; + groups = [ "vagrant" ]; + commands = [ + { + command = "ALL"; + options = [ "NOPASSWD" ]; + } + ]; + } + ]; - boot.loader = { - systemd-boot = { - enable = true; - }; - efi.canTouchEfiVariables = true; - }; - networking = { - hostName = "vagrant"; - networkmanager.enable = true; - #proxy.default = "http://user:password@proxy:port/"; - #proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - }; - time.timeZone = "UTC"; - - i18n.defaultLocale = "en_US.UTF-8"; - console = { - font = "Lat2-Terminux16"; - keyMap = lib.mkForce "us"; - useXkbConfig = true; - }; + boot.loader = { + systemd-boot = { + enable = true; + }; + efi.canTouchEfiVariables = true; + }; + networking = { + hostName = "vagrant"; + networkmanager.enable = true; + #proxy.default = "http://user:password@proxy:port/"; + #proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + }; + time.timeZone = "UTC"; - nix = { - package = pkgs.nixFlakes; - settings = { - experimental-features = "nix-command flakes"; - }; - }; + i18n.defaultLocale = "en_US.UTF-8"; + console = { + font = "Lat2-Terminux16"; + keyMap = lib.mkForce "us"; + useXkbConfig = true; + }; + + nix = { + package = pkgs.nixFlakes; + settings = { + experimental-features = "nix-command flakes"; + }; + }; } diff --git a/distros/nixos/23.05/http/flake.nix b/distros/nixos/23.05/http/flake.nix index f69c643..d3590cf 100644 --- a/distros/nixos/23.05/http/flake.nix +++ b/distros/nixos/23.05/http/flake.nix @@ -1,15 +1,16 @@ { - description = "A basic NixOS Vagrant install"; + description = "A basic NixOS Vagrant install"; - inputs = { - nixstable.url = "github:nixos/nixpkgs/nixos-23.05"; - }; + inputs = { + nixstable.url = "github:nixos/nixpkgs/nixos-23.05"; + }; - outputs = { nixstable, self, ... }@inputs: - { - nixosConfigurations.vagrant = nixstable.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ ./configuration.nix ]; - }; - }; + outputs = + { nixstable, self, ... }@inputs: + { + nixosConfigurations.vagrant = nixstable.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ ./configuration.nix ]; + }; + }; } diff --git a/distros/nixos/23.05/http/ga-kvm.nix b/distros/nixos/23.05/http/ga-kvm.nix deleted file mode 120000 index 15276b3..0000000 --- a/distros/nixos/23.05/http/ga-kvm.nix +++ /dev/null @@ -1 +0,0 @@ -ga-qemu.nix \ No newline at end of file diff --git a/distros/nixos/23.05/http/ga-kvm.nix b/distros/nixos/23.05/http/ga-kvm.nix new file mode 100644 index 0000000..65105c0 --- /dev/null +++ b/distros/nixos/23.05/http/ga-kvm.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + services.qemuGuest.enable = true; +} diff --git a/distros/nixos/23.05/http/ga-microsoft.nix b/distros/nixos/23.05/http/ga-microsoft.nix index a477797..f924009 100644 --- a/distros/nixos/23.05/http/ga-microsoft.nix +++ b/distros/nixos/23.05/http/ga-microsoft.nix @@ -1,4 +1,4 @@ -{...}: +{ ... }: { - virtualisation.hypervGuest.enable = true; -} \ No newline at end of file + virtualisation.hypervGuest.enable = true; +} diff --git a/distros/nixos/23.05/http/ga-oracle.nix b/distros/nixos/23.05/http/ga-oracle.nix index 06bc077..c81513e 100644 --- a/distros/nixos/23.05/http/ga-oracle.nix +++ b/distros/nixos/23.05/http/ga-oracle.nix @@ -1,7 +1,7 @@ -{...}: +{ ... }: { - virtualisation.virtualbox.guest = { - enable = true; - x11 = false; - }; -} \ No newline at end of file + virtualisation.virtualbox.guest = { + enable = true; + x11 = false; + }; +} diff --git a/distros/nixos/23.05/http/ga-qemu.nix b/distros/nixos/23.05/http/ga-qemu.nix index 7389b6d..65105c0 100644 --- a/distros/nixos/23.05/http/ga-qemu.nix +++ b/distros/nixos/23.05/http/ga-qemu.nix @@ -1,4 +1,4 @@ -{...}: +{ ... }: { - services.qemuGuest.enable = true; -} \ No newline at end of file + services.qemuGuest.enable = true; +} diff --git a/distros/nixos/23.11/http/configuration.nix b/distros/nixos/23.11/http/configuration.nix index 69667f4..5efd647 100644 --- a/distros/nixos/23.11/http/configuration.nix +++ b/distros/nixos/23.11/http/configuration.nix @@ -1,67 +1,75 @@ -{config, pkgs, lib, ...}: +{ + config, + pkgs, + lib, + ... +}: { - imports = [ - ./hardware-configuration.nix - ./guest-agent.nix - ]; + imports = [ + ./hardware-configuration.nix + ./guest-agent.nix + ]; - system.stateVersion = "23.11"; + system.stateVersion = "23.11"; - # Packages installed on the whole system - environment.systemPackages = with pkgs; [ - curl - nano - python3 - ]; - # Services that are running - services = { - openssh.enable = true; - #xserver.enable = true; - }; - # User setup - users.groups.vagrant = {}; - users.users.vagrant = { - isNormalUser = true; - group = "vagrant"; - extraGroups = [ "wheel" ]; - password = "vagrant"; - }; - security.sudo.extraRules = [ - { - users = [ "vagrant" ]; - groups = [ "vagrant" ]; - commands = [ - { command = "ALL"; options = [ "NOPASSWD" ]; } - ]; - } - ]; + # Packages installed on the whole system + environment.systemPackages = with pkgs; [ + curl + nano + python3 + ]; + # Services that are running + services = { + openssh.enable = true; + #xserver.enable = true; + }; + # User setup + users.groups.vagrant = { }; + users.users.vagrant = { + isNormalUser = true; + group = "vagrant"; + extraGroups = [ "wheel" ]; + password = "vagrant"; + }; + security.sudo.extraRules = [ + { + users = [ "vagrant" ]; + groups = [ "vagrant" ]; + commands = [ + { + command = "ALL"; + options = [ "NOPASSWD" ]; + } + ]; + } + ]; - boot.loader = { - systemd-boot = { - enable = true; - }; - efi.canTouchEfiVariables = true; - }; - networking = { - hostName = "vagrant"; - networkmanager.enable = true; - #proxy.default = "http://user:password@proxy:port/"; - #proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - }; - time.timeZone = "UTC"; - - i18n.defaultLocale = "en_US.UTF-8"; - console = { - font = "Lat2-Terminux16"; - keyMap = lib.mkForce "us"; - useXkbConfig = true; - }; + boot.loader = { + systemd-boot = { + enable = true; + }; + efi.canTouchEfiVariables = true; + }; + networking = { + hostName = "vagrant"; + networkmanager.enable = true; + #proxy.default = "http://user:password@proxy:port/"; + #proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + }; + time.timeZone = "UTC"; - nix = { - package = pkgs.nixFlakes; - settings = { - experimental-features = "nix-command flakes"; - }; - }; + i18n.defaultLocale = "en_US.UTF-8"; + console = { + font = "Lat2-Terminux16"; + keyMap = lib.mkForce "us"; + useXkbConfig = true; + }; + + nix = { + package = pkgs.nixFlakes; + settings = { + experimental-features = "nix-command flakes"; + }; + }; } diff --git a/distros/nixos/23.11/http/flake.nix b/distros/nixos/23.11/http/flake.nix index 7994fc3..cbda5c6 100644 --- a/distros/nixos/23.11/http/flake.nix +++ b/distros/nixos/23.11/http/flake.nix @@ -1,15 +1,16 @@ { - description = "A basic NixOS Vagrant install"; + description = "A basic NixOS Vagrant install"; - inputs = { - nixstable.url = "github:nixos/nixpkgs/nixos-23.11"; - }; + inputs = { + nixstable.url = "github:nixos/nixpkgs/nixos-23.11"; + }; - outputs = { nixstable, self, ... }@inputs: - { - nixosConfigurations.vagrant = nixstable.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ ./configuration.nix ]; - }; - }; + outputs = + { nixstable, self, ... }@inputs: + { + nixosConfigurations.vagrant = nixstable.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ ./configuration.nix ]; + }; + }; } diff --git a/distros/nixos/23.11/http/ga-kvm.nix b/distros/nixos/23.11/http/ga-kvm.nix deleted file mode 120000 index 15276b3..0000000 --- a/distros/nixos/23.11/http/ga-kvm.nix +++ /dev/null @@ -1 +0,0 @@ -ga-qemu.nix \ No newline at end of file diff --git a/distros/nixos/23.11/http/ga-kvm.nix b/distros/nixos/23.11/http/ga-kvm.nix new file mode 100644 index 0000000..65105c0 --- /dev/null +++ b/distros/nixos/23.11/http/ga-kvm.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + services.qemuGuest.enable = true; +} diff --git a/distros/nixos/23.11/http/ga-microsoft.nix b/distros/nixos/23.11/http/ga-microsoft.nix index a477797..f924009 100644 --- a/distros/nixos/23.11/http/ga-microsoft.nix +++ b/distros/nixos/23.11/http/ga-microsoft.nix @@ -1,4 +1,4 @@ -{...}: +{ ... }: { - virtualisation.hypervGuest.enable = true; -} \ No newline at end of file + virtualisation.hypervGuest.enable = true; +} diff --git a/distros/nixos/23.11/http/ga-oracle.nix b/distros/nixos/23.11/http/ga-oracle.nix index 06bc077..c81513e 100644 --- a/distros/nixos/23.11/http/ga-oracle.nix +++ b/distros/nixos/23.11/http/ga-oracle.nix @@ -1,7 +1,7 @@ -{...}: +{ ... }: { - virtualisation.virtualbox.guest = { - enable = true; - x11 = false; - }; -} \ No newline at end of file + virtualisation.virtualbox.guest = { + enable = true; + x11 = false; + }; +} diff --git a/distros/nixos/23.11/http/ga-qemu.nix b/distros/nixos/23.11/http/ga-qemu.nix index 7389b6d..65105c0 100644 --- a/distros/nixos/23.11/http/ga-qemu.nix +++ b/distros/nixos/23.11/http/ga-qemu.nix @@ -1,4 +1,4 @@ -{...}: +{ ... }: { - services.qemuGuest.enable = true; -} \ No newline at end of file + services.qemuGuest.enable = true; +} diff --git a/distros/nixos/24.05/http/configuration.nix b/distros/nixos/24.05/http/configuration.nix index 2cc98aa..d8cb29f 100644 --- a/distros/nixos/24.05/http/configuration.nix +++ b/distros/nixos/24.05/http/configuration.nix @@ -1,67 +1,75 @@ -{config, pkgs, lib, ...}: +{ + config, + pkgs, + lib, + ... +}: { - imports = [ - ./hardware-configuration.nix - ./guest-agent.nix - ]; + imports = [ + ./hardware-configuration.nix + ./guest-agent.nix + ]; - system.stateVersion = "24.05"; + system.stateVersion = "24.05"; - # Packages installed on the whole system - environment.systemPackages = with pkgs; [ - curl - nano - python3 - ]; - # Services that are running - services = { - openssh.enable = true; - #xserver.enable = true; - }; - # User setup - users.groups.vagrant = {}; - users.users.vagrant = { - isNormalUser = true; - group = "vagrant"; - extraGroups = [ "wheel" ]; - password = "vagrant"; - }; - security.sudo.extraRules = [ - { - users = [ "vagrant" ]; - groups = [ "vagrant" ]; - commands = [ - { command = "ALL"; options = [ "NOPASSWD" ]; } - ]; - } - ]; + # Packages installed on the whole system + environment.systemPackages = with pkgs; [ + curl + nano + python3 + ]; + # Services that are running + services = { + openssh.enable = true; + #xserver.enable = true; + }; + # User setup + users.groups.vagrant = { }; + users.users.vagrant = { + isNormalUser = true; + group = "vagrant"; + extraGroups = [ "wheel" ]; + password = "vagrant"; + }; + security.sudo.extraRules = [ + { + users = [ "vagrant" ]; + groups = [ "vagrant" ]; + commands = [ + { + command = "ALL"; + options = [ "NOPASSWD" ]; + } + ]; + } + ]; - boot.loader = { - systemd-boot = { - enable = true; - }; - efi.canTouchEfiVariables = true; - }; - networking = { - hostName = "vagrant"; - networkmanager.enable = true; - #proxy.default = "http://user:password@proxy:port/"; - #proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - }; - time.timeZone = "UTC"; - - i18n.defaultLocale = "en_US.UTF-8"; - console = { - font = "Lat2-Terminux16"; - keyMap = lib.mkForce "us"; - useXkbConfig = true; - }; + boot.loader = { + systemd-boot = { + enable = true; + }; + efi.canTouchEfiVariables = true; + }; + networking = { + hostName = "vagrant"; + networkmanager.enable = true; + #proxy.default = "http://user:password@proxy:port/"; + #proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + }; + time.timeZone = "UTC"; - nix = { - package = pkgs.nixFlakes; - settings = { - experimental-features = "nix-command flakes"; - }; - }; + i18n.defaultLocale = "en_US.UTF-8"; + console = { + font = "Lat2-Terminux16"; + keyMap = lib.mkForce "us"; + useXkbConfig = true; + }; + + nix = { + package = pkgs.nixFlakes; + settings = { + experimental-features = "nix-command flakes"; + }; + }; } diff --git a/distros/nixos/24.05/http/flake.nix b/distros/nixos/24.05/http/flake.nix index f8b0e18..1dabf97 100644 --- a/distros/nixos/24.05/http/flake.nix +++ b/distros/nixos/24.05/http/flake.nix @@ -1,15 +1,16 @@ { - description = "A basic NixOS Vagrant install"; + description = "A basic NixOS Vagrant install"; - inputs = { - nixstable.url = "github:nixos/nixpkgs/nixos-24.05"; - }; + inputs = { + nixstable.url = "github:nixos/nixpkgs/nixos-24.05"; + }; - outputs = { nixstable, self, ... }@inputs: - { - nixosConfigurations.vagrant = nixstable.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ ./configuration.nix ]; - }; - }; + outputs = + { nixstable, self, ... }@inputs: + { + nixosConfigurations.vagrant = nixstable.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ ./configuration.nix ]; + }; + }; } diff --git a/distros/nixos/24.05/http/ga-kvm.nix b/distros/nixos/24.05/http/ga-kvm.nix deleted file mode 120000 index 15276b3..0000000 --- a/distros/nixos/24.05/http/ga-kvm.nix +++ /dev/null @@ -1 +0,0 @@ -ga-qemu.nix \ No newline at end of file diff --git a/distros/nixos/24.05/http/ga-kvm.nix b/distros/nixos/24.05/http/ga-kvm.nix new file mode 100644 index 0000000..65105c0 --- /dev/null +++ b/distros/nixos/24.05/http/ga-kvm.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + services.qemuGuest.enable = true; +} diff --git a/distros/nixos/24.05/http/ga-microsoft.nix b/distros/nixos/24.05/http/ga-microsoft.nix index a477797..f924009 100644 --- a/distros/nixos/24.05/http/ga-microsoft.nix +++ b/distros/nixos/24.05/http/ga-microsoft.nix @@ -1,4 +1,4 @@ -{...}: +{ ... }: { - virtualisation.hypervGuest.enable = true; -} \ No newline at end of file + virtualisation.hypervGuest.enable = true; +} diff --git a/distros/nixos/24.05/http/ga-oracle.nix b/distros/nixos/24.05/http/ga-oracle.nix index 6f304b0..e274dac 100644 --- a/distros/nixos/24.05/http/ga-oracle.nix +++ b/distros/nixos/24.05/http/ga-oracle.nix @@ -1,6 +1,6 @@ -{...}: +{ ... }: { - virtualisation.virtualbox.guest = { - enable = true; - }; + virtualisation.virtualbox.guest = { + enable = true; + }; } diff --git a/distros/nixos/24.05/http/ga-qemu.nix b/distros/nixos/24.05/http/ga-qemu.nix index 7389b6d..65105c0 100644 --- a/distros/nixos/24.05/http/ga-qemu.nix +++ b/distros/nixos/24.05/http/ga-qemu.nix @@ -1,4 +1,4 @@ -{...}: +{ ... }: { - services.qemuGuest.enable = true; -} \ No newline at end of file + services.qemuGuest.enable = true; +} diff --git a/distros/nixos/default.nix b/distros/nixos/default.nix index 35e8b4a..a308c55 100644 --- a/distros/nixos/default.nix +++ b/distros/nixos/default.nix @@ -1,13 +1,17 @@ -[ { - version = "23.05"; - arch = "amd64"; - eol = true; -} { - version = "23.11"; - arch = "amd64"; - eol = true; -} { - version = "24.05"; - arch = "amd64"; - eol = false; -} ] +[ + { + version = "23.05"; + arch = "amd64"; + eol = true; + } + { + version = "23.11"; + arch = "amd64"; + eol = true; + } + { + version = "24.05"; + arch = "amd64"; + eol = false; + } +] diff --git a/distros/opensuse/default.nix b/distros/opensuse/default.nix index d44b945..a67d93e 100644 --- a/distros/opensuse/default.nix +++ b/distros/opensuse/default.nix @@ -1,17 +1,22 @@ -[ { - version = "15.5"; - arch = "amd64"; - eol = false; -} { - version = "15.6"; - arch = "amd64"; - eol = false; -} { - version = "16.0"; - arch = "amd64"; - eol = true; # Not yet released, and bugged at the moment -} { - version = "tumbleweed"; - arch = "amd64"; - eol = false; -} ] +[ + { + version = "15.5"; + arch = "amd64"; + eol = false; + } + { + version = "15.6"; + arch = "amd64"; + eol = false; + } + { + version = "16.0"; + arch = "amd64"; + eol = true; # Not yet released, and bugged at the moment + } + { + version = "tumbleweed"; + arch = "amd64"; + eol = false; + } +] diff --git a/distros/rockylinux/default.nix b/distros/rockylinux/default.nix index a0837c6..d17f358 100644 --- a/distros/rockylinux/default.nix +++ b/distros/rockylinux/default.nix @@ -1,9 +1,12 @@ -[ { - version = "8"; - arch = "amd64"; - eol = true; -} { - version = "9"; - arch = "amd64"; - eol = false; -} ] +[ + { + version = "8"; + arch = "amd64"; + eol = true; + } + { + version = "9"; + arch = "amd64"; + eol = false; + } +] diff --git a/distros/ubuntu/default.nix b/distros/ubuntu/default.nix index e86e7ca..deb0257 100644 --- a/distros/ubuntu/default.nix +++ b/distros/ubuntu/default.nix @@ -1,25 +1,32 @@ -[ { - version = "18.04"; - arch = "amd64"; - eol = true; -} { - version = "20.04"; - arch = "amd64"; - eol = false; -} { - version = "22.04"; - arch = "amd64"; - eol = false; -} { - version = "23.10"; - arch = "amd64"; - eol = true; -} { - version = "24.04"; - arch = "amd64"; - eol = false; -} { - version = "24.10"; - arch = "amd64"; - eol = false; -} ] +[ + { + version = "18.04"; + arch = "amd64"; + eol = true; + } + { + version = "20.04"; + arch = "amd64"; + eol = false; + } + { + version = "22.04"; + arch = "amd64"; + eol = false; + } + { + version = "23.10"; + arch = "amd64"; + eol = true; + } + { + version = "24.04"; + arch = "amd64"; + eol = false; + } + { + version = "24.10"; + arch = "amd64"; + eol = false; + } +] diff --git a/flake.lock b/flake.lock index 4e87450..b3ca643 100644 --- a/flake.lock +++ b/flake.lock @@ -37,21 +37,6 @@ "type": "github" } }, - "flake-root": { - "locked": { - "lastModified": 1713493429, - "narHash": "sha256-ztz8JQkI08tjKnsTpfLqzWoKFQF4JGu2LRz8bkdnYUk=", - "owner": "srid", - "repo": "flake-root", - "rev": "bc748b93b86ee76e2032eecda33440ceb2532fcd", - "type": "github" - }, - "original": { - "owner": "srid", - "repo": "flake-root", - "type": "github" - } - }, "flake-utils": { "inputs": { "systems": "systems" @@ -114,22 +99,6 @@ "type": "github" } }, - "nixpkgs_3": { - "locked": { - "lastModified": 1708475490, - "narHash": "sha256-g1v0TsWBQPX97ziznfJdWhgMyMGtoBFs102xSYO4syU=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "0e74ca98a74bc7270d28838369593635a5db3260", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "process-compose": { "locked": { "lastModified": 1718031437, @@ -149,10 +118,8 @@ "inputs": { "devshell": "devshell", "flake-parts": "flake-parts", - "flake-root": "flake-root", "nixpkgs": "nixpkgs_2", - "process-compose": "process-compose", - "treefmt-nix": "treefmt-nix" + "process-compose": "process-compose" } }, "systems": { @@ -169,24 +136,6 @@ "repo": "default", "type": "github" } - }, - "treefmt-nix": { - "inputs": { - "nixpkgs": "nixpkgs_3" - }, - "locked": { - "lastModified": 1718522839, - "narHash": "sha256-ULzoKzEaBOiLRtjeY3YoGFJMwWSKRYOic6VNw2UyTls=", - "owner": "numtide", - "repo": "treefmt-nix", - "rev": "68eb1dc333ce82d0ab0c0357363ea17c31ea1f81", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "treefmt-nix", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 287801c..0d34da1 100644 --- a/flake.nix +++ b/flake.nix @@ -1,205 +1,281 @@ # github.com/brianmcgee has lots of great ideas for going above and beyond for this { - description = "Greg's homepage"; - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - devshell.url = "github:numtide/devshell"; - flake-parts.url = "github:hercules-ci/flake-parts"; - flake-root.url = "github:srid/flake-root"; - process-compose.url = "github:Platonic-Systems/process-compose-flake"; - treefmt-nix.url = "github:numtide/treefmt-nix"; - }; + description = "Greg's homepage"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + devshell.url = "github:numtide/devshell"; + flake-parts.url = "github:hercules-ci/flake-parts"; + process-compose.url = "github:Platonic-Systems/process-compose-flake"; + }; - outputs = { devshell, flake-parts, flake-root, process-compose, treefmt-nix, nixpkgs, ... }@inputs: let - lib = nixpkgs.lib; - providers = [ - "qemu" - "virtualbox-iso" - "hyperv-iso" - ]; - distros = import ./distros; - # Inserts the distro name into each element in the list - insertNames = lib.attrsets.mapAttrsToList (distro: val: (builtins.map (x: x // { inherit distro; }) val)) distros; - # Flattens all the distros into a single list - flat = lib.lists.flatten insertNames; - # Combines providers list with flattened list - withProviders = lib.attrsets.mapCartesianProduct - ({d, provider}: d // { inherit provider; }) - { d = flat; provider = providers; }; - active = builtins.filter (x: (x?eol) && (!x.eol)) withProviders; - name = d: "-${d.distro}-${d.arch}-${d.provider}-${d.version}"; - distroFile = d: "distros/${d.distro}/${d.version}/${d.arch}.pkrvars.hcl"; - cmd = d: '' - # This is a workaround for a goofy behavior in CI - if [ -e "''${PACKER_CONFIG_DIR}" ]; then - find "''${PACKER_CONFIG_DIR}" -name '*_linux_amd64' -exec chmod +x '{}' ";" - fi - packer init sources - packer build -only=${d.provider}.${d.arch} -var-file=${distroFile d}''; - in flake-parts.lib.mkFlake { inherit inputs; } - { - imports = [ - inputs.devshell.flakeModule - inputs.flake-root.flakeModule - inputs.treefmt-nix.flakeModule - ]; - flake = { - # Universal things - }; - systems = [ - "x86_64-linux" - "aarch64-linux" - ]; - perSystem = { config, pkgs, self', system, ... }: - { - _module.args.pkgs = import inputs.nixpkgs { - inherit system; - config.allowUnfree = true; - }; - # https://numtide.github.io/devshell/intro.html - devshells.default = { - # These commands will be shown in the motd that users read - # upon entering the shell - commands = [ { - package = self'.packages.cache; - category = "utils"; - help = "Downloads ISO files and adds them to the S3 bucket"; - } { - package = self'.packages.generate; - category = "utils"; - help = "Generate dynamic HCL files"; - } { - package = self'.packages.shellcheck; - category = "utils"; - help = "Run shellchecks"; - } { - package = self'.packages.validate; - category = "utils"; - help = "Validate all the files"; - } { - package = pkgs.vagrant; - category = "utils"; - help = "Vagrant to help with testing"; - } ] ++ (builtins.map (d: { package = self'.packages."build${name d}"; category = "builds"; }) withProviders); - env = [{ - name = "EFI_DIR"; - value = "${pkgs.OVMF.fd}/FV/"; - } { - name = "PACKER_CONFIG_DIR"; - value = "./packer_config"; - } { - name = "STORAGE_URL"; - value = "http://s3.thehellings.lan:9000"; - } ]; - }; + outputs = + { flake-parts, nixpkgs, ... }@inputs: + let + lib = nixpkgs.lib; + providers = [ + "qemu" + "virtualbox-iso" + "hyperv-iso" + ]; + distros = import ./distros; + # Inserts the distro name into each element in the list + insertNames = lib.attrsets.mapAttrsToList ( + distro: val: (builtins.map (x: x // { inherit distro; }) val) + ) distros; + # Flattens all the distros into a single list + flat = lib.lists.flatten insertNames; + # Combines providers list with flattened list + withProviders = lib.attrsets.mapCartesianProduct ({ d, provider }: d // { inherit provider; }) { + d = flat; + provider = providers; + }; + active = builtins.filter (x: (x ? eol) && (!x.eol)) withProviders; + name = d: "-${d.distro}-${d.arch}-${d.provider}-${d.version}"; + distroFile = d: "distros/${d.distro}/${d.version}/${d.arch}.pkrvars.hcl"; + cmd = d: '' + # This is a workaround for a goofy behavior in CI + if [ -e "''${PACKER_CONFIG_DIR}" ]; then + find "''${PACKER_CONFIG_DIR}" -name '*_linux_amd64' -exec chmod +x '{}' ";" + fi + packer init sources + packer build -only=${d.provider}.${d.arch} -var-file=${distroFile d}''; + in + flake-parts.lib.mkFlake { inherit inputs; } { + imports = [ + inputs.devshell.flakeModule + inputs.flake-root.flakeModule + inputs.treefmt-nix.flakeModule + ]; + flake = { + # Universal things + }; + systems = [ + "x86_64-linux" + "aarch64-linux" + ]; + perSystem = + { + pkgs, + self', + system, + ... + }@inputs': + { + _module.args.pkgs = import inputs.nixpkgs { + inherit system; + config.allowUnfree = true; + }; + # https://numtide.github.io/devshell/intro.html + devshells.default = { + # These commands will be shown in the motd that users read + # upon entering the shell + commands = + [ + { + package = self'.packages.cache; + category = "utils"; + help = "Downloads ISO files and adds them to the S3 bucket"; + } + { + package = self'.packages.generate; + category = "utils"; + help = "Generate dynamic HCL files"; + } + { + package = self'.packages.shellcheck; + category = "utils"; + help = "Run shellchecks"; + } + { + package = self'.packages.validate; + category = "utils"; + help = "Validate all the files"; + } + { + package = pkgs.vagrant; + category = "utils"; + help = "Vagrant to help with testing"; + } + ] + ++ (builtins.map (d: { + package = self'.packages."build${name d}"; + category = "builds"; + }) withProviders); + env = [ + { + name = "EFI_DIR"; + value = "${pkgs.OVMF.fd}/FV/"; + } + { + name = "PACKER_CONFIG_DIR"; + value = "./packer_config"; + } + { + name = "STORAGE_URL"; + value = "http://s3.thehellings.lan:9000"; + } + ]; + }; -# This is not special, this is just flakes - packages = let - base = { - runtimeInputs = with pkgs; [ - cdrtools - findutils - packer - qemu_full - vagrant - xorriso - ]; - }; - build = d: let - vp = x: if x.provider == "qemu" then "libvirt" - else if x.provider == "virtualbox-iso" then "virtualbox" - else if x.provider == "hyperv-iso" then "hyperv" - else "unknown"; - in pkgs.writeShellApplication (base // { - name = "build${name d}"; - text = '' - set -x - ${cmd d} -except=upload -var headless=false sources/ - vagrant box add --provider ${vp d} ./output/${vp d}/${d.distro}-${d.version}.box --name test_box --force - ''; - }); - cibuild = d: pkgs.writeShellApplication (base // { - name = "ci${name d}"; - text = '' - set -x - ${cmd d} -except=upload sources/ - ''; - }); - upload = d: pkgs.writeShellApplication (base // { - name = "upload${name d}"; - text = '' - set -x - ${cmd d} sources/ - ''; - }); - builds = lib.lists.foldr (d: acc: acc // { "build${name d}" = (build d); }) {} withProviders; - uploads = lib.lists.foldr (d: acc: acc // { "upload${name d}" = (upload d); }) {} withProviders; - cibuilds = lib.lists.foldr (d: acc: acc // { "ci${name d}" = (cibuild d); }) {} withProviders; - qemu_list = builtins.toJSON (builtins.map (d: { buildcmd = (name d); }) (builtins.filter (x: x.provider == "qemu") active)); - vbox_list = builtins.toJSON (builtins.map (d: { buildcmd = (name d); }) (builtins.filter (x: x.provider == "virtualbox-iso") active)); - hyperv_list = builtins.toJSON (builtins.map (d: { distro = distroFile d; }) (builtins.filter (x: x.provider == "hyperv-iso") active)); - in builds // uploads // cibuilds // { - continue = pkgs.writeText "continue.yml" - (builtins.replaceStrings ["QEMU_MATRIX" "VBOX_MATRIX" "HYPERV_MATRIX"] [qemu_list vbox_list hyperv_list] - (builtins.readFile ./.gitlab-ci-build.yml.in) - ); - cache = pkgs.callPackage (import ./nix/cache.nix) { inherit active distroFile; }; - validate = pkgs.callPackage (import ./nix/validate.nix) {}; - cache-restore = pkgs.writeShellApplication { - name = "cache-restore"; - runtimeInputs = with pkgs; [ - jq - minio-client - packer - ]; - text = builtins.readFile ./cache-restore.sh; - }; - generate = pkgs.writeShellApplication { - name = "generate"; - runtimeInputs = with pkgs; [ - bash - coreutils - curl - jq - pup - ]; - text = '' - shopt -s globstar - for vars in distros/**/*.pkrvars.hcl.sh; do - bash "./''${vars}" - done - set -x - echo "BUILD=$(date "+%Y.%m.%d.%H")" >> build.env - ''; - }; - shellcheck = pkgs.writeShellApplication { - name = "shellcheck"; - runtimeInputs = with pkgs; [ - shellcheck - ]; - text = '' - scripts=() - shopt -s globstar - for f in **/*.sh; do - scripts+=("$f") - done - shellcheck -e SC2239 "''${scripts[@]}" - ''; - }; - }; + # This is not special, this is just flakes + packages = + let + base = { + runtimeInputs = with pkgs; [ + cdrtools + findutils + packer + qemu_full + vagrant + xorriso + ]; + }; + build = + d: + let + vp = + x: + if x.provider == "qemu" then + "libvirt" + else if x.provider == "virtualbox-iso" then + "virtualbox" + else if x.provider == "hyperv-iso" then + "hyperv" + else + "unknown"; + in + pkgs.writeShellApplication ( + base + // { + name = "build${name d}"; + text = '' + set -x + ${cmd d} -except=upload -var headless=false sources/ + vagrant box add --provider ${vp d} ./output/${vp d}/${d.distro}-${d.version}.box --name test_box --force + ''; + } + ); + cibuild = + d: + pkgs.writeShellApplication ( + base + // { + name = "ci${name d}"; + text = '' + set -x + ${cmd d} -except=upload sources/ + ''; + } + ); + upload = + d: + pkgs.writeShellApplication ( + base + // { + name = "upload${name d}"; + text = '' + set -x + ${cmd d} sources/ + ''; + } + ); + builds = lib.lists.foldr (d: acc: acc // { "build${name d}" = (build d); }) { } withProviders; + uploads = lib.lists.foldr (d: acc: acc // { "upload${name d}" = (upload d); }) { } withProviders; + cibuilds = lib.lists.foldr (d: acc: acc // { "ci${name d}" = (cibuild d); }) { } withProviders; + qemu_list = builtins.toJSON ( + builtins.map (d: { buildcmd = (name d); }) (builtins.filter (x: x.provider == "qemu") active) + ); + vbox_list = builtins.toJSON ( + builtins.map (d: { buildcmd = (name d); }) ( + builtins.filter (x: x.provider == "virtualbox-iso") active + ) + ); + hyperv_list = builtins.toJSON ( + builtins.map (d: { distro = distroFile d; }) ( + builtins.filter (x: x.provider == "hyperv-iso") active + ) + ); + in + builds + // uploads + // cibuilds + // { + continue = pkgs.writeText "continue.yml" ( + builtins.replaceStrings + [ + "QEMU_MATRIX" + "VBOX_MATRIX" + "HYPERV_MATRIX" + ] + [ + qemu_list + vbox_list + hyperv_list + ] + (builtins.readFile ./.gitlab-ci-build.yml.in) + ); + cache = pkgs.callPackage (import ./nix/cache.nix) { inherit active distroFile; }; + validate = pkgs.callPackage (import ./nix/validate.nix) { }; + cache-restore = pkgs.writeShellApplication { + name = "cache-restore"; + runtimeInputs = with pkgs; [ + jq + minio-client + packer + ]; + text = builtins.readFile ./cache-restore.sh; + }; + generate = pkgs.writeShellApplication { + name = "generate"; + runtimeInputs = with pkgs; [ + bash + coreutils + curl + jq + pup + ]; + text = '' + shopt -s globstar + for vars in distros/**/*.pkrvars.hcl.sh; do + bash "./''${vars}" + done + set -x + echo "BUILD=$(date "+%Y.%m.%d.%H")" >> build.env + ''; + }; + shellcheck = pkgs.writeShellApplication { + name = "shellcheck"; + runtimeInputs = with pkgs; [ + shellcheck + ]; + text = '' + scripts=() + shopt -s globstar + for f in **/*.sh; do + scripts+=("$f") + done + shellcheck -e SC2239 "''${scripts[@]}" + ''; + }; + }; - # https://numtide.github.io/treefmt/ - treefmt.config = { - inherit (config.flake-root) projectRootFile; - package = pkgs.treefmt; - - programs = { - deadnix.enable = true; - }; - - settings.formatter = { - }; - }; - }; - }; + checks = { + pre-commit = inputs.hooks.lib.${inputs'.system}.run { + src = ./.; + hooks = { + check-added-large-files.enable = true; + check-case-conflicts.enable = true; + check-merge-conflicts.enable = true; + check-symlinks.enable = true; + deadnix.enable = true; + end-of-file-fixer.enable = true; + fix-byte-order-marker.enable = true; + mixed-line-endings.enable = true; + nixfmt-rfc-style.enable = true; + trim-trailing-whitespace.enable = true; + }; + }; + }; + }; + }; } diff --git a/nix/cache.nix b/nix/cache.nix index 4add151..5ddc4ed 100644 --- a/nix/cache.nix +++ b/nix/cache.nix @@ -1,44 +1,47 @@ { - writeShellApplication, - active, - distroFile, + writeShellApplication, + active, + distroFile, - curl, - minio-client, - packer, + curl, + minio-client, + packer, - ... + ... }: let - inherit (builtins) concatStringsSep map; -in writeShellApplication { - name = "cache-isos"; - runtimeInputs = [ - curl - minio-client - packer - ]; - text = '' - push="''${1:-yes}" - if [ "$push" == "yes" ]; then - mc alias set storage "$STORAGE_URL" root "$MINIO_SECRET" - fi - mkdir -p cache - '' + (concatStringsSep "\n" ( - map (d: '' - url=$(echo var.iso.url | packer console -var-file="${distroFile d}" -config-type=hcl2 sources/) - sha=$(echo var.iso.checksum | packer console -var-file="${distroFile d}" -config-type=hcl2 sources/) - distro=$(echo var.distro | packer console -var-file="${distroFile d}" -config-type=hcl2 sources/) - # shellcheck disable=SC2143 - if [ -z "$(mc ls "storage/isos/cache/$distro" | grep "$sha")" ]; then - curl -L --retry 3 --retry-all-errors -o "cache/$sha.iso" "$url" - if [ "$push" == "yes" ]; then - mc put "cache/$sha.iso" "storage/isos/cache/$distro/$sha.iso" - fi - else - echo "Skipping ${d.distro} - cache/$sha.iso" - fi - '') active - )); + inherit (builtins) concatStringsSep map; +in +writeShellApplication { + name = "cache-isos"; + runtimeInputs = [ + curl + minio-client + packer + ]; + text = + '' + push="''${1:-yes}" + if [ "$push" == "yes" ]; then + mc alias set storage "$STORAGE_URL" root "$MINIO_SECRET" + fi + mkdir -p cache + '' + + (concatStringsSep "\n" ( + map (d: '' + url=$(echo var.iso.url | packer console -var-file="${distroFile d}" -config-type=hcl2 sources/) + sha=$(echo var.iso.checksum | packer console -var-file="${distroFile d}" -config-type=hcl2 sources/) + distro=$(echo var.distro | packer console -var-file="${distroFile d}" -config-type=hcl2 sources/) + # shellcheck disable=SC2143 + if [ -z "$(mc ls "storage/isos/cache/$distro" | grep "$sha")" ]; then + curl -L --retry 3 --retry-all-errors -o "cache/$sha.iso" "$url" + if [ "$push" == "yes" ]; then + mc put "cache/$sha.iso" "storage/isos/cache/$distro/$sha.iso" + fi + else + echo "Skipping ${d.distro} - cache/$sha.iso" + fi + '') active + )); } diff --git a/nix/validate.nix b/nix/validate.nix index e433806..542313d 100644 --- a/nix/validate.nix +++ b/nix/validate.nix @@ -1,23 +1,23 @@ { - writeShellApplication, - findutils, - packer, - ... + writeShellApplication, + findutils, + packer, + ... }: writeShellApplication { - name = "validate"; - runtimeInputs = [ - findutils - packer - ]; - text = '' - shopt -s globstar - if [ -e "''${PACKER_CONFIG_DIR}" ]; then - find "''${PACKER_CONFIG_DIR}" -name '*_linux_amd64' -exec chmod +x '{}' ";" - fi - packer init sources - for vars in distros/**/*.pkrvars.hcl; do - packer validate -except=upload "-var-file=''${vars}" sources/ - done - ''; + name = "validate"; + runtimeInputs = [ + findutils + packer + ]; + text = '' + shopt -s globstar + if [ -e "''${PACKER_CONFIG_DIR}" ]; then + find "''${PACKER_CONFIG_DIR}" -name '*_linux_amd64' -exec chmod +x '{}' ";" + fi + packer init sources + for vars in distros/**/*.pkrvars.hcl; do + packer validate -except=upload "-var-file=''${vars}" sources/ + done + ''; } From ee831b6c4838f150cd6c9e422caba5b844382b26 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Mon, 18 Nov 2024 21:31:43 -0600 Subject: [PATCH 03/11] Fix flake.nix and use its hooks Fixes #24 --- .gitignore | 1 + flake.lock | 102 ++++++++++++++++++++++++++++++-------------------- flake.nix | 108 +++++++++++++++++++---------------------------------- 3 files changed, 101 insertions(+), 110 deletions(-) diff --git a/.gitignore b/.gitignore index 1e1b574..8fac0c1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.pre-commit-config.yaml output_* output/* *.box diff --git a/flake.lock b/flake.lock index b3ca643..7641126 100644 --- a/flake.lock +++ b/flake.lock @@ -1,21 +1,18 @@ { "nodes": { - "devshell": { - "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" - }, + "flake-compat": { + "flake": false, "locked": { - "lastModified": 1717408969, - "narHash": "sha256-Q0OEFqe35fZbbRPPRdrjTUUChKVhhWXz3T9ZSKmaoVY=", - "owner": "numtide", - "repo": "devshell", - "rev": "1ebbe68d57457c8cae98145410b164b5477761f4", + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "type": "github" }, "original": { - "owner": "numtide", - "repo": "devshell", + "owner": "edolstra", + "repo": "flake-compat", "type": "github" } }, @@ -37,31 +34,55 @@ "type": "github" } }, - "flake-utils": { + "gitignore": { "inputs": { - "systems": "systems" + "nixpkgs": [ + "hooks", + "nixpkgs" + ] }, "locked": { - "lastModified": 1701680307, - "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": "nixpkgs", + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1731363552, + "narHash": "sha256-vFta1uHnD29VUY4HJOO/D6p6rxyObnf+InnSMT4jlMU=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "cd1af27aa85026ac759d5d3fccf650abe7e1bbf0", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1704161960, - "narHash": "sha256-QGua89Pmq+FBAro8NriTuoO/wNaUtugt29/qqA8zeeM=", + "lastModified": 1730768919, + "narHash": "sha256-8AKquNnnSaJRXZxc5YmF/WfmxiHX6MMZZasRP6RRQkE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "63143ac2c9186be6d9da6035fa22620018c85932", + "rev": "a04d33c0c3f1a59a2c1cb0c6e34cd24500e5a1dc", "type": "github" }, "original": { @@ -83,6 +104,22 @@ "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1730741070, + "narHash": "sha256-edm8WG19kWozJ/GqyYx2VjW99EdhjKwbY3ZwdlPAAlo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d063c1dd113c91ab27959ba540c0d9753409edf3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1720750130, @@ -116,26 +153,11 @@ }, "root": { "inputs": { - "devshell": "devshell", "flake-parts": "flake-parts", + "hooks": "hooks", "nixpkgs": "nixpkgs_2", "process-compose": "process-compose" } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 0d34da1..3c106b7 100644 --- a/flake.nix +++ b/flake.nix @@ -3,9 +3,9 @@ description = "Greg's homepage"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - devshell.url = "github:numtide/devshell"; flake-parts.url = "github:hercules-ci/flake-parts"; process-compose.url = "github:Platonic-Systems/process-compose-flake"; + hooks.url = "github:cachix/git-hooks.nix"; }; outputs = @@ -41,11 +41,6 @@ packer build -only=${d.provider}.${d.arch} -var-file=${distroFile d}''; in flake-parts.lib.mkFlake { inherit inputs; } { - imports = [ - inputs.devshell.flakeModule - inputs.flake-root.flakeModule - inputs.treefmt-nix.flakeModule - ]; flake = { # Universal things }; @@ -65,56 +60,29 @@ inherit system; config.allowUnfree = true; }; - # https://numtide.github.io/devshell/intro.html - devshells.default = { + + devShells.default = pkgs.mkShell { + buildInputs = self'.checks.pre-commit.enabledPackages; + shellHook = self'.checks.pre-commit.shellHook; + + packages = + (with pkgs; [ + vagrant + ]) + ++ (with self'.packages; [ + cache + generate + shellcheck + validate + ]) + ++ (builtins.map (d: self'.packages."build${name d}") withProviders); # These commands will be shown in the motd that users read # upon entering the shell - commands = - [ - { - package = self'.packages.cache; - category = "utils"; - help = "Downloads ISO files and adds them to the S3 bucket"; - } - { - package = self'.packages.generate; - category = "utils"; - help = "Generate dynamic HCL files"; - } - { - package = self'.packages.shellcheck; - category = "utils"; - help = "Run shellchecks"; - } - { - package = self'.packages.validate; - category = "utils"; - help = "Validate all the files"; - } - { - package = pkgs.vagrant; - category = "utils"; - help = "Vagrant to help with testing"; - } - ] - ++ (builtins.map (d: { - package = self'.packages."build${name d}"; - category = "builds"; - }) withProviders); - env = [ - { - name = "EFI_DIR"; - value = "${pkgs.OVMF.fd}/FV/"; - } - { - name = "PACKER_CONFIG_DIR"; - value = "./packer_config"; - } - { - name = "STORAGE_URL"; - value = "http://s3.thehellings.lan:9000"; - } - ]; + env = { + EFI_DIR = "${pkgs.OVMF.fd}/FV/"; + PACKER_CONFIG_DIR = "./packer_config"; + STORAGE_URL = "http://s3.thehellings.lan:9000"; + }; }; # This is not special, this is just flakes @@ -162,8 +130,8 @@ // { name = "ci${name d}"; text = '' - set -x - ${cmd d} -except=upload sources/ + set -x + ${cmd d} -except=upload sources/ ''; } ); @@ -174,8 +142,8 @@ // { name = "upload${name d}"; text = '' - set -x - ${cmd d} sources/ + set -x + ${cmd d} sources/ ''; } ); @@ -235,12 +203,12 @@ pup ]; text = '' - shopt -s globstar - for vars in distros/**/*.pkrvars.hcl.sh; do - bash "./''${vars}" - done - set -x - echo "BUILD=$(date "+%Y.%m.%d.%H")" >> build.env + shopt -s globstar + for vars in distros/**/*.pkrvars.hcl.sh; do + bash "./''${vars}" + done + set -x + echo "BUILD=$(date "+%Y.%m.%d.%H")" >> build.env ''; }; shellcheck = pkgs.writeShellApplication { @@ -249,12 +217,12 @@ shellcheck ]; text = '' - scripts=() - shopt -s globstar - for f in **/*.sh; do - scripts+=("$f") - done - shellcheck -e SC2239 "''${scripts[@]}" + scripts=() + shopt -s globstar + for f in **/*.sh; do + scripts+=("$f") + done + shellcheck -e SC2239 "''${scripts[@]}" ''; }; }; From 1b8a742563a767b925b6990a4e7c00d2d39f7d02 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Mon, 18 Nov 2024 22:26:17 -0600 Subject: [PATCH 04/11] Streamline generating continue file Fixes #29 --- flake.nix | 16 +++----- nix/cache.nix | 32 ++++++++-------- nix/continue.nix | 98 ++++++++++++++++++++++++++++++++++++++++++++++++ nix/validate.nix | 16 ++++---- 4 files changed, 128 insertions(+), 34 deletions(-) create mode 100644 nix/continue.nix diff --git a/flake.nix b/flake.nix index 3c106b7..b8e109f 100644 --- a/flake.nix +++ b/flake.nix @@ -168,19 +168,15 @@ // uploads // cibuilds // { - continue = pkgs.writeText "continue.yml" ( - builtins.replaceStrings - [ - "QEMU_MATRIX" - "VBOX_MATRIX" - "HYPERV_MATRIX" - ] - [ + continue = ( + import ./nix/continue.nix { + inherit + pkgs qemu_list vbox_list hyperv_list - ] - (builtins.readFile ./.gitlab-ci-build.yml.in) + ; + } ); cache = pkgs.callPackage (import ./nix/cache.nix) { inherit active distroFile; }; validate = pkgs.callPackage (import ./nix/validate.nix) { }; diff --git a/nix/cache.nix b/nix/cache.nix index 5ddc4ed..6b0c4c5 100644 --- a/nix/cache.nix +++ b/nix/cache.nix @@ -22,26 +22,26 @@ writeShellApplication { ]; text = '' - push="''${1:-yes}" - if [ "$push" == "yes" ]; then - mc alias set storage "$STORAGE_URL" root "$MINIO_SECRET" - fi - mkdir -p cache + push="''${1:-yes}" + if [ "$push" == "yes" ]; then + mc alias set storage "$STORAGE_URL" root "$MINIO_SECRET" + fi + mkdir -p cache '' + (concatStringsSep "\n" ( map (d: '' - url=$(echo var.iso.url | packer console -var-file="${distroFile d}" -config-type=hcl2 sources/) - sha=$(echo var.iso.checksum | packer console -var-file="${distroFile d}" -config-type=hcl2 sources/) - distro=$(echo var.distro | packer console -var-file="${distroFile d}" -config-type=hcl2 sources/) - # shellcheck disable=SC2143 - if [ -z "$(mc ls "storage/isos/cache/$distro" | grep "$sha")" ]; then - curl -L --retry 3 --retry-all-errors -o "cache/$sha.iso" "$url" - if [ "$push" == "yes" ]; then - mc put "cache/$sha.iso" "storage/isos/cache/$distro/$sha.iso" - fi - else - echo "Skipping ${d.distro} - cache/$sha.iso" + url=$(echo var.iso.url | packer console -var-file="${distroFile d}" -config-type=hcl2 sources/) + sha=$(echo var.iso.checksum | packer console -var-file="${distroFile d}" -config-type=hcl2 sources/) + distro=$(echo var.distro | packer console -var-file="${distroFile d}" -config-type=hcl2 sources/) + # shellcheck disable=SC2143 + if [ -z "$(mc ls "storage/isos/cache/$distro" | grep "$sha")" ]; then + curl -L --retry 3 --retry-all-errors -o "cache/$sha.iso" "$url" + if [ "$push" == "yes" ]; then + mc put "cache/$sha.iso" "storage/isos/cache/$distro/$sha.iso" fi + else + echo "Skipping ${d.distro} - cache/$sha.iso" + fi '') active )); } diff --git a/nix/continue.nix b/nix/continue.nix new file mode 100644 index 0000000..b4f655f --- /dev/null +++ b/nix/continue.nix @@ -0,0 +1,98 @@ +{ + pkgs, + qemu_list, + vbox_list, + hyperv_list, + ... +}: + +let + + general = { + stage = "build"; + cache = [ + { + key = { + files = [ "sources/build.pkr.hcl" ]; + }; + paths = [ "./packer_config/" ]; + } + ]; + rules = [ + { + "if" = "$CI_COMMIT_TAG"; + variables = { + EXCEPT = ""; + JOB_PREFIX = "upload"; + }; + } + { + "if" = "$CI_COMMIT_TAG =~ \"/^$/\""; + variables = { + EXCEPT = "-except=upload"; + JOB_PREIX = "ci"; + }; + } + ]; + needs = [ + { + pipeline = "$PARENT_PIPELINE_ID"; + job = "generate"; + artifacts = true; + } + ]; + script = [ + "nix run \".#\\\"\${JOB_PREIX}\${buildcmd}\\\"\" || exit 1" + ]; + }; + + variables = { + PACKER_CONFIG_DIR = "./packer_config/"; + PACKER_CACHE_DIR = "./cache/"; + PACKER_LOG = "1"; + }; + + continue = { + stages = [ + "build" + "release" + ]; + "qemu.amd64" = general // { + variables = variables // { + only = "-only=qemu.amd64"; + }; + tag = [ "qemu" ]; + parallel = { + matrix = qemu_list; + }; + before_script = [ + "echo $BUILD" + "env" + ]; + }; + "virtualbox-iso.amd64" = general // { + variables = variables // { + only = "-only=\"virtualbox-iso.amd64\""; + }; + tags = [ "vbox" ]; + parallel = { + matrix = vbox_list; + }; + }; + "hyperv-iso.amd64" = general // { + variables = variables // { + only = "-only=\"hyperv-iso.amd64\""; + }; + tags = [ "hyperv" ]; + parallel = { + matrix = hyperv_list; + }; + script = [ + "packer init sources" + "packer build -only=\"hyperv-iso.amd64\" -var-file=\"\${distro}\" -var build=\${BUILD} -var cpus=2 -var memory=4096 \${EXCEPT} sources" + "if (-not $?) { throw \"Error in build\")" + ]; + }; + }; +in +pkgs.writeText "continue.yml" (builtins.toJSON continue) diff --git a/nix/validate.nix b/nix/validate.nix index 542313d..ec7fd57 100644 --- a/nix/validate.nix +++ b/nix/validate.nix @@ -11,13 +11,13 @@ writeShellApplication { packer ]; text = '' - shopt -s globstar - if [ -e "''${PACKER_CONFIG_DIR}" ]; then - find "''${PACKER_CONFIG_DIR}" -name '*_linux_amd64' -exec chmod +x '{}' ";" - fi - packer init sources - for vars in distros/**/*.pkrvars.hcl; do - packer validate -except=upload "-var-file=''${vars}" sources/ - done + shopt -s globstar + if [ -e "''${PACKER_CONFIG_DIR}" ]; then + find "''${PACKER_CONFIG_DIR}" -name '*_linux_amd64' -exec chmod +x '{}' ";" + fi + packer init sources + for vars in distros/**/*.pkrvars.hcl; do + packer validate -except=upload "-var-file=''${vars}" sources/ + done ''; } From de666d44c8c07dfcabba3b28237fe0629f1d1621 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Mon, 18 Nov 2024 22:32:20 -0600 Subject: [PATCH 05/11] Fix shellcheck --- flake.nix | 16 ++++++---------- scripts/minimize.sh | 13 +++++++++---- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/flake.nix b/flake.nix index b8e109f..2eb2632 100644 --- a/flake.nix +++ b/flake.nix @@ -150,18 +150,14 @@ builds = lib.lists.foldr (d: acc: acc // { "build${name d}" = (build d); }) { } withProviders; uploads = lib.lists.foldr (d: acc: acc // { "upload${name d}" = (upload d); }) { } withProviders; cibuilds = lib.lists.foldr (d: acc: acc // { "ci${name d}" = (cibuild d); }) { } withProviders; - qemu_list = builtins.toJSON ( - builtins.map (d: { buildcmd = (name d); }) (builtins.filter (x: x.provider == "qemu") active) + qemu_list = builtins.map (d: { buildcmd = (name d); }) ( + builtins.filter (x: x.provider == "qemu") active ); - vbox_list = builtins.toJSON ( - builtins.map (d: { buildcmd = (name d); }) ( - builtins.filter (x: x.provider == "virtualbox-iso") active - ) + vbox_list = builtins.map (d: { buildcmd = (name d); }) ( + builtins.filter (x: x.provider == "virtualbox-iso") active ); - hyperv_list = builtins.toJSON ( - builtins.map (d: { distro = distroFile d; }) ( - builtins.filter (x: x.provider == "hyperv-iso") active - ) + hyperv_list = builtins.map (d: { distro = distroFile d; }) ( + builtins.filter (x: x.provider == "hyperv-iso") active ); in builds diff --git a/scripts/minimize.sh b/scripts/minimize.sh index 61a618d..7cc22f0 100644 --- a/scripts/minimize.sh +++ b/scripts/minimize.sh @@ -21,10 +21,15 @@ elif [ -n "$swap_device_label" ]; then swap_device=$(readlink -f /dev/disk/by-label/"$swap_device_label") fi -if [ -n "${swap_device}" ] && [ -e "${swap_device}" ] && [ "${swap_device}" != "/dev/zram"* ]; then - sudo /sbin/swapoff "$swap_device" - sudo dd if=/dev/zero of="$swap_device" bs=1M || : - sudo /sbin/mkswap ${swap_device_label:+-L "$swap_device_label"} ${swap_device_uuid:+-U "$swap_device_uuid"} "$swap_device" +if [ -n "${swap_device}" ] && [ -e "${swap_device}" ]; then + case ${swap_device} in + "/dev/zram"*) ;; + *) + sudo /sbin/swapoff "$swap_device" + sudo dd if=/dev/zero of="$swap_device" bs=1M || : + sudo /sbin/mkswap ${swap_device_label:+-L "$swap_device_label"} ${swap_device_uuid:+-U "$swap_device_uuid"} "$swap_device" + ;; + esac fi sleep 15 # Hyper-v seems to be super fast during boot From 57ac996a38a866736f3782393c9e226a84590a10 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Mon, 18 Nov 2024 22:42:31 -0600 Subject: [PATCH 06/11] Fix name of the tags array --- nix/continue.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/continue.nix b/nix/continue.nix index b4f655f..995425e 100644 --- a/nix/continue.nix +++ b/nix/continue.nix @@ -61,7 +61,7 @@ let variables = variables // { only = "-only=qemu.amd64"; }; - tag = [ "qemu" ]; + tags = [ "qemu" ]; parallel = { matrix = qemu_list; }; From f14c55e0c9a08b4e94e70798f0c4b8e9876fb9a5 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Mon, 18 Nov 2024 23:28:04 -0600 Subject: [PATCH 07/11] Enable filtering Honor the value of `exclude` in a distro listing. It has already been in use to exclude Debian 12 from building on virtualbox-iso, but now we will actually honor that call. Also, tightens up the code that generates all the scripts so that it is less verbose and more legible Fixes #26 --- flake.nix | 104 ++++++++++++++++++------------------------------------ 1 file changed, 34 insertions(+), 70 deletions(-) diff --git a/flake.nix b/flake.nix index 2eb2632..f439363 100644 --- a/flake.nix +++ b/flake.nix @@ -29,16 +29,12 @@ d = flat; provider = providers; }; - active = builtins.filter (x: (x ? eol) && (!x.eol)) withProviders; + active = builtins.filter ( + x: + !(x.eol or false) && ((lib.lists.findFirstIndex (y: y == x.provider) (-1) (x.exclude or [ ])) == -1) + ) withProviders; name = d: "-${d.distro}-${d.arch}-${d.provider}-${d.version}"; distroFile = d: "distros/${d.distro}/${d.version}/${d.arch}.pkrvars.hcl"; - cmd = d: '' - # This is a workaround for a goofy behavior in CI - if [ -e "''${PACKER_CONFIG_DIR}" ]; then - find "''${PACKER_CONFIG_DIR}" -name '*_linux_amd64' -exec chmod +x '{}' ";" - fi - packer init sources - packer build -only=${d.provider}.${d.arch} -var-file=${distroFile d}''; in flake-parts.lib.mkFlake { inherit inputs; } { flake = { @@ -88,68 +84,36 @@ # This is not special, this is just flakes packages = let - base = { - runtimeInputs = with pkgs; [ - cdrtools - findutils - packer - qemu_full - vagrant - xorriso - ]; - }; - build = - d: - let - vp = - x: - if x.provider == "qemu" then - "libvirt" - else if x.provider == "virtualbox-iso" then - "virtualbox" - else if x.provider == "hyperv-iso" then - "hyperv" - else - "unknown"; - in - pkgs.writeShellApplication ( - base - // { - name = "build${name d}"; - text = '' - set -x - ${cmd d} -except=upload -var headless=false sources/ - vagrant box add --provider ${vp d} ./output/${vp d}/${d.distro}-${d.version}.box --name test_box --force - ''; - } - ); - cibuild = - d: - pkgs.writeShellApplication ( - base - // { - name = "ci${name d}"; - text = '' - set -x - ${cmd d} -except=upload sources/ - ''; - } - ); - upload = - d: - pkgs.writeShellApplication ( - base - // { - name = "upload${name d}"; - text = '' - set -x - ${cmd d} sources/ - ''; - } - ); - builds = lib.lists.foldr (d: acc: acc // { "build${name d}" = (build d); }) { } withProviders; - uploads = lib.lists.foldr (d: acc: acc // { "upload${name d}" = (upload d); }) { } withProviders; - cibuilds = lib.lists.foldr (d: acc: acc // { "ci${name d}" = (cibuild d); }) { } withProviders; + base = + prefix: d: args: + pkgs.writeShellApplication { + name = "${prefix}${name d}"; + runtimeInputs = with pkgs; [ + cdrtools + findutils + packer + qemu_full + vagrant + xorriso + ]; + text = '' + # This is a workaround for a goofy behavior in CI + if [ -e "''${PACKER_CONFIG_DIR}" ]; then + find "''${PACKER_CONFIG_DIR}" -name '*_linux_amd64' -exec chmod +x '{}' ";" + fi + packer init sources + packer build -only=${d.provider}.${d.arch} -var-file=${distroFile d} ${args} sources/ + ''; + }; + builds = lib.lists.foldr ( + d: acc: acc // { "build${name d}" = (base "build" d "-except=upload -var headless=false"); } + ) { } withProviders; + cibuilds = lib.lists.foldr ( + d: acc: acc // { "ci${name d}" = (base "ci" d "-except=upload"); } + ) { } withProviders; + uploads = lib.lists.foldr ( + d: acc: acc // { "upload${name d}" = (base "upload" d ""); } + ) { } withProviders; qemu_list = builtins.map (d: { buildcmd = (name d); }) ( builtins.filter (x: x.provider == "qemu") active ); From 1864511341fe934be565cee146625526fe35e39b Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Mon, 18 Nov 2024 23:37:30 -0600 Subject: [PATCH 08/11] Pull more of the scripts to their own files Fixes #19 --- flake.nix | 34 ++-------------------------------- nix/generate.nix | 27 +++++++++++++++++++++++++++ nix/shellcheck.nix | 15 +++++++++++++++ 3 files changed, 44 insertions(+), 32 deletions(-) create mode 100644 nix/generate.nix create mode 100644 nix/shellcheck.nix diff --git a/flake.nix b/flake.nix index f439363..6d6c572 100644 --- a/flake.nix +++ b/flake.nix @@ -149,38 +149,8 @@ ]; text = builtins.readFile ./cache-restore.sh; }; - generate = pkgs.writeShellApplication { - name = "generate"; - runtimeInputs = with pkgs; [ - bash - coreutils - curl - jq - pup - ]; - text = '' - shopt -s globstar - for vars in distros/**/*.pkrvars.hcl.sh; do - bash "./''${vars}" - done - set -x - echo "BUILD=$(date "+%Y.%m.%d.%H")" >> build.env - ''; - }; - shellcheck = pkgs.writeShellApplication { - name = "shellcheck"; - runtimeInputs = with pkgs; [ - shellcheck - ]; - text = '' - scripts=() - shopt -s globstar - for f in **/*.sh; do - scripts+=("$f") - done - shellcheck -e SC2239 "''${scripts[@]}" - ''; - }; + generate = pkgs.callPackage (import ./nix/generate.nix) { }; + shellcheck = pkgs.callPackage (import ./nix/shellcheck.nix) { }; }; checks = { diff --git a/nix/generate.nix b/nix/generate.nix new file mode 100644 index 0000000..699c813 --- /dev/null +++ b/nix/generate.nix @@ -0,0 +1,27 @@ +{ + writeShellApplication, + bash, + coreutils, + curl, + jq, + pup, +}: + +writeShellApplication { + name = "generate"; + runtimeInputs = [ + bash + coreutils + curl + jq + pup + ]; + text = '' + shopt -s globstar + for vars in distros/**/*.pkrvars.hcl.sh; do + bash "./''${vars}" + done + set -x + echo "BUILD=$(date "+%Y.%m.%d.%H")" >> build.env + ''; +} diff --git a/nix/shellcheck.nix b/nix/shellcheck.nix new file mode 100644 index 0000000..4940db2 --- /dev/null +++ b/nix/shellcheck.nix @@ -0,0 +1,15 @@ +{ writeShellApplication, shellcheck }: +writeShellApplication { + name = "shellcheck"; + runtimeInputs = [ + shellcheck + ]; + text = '' + scripts=() + shopt -s globstar + for f in **/*.sh; do + scripts+=("$f") + done + shellcheck -e SC2239 "''${scripts[@]}" + ''; +} From 4324f0ce67fabef4c48e6ce8119fd31bdcfd1d91 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Mon, 18 Nov 2024 23:42:28 -0600 Subject: [PATCH 09/11] Get everything passing the flake checks --- .gitattributes | 2 +- .gitlab-ci-build.yml.in | 1 - .gitlab-ci.yml | 4 ++++ Vagrantfile.in | 4 ++-- distros/almalinux/9/finalize.sh | 2 +- distros/alpine/3.19.0/finalize.sh | 2 +- distros/alpine/3.19.0/http/answers.cfg.sh | 2 +- distros/alpine/3.19.0/http/in-chroot.sh | 2 +- distros/alpine/3.19.0/qemu.sh | 2 +- distros/alpine/3.20/finalize.sh | 2 +- distros/alpine/3.20/http/answers.cfg.sh | 2 +- distros/alpine/3.20/http/in-chroot.sh | 2 +- distros/alpine/3.20/qemu.sh | 2 +- distros/centos-stream/9/finalize.sh | 2 +- distros/centos/7/disc/ks.cfg | 1 - distros/debian/10/finalize.sh | 2 +- distros/debian/10/http/preseed.cfg | 2 +- distros/debian/11/finalize.sh | 2 +- distros/debian/11/http/preseed.cfg | 2 +- distros/debian/12/finalize.sh | 2 +- distros/debian/12/http/preseed.cfg | 2 +- distros/fedora/38/amd64-ks.cfg | 1 - distros/fedora/39/amd64-ks.cfg | 1 - distros/fedora/40/amd64-ks.cfg | 1 - distros/fedora/41/amd64-ks.cfg | 1 - distros/fedora/rawhide/amd64-ks.cfg | 1 - distros/nixos/23.05/http/configuration.nix | 1 - distros/nixos/23.05/http/flake.nix | 2 +- distros/nixos/23.05/http/ga-vmware.nix | 6 +++--- distros/nixos/23.05/http/install.sh | 2 +- distros/nixos/23.11/http/configuration.nix | 1 - distros/nixos/23.11/http/flake.nix | 2 +- distros/nixos/23.11/http/ga-vmware.nix | 6 +++--- distros/nixos/23.11/http/install.sh | 2 +- distros/nixos/23.11/qemu.sh | 2 +- distros/nixos/23.11/virtualbox.sh | 2 +- distros/nixos/23.11/vmware.sh | 2 +- distros/nixos/24.05/http/configuration.nix | 1 - distros/nixos/24.05/http/flake.nix | 2 +- distros/nixos/24.05/http/ga-vmware.nix | 6 +++--- distros/nixos/24.05/http/install.sh | 2 +- distros/nixos/24.05/qemu.sh | 2 +- distros/nixos/24.05/virtualbox.sh | 2 +- distros/nixos/24.05/vmware.sh | 2 +- distros/opensuse/15.5/finalize.sh | 2 +- distros/opensuse/15.5/http/autoinst.xml | 2 +- distros/opensuse/15.5/virtualbox.sh | 2 +- distros/opensuse/15.6/finalize.sh | 2 +- distros/opensuse/15.6/http/autoinst.xml | 2 +- distros/opensuse/15.6/virtualbox.sh | 2 +- distros/opensuse/16.0/finalize.sh | 2 +- distros/opensuse/16.0/http/autoinst.xml | 2 +- distros/opensuse/16.0/virtualbox.sh | 2 +- distros/opensuse/tumbleweed/finalize.sh | 2 +- distros/opensuse/tumbleweed/virtualbox.sh | 2 +- distros/rockylinux/9/finalize.sh | 2 +- 56 files changed, 56 insertions(+), 62 deletions(-) diff --git a/.gitattributes b/.gitattributes index 07764a7..fcadb2c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1 @@ -* text eol=lf \ No newline at end of file +* text eol=lf diff --git a/.gitlab-ci-build.yml.in b/.gitlab-ci-build.yml.in index 2503f97..faac4b5 100644 --- a/.gitlab-ci-build.yml.in +++ b/.gitlab-ci-build.yml.in @@ -94,4 +94,3 @@ hyperv-iso.amd64: description: >- Release $CI_COMMIT_TAG, found on [Vagrant Cloud](https://app.vagrantup.com/boxen/) as version v${BUILD} - diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f3dc344..f1dedb3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -35,6 +35,10 @@ shellcheck: stage: generate script: nix run ".#shellcheck" +flake-check: + stage: generate + script: nix flake check + validate: stage: check needs: diff --git a/Vagrantfile.in b/Vagrantfile.in index 9f9d9a3..378e257 100644 --- a/Vagrantfile.in +++ b/Vagrantfile.in @@ -33,12 +33,12 @@ Vagrant.configure("2") do |config| config.vm.provider "libvirt" do |lv| end - + config.vm.provider "hyperv" do |hv, over| over.vm.network "private_network", bridge: "packer-amd64" #config.vm.network "private_network", bridge: "packer-amd64" end - + # # View the documentation for the provider you are using for more # information on available options. diff --git a/distros/almalinux/9/finalize.sh b/distros/almalinux/9/finalize.sh index c256ce4..52a6d2f 100644 --- a/distros/almalinux/9/finalize.sh +++ b/distros/almalinux/9/finalize.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash set -ex -dnf clean all \ No newline at end of file +dnf clean all diff --git a/distros/alpine/3.19.0/finalize.sh b/distros/alpine/3.19.0/finalize.sh index 5a01809..eaaa81a 100644 --- a/distros/alpine/3.19.0/finalize.sh +++ b/distros/alpine/3.19.0/finalize.sh @@ -1,2 +1,2 @@ #!/usr/bin/env sh -set -ex \ No newline at end of file +set -ex diff --git a/distros/alpine/3.19.0/http/answers.cfg.sh b/distros/alpine/3.19.0/http/answers.cfg.sh index a430023..f743a28 100644 --- a/distros/alpine/3.19.0/http/answers.cfg.sh +++ b/distros/alpine/3.19.0/http/answers.cfg.sh @@ -58,4 +58,4 @@ mv in-chroot.sh /mnt for fs in proc sys dev sys/firmware/efi/efivars; do mount -o bind /${fs} /mnt/${fs}; done chroot /mnt /bin/ash /in-chroot.sh rm /mnt/in-chroot.sh -reboot \ No newline at end of file +reboot diff --git a/distros/alpine/3.19.0/http/in-chroot.sh b/distros/alpine/3.19.0/http/in-chroot.sh index 4300f7d..d127e9c 100644 --- a/distros/alpine/3.19.0/http/in-chroot.sh +++ b/distros/alpine/3.19.0/http/in-chroot.sh @@ -54,4 +54,4 @@ virtualbox*) ;; esac -efibootmgr --bootnext "${target}" \ No newline at end of file +efibootmgr --bootnext "${target}" diff --git a/distros/alpine/3.19.0/qemu.sh b/distros/alpine/3.19.0/qemu.sh index 5a01809..eaaa81a 100644 --- a/distros/alpine/3.19.0/qemu.sh +++ b/distros/alpine/3.19.0/qemu.sh @@ -1,2 +1,2 @@ #!/usr/bin/env sh -set -ex \ No newline at end of file +set -ex diff --git a/distros/alpine/3.20/finalize.sh b/distros/alpine/3.20/finalize.sh index 5a01809..eaaa81a 100644 --- a/distros/alpine/3.20/finalize.sh +++ b/distros/alpine/3.20/finalize.sh @@ -1,2 +1,2 @@ #!/usr/bin/env sh -set -ex \ No newline at end of file +set -ex diff --git a/distros/alpine/3.20/http/answers.cfg.sh b/distros/alpine/3.20/http/answers.cfg.sh index a430023..f743a28 100644 --- a/distros/alpine/3.20/http/answers.cfg.sh +++ b/distros/alpine/3.20/http/answers.cfg.sh @@ -58,4 +58,4 @@ mv in-chroot.sh /mnt for fs in proc sys dev sys/firmware/efi/efivars; do mount -o bind /${fs} /mnt/${fs}; done chroot /mnt /bin/ash /in-chroot.sh rm /mnt/in-chroot.sh -reboot \ No newline at end of file +reboot diff --git a/distros/alpine/3.20/http/in-chroot.sh b/distros/alpine/3.20/http/in-chroot.sh index 4300f7d..d127e9c 100644 --- a/distros/alpine/3.20/http/in-chroot.sh +++ b/distros/alpine/3.20/http/in-chroot.sh @@ -54,4 +54,4 @@ virtualbox*) ;; esac -efibootmgr --bootnext "${target}" \ No newline at end of file +efibootmgr --bootnext "${target}" diff --git a/distros/alpine/3.20/qemu.sh b/distros/alpine/3.20/qemu.sh index 5a01809..eaaa81a 100644 --- a/distros/alpine/3.20/qemu.sh +++ b/distros/alpine/3.20/qemu.sh @@ -1,2 +1,2 @@ #!/usr/bin/env sh -set -ex \ No newline at end of file +set -ex diff --git a/distros/centos-stream/9/finalize.sh b/distros/centos-stream/9/finalize.sh index c256ce4..52a6d2f 100644 --- a/distros/centos-stream/9/finalize.sh +++ b/distros/centos-stream/9/finalize.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash set -ex -dnf clean all \ No newline at end of file +dnf clean all diff --git a/distros/centos/7/disc/ks.cfg b/distros/centos/7/disc/ks.cfg index 8da018b..ec7efe4 100644 --- a/distros/centos/7/disc/ks.cfg +++ b/distros/centos/7/disc/ks.cfg @@ -75,4 +75,3 @@ if [ "${virt}" == "microsoft" ]; then systemctl enable hypervvssd fi %end - diff --git a/distros/debian/10/finalize.sh b/distros/debian/10/finalize.sh index 358224e..d6899f3 100644 --- a/distros/debian/10/finalize.sh +++ b/distros/debian/10/finalize.sh @@ -17,4 +17,4 @@ if [ "${virt}" == "microsoft" ]; then systemctl enable hyperv-daemons.hv-fcopy-daemon systemctl enable hyperv-daemons.hv-kvp-daemon systemctl enable hyperv-daemons.hv-vss-daemon -fi \ No newline at end of file +fi diff --git a/distros/debian/10/http/preseed.cfg b/distros/debian/10/http/preseed.cfg index fb67199..be040a7 100644 --- a/distros/debian/10/http/preseed.cfg +++ b/distros/debian/10/http/preseed.cfg @@ -55,4 +55,4 @@ d-i preseed/late_command string chmod 440 /target/etc/sudoers.d/vagrant; \ in-target apt-get update; \ in-target apt-get upgrade -y; \ - in-target bash -c 'if [ "$(systemd-detect-virt)" == "microsoft" ]; then apt-get install -y hyperv-daemons; fi' \ No newline at end of file + in-target bash -c 'if [ "$(systemd-detect-virt)" == "microsoft" ]; then apt-get install -y hyperv-daemons; fi' diff --git a/distros/debian/11/finalize.sh b/distros/debian/11/finalize.sh index 943aaa8..35357ec 100644 --- a/distros/debian/11/finalize.sh +++ b/distros/debian/11/finalize.sh @@ -19,4 +19,4 @@ if [ "${virt}" == "microsoft" ]; then systemctl enable hv-fcopy-daemon systemctl enable hv-kvp-daemon systemctl enable hv-vss-daemon -fi \ No newline at end of file +fi diff --git a/distros/debian/11/http/preseed.cfg b/distros/debian/11/http/preseed.cfg index 9c06bbe..46d2515 100644 --- a/distros/debian/11/http/preseed.cfg +++ b/distros/debian/11/http/preseed.cfg @@ -49,4 +49,4 @@ d-i preseed/late_command string chmod 440 /target/etc/sudoers.d/vagrant; \ sed -i -e 's/ens3/ens5/g' /target/etc/network/interfaces; \ in-target apt-get update; \ - in-target apt-get upgrade -y \ No newline at end of file + in-target apt-get upgrade -y diff --git a/distros/debian/12/finalize.sh b/distros/debian/12/finalize.sh index e8a9a28..9da84aa 100644 --- a/distros/debian/12/finalize.sh +++ b/distros/debian/12/finalize.sh @@ -19,4 +19,4 @@ if [ "${virt}" == "microsoft" ]; then systemctl enable hv-fcopy-daemon systemctl enable hv-kvp-daemon systemctl enable hv-vss-daemon -fi \ No newline at end of file +fi diff --git a/distros/debian/12/http/preseed.cfg b/distros/debian/12/http/preseed.cfg index a15e0d7..302d981 100644 --- a/distros/debian/12/http/preseed.cfg +++ b/distros/debian/12/http/preseed.cfg @@ -67,4 +67,4 @@ d-i preseed/late_command string chmod 440 /target/etc/sudoers.d/vagrant; \ sed -i -e 's/ens3/ens5/g' /target/etc/network/interfaces; \ in-target apt-get update; \ - in-target apt-get upgrade -y \ No newline at end of file + in-target apt-get upgrade -y diff --git a/distros/fedora/38/amd64-ks.cfg b/distros/fedora/38/amd64-ks.cfg index d72575e..dce0c11 100644 --- a/distros/fedora/38/amd64-ks.cfg +++ b/distros/fedora/38/amd64-ks.cfg @@ -168,4 +168,3 @@ ssh-keygen -A %end ##### end kickstart post ############################################ - diff --git a/distros/fedora/39/amd64-ks.cfg b/distros/fedora/39/amd64-ks.cfg index ba67610..6eae6ee 100644 --- a/distros/fedora/39/amd64-ks.cfg +++ b/distros/fedora/39/amd64-ks.cfg @@ -180,4 +180,3 @@ chcon -R unconfined_u:object_r:user_home_t:s0 /home/vagrant/.ssh %end ##### end kickstart post ############################################ - diff --git a/distros/fedora/40/amd64-ks.cfg b/distros/fedora/40/amd64-ks.cfg index 9e19b81..af8a3b4 100644 --- a/distros/fedora/40/amd64-ks.cfg +++ b/distros/fedora/40/amd64-ks.cfg @@ -179,4 +179,3 @@ chcon -R unconfined_u:object_r:user_home_t:s0 /home/vagrant/.ssh %end ##### end kickstart post ############################################ - diff --git a/distros/fedora/41/amd64-ks.cfg b/distros/fedora/41/amd64-ks.cfg index 9e19b81..af8a3b4 100644 --- a/distros/fedora/41/amd64-ks.cfg +++ b/distros/fedora/41/amd64-ks.cfg @@ -179,4 +179,3 @@ chcon -R unconfined_u:object_r:user_home_t:s0 /home/vagrant/.ssh %end ##### end kickstart post ############################################ - diff --git a/distros/fedora/rawhide/amd64-ks.cfg b/distros/fedora/rawhide/amd64-ks.cfg index 6d5fa77..66472f2 100644 --- a/distros/fedora/rawhide/amd64-ks.cfg +++ b/distros/fedora/rawhide/amd64-ks.cfg @@ -181,4 +181,3 @@ chcon -R unconfined_u:object_r:user_home_t:s0 /home/vagrant/.ssh %end ##### end kickstart post ############################################ - diff --git a/distros/nixos/23.05/http/configuration.nix b/distros/nixos/23.05/http/configuration.nix index 3d96aa3..9ad5d11 100644 --- a/distros/nixos/23.05/http/configuration.nix +++ b/distros/nixos/23.05/http/configuration.nix @@ -1,5 +1,4 @@ { - config, pkgs, lib, ... diff --git a/distros/nixos/23.05/http/flake.nix b/distros/nixos/23.05/http/flake.nix index d3590cf..f0d8614 100644 --- a/distros/nixos/23.05/http/flake.nix +++ b/distros/nixos/23.05/http/flake.nix @@ -6,7 +6,7 @@ }; outputs = - { nixstable, self, ... }@inputs: + { nixstable, ... }: { nixosConfigurations.vagrant = nixstable.lib.nixosSystem { system = "x86_64-linux"; diff --git a/distros/nixos/23.05/http/ga-vmware.nix b/distros/nixos/23.05/http/ga-vmware.nix index 8599f81..dbedb7d 100644 --- a/distros/nixos/23.05/http/ga-vmware.nix +++ b/distros/nixos/23.05/http/ga-vmware.nix @@ -1,7 +1,7 @@ -{...}: +{ ... }: { virtualisation.vmware.guest = { enable = true; headless = false; - } -} \ No newline at end of file + }; +} diff --git a/distros/nixos/23.05/http/install.sh b/distros/nixos/23.05/http/install.sh index abd1c6c..0afef82 100644 --- a/distros/nixos/23.05/http/install.sh +++ b/distros/nixos/23.05/http/install.sh @@ -61,4 +61,4 @@ rm /mnt/root/in-chroot.sh umount /mnt/boot umount /mnt efibootmgr --bootnext "$(efibootmgr | grep Linux | awk '{print $1}' | sed -E 's/[^0-9]//g')" -reboot \ No newline at end of file +reboot diff --git a/distros/nixos/23.11/http/configuration.nix b/distros/nixos/23.11/http/configuration.nix index 5efd647..721a250 100644 --- a/distros/nixos/23.11/http/configuration.nix +++ b/distros/nixos/23.11/http/configuration.nix @@ -1,5 +1,4 @@ { - config, pkgs, lib, ... diff --git a/distros/nixos/23.11/http/flake.nix b/distros/nixos/23.11/http/flake.nix index cbda5c6..87edfe3 100644 --- a/distros/nixos/23.11/http/flake.nix +++ b/distros/nixos/23.11/http/flake.nix @@ -6,7 +6,7 @@ }; outputs = - { nixstable, self, ... }@inputs: + { nixstable, ... }: { nixosConfigurations.vagrant = nixstable.lib.nixosSystem { system = "x86_64-linux"; diff --git a/distros/nixos/23.11/http/ga-vmware.nix b/distros/nixos/23.11/http/ga-vmware.nix index 8599f81..dbedb7d 100644 --- a/distros/nixos/23.11/http/ga-vmware.nix +++ b/distros/nixos/23.11/http/ga-vmware.nix @@ -1,7 +1,7 @@ -{...}: +{ ... }: { virtualisation.vmware.guest = { enable = true; headless = false; - } -} \ No newline at end of file + }; +} diff --git a/distros/nixos/23.11/http/install.sh b/distros/nixos/23.11/http/install.sh index abd1c6c..0afef82 100644 --- a/distros/nixos/23.11/http/install.sh +++ b/distros/nixos/23.11/http/install.sh @@ -61,4 +61,4 @@ rm /mnt/root/in-chroot.sh umount /mnt/boot umount /mnt efibootmgr --bootnext "$(efibootmgr | grep Linux | awk '{print $1}' | sed -E 's/[^0-9]//g')" -reboot \ No newline at end of file +reboot diff --git a/distros/nixos/23.11/qemu.sh b/distros/nixos/23.11/qemu.sh index 087d718..4cfad53 100644 --- a/distros/nixos/23.11/qemu.sh +++ b/distros/nixos/23.11/qemu.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -set -ex \ No newline at end of file +set -ex diff --git a/distros/nixos/23.11/virtualbox.sh b/distros/nixos/23.11/virtualbox.sh index 087d718..4cfad53 100644 --- a/distros/nixos/23.11/virtualbox.sh +++ b/distros/nixos/23.11/virtualbox.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -set -ex \ No newline at end of file +set -ex diff --git a/distros/nixos/23.11/vmware.sh b/distros/nixos/23.11/vmware.sh index 087d718..4cfad53 100644 --- a/distros/nixos/23.11/vmware.sh +++ b/distros/nixos/23.11/vmware.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -set -ex \ No newline at end of file +set -ex diff --git a/distros/nixos/24.05/http/configuration.nix b/distros/nixos/24.05/http/configuration.nix index d8cb29f..8e08193 100644 --- a/distros/nixos/24.05/http/configuration.nix +++ b/distros/nixos/24.05/http/configuration.nix @@ -1,5 +1,4 @@ { - config, pkgs, lib, ... diff --git a/distros/nixos/24.05/http/flake.nix b/distros/nixos/24.05/http/flake.nix index 1dabf97..f254d66 100644 --- a/distros/nixos/24.05/http/flake.nix +++ b/distros/nixos/24.05/http/flake.nix @@ -6,7 +6,7 @@ }; outputs = - { nixstable, self, ... }@inputs: + { nixstable, ... }: { nixosConfigurations.vagrant = nixstable.lib.nixosSystem { system = "x86_64-linux"; diff --git a/distros/nixos/24.05/http/ga-vmware.nix b/distros/nixos/24.05/http/ga-vmware.nix index 8599f81..dbedb7d 100644 --- a/distros/nixos/24.05/http/ga-vmware.nix +++ b/distros/nixos/24.05/http/ga-vmware.nix @@ -1,7 +1,7 @@ -{...}: +{ ... }: { virtualisation.vmware.guest = { enable = true; headless = false; - } -} \ No newline at end of file + }; +} diff --git a/distros/nixos/24.05/http/install.sh b/distros/nixos/24.05/http/install.sh index abd1c6c..0afef82 100644 --- a/distros/nixos/24.05/http/install.sh +++ b/distros/nixos/24.05/http/install.sh @@ -61,4 +61,4 @@ rm /mnt/root/in-chroot.sh umount /mnt/boot umount /mnt efibootmgr --bootnext "$(efibootmgr | grep Linux | awk '{print $1}' | sed -E 's/[^0-9]//g')" -reboot \ No newline at end of file +reboot diff --git a/distros/nixos/24.05/qemu.sh b/distros/nixos/24.05/qemu.sh index 087d718..4cfad53 100644 --- a/distros/nixos/24.05/qemu.sh +++ b/distros/nixos/24.05/qemu.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -set -ex \ No newline at end of file +set -ex diff --git a/distros/nixos/24.05/virtualbox.sh b/distros/nixos/24.05/virtualbox.sh index 087d718..4cfad53 100644 --- a/distros/nixos/24.05/virtualbox.sh +++ b/distros/nixos/24.05/virtualbox.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -set -ex \ No newline at end of file +set -ex diff --git a/distros/nixos/24.05/vmware.sh b/distros/nixos/24.05/vmware.sh index 087d718..4cfad53 100644 --- a/distros/nixos/24.05/vmware.sh +++ b/distros/nixos/24.05/vmware.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -set -ex \ No newline at end of file +set -ex diff --git a/distros/opensuse/15.5/finalize.sh b/distros/opensuse/15.5/finalize.sh index b29f91f..92d95d3 100644 --- a/distros/opensuse/15.5/finalize.sh +++ b/distros/opensuse/15.5/finalize.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash set -ex -zypper clean -a \ No newline at end of file +zypper clean -a diff --git a/distros/opensuse/15.5/http/autoinst.xml b/distros/opensuse/15.5/http/autoinst.xml index 65753c6..a20f842 100644 --- a/distros/opensuse/15.5/http/autoinst.xml +++ b/distros/opensuse/15.5/http/autoinst.xml @@ -122,4 +122,4 @@ root ALL=(ALL) NOPASSWD: ALL https://raw.githubusercontent.com/hashicorp/vagrant/master/keys/vagrant.pub - \ No newline at end of file + diff --git a/distros/opensuse/15.5/virtualbox.sh b/distros/opensuse/15.5/virtualbox.sh index 087d718..4cfad53 100644 --- a/distros/opensuse/15.5/virtualbox.sh +++ b/distros/opensuse/15.5/virtualbox.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -set -ex \ No newline at end of file +set -ex diff --git a/distros/opensuse/15.6/finalize.sh b/distros/opensuse/15.6/finalize.sh index b29f91f..92d95d3 100644 --- a/distros/opensuse/15.6/finalize.sh +++ b/distros/opensuse/15.6/finalize.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash set -ex -zypper clean -a \ No newline at end of file +zypper clean -a diff --git a/distros/opensuse/15.6/http/autoinst.xml b/distros/opensuse/15.6/http/autoinst.xml index 65753c6..a20f842 100644 --- a/distros/opensuse/15.6/http/autoinst.xml +++ b/distros/opensuse/15.6/http/autoinst.xml @@ -122,4 +122,4 @@ root ALL=(ALL) NOPASSWD: ALL https://raw.githubusercontent.com/hashicorp/vagrant/master/keys/vagrant.pub - \ No newline at end of file + diff --git a/distros/opensuse/15.6/virtualbox.sh b/distros/opensuse/15.6/virtualbox.sh index 087d718..4cfad53 100644 --- a/distros/opensuse/15.6/virtualbox.sh +++ b/distros/opensuse/15.6/virtualbox.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -set -ex \ No newline at end of file +set -ex diff --git a/distros/opensuse/16.0/finalize.sh b/distros/opensuse/16.0/finalize.sh index b29f91f..92d95d3 100644 --- a/distros/opensuse/16.0/finalize.sh +++ b/distros/opensuse/16.0/finalize.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash set -ex -zypper clean -a \ No newline at end of file +zypper clean -a diff --git a/distros/opensuse/16.0/http/autoinst.xml b/distros/opensuse/16.0/http/autoinst.xml index 65753c6..a20f842 100644 --- a/distros/opensuse/16.0/http/autoinst.xml +++ b/distros/opensuse/16.0/http/autoinst.xml @@ -122,4 +122,4 @@ root ALL=(ALL) NOPASSWD: ALL https://raw.githubusercontent.com/hashicorp/vagrant/master/keys/vagrant.pub - \ No newline at end of file + diff --git a/distros/opensuse/16.0/virtualbox.sh b/distros/opensuse/16.0/virtualbox.sh index 087d718..4cfad53 100644 --- a/distros/opensuse/16.0/virtualbox.sh +++ b/distros/opensuse/16.0/virtualbox.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -set -ex \ No newline at end of file +set -ex diff --git a/distros/opensuse/tumbleweed/finalize.sh b/distros/opensuse/tumbleweed/finalize.sh index b29f91f..92d95d3 100644 --- a/distros/opensuse/tumbleweed/finalize.sh +++ b/distros/opensuse/tumbleweed/finalize.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash set -ex -zypper clean -a \ No newline at end of file +zypper clean -a diff --git a/distros/opensuse/tumbleweed/virtualbox.sh b/distros/opensuse/tumbleweed/virtualbox.sh index 087d718..4cfad53 100644 --- a/distros/opensuse/tumbleweed/virtualbox.sh +++ b/distros/opensuse/tumbleweed/virtualbox.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -set -ex \ No newline at end of file +set -ex diff --git a/distros/rockylinux/9/finalize.sh b/distros/rockylinux/9/finalize.sh index c256ce4..52a6d2f 100644 --- a/distros/rockylinux/9/finalize.sh +++ b/distros/rockylinux/9/finalize.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash set -ex -dnf clean all \ No newline at end of file +dnf clean all From ea21c78f58f2c252891d0fb9fe241fe1e27254e8 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Mon, 18 Nov 2024 23:47:11 -0600 Subject: [PATCH 10/11] Fix the URL for Ubuntu file --- distros/ubuntu/24.04/amd64.pkrvars.hcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distros/ubuntu/24.04/amd64.pkrvars.hcl b/distros/ubuntu/24.04/amd64.pkrvars.hcl index 0e2ae1b..e6d2b3f 100644 --- a/distros/ubuntu/24.04/amd64.pkrvars.hcl +++ b/distros/ubuntu/24.04/amd64.pkrvars.hcl @@ -1,7 +1,7 @@ distro = "ubuntu" version = "24.04" iso = { - url = "http://releases.ubuntu.com/24.04/ubuntu-24.04.01-live-server-amd64.iso" + url = "http://releases.ubuntu.com/24.04/ubuntu-24.04.1-live-server-amd64.iso" checksum = "e240e4b801f7bb68c20d1356b60968ad0c33a41d00d828e74ceb3364a0317be9" } boot_command = [ From a3eae3daf5f1e559b1b4d51d80d7264da774d83e Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 19 Nov 2024 05:57:21 +0000 Subject: [PATCH 11/11] Fix powershell mismatch --- nix/continue.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/continue.nix b/nix/continue.nix index 995425e..6f56aef 100644 --- a/nix/continue.nix +++ b/nix/continue.nix @@ -90,7 +90,7 @@ let script = [ "packer init sources" "packer build -only=\"hyperv-iso.amd64\" -var-file=\"\${distro}\" -var build=\${BUILD} -var cpus=2 -var memory=4096 \${EXCEPT} sources" - "if (-not $?) { throw \"Error in build\")" + "if (-not $?) { throw \"Error in build\" }" ]; }; };