Merge branch 'packer/cached-converter' into 'master'
[xonotic/xonotic.git] / derivation.nix
index 945f39ac05fbfe2ba1758168f0fbebcfe5fb4a64..d0365715ca9a234943b3715607b1d4d1365de7e6 100644 (file)
@@ -1,6 +1,7 @@
 # nix-shell -A shell
 # nix-shell -A shell
-# nix-build -A xonotic
+# ./nix-build.sh -A xonotic
 # --argstr cc clang
 # --argstr cc clang
+# for it in $(./nix-build.sh -A dockerImage --no-out-link); do docker load -i $it; done
 {
     pkgs, lib,
     cc ? null,
 {
     pkgs, lib,
     cc ? null,
 let
     VERSION = "0.8.2";
 
 let
     VERSION = "0.8.2";
 
-    stdenv = if (cc == null) then pkgs.stdenv
-        else pkgs.overrideCC pkgs.stdenv pkgs."${cc}";
+    x = {
+        # https://gitlab.com/xonotic/xonotic
+        srcs."xonotic" = localFilesMain ./.;
+        vers."xonotic" = "${VERSION}";
 
 
-    cleanSourceFilter = name: type: let
-        baseName = baseNameOf (toString name);
-        result = (lib.cleanSourceFilter name type)
-            && !(lib.hasSuffix ".nix" baseName)
-            && !(type == "directory" && baseName == ".git")
-            && !(type == "directory" && baseName == ".idea")
-            && !(type == "directory" && (lib.hasPrefix "cmake-build-" baseName))
-        ;
-    in result;
+        srcs."data/font-dejavu" = localFiles ./data/font-dejavu.pk3dir;
+        vers."data/font-dejavu" = "xonotic-${VERSION}";
 
 
-    localFilesCustom = src: filter:
-        builtins.filterSource (name: type: (cleanSourceFilter name type) && (filter name type)) src
-    ;
-    localFiles = src: localFilesCustom src (name: type: true);
+        srcs."data/font-nimbussansl" = localFiles ./data/font-nimbussansl.pk3dir;
+        vers."data/font-nimbussansl" = "xonotic-${VERSION}";
+
+        srcs."data/font-unifont" = localFiles ./data/font-unifont.pk3dir;
+        vers."data/font-unifont" = "xonotic-${VERSION}";
+
+        srcs."data/font-xolonium" = localFiles ./data/font-xolonium.pk3dir;
+        vers."data/font-xolonium" = "xonotic-${VERSION}";
+
+
+        # https://gitlab.com/xonotic/d0_blind_id
+        srcs."d0_blind_id" = localFiles ./d0_blind_id;
+        vers."d0_blind_id" = "xonotic-${VERSION}";
+
+
+        # https://gitlab.com/xonotic/darkplaces
+        srcs."darkplaces" = localFiles ./darkplaces;
+        vers."darkplaces" = "xonotic-${VERSION}";
+
+
+        # https://gitlab.com/xonotic/gmqcc
+        srcs."gmqcc" = localFiles ./gmqcc;
+        vers."gmqcc" = "xonotic-${VERSION}";
+
+
+        # https://gitlab.com/xonotic/netradiant
+        srcs."netradiant" = localFiles ./netradiant;
+        vers."netradiant" = "xonotic-${VERSION}";
+
+
+        # https://gitlab.com/xonotic/xonotic-data.pk3dir
+        srcs."data/xonotic-data" = localFilesCustom ./data/xonotic-data.pk3dir (name: type: type == "directory" || !(isCode name));
+        vers."data/xonotic-data" = builtins.getEnv "VERSION_data_xonotic_data_pk3dir";
+
+        srcs."data/xonotic-data/qcsrc" = localFilesCustom ./data/xonotic-data.pk3dir (name: type: type == "directory" || (isCode name));
+        vers."data/xonotic-data/qcsrc" = vers."data/xonotic-data";
+
+
+        # https://gitlab.com/xonotic/xonotic-maps.pk3dir
+        srcs."data/xonotic-maps" = localFiles ./data/xonotic-maps.pk3dir;
+        vers."data/xonotic-maps" = "${VERSION}";
+
+        # https://gitlab.com/xonotic/xonotic-music.pk3dir
+        srcs."data/xonotic-music" = localFiles ./data/xonotic-music.pk3dir;
+        vers."data/xonotic-music" = "${VERSION}";
+
+        # https://gitlab.com/xonotic/xonotic-nexcompat.pk3dir
+        srcs."data/xonotic-nexcompat" = localFiles ./data/xonotic-nexcompat.pk3dir;
+        vers."data/xonotic-nexcompat" = "${VERSION}";
+    };
+    inherit (x) srcs vers;
 
     localFilesMain = src: let
         project = toString ./.;
 
     localFilesMain = src: let
         project = toString ./.;
@@ -47,58 +90,51 @@ let
 
     isCode = name: let
         baseName = baseNameOf (toString name);
 
     isCode = name: let
         baseName = baseNameOf (toString name);
-        result = false
-            || (lib.hasSuffix ".txt" baseName)
-            || (lib.hasSuffix ".cmake" baseName)
-            || (lib.hasSuffix ".in" baseName)
-            || (lib.hasSuffix ".sh" baseName)
-
-            || (lib.hasSuffix ".qc" baseName)
-            || (lib.hasSuffix ".qh" baseName)
-            || (lib.hasSuffix ".inc" baseName)
-
-            || (lib.hasSuffix ".cfg" baseName)
-        ;
+        result = !(false
+            || (lib.hasSuffix ".ase" baseName)
+            || (lib.hasSuffix ".dem" baseName)
+            || (lib.hasSuffix ".dpm" baseName)
+            || (lib.hasSuffix ".framegroups" baseName)
+            || (lib.hasSuffix ".iqm" baseName)
+            || (lib.hasSuffix ".jpg" baseName)
+            || (lib.hasSuffix ".lmp" baseName)
+            || (lib.hasSuffix ".md3" baseName)
+            || (lib.hasSuffix ".mdl" baseName)
+            || (lib.hasSuffix ".obj" baseName)
+            || (lib.hasSuffix ".ogg" baseName)
+            || (lib.hasSuffix ".png" baseName)
+            || (lib.hasSuffix ".shader" baseName)
+            || (lib.hasSuffix ".skin" baseName)
+            || (lib.hasSuffix ".sounds" baseName)
+            || (lib.hasSuffix ".sp2" baseName)
+            || (lib.hasSuffix ".spr" baseName)
+            || (lib.hasSuffix ".spr32" baseName)
+            || (lib.hasSuffix ".svg" baseName)
+            || (lib.hasSuffix ".tga" baseName)
+            || (lib.hasSuffix ".wav" baseName)
+            || (lib.hasSuffix ".width" baseName)
+            || (lib.hasSuffix ".zym" baseName)
+        );
     in result;
 
     in result;
 
-    srcs = {
-        # https://gitlab.com/xonotic/xonotic
-        "xonotic" = localFilesMain ./.;
-        "data/font-dejavu" = localFiles ./data/font-dejavu.pk3dir;
-        "data/font-nimbussansl" = localFiles ./data/font-nimbussansl.pk3dir;
-        "data/font-unifont" = localFiles ./data/font-unifont.pk3dir;
-        "data/font-xolonium" = localFiles ./data/font-xolonium.pk3dir;
-
-        # https://gitlab.com/xonotic/d0_blind_id
-        "d0_blind_id" = localFiles ./d0_blind_id;
+    pk3 = drv: mkDerivation {
+        name = "${drv.name}.pk3";
+        version = drv.version;
 
 
-        # https://gitlab.com/xonotic/darkplaces
-        "darkplaces" = localFiles ./darkplaces;
-
-        # https://gitlab.com/xonotic/gmqcc
-        "gmqcc" = localFiles ./gmqcc;
-
-        # https://gitlab.com/xonotic/netradiant
-        "netradiant" = localFiles ./netradiant;
-
-        # https://gitlab.com/xonotic/xonotic-data.pk3dir
-        "data/xonotic-data" = localFilesCustom ./data/xonotic-data.pk3dir (name: type: type == "directory" || !(isCode name));
-        "data/xonotic-data/qcsrc" = localFilesCustom ./data/xonotic-data.pk3dir (name: type: type == "directory" || (isCode name));
+        nativeBuildInputs = with pkgs; [
+            zip
+        ];
 
 
-        # https://gitlab.com/xonotic/xonotic-maps.pk3dir
-        "data/xonotic-maps" = localFiles ./data/xonotic-maps.pk3dir;
-
-        # https://gitlab.com/xonotic/xonotic-music.pk3dir
-        "data/xonotic-music" = localFiles ./data/xonotic-music.pk3dir;
-
-        # https://gitlab.com/xonotic/xonotic-nexcompat.pk3dir
-        "data/xonotic-nexcompat" = localFiles ./data/xonotic-nexcompat.pk3dir;
+        phases = [ "installPhase" ];
+        installPhase = ''
+            (cd ${drv} && zip -r ${drv.pk3args or ""} $out .)
+        '';
     };
 
     targets = rec {
         font-dejavu = mkDerivation rec {
             name = "font-dejavu-${version}";
     };
 
     targets = rec {
         font-dejavu = mkDerivation rec {
             name = "font-dejavu-${version}";
-            version = VERSION;
+            version = vers."data/font-dejavu";
 
             src = srcs."data/font-dejavu";
 
 
             src = srcs."data/font-dejavu";
 
@@ -110,7 +146,7 @@ let
 
         font-nimbussansl = mkDerivation rec {
             name = "font-nimbussansl-${version}";
 
         font-nimbussansl = mkDerivation rec {
             name = "font-nimbussansl-${version}";
-            version = VERSION;
+            version = vers."data/font-nimbussansl";
 
             src = srcs."data/font-nimbussansl";
 
 
             src = srcs."data/font-nimbussansl";
 
@@ -122,7 +158,7 @@ let
 
         font-unifont = mkDerivation rec {
             name = "font-unifont-${version}";
 
         font-unifont = mkDerivation rec {
             name = "font-unifont-${version}";
-            version = VERSION;
+            version = vers."data/font-unifont";
 
             src = srcs."data/font-unifont";
 
 
             src = srcs."data/font-unifont";
 
@@ -134,7 +170,7 @@ let
 
         font-xolonium = mkDerivation rec {
             name = "font-xolonium-${version}";
 
         font-xolonium = mkDerivation rec {
             name = "font-xolonium-${version}";
-            version = VERSION;
+            version = vers."data/font-xolonium";
 
             src = srcs."data/font-xolonium";
 
 
             src = srcs."data/font-xolonium";
 
@@ -146,7 +182,7 @@ let
 
         d0_blind_id = mkDerivation rec {
             name = "d0_blind_id-${version}";
 
         d0_blind_id = mkDerivation rec {
             name = "d0_blind_id-${version}";
-            version = "xonotic-${VERSION}";
+            version = vers."d0_blind_id";
 
             src = srcs."d0_blind_id";
 
 
             src = srcs."d0_blind_id";
 
@@ -160,17 +196,20 @@ let
 
             installPhase = ''
                 mkdir -p $out/lib
 
             installPhase = ''
                 mkdir -p $out/lib
+                mkdir -p $out/include/d0_blind_id
+
                 cp libd0_blind_id.so $out/lib
                 cp libd0_blind_id.so $out/lib
+                (cd $src; cp d0.h d0_blind_id.h $out/include/d0_blind_id)
 
 
-                mkdir -p $out/include/d0_blind_id
-                (cd $src; cp d0_blind_id.h d0.h $out/include/d0_blind_id)
+                cp libd0_rijndael.so $out/lib
+                (cd $src; cp d0_rijndael.h $out/include/d0_blind_id)
             '';
         };
 
         darkplaces = let
             unwrapped = mkDerivation rec {
                 name = "darkplaces-unwrapped-${version}";
             '';
         };
 
         darkplaces = let
             unwrapped = mkDerivation rec {
                 name = "darkplaces-unwrapped-${version}";
-                version = "xonotic-${VERSION}";
+                version = vers."darkplaces";
 
                 src = srcs."darkplaces";
 
 
                 src = srcs."darkplaces";
 
@@ -192,7 +231,7 @@ let
             };
             result = mkDerivation rec {
                 name = "darkplaces-${version}";
             };
             result = mkDerivation rec {
                 name = "darkplaces-${version}";
-                version = "xonotic-${VERSION}";
+                version = vers."darkplaces";
 
                 buildInputs = unwrapped.buildInputs ++ runtimeInputs;
                 runtimeInputs = with pkgs; [
 
                 buildInputs = unwrapped.buildInputs ++ runtimeInputs;
                 runtimeInputs = with pkgs; [
@@ -219,14 +258,12 @@ let
                     chmod +w bin/*
                     cd bin
 
                     chmod +w bin/*
                     cd bin
 
-                    for exe in darkplaces-sdl; do
-                        rpath=$(patchelf --print-rpath $exe)
-                        rpath=''${rpath:+$rpath:}${lib.makeLibraryPath runtimeInputs}
-                        patchelf --set-rpath $rpath $exe
-                    done
-
                     for exe in dedicated sdl; do
                     for exe in dedicated sdl; do
-                        cp darkplaces-$exe $out/bin/xonotic-linux64-$exe
+                        f=darkplaces-$exe
+                        rpath=$(patchelf --print-rpath $f)
+                        rpath=''${rpath:+$rpath:}${lib.makeLibraryPath runtimeInputs}
+                        patchelf --set-rpath $rpath $f
+                        cp $f $out/bin/xonotic-linux64-$exe
                     done
                 '';
             };
                     done
                 '';
             };
@@ -234,7 +271,7 @@ let
 
         gmqcc = mkDerivation rec {
             name = "gmqcc-${version}";
 
         gmqcc = mkDerivation rec {
             name = "gmqcc-${version}";
-            version = "xonotic-${VERSION}";
+            version = vers."gmqcc";
 
             src = srcs."gmqcc";
 
 
             src = srcs."gmqcc";
 
@@ -250,7 +287,7 @@ let
 
         netradiant = mkDerivation rec {
             name = "netradiant-${version}";
 
         netradiant = mkDerivation rec {
             name = "netradiant-${version}";
-            version = VERSION;
+            version = vers."netradiant";
 
             src = srcs."netradiant";
 
 
             src = srcs."netradiant";
 
@@ -286,7 +323,7 @@ let
 
         xonotic-data = mkDerivation rec {
             name = "xonotic-data-${version}";
 
         xonotic-data = mkDerivation rec {
             name = "xonotic-data-${version}";
-            version = "xonotic-${VERSION}";
+            version = vers."data/xonotic-data";
 
             src = srcs."data/xonotic-data";
 
 
             src = srcs."data/xonotic-data";
 
@@ -301,12 +338,13 @@ let
 
         xonotic-data-code = mkDerivation rec {
             name = "xonotic-data-code-${version}";
 
         xonotic-data-code = mkDerivation rec {
             name = "xonotic-data-code-${version}";
-            version = "xonotic-${VERSION}";
+            version = vers."data/xonotic-data/qcsrc";
 
             src = srcs."data/xonotic-data/qcsrc";
 
             env = {
                 QCC = "${gmqcc}/bin/gmqcc";
 
             src = srcs."data/xonotic-data/qcsrc";
 
             env = {
                 QCC = "${gmqcc}/bin/gmqcc";
+                VERSION = version;
             };
 
             nativeBuildInputs = with pkgs; [
             };
 
             nativeBuildInputs = with pkgs; [
@@ -319,13 +357,93 @@ let
                 cp -r $src/. $out
                 chmod -R +w $out
                 cp {menu,progs,csprogs}.{dat,lno} $out
                 cp -r $src/. $out
                 chmod -R +w $out
                 cp {menu,progs,csprogs}.{dat,lno} $out
+                cp csprogs-${version}.{dat,lno,txt} $out/.tmp
                 find $out -depth -type d -empty -exec rmdir {} \;
             '';
                 find $out -depth -type d -empty -exec rmdir {} \;
             '';
+
+            passthru.csprogs = pkgs.runCommand "xonotic-data-csprogs-${version}" { inherit version; pk3name = "csprogs-${version}"; } ''
+                mkdir $out
+                cp ${xonotic-data-code}/.tmp/csprogs-${version}.{dat,lno,txt} $out
+            '';
+        };
+
+        # todo: build
+        xonotic-maps = mkDerivation rec {
+            name = "xonotic-maps-${version}";
+            version = vers."data/xonotic-maps";
+
+            src = srcs."data/xonotic-maps";
+
+            phases = [ "installPhase" ];
+            installPhase = ''
+                mkdir $out
+                cp -r $src/. $out
+            '';
+
+            passthru.dance = mkDerivation rec {
+                name = "dance";
+                version = vers."data/xonotic-maps";
+
+                src = pkgs.fetchurl {
+                    url = http://beta.xonotic.org/autobuild-bsp/dance-full-88c416b8c11bdcecfdb889af2a2b97b4c0e2b8de-319ee7234504199da56f07ce25185f6d6cb889cd.pk3;
+                    sha256 = "1jgdg4mz56kbxcy3mwn4h5qlf3ahm1cmarp9l70fz9nfn6cnaknq";
+                };
+
+                phases = [ "installPhase" ];
+
+                installPhase = ''
+                    mkdir -p $out
+                    cd $out
+                    ${pkgs.unzip}/bin/unzip $src
+                '';
+            };
+        };
+
+        xonotic-music = mkDerivation rec {
+            name = "xonotic-music-${version}";
+            version = vers."data/xonotic-music";
+
+            src = srcs."data/xonotic-music";
+
+            phases = [ "installPhase" ];
+            installPhase = ''
+                mkdir $out
+                cp -r $src/. $out
+            '';
+
+            passthru.pk3args = "-0";
+        };
+
+        xonotic-nexcompat = mkDerivation rec {
+            name = "xonotic-nexcompat-${version}";
+            version = vers."data/xonotic-nexcompat";
+
+            src = srcs."data/xonotic-nexcompat";
+
+            phases = [ "installPhase" ];
+            installPhase = ''
+                mkdir $out
+                cp -r $src/. $out
+            '';
+        };
+
+        xonotic-keys = mkDerivation rec {
+            name = "xonotic-keys-${version}";
+            version = vers."xonotic";
+
+            src = srcs."xonotic";
+
+            phases = [ "installPhase" ];
+
+            installPhase = ''
+                mkdir $out
+                cp $src/*.d0pk $out
+            '';
         };
 
         xonotic = mkDerivation rec {
             name = "xonotic-${version}";
         };
 
         xonotic = mkDerivation rec {
             name = "xonotic-${version}";
-            version = VERSION;
+            version = vers."xonotic";
 
             src = srcs."xonotic";
 
 
             src = srcs."xonotic";
 
@@ -333,33 +451,120 @@ let
                 XON_NO_DAEMON = "1";
             };
 
                 XON_NO_DAEMON = "1";
             };
 
+            passthru.paks = {
+                inherit
+                    font-dejavu
+                    font-nimbussansl
+                    font-unifont
+                    font-xolonium
+                    xonotic-data
+                    xonotic-data-code
+                    xonotic-maps
+                    xonotic-music
+                    xonotic-nexcompat
+                ;
+                xonotic-data-csprogs = xonotic-data-code.passthru.csprogs;
+                inherit (xonotic-maps)
+                    dance
+                ;
+            };
+
             phases = [ "installPhase" ];
 
             phases = [ "installPhase" ];
 
-            # test: `ln -s`
-            # release: `cp -r`
             installPhase = ''
                 mkdir $out
                 cp -r $src/. $out
                 cp ${darkplaces}/bin/* $out
 
                 mkdir -p $out/data
             installPhase = ''
                 mkdir $out
                 cp -r $src/. $out
                 cp ${darkplaces}/bin/* $out
 
                 mkdir -p $out/data
-                ln -s ${font-dejavu} $out/data/font-dejavu.pk3dir
-                ln -s ${font-nimbussansl} $out/data/font-nimbussansl.pk3dir
-                ln -s ${font-unifont} $out/data/font-unifont.pk3dir
-                ln -s ${font-xolonium} $out/data/font-xolonium.pk3dir
-
-                ln -s ${xonotic-data} $out/data/xonotic-data.pk3dir
-                ln -s ${xonotic-data-code} $out/data/xonotic-data-code.pk3dir
-                ln -s ${srcs."data/xonotic-maps"} $out/data/xonotic-maps.pk3dir # todo: build
-                ln -s ${srcs."data/xonotic-music"} $out/data/xonotic-music.pk3dir
-                ln -s ${srcs."data/xonotic-nexcompat"} $out/data/xonotic-nexcompat.pk3dir
+                ${lib.concatStringsSep "\n" (lib.mapAttrsToList (k: v:
+                    # "cp ${pk3 v} $out/data/${k}.pk3"
+                    "ln -s ${v} $out/data/${k}.pk3dir"
+                ) passthru.paks)}
 
                 mkdir -p $out/mapping
                 ln -s ${netradiant} $out/mapping/${netradiant.name}
             '';
         };
 
                 mkdir -p $out/mapping
                 ln -s ${netradiant} $out/mapping/${netradiant.name}
             '';
         };
+
+        dockerImage = let
+            main = pkgs.dockerTools.buildImage {
+                name = "xonotic";
+                tag = VERSION;
+                contents = mkDerivation {
+                    name = "xonotic-init";
+                    phases = [ "installPhase" ];
+                    installPhase = ''
+                        mkdir -p $out
+                        cat > $out/init <<EOF
+                        #!${stdenv.shell}
+                        ${pkgs.coreutils}/bin/ln -s ${xonotic-keys}/* /
+
+                        ${pkgs.coreutils}/bin/ls -l /
+                        ${pkgs.coreutils}/bin/ls -l /data
+
+                        exec ${darkplaces}/bin/xonotic-linux64-dedicated "\''${@}"
+                        EOF
+                        chmod +x $out/init
+                    '';
+                };
+                config.Entrypoint = "/init";
+            };
+            unpackImage = { name, from, to }: pkgs.dockerTools.buildImage {
+                name = "xonotic_${name}";
+                tag = VERSION;
+                contents = mkDerivation {
+                    name = "xonotic-${name}-init";
+                    phases = [ "installPhase" ];
+                    installPhase = ''
+                        mkdir -p $out
+                        cat > $out/init <<EOF
+                        #!${stdenv.shell}
+                        ${pkgs.coreutils}/bin/cp -r ${from} /data/${to}
+                        EOF
+                        chmod +x $out/init
+                    '';
+                };
+                config.Entrypoint = "/init";
+                fromImage = pkgs.dockerTools.buildImage {
+                    name = "xonotic_deps";
+                    contents = mkDerivation {
+                        name = "xonotic_deps";
+                        phases = [ "installPhase" ];
+                        installPhase = ''
+                            mkdir -p $out
+                            cat > $out/init <<EOF
+                            ${stdenv.shell}
+                            ${pkgs.coreutils}
+                            EOF
+                        '';
+                    };
+                };
+            };
+        in { main = main; }
+            // (lib.mapAttrs (k: v: unpackImage { name = k; from = pk3 v; to = "${v.pk3name or k}.pk3"; }) xonotic.paks)
+        ;
     };
 
     };
 
+    cleanSourceFilter = name: type: let
+        baseName = baseNameOf (toString name);
+        result = (lib.cleanSourceFilter name type)
+            && !(lib.hasSuffix ".nix" baseName)
+            && !(type == "directory" && baseName == ".git")
+            && !(type == "directory" && baseName == ".idea")
+            && !(type == "directory" && (lib.hasPrefix "cmake-build-" baseName))
+        ;
+    in result;
+
+    localFilesCustom = src: filter:
+        builtins.filterSource (name: type: (cleanSourceFilter name type) && (filter name type)) src
+    ;
+
+    localFiles = src: localFilesCustom src (name: type: true);
+
+    stdenv = if (cc == null) then pkgs.stdenv
+            else pkgs.overrideCC pkgs.stdenv pkgs."${cc}";
+
     mkDerivation = {env ? {}, shellHook ? "", runtimeInputs ? [], ...}@args: stdenv.mkDerivation ({}
         // { enableParallelBuilding = true; }
         // (removeAttrs args ["env" "shellHook" "runtimeInputs"])
     mkDerivation = {env ? {}, shellHook ? "", runtimeInputs ? [], ...}@args: stdenv.mkDerivation ({}
         // { enableParallelBuilding = true; }
         // (removeAttrs args ["env" "shellHook" "runtimeInputs"])
@@ -372,10 +577,11 @@ let
             '';
         }
     );
             '';
         }
     );
-    shell = let inputs = (lib.mapAttrsToList (n: v: v) targets); in stdenv.mkDerivation (rec {
+
+    shell = let inputs = (lib.mapAttrsToList (k: v: v) targets); in stdenv.mkDerivation (rec {
         name = "xonotic-shell";
         name = "xonotic-shell";
-        nativeBuildInputs = builtins.map (it: it.nativeBuildInputs) inputs;
-        buildInputs = builtins.map (it: it.buildInputs) inputs;
+        nativeBuildInputs = builtins.map (it: it.nativeBuildInputs) (builtins.filter (it: it?nativeBuildInputs) inputs);
+        buildInputs = builtins.map (it: it.buildInputs) (builtins.filter (it: it?buildInputs) inputs);
         shellHook = builtins.map (it: it.shellHook) (builtins.filter (it: it?shellHook) inputs);
     });
 in { inherit shell; } // targets
         shellHook = builtins.map (it: it.shellHook) (builtins.filter (it: it?shellHook) inputs);
     });
 in { inherit shell; } // targets