refactor: read the release environment from the crate build and generate the sample machine apps

This commit is contained in:
Willem Vanhulle committed 2026-10-30 15:46:26 +01:00
1 parent 59f2b12cb8
commit d4bd3b4b76
2 files changed
+61 -74

No files matched your search

+52 -65
View File
@@ -86,51 +86,46 @@
... ...
}: }:
let let
runSampleMachine = machineName: description: { shellScriptApp = name: description: scriptArgs: {
type = "app";
meta.description = "Boot the ${machineName} sample machine in QEMU: ${description}";
program = lib.getExe (vmTests.nixosSystemFor system machineName).config.system.build.vm;
};
runReleasePlzOnCodeberg = subcommand: description: {
type = "app"; type = "app";
meta.description = description; meta.description = description;
program = lib.getExe ( program = lib.getExe (pkgs.writeShellApplication ({ inherit name; } // scriptArgs));
pkgs.writeShellApplication {
name = "release-plz-${subcommand}";
runtimeInputs = [
pkgs.release-plz
pkgs.gitMinimal
pkgs.pkg-config
pkgs.stdenv.cc
rustToolchain
];
text = ''
export PKG_CONFIG_PATH="${
lib.makeSearchPathOutput "dev" "lib/pkgconfig" [
pkgs.dbus
pkgs.systemd
]
}"
exec release-plz ${subcommand} --forge gitea --git-token "$CODEBERG_TOKEN"
'';
}
);
}; };
sampleMachineApps = lib.mapAttrs' (
machineName: machineDescription:
lib.nameValuePair "sample-vm-${machineName}" {
type = "app";
meta.description = "Boot the ${machineName} sample machine in QEMU: ${machineDescription}";
program = lib.getExe (vmTests.nixosSystemFor system machineName).config.system.build.vm;
}
) vmTests.machineDescriptions;
releasePlzOnCodeberg =
subcommand: description:
shellScriptApp "release-plz-${subcommand}" description {
runtimeInputs = [
pkgs.release-plz
pkgs.gitMinimal
pkgs.pkg-config
pkgs.stdenv.cc
rustToolchain
];
runtimeEnv.PKG_CONFIG_PATH =
lib.makeSearchPathOutput "dev" "lib/pkgconfig"
builds.bootvine.buildInputs;
text = ''exec release-plz ${subcommand} --forge gitea --git-token "$CODEBERG_TOKEN"'';
};
in in
{ sampleMachineApps
release-plz-release = runReleasePlzOnCodeberg "release" "Publish unpublished versions to crates.io and tag them with a Codeberg release"; // {
release-plz-release-pr = runReleasePlzOnCodeberg "release-pr" "Open or update the Codeberg pull request that bumps the version and changelog"; release-plz-release = releasePlzOnCodeberg "release" "Publish unpublished versions to crates.io and tag them with a Codeberg release";
sample-vm-slow-services = runSampleMachine "slow-services" "slow and failing units, a held initrd probe and a greetd login"; release-plz-release-pr = releasePlzOnCodeberg "release-pr" "Open or update the Codeberg pull request that bumps the version and changelog";
sample-vm-text-console = runSampleMachine "text-console" "the slow units without a display manager, handing over at the default target";
sample-vm-scripted-initrd = runSampleMachine "scripted-initrd" "the slow units with the scripted initrd, so bootvine starts in stage 2"; record-screencasts =
sample-vm-encrypted-volume = runSampleMachine "encrypted-volume" "a LUKS volume unlocked in the initrd with the passphrase 'sample passphrase'"; shellScriptApp "record-screencasts"
sample-vm-failures = runSampleMachine "failures" "units that fail in every way systemd reports, each with journal messages"; "Re-record the scripted demo animations and the sample machine recordings into recordings/"
record-screencasts = { {
type = "app";
meta.description = "Re-record the scripted demo animations and the sample machine recordings into recordings/";
program = lib.getExe (
pkgs.writeShellApplication {
name = "record-screencasts";
runtimeInputs = [ runtimeInputs = [
pkgs.vhs pkgs.vhs
pkgs.libwebp pkgs.libwebp
@@ -142,34 +137,26 @@
lib.mapAttrs (machineName: _: self.checks.${system}."vm-${machineName}") vmTests.machines lib.mapAttrs (machineName: _: self.checks.${system}."vm-${machineName}") vmTests.machines
) )
}"; }";
} };
);
}; build-and-push-to-cachix =
build-and-push-to-cachix = { shellScriptApp "build-and-push-to-cachix"
type = "app"; "Build flake outputs and push everything built to the wvhulle Cachix cache"
meta.description = "Build flake outputs and push everything built to the wvhulle Cachix cache"; {
program = lib.getExe (
pkgs.writeShellApplication {
name = "build-and-push-to-cachix";
runtimeInputs = [ pkgs.cachix ]; runtimeInputs = [ pkgs.cachix ];
text = ''exec cachix watch-exec wvhulle -- nix build --print-build-logs "$@"''; text = ''exec cachix watch-exec wvhulle -- nix build --print-build-logs "$@"'';
} };
);
}; check-conventional-commits =
check-conventional-commits = { shellScriptApp "check-conventional-commits"
type = "app"; "Check that the commit messages in a git revision range are conventional commits"
meta.description = "Check that the commit messages in a git revision range are conventional commits"; {
program = lib.getExe (
pkgs.writeShellApplication {
name = "check-conventional-commits";
runtimeInputs = [ runtimeInputs = [
pkgs.convco pkgs.convco
pkgs.gitMinimal pkgs.gitMinimal
]; ];
text = ''exec convco check "$@"''; text = ''exec convco check "$@"'';
} };
);
};
} }
); );
@@ -180,9 +167,9 @@
bootvine-build = builds.bootvine; bootvine-build = builds.bootvine;
repo-tasks-build = builds.repo-tasks; repo-tasks-build = builds.repo-tasks;
} }
// lib.mapAttrs' ( // lib.mapAttrs' (machineName: check: lib.nameValuePair "vm-${machineName}" check) (
machineName: check: lib.nameValuePair "vm-${machineName}" check vmTests.checksFor pkgs
) (vmTests.checksFor pkgs) )
); );
devShells = forEachSystem ( devShells = forEachSystem (
+9 -9
View File
@@ -9,18 +9,18 @@ let
networking.hostName = "bootvine-${machineName}"; networking.hostName = "bootvine-${machineName}";
}; };
machineNames = [ machineDescriptions = {
"slow-services" slow-services = "slow and failing units, a held initrd probe and a greetd login";
"text-console" text-console = "the slow units without a display manager, handing over at the default target";
"scripted-initrd" scripted-initrd = "the slow units with the scripted initrd, so bootvine starts in stage 2";
"encrypted-volume" encrypted-volume = "a LUKS volume unlocked in the initrd with the passphrase 'sample passphrase'";
"failures" failures = "units that fail in every way systemd reports, each with journal messages";
]; };
machines = lib.genAttrs machineNames machineModule; machines = lib.mapAttrs (machineName: _: machineModule machineName) machineDescriptions;
in in
{ {
inherit machines; inherit machines machineDescriptions;
sampleUnits = import ./slow-services/sample-units.nix; sampleUnits = import ./slow-services/sample-units.nix;