erbium: switch to using crate2nix from upstream

This commit is contained in:
Luke Granger-Brown 2020-11-30 19:41:39 +00:00
parent 185ef2a819
commit 8ff8546339
2 changed files with 4 additions and 52 deletions

View file

@ -1,44 +0,0 @@
{ depot, pkgs, lib, ... }:
{ name, src, crateName ? "", depsHash, crate2nixArgs ? {} }:
let
inherit (depot.third_party) crate2nix;
keepFiles = [ ./Cargo.toml ./Cargo.lock ];
deps = pkgs.stdenv.mkDerivation {
inherit src;
name = "${name}-deps";
buildInputs = [ crate2nix ];
buildPhase = ''
mkdir /tmp/cargo
export CARGO_HOME=/tmp/cargo
mkdir /tmp/gen
cp -R $src/* /tmp/gen
cd /tmp/gen
${crate2nix}/bin/crate2nix generate
mkdir $out
cp /tmp/gen/Cargo.nix $out/Cargo.nix
cat >$out/default.nix <<EOF
{ nixpkgs ? import <nixpkgs> {} }:
let cargo_nix = nixpkgs.callPackage ./Cargo.nix { inherit nixpkgs; };
in cargo_nix.${if crateName == "" then "rootCrate" else "workspaceMembers.${crateName}"}.build
EOF
'';
installPhase = "true";
outputHash = depsHash;
outputHashMode = "recursive";
};
merged = pkgs.runCommand "${name}-merged" {
inherit src deps;
} ''
mkdir $out
cp -R $src/* $out/
cp $deps/default.nix $deps/Cargo.nix $out/
'';
in
import merged ({ nixpkgs = pkgs; } // crate2nixArgs)

View file

@ -1,14 +1,10 @@
{ depot, pkgs, lib, ... }@args:
let
crate2nixify = import ./crate2nixify.nix args;
in
crate2nixify {
name = "erbium";
src = pkgs.fetchFromGitHub {
owner = "isomer";
repo = "erbium";
rev = "39465a183454005ca96cdf7fad8638dba192f9a2";
hash = "sha256:10770s5bm0b0kl2q2irx78s0j5h00a8xyk1dqp9dj03vk4jbhs7q";
rev = "aff026d4f83ff055c704508d9a146ab12c901535";
hash = "sha256:1gn41dy8s0c8bq2dckrilf7dlc54hhq14n51nhf1rfhqrbzily3w";
};
depsHash = "sha256:0a5bcp2jvayavia7kk8di8kdx0bdbc25p67nskypqynwgyz5ckva";
}
in
import src