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