summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/applications/virtualization/crosvm/default.nix56
1 files changed, 28 insertions, 28 deletions
diff --git a/pkgs/applications/virtualization/crosvm/default.nix b/pkgs/applications/virtualization/crosvm/default.nix
index 106b39b0336..2681002a25d 100644
--- a/pkgs/applications/virtualization/crosvm/default.nix
+++ b/pkgs/applications/virtualization/crosvm/default.nix
@@ -11,32 +11,15 @@ let
     else if isx86_64 then "x86_64"
     else throw "no seccomp policy files available for host platform";
 
-  # used to turn symlinks into real files because write permissions are necessary for the vendoring process
-  delink = src: runCommand "${src.name}-delinked" {
-    preferLocalBuild = true;
-    allowSubstitutes = false;
-  } ''
-    cp -prL --reflink=auto ${src} $out
-  '';
-
-  # used to place subtrees into the location they have in the Chromium monorepo
-  move = src: target: runCommand "moved-${src.name}" {
-    preferLocalBuild = true;
-    allowSubstitutes = false;
-  } ''
-    mkdir -p $(dirname $out/${target})
-    ln -s ${src} $out/${target}
-  '';
-
-  # used to check out subtrees from the Chromium monorepo
-  chromiumSource = name: subtrees: delink (symlinkJoin {
-    inherit name;
-    paths = stdenv.lib.mapAttrsToList (
-      location: { url, rev, sha256, fetchSubmodules, ... }:
-      move (fetchgit {
-        inherit url rev sha256 fetchSubmodules;
-      }) location) subtrees;
-  });
+  crosvmSrc = fetchgit {
+    inherit (upstreamInfo.components."chromiumos/platform/crosvm")
+      url rev sha256 fetchSubmodules;
+  };
+
+  adhdSrc = fetchgit {
+    inherit (upstreamInfo.components."chromiumos/third_party/adhd")
+      url rev sha256 fetchSubmodules;
+  };
 
 in
 
@@ -44,9 +27,26 @@ in
     pname = "crosvm";
     inherit (upstreamInfo) version;
 
-    src = chromiumSource "${pname}-sources" upstreamInfo.components;
+    unpackPhase = ''
+      runHook preUnpack
+      mkdir -p chromiumos/platform chromiumos/third_party
+
+      pushd chromiumos/platform
+      unpackFile ${crosvmSrc}
+      mv crosvm-* crosvm
+      popd
+
+      pushd chromiumos/third_party
+      unpackFile ${adhdSrc}
+      mv adhd-* adhd
+      popd
+
+      chmod -R u+w -- "$sourceRoot"
+
+      runHook postUnpack
+    '';
 
-    sourceRoot = "${src.name}/chromiumos/platform/crosvm";
+    sourceRoot = "chromiumos/platform/crosvm";
 
     patches = [
       ./default-seccomp-policy-dir.patch