ci.nix (2479B)
1 { 2 nixpkgs 3 , unstable 4 , liminix 5 , ... }: 6 let 7 inherit (builtins) map; 8 pkgs = (import nixpkgs {}); 9 borderVmConf = ./bordervm.conf-example.nix; 10 inherit (pkgs.lib.attrsets) genAttrs; 11 devices = [ 12 "gl-ar750" "gl-mt300n-v2" "gl-mt300a" 13 "qemu" "qemu-aarch64" "qemu-armv7l" 14 "tp-archer-ax23" 15 ]; 16 vanilla = ./vanilla-configuration.nix; 17 for-device = name: 18 (import liminix { 19 inherit nixpkgs borderVmConf; 20 device = import (liminix + "/devices/${name}"); 21 liminix-config = vanilla; 22 }).outputs.default; 23 tests = import ./tests/ci.nix; 24 jobs = 25 (genAttrs devices for-device) // 26 tests // 27 { 28 buildEnv = (import liminix { 29 inherit nixpkgs borderVmConf; 30 device = import (liminix + "/devices/qemu"); 31 liminix-config = vanilla; 32 }).buildEnv; 33 doc = 34 let json = 35 (import liminix { 36 inherit nixpkgs borderVmConf; 37 device = import (liminix + "/devices/qemu"); 38 liminix-config = {...} : { 39 imports = [ ./modules/all-modules.nix ]; 40 }; 41 }).outputs.optionsJson; 42 installers = map (f: "system.outputs.${f}") [ 43 "vmroot" 44 "mtdimage" 45 "ubimage" 46 ]; 47 inherit (pkgs.lib) concatStringsSep; 48 in pkgs.stdenv.mkDerivation { 49 name = "liminix-doc"; 50 nativeBuildInputs = with pkgs; [ 51 gnumake sphinx fennel luaPackages.lyaml 52 ]; 53 src = ./.; 54 buildPhase = '' 55 cat ${json} | fennel --correlate doc/parse-options.fnl > doc/modules-generated.rst 56 cat ${json} | fennel --correlate doc/parse-options-outputs.fnl > doc/outputs-generated.rst 57 cp ${(import ./doc/hardware.nix)} doc/hardware.rst 58 make -C doc html 59 ''; 60 installPhase = '' 61 mkdir -p $out/nix-support $out/share/doc/ 62 cd doc 63 cp *-generated.rst $out 64 ln -s ${json} $out/options.json 65 cp -a _build/html $out/share/doc/liminix 66 echo "file source-dist \"$out/share/doc/liminix\"" \ 67 > $out/nix-support/hydra-build-products 68 ''; 69 }; 70 with-unstable = (import liminix { 71 nixpkgs = unstable; 72 inherit borderVmConf; 73 device = import (liminix + "/devices/qemu"); 74 liminix-config = vanilla; 75 }).outputs.default; 76 }; 77 in jobs