nixpkgs/pkgs/tools/misc/lorri/default.nix

71 lines
1.7 KiB
Nix
Raw Normal View History

2021-03-05 16:49:05 +01:00
{ lib
, stdenv
, pkgs
2021-03-05 16:49:05 +01:00
, rustPackages
, fetchFromGitHub
, rustPlatform
2020-06-30 02:09:13 +02:00
, writers
, nixosTests
, CoreServices
, Security
}:
2020-08-04 17:47:29 +02:00
let
# Run `eval $(nix-build -A lorri.updater)` after updating the revision!
2021-05-11 20:35:18 +02:00
version = "1.5.0";
gitRev = "f4b6a135e2efb18b3a679e3946d4d070a1c45a2c";
sha256 = "0irgzw7vwhvm97nmylj44x2dnd8pwf47gvlgw7fj58fj67a0l8fr";
cargoSha256 = "18l7yxciqcvagsg9lykilfhr104a4qqdydjkjysxgd197xalxgzr";
2020-08-04 17:47:29 +02:00
in (rustPlatform.buildRustPackage rec {
pname = "lorri";
2020-08-04 17:47:29 +02:00
inherit version;
src = fetchFromGitHub {
owner = "nix-community";
repo = pname;
2020-08-04 17:47:29 +02:00
rev = gitRev;
inherit sha256;
};
outputs = [ "out" "man" "doc" ];
2020-08-04 17:47:29 +02:00
inherit cargoSha256;
doCheck = false;
BUILD_REV_COUNT = src.revCount or 1;
2021-03-05 16:49:05 +01:00
RUN_TIME_CLOSURE = pkgs.callPackage ./runtime.nix { };
2021-03-05 16:49:05 +01:00
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 = {
2020-06-30 02:09:13 +02:00
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;
};
};
2021-03-05 16:49:05 +01:00
meta = with lib; {
description = "Your project's nix-env";
homepage = "https://github.com/target/lorri";
license = licenses.asl20;
maintainers = with maintainers; [ grahamc Profpatsch ];
};
})