112 lines
3.9 KiB
Nix
Raw Normal View History

# Build ISO image
2024-12-21 10:18:28 -05:00
# nix build --extra-experimental-features nix-command --extra-experimental-features flakes .#iso.odo
# output: result/iso/nixos.iso
# Run the ISO image
# "$(nix-build '<nixpkgs>' --no-out-link -A 'qemu')/bin/qemu-system-x86_64" \
# -accel kvm \
# -cpu host \
# -smp cores=8 \
# -m 32768 \
# -drive "file=$(nix-build '<nixpkgs>' --no-out-link -A 'OVMF.fd')/FV/OVMF.fd,if=pflash,format=raw,readonly=on" \
# -drive if=pflash,format=raw,file="/tmp/OVMF_VARS.fd" \
# -nic user,hostfwd=tcp::60022-:22 \
# -boot order=d \
# -cdrom "$(readlink -f ./result/iso/nixos.iso)" \
# -display vnc=127.0.0.1:0
#
# doas cp "$(nix-build '<nixpkgs>' --no-out-link -A 'OVMF.fd')/FV/OVMF_VARS.fd" /tmp/OVMF_VARS.fd
# doas "$(nix-build '<nixpkgs>' --no-out-link -A 'qemu')/bin/qemu-system-x86_64" -accel kvm -cpu host -smp cores=8 -m 32768 -drive "file=$(nix-build '<nixpkgs>' --no-out-link -A 'OVMF.fd')/FV/OVMF.fd,if=pflash,format=raw,readonly=on" -drive if=pflash,format=raw,file="/tmp/OVMF_VARS.fd" -nic user,hostfwd=tcp::60022-:22 -boot order=d -cdrom /persist/machine_setup/nix/configuration/result/iso/nixos.iso -display vnc=127.0.0.1:0
# Get a repl for this flake
# nix repl --expr "builtins.getFlake \"$PWD\""
# TODO maybe use `nix eval --raw .#iso.odo.outPath`
# iso.odo.isoName == "nixos.iso"
# full path = <outPath> / iso / <isoName>
2024-12-17 15:26:10 -05:00
{
description = "My system configuration";
inputs = {
impermanence.url = "github:nix-community/impermanence";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-b93b4e9b5.url = "github:NixOS/nixpkgs/b93b4e9b527904aadf52dba6ca35efde2067cbd4";
home-manager.url = "github:nix-community/home-manager/release-24.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
2024-12-22 10:58:01 -05:00
lanzaboote = {
url = "github:nix-community/lanzaboote/v0.4.1";
2024-12-23 15:44:53 -05:00
# Optional but recommended to limit the size of your system closure.
inputs.nixpkgs.follows = "nixpkgs";
};
zsh-histdb = {
url = "path:flakes/zsh-histdb";
2024-12-22 10:58:01 -05:00
# Optional but recommended to limit the size of your system closure.
inputs.nixpkgs.follows = "nixpkgs";
};
2024-12-17 15:26:10 -05:00
};
2024-12-20 22:37:44 -05:00
outputs =
{
self,
nixpkgs,
nixpkgs-unstable,
nixpkgs-b93b4e9b5,
impermanence,
home-manager,
2024-12-22 10:58:01 -05:00
lanzaboote,
2024-12-23 15:44:53 -05:00
zsh-histdb,
2024-12-20 22:37:44 -05:00
...
}@inputs:
let
2024-12-21 10:18:28 -05:00
base_x86_64_linux = rec {
2024-12-20 22:37:44 -05:00
system = "x86_64-linux";
specialArgs = {
pkgs-b93b4e9b5 = import nixpkgs-b93b4e9b5 {
inherit system;
};
pkgs-unstable = import nixpkgs-unstable {
inherit system;
};
};
2024-12-20 22:37:44 -05:00
modules = [
impermanence.nixosModules.impermanence
home-manager.nixosModules.home-manager
2024-12-22 10:58:01 -05:00
lanzaboote.nixosModules.lanzaboote
2024-12-20 22:37:44 -05:00
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
}
2024-12-23 15:44:53 -05:00
{ nixpkgs.overlays = [ zsh-histdb.overlays.default ]; }
2024-12-20 22:37:44 -05:00
./configuration.nix
];
};
2024-12-21 10:18:28 -05:00
systems = {
odo = {
main = nixpkgs.lib.nixosSystem (base_x86_64_linux // { });
iso = nixpkgs.lib.nixosSystem (
base_x86_64_linux
// {
modules = base_x86_64_linux.modules ++ [
(nixpkgs + "/nixos/modules/installer/cd-dvd/iso-image.nix")
# TODO: maybe? imports = [ "${modulesPath}/profiles/image-based-appliance.nix" ];
{
isoImage.makeEfiBootable = true;
isoImage.makeUsbBootable = true;
me.buildingIso = true;
}
];
}
);
};
};
2024-12-20 22:37:44 -05:00
in
2024-12-17 15:26:10 -05:00
{
2024-12-21 10:18:28 -05:00
nixosConfigurations.odo = systems.odo.main;
iso.odo = systems.odo.iso.config.system.build.isoImage;
2024-12-17 15:26:10 -05:00
};
}