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