diff options
author | Alyssa Ross <hi@alyssa.is> | 2019-12-02 21:29:52 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2019-12-03 15:15:38 +0000 |
commit | 51fe75bdd32fa50b5e1b043957b71faf9260592f (patch) | |
tree | 77587b9a298e60ca706b1edb1f04b05de18a16b3 | |
parent | ca861c697889eb3a408b5ed12bbc292738872be6 (diff) | |
download | nixpkgs-51fe75bdd32fa50b5e1b043957b71faf9260592f.tar nixpkgs-51fe75bdd32fa50b5e1b043957b71faf9260592f.tar.gz nixpkgs-51fe75bdd32fa50b5e1b043957b71faf9260592f.tar.bz2 nixpkgs-51fe75bdd32fa50b5e1b043957b71faf9260592f.tar.lz nixpkgs-51fe75bdd32fa50b5e1b043957b71faf9260592f.tar.xz nixpkgs-51fe75bdd32fa50b5e1b043957b71faf9260592f.tar.zst nixpkgs-51fe75bdd32fa50b5e1b043957b71faf9260592f.zip |
crosvm: use custom unpackPhase
Constructing srcs like this feels dirty -- this is what unpackPhase is for. The mv shouldn't be necessary, but nix-prefetch-git (used in the update script) doesn't support a name argument. We should be using fetchzip anyway, but that's a future enhancement. When it happens, the mv can be dropped.
-rw-r--r-- | pkgs/applications/virtualization/crosvm/default.nix | 56 |
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 |