From 60098412035873d6635581e6b305d1a9c3f46387 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Sun, 15 Dec 2024 18:06:15 -0500 Subject: [PATCH] hosts: add iso This makes it possible to build a custom NixOS installer iso with the tools I want. Ideally I get to a point where I can use the iso like a live cd with Hyprland and/or dwm installed with everything already configured. Build the iso with the following command: ``` nix build .#nixosConfigurations.iso.config.system.build.isoImage ``` Then, use qemu to test the iso: ``` qemu-system-x86_64 -enable-kvm -m 256 -cdrom ./result/iso/nixos-* ``` --- flake.nix | 6 ++++++ hosts/iso/configuration.nix | 13 +++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 hosts/iso/configuration.nix diff --git a/flake.nix b/flake.nix index 049b7283..c67f61b2 100644 --- a/flake.nix +++ b/flake.nix @@ -84,6 +84,12 @@ specialArgs.nix-config = self; modules = listFilesRecursive ./hosts/phone; }; + + iso = nixosSystem { + system = "x86_64-linux"; + specialArgs.nix-config = self; + modules = listFilesRecursive ./hosts/iso; + }; }; formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style); diff --git a/hosts/iso/configuration.nix b/hosts/iso/configuration.nix new file mode 100644 index 00000000..f2d36d89 --- /dev/null +++ b/hosts/iso/configuration.nix @@ -0,0 +1,13 @@ +{ pkgs, modulesPath, ... }: + +{ + imports = [ + (modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix") + ]; + + environment.systemPackages = with pkgs; [ + neovim + ]; + + isoImage.squashfsCompression = "gzip -Xcompression-level 1"; +}