mirror of
https://github.com/ipetkov/crane.git
synced 2024-11-26 09:08:57 +03:00
Add buildWithCargo as a thin wrapper around mkDerivation
This commit is contained in:
parent
83632355d2
commit
e1b7cea23c
@ -19,8 +19,12 @@
|
||||
inherit system;
|
||||
};
|
||||
|
||||
myPkgs = myPkgsFor pkgs;
|
||||
|
||||
# To override do: lib.overrideScope' (self: super: { ... });
|
||||
lib = import ./lib {
|
||||
inherit (pkgs) lib newScope;
|
||||
inherit myPkgs;
|
||||
};
|
||||
|
||||
checks = pkgs.callPackages ./checks { };
|
||||
@ -28,7 +32,7 @@
|
||||
{
|
||||
inherit checks lib;
|
||||
|
||||
packages = myPkgsFor pkgs;
|
||||
packages = myPkgs;
|
||||
|
||||
devShell = pkgs.mkShell {
|
||||
inputsFrom = builtins.attrValues checks;
|
||||
|
21
lib/buildWithCargo.nix
Normal file
21
lib/buildWithCargo.nix
Normal file
@ -0,0 +1,21 @@
|
||||
{ cargo
|
||||
, configureCargoVendoredDepsHook
|
||||
, lib
|
||||
, stdenv
|
||||
}:
|
||||
|
||||
args@{ nativeBuildInputs ? [ ], ... }:
|
||||
stdenv.mkDerivation (args // {
|
||||
nativeBuildInputs = nativeBuildInputs ++ [
|
||||
cargo
|
||||
configureCargoVendoredDepsHook
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
cargo check --release
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
touch $out
|
||||
'';
|
||||
})
|
@ -1,4 +1,5 @@
|
||||
{ lib
|
||||
, myPkgs
|
||||
, newScope
|
||||
}:
|
||||
|
||||
@ -6,9 +7,10 @@ lib.makeScope newScope (self:
|
||||
let
|
||||
callPackage = self.newScope { };
|
||||
in
|
||||
{
|
||||
myPkgs // {
|
||||
inherit callPackage;
|
||||
|
||||
buildWithCargo = callPackage ./buildWithCargo.nix { };
|
||||
downloadCargoPackage = callPackage ./downloadCargoPackage.nix { };
|
||||
urlForCargoPackage = callPackage ./urlForCargoPackage.nix { };
|
||||
vendorCargoDeps = callPackage ./vendorCargoDeps.nix { };
|
||||
|
@ -14,5 +14,7 @@ EOF
|
||||
}
|
||||
|
||||
if [ -n "${cargoVendorDir-}" ]; then
|
||||
postPatchHooks+=(configureCargoVendoredDepsHook)
|
||||
preConfigureHooks+=(configureCargoVendoredDepsHook)
|
||||
else
|
||||
echo "cargoVendorDir not set"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user