uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
70
pkgs/tools/misc/lorri/default.nix
Normal file
70
pkgs/tools/misc/lorri/default.nix
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, pkgs
|
||||
, rustPackages
|
||||
, fetchFromGitHub
|
||||
, rustPlatform
|
||||
, writers
|
||||
, nixosTests
|
||||
, CoreServices
|
||||
, Security
|
||||
}:
|
||||
|
||||
let
|
||||
# Run `eval $(nix-build -A lorri.updater)` after updating the revision!
|
||||
version = "1.5.0";
|
||||
gitRev = "f4b6a135e2efb18b3a679e3946d4d070a1c45a2c";
|
||||
sha256 = "0irgzw7vwhvm97nmylj44x2dnd8pwf47gvlgw7fj58fj67a0l8fr";
|
||||
cargoSha256 = "18l7yxciqcvagsg9lykilfhr104a4qqdydjkjysxgd197xalxgzr";
|
||||
|
||||
in (rustPlatform.buildRustPackage rec {
|
||||
pname = "lorri";
|
||||
inherit version;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "nix-community";
|
||||
repo = pname;
|
||||
rev = gitRev;
|
||||
inherit sha256;
|
||||
};
|
||||
|
||||
outputs = [ "out" "man" "doc" ];
|
||||
|
||||
inherit cargoSha256;
|
||||
doCheck = false;
|
||||
|
||||
BUILD_REV_COUNT = src.revCount or 1;
|
||||
RUN_TIME_CLOSURE = pkgs.callPackage ./runtime.nix { };
|
||||
|
||||
nativeBuildInputs = [ rustPackages.rustfmt ];
|
||||
buildInputs = lib.optionals stdenv.isDarwin [ CoreServices Security ];
|
||||
|
||||
# copy the docs to the $man and $doc outputs
|
||||
postInstall = ''
|
||||
install -Dm644 lorri.1 $man/share/man/man1/lorri.1
|
||||
install -Dm644 -t $doc/share/doc/lorri/ \
|
||||
README.md \
|
||||
CONTRIBUTING.md \
|
||||
LICENSE \
|
||||
MAINTAINERS.md
|
||||
cp -r contrib/ $doc/share/doc/lorri/contrib
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
updater = writers.writeBash "copy-runtime-nix.sh" ''
|
||||
set -euo pipefail
|
||||
cp ${src}/nix/runtime.nix ${toString ./runtime.nix}
|
||||
cp ${src}/nix/runtime-closure.nix.template ${toString ./runtime-closure.nix.template}
|
||||
'';
|
||||
tests = {
|
||||
nixos = nixosTests.lorri;
|
||||
};
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "Your project's nix-env";
|
||||
homepage = "https://github.com/target/lorri";
|
||||
license = licenses.asl20;
|
||||
maintainers = with maintainers; [ grahamc Profpatsch ];
|
||||
};
|
||||
})
|
||||
37
pkgs/tools/misc/lorri/runtime-closure.nix.template
Normal file
37
pkgs/tools/misc/lorri/runtime-closure.nix.template
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
# Nix with sandboxing requires every path used at build time be
|
||||
# explicitly declared. If we simply passed in the paths, they
|
||||
# would be copied in as sources. Using builtins.storePath we're
|
||||
# able to tell Nix that, no, in fact, treat these not as sources
|
||||
# to copy, but instead of a regular store path.
|
||||
#
|
||||
# Include the explicit closure, too, otherwise we'll get mysterious
|
||||
# "file not found" errors due to the glibc interpreter being
|
||||
# missing.
|
||||
let
|
||||
# Magic inspired by Nix's config.nix:
|
||||
# https://github.com/NixOS/nix/blob/f9a2ea44867cd1dbb408bca4df0ced806137b7f7/corepkgs/config.nix.in#L23
|
||||
#
|
||||
# If the dependency is in the Nix store we're using, refer to
|
||||
# it as a literal store path. If it isn't, refer to it "normally".
|
||||
#
|
||||
# This makes sandboxing happy when in a nix-build, and the
|
||||
# evaluation happy when in a «cargo build».
|
||||
tools_build_host = @tools_build_host@;
|
||||
|
||||
# Compare the stringified version of the tools_build_host Nix store
|
||||
# path to the evaluator's stringified Nix store path. Otherwise,
|
||||
# Nix will read the sources in to the /nix/store, and, well,
|
||||
# you can only copy the /nix/store in to the /nix/store so many
|
||||
# times before you run out of disk space.
|
||||
dep = if ("${toString (dirOf tools_build_host)}" == "${toString builtins.storeDir}")
|
||||
then (builtins.trace "using storePath" builtins.storePath)
|
||||
else (builtins.trace "using toString" toString) # assume we have no sandboxing
|
||||
;
|
||||
|
||||
tools = dep tools_build_host;
|
||||
|
||||
in {
|
||||
path = "${tools}/bin";
|
||||
builder = "${tools}/bin/bash";
|
||||
closure = import @runtime_closure_list@ { inherit dep; };
|
||||
}
|
||||
38
pkgs/tools/misc/lorri/runtime.nix
Normal file
38
pkgs/tools/misc/lorri/runtime.nix
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
# Plumbing tools:
|
||||
closureInfo
|
||||
, runCommand
|
||||
, writeText
|
||||
, buildEnv
|
||||
, # Actual dependencies to propagate:
|
||||
bash
|
||||
, coreutils
|
||||
}:
|
||||
let
|
||||
tools = buildEnv {
|
||||
name = "lorri-runtime-tools";
|
||||
paths = [ coreutils bash ];
|
||||
};
|
||||
|
||||
runtimeClosureInfo = closureInfo {
|
||||
rootPaths = [ tools ];
|
||||
};
|
||||
|
||||
closureToNix = runCommand "closure.nix" {}
|
||||
''
|
||||
(
|
||||
echo '{ dep, ... }: ['
|
||||
sed -E 's/^(.*)$/ (dep \1)/' ${runtimeClosureInfo}/store-paths
|
||||
echo ']'
|
||||
) > $out
|
||||
'';
|
||||
|
||||
runtimeClosureInfoAsNix = runCommand "runtime-closure.nix" {
|
||||
runtime_closure_list = closureToNix;
|
||||
tools_build_host = tools;
|
||||
}
|
||||
''
|
||||
substituteAll ${./runtime-closure.nix.template} $out
|
||||
'';
|
||||
in
|
||||
runtimeClosureInfoAsNix
|
||||
Loading…
Add table
Add a link
Reference in a new issue