liminix/ci.nix

77 lines
2.5 KiB
Nix
Raw Normal View History

2023-01-29 21:42:53 +00:00
{
2023-02-05 22:38:21 +00:00
nixpkgs
, unstable
, liminix
, ... }:
let
inherit (builtins) map;
pkgs = (import nixpkgs {});
2023-02-20 17:46:07 +00:00
borderVmConf = ./bordervm.conf-example.nix;
2023-02-05 22:38:21 +00:00
inherit (pkgs.lib.attrsets) genAttrs;
2023-09-20 20:03:51 +00:00
devices = {
2023-11-05 20:56:25 +00:00
virt = [ "qemu" "qemu-aarch64" "qemu-armv7l" ];
2023-09-20 20:03:51 +00:00
hw = [ "gl-ar750" "gl-mt300n-v2" "gl-mt300a" ];
};
2023-02-05 22:38:21 +00:00
vanilla = ./vanilla-configuration.nix;
2023-09-20 20:03:51 +00:00
for-device = cfg: name:
2023-02-05 22:38:21 +00:00
(import liminix {
2023-02-20 17:46:07 +00:00
inherit nixpkgs borderVmConf;
2023-02-05 22:38:21 +00:00
device = import (liminix + "/devices/${name}");
2023-09-20 20:03:51 +00:00
liminix-config = cfg;
2023-02-05 22:38:21 +00:00
}).outputs.default;
tests = import ./tests/ci.nix;
jobs =
2023-09-20 20:03:51 +00:00
(genAttrs devices.hw (name: for-device ./vanilla-configuration-hw.nix name)) //
(genAttrs devices.virt (name: for-device vanilla name)) //
tests //
{
buildEnv = (import liminix {
inherit nixpkgs borderVmConf;
device = import (liminix + "/devices/qemu");
liminix-config = vanilla;
}).buildEnv;
doc =
let json =
(import liminix {
inherit nixpkgs borderVmConf;
device = import (liminix + "/devices/qemu");
liminix-config = {...} : {
imports = [ ./modules/all-modules.nix ];
};
}).outputs.optionsJson;
2023-11-09 22:43:50 +00:00
installers = map (f: "system.outputs.${f}") [
"vmroot"
"flashimage"
];
inherit (pkgs.lib) concatStringsSep;
in pkgs.stdenv.mkDerivation {
name = "liminix-doc";
nativeBuildInputs = with pkgs; [
gnumake sphinx fennel luaPackages.lyaml
];
src = ./.;
buildPhase = ''
cat ${json} | fennel --correlate doc/parse-options.fnl > doc/modules-generated.rst
2023-11-09 22:43:50 +00:00
cat ${json} | fennel --correlate doc/parse-options-outputs.fnl ${concatStringsSep " " installers} > doc/installers-generated.rst
cp ${(import ./doc/hardware.nix)} doc/hardware.rst
make -C doc html
'';
installPhase = ''
mkdir -p $out/nix-support $out/share/doc/
cd doc
cp *-generated.rst $out
ln -s ${json} $out/options.json
cp -a _build/html $out/share/doc/liminix
echo "file source-dist \"$out/share/doc/liminix\"" \
> $out/nix-support/hydra-build-products
'';
2023-05-21 19:53:05 +00:00
};
2023-02-05 22:38:21 +00:00
with-unstable = (import liminix {
nixpkgs = unstable;
2023-02-20 17:46:07 +00:00
inherit borderVmConf;
2023-02-05 22:38:21 +00:00
device = import (liminix + "/devices/qemu");
liminix-config = vanilla;
}).outputs.default;
};
in jobs