nix/pkgs: add erbium
This commit is contained in:
parent
7a19e14649
commit
75aef1e3ca
4 changed files with 77 additions and 8 deletions
|
@ -10,4 +10,5 @@ args: {
|
|||
secretsync = import ./secretsync args;
|
||||
copybara = import ./copybara.nix args;
|
||||
hg-git = import ./hg-git.nix args;
|
||||
erbium = import ./erbium args;
|
||||
} // (import ./heptapod-runner.nix args)
|
||||
|
|
44
nix/pkgs/erbium/crate2nixify.nix
Normal file
44
nix/pkgs/erbium/crate2nixify.nix
Normal file
|
@ -0,0 +1,44 @@
|
|||
{ 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)
|
14
nix/pkgs/erbium/default.nix
Normal file
14
nix/pkgs/erbium/default.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{ 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";
|
||||
};
|
||||
depsHash = "sha256:0vxkl8q554018x7qw0qgbp7z0mgb7jcqsrdcphv319lfxbnymzyv";
|
||||
}
|
26
third_party/default.nix
vendored
26
third_party/default.nix
vendored
|
@ -3,17 +3,25 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
{ ... }@ch:
|
||||
let nixpkgsConfig = {
|
||||
allowUnfree = true;
|
||||
permittedInsecurePackages = [
|
||||
"p7zip-16.02"
|
||||
];
|
||||
}; in
|
||||
rec {
|
||||
inherit nixpkgsConfig;
|
||||
let
|
||||
nixpkgsConfig = {
|
||||
allowUnfree = true;
|
||||
permittedInsecurePackages = [
|
||||
"p7zip-16.02"
|
||||
];
|
||||
};
|
||||
nixpkgs = import ./nixpkgs {
|
||||
config = nixpkgsConfig;
|
||||
};
|
||||
crate2nixSrc = nixpkgs.fetchFromGitHub {
|
||||
owner = "kolloch";
|
||||
repo = "crate2nix";
|
||||
rev = "e07af104b8e41d1cd7e41dc7ac3fdcdf4953efae";
|
||||
hash = "sha256:07syygn1rc5n1big7hf42pzgm5wc1r0mzglzvlbcb7rkzgqqhbqx";
|
||||
};
|
||||
in
|
||||
rec {
|
||||
inherit nixpkgsConfig nixpkgs;
|
||||
nixos = import ./nixpkgs/nixos;
|
||||
nixeval = import ./nixpkgs/nixos/lib/eval-config.nix;
|
||||
buildGo =
|
||||
|
@ -37,4 +45,6 @@ rec {
|
|||
};
|
||||
readTree = import ./tvl/nix/readTree {};
|
||||
gopkgs = readTree ch ./gopkgs;
|
||||
|
||||
crate2nix = import "${crate2nixSrc}" {};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue