2021-03-05 16:49:05 +01:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2019-11-05 11:57:05 +01:00
|
|
|
, pkgs
|
2021-03-05 16:49:05 +01:00
|
|
|
, rustPackages
|
2019-11-05 11:57:05 +01:00
|
|
|
, fetchFromGitHub
|
|
|
|
, rustPlatform
|
2020-06-30 02:09:13 +02:00
|
|
|
, writers
|
2019-11-05 11:57:05 +01:00
|
|
|
, nixosTests
|
|
|
|
, CoreServices
|
|
|
|
, Security
|
|
|
|
}:
|
|
|
|
|
2020-08-04 17:47:29 +02:00
|
|
|
let
|
|
|
|
# Run `eval $(nix-build -A lorri.updater)` after updating the revision!
|
2021-03-11 23:52:20 +01:00
|
|
|
version = "1.3.1";
|
|
|
|
gitRev = "df83b9b175fecc8ec8b02096c5cfe2db3d00b92e";
|
|
|
|
sha256 = "1df6p0b482vhymw3z7gimc441jr7aix9lhdbcm5wjvw9f276016f";
|
|
|
|
cargoSha256 = "1f9b2h3zakw7qmlnc4rqhxnw80sl5h4mj8cghr82iacxwqz499ql";
|
2020-08-04 17:47:29 +02:00
|
|
|
|
|
|
|
in (rustPlatform.buildRustPackage rec {
|
2019-11-05 11:57:05 +01:00
|
|
|
pname = "lorri";
|
2020-08-04 17:47:29 +02:00
|
|
|
inherit version;
|
2019-11-05 11:57:05 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2021-03-05 13:07:31 +01:00
|
|
|
owner = "nix-community";
|
2019-11-05 11:57:05 +01:00
|
|
|
repo = pname;
|
2020-08-04 17:47:29 +02:00
|
|
|
rev = gitRev;
|
|
|
|
inherit sha256;
|
2019-11-05 11:57:05 +01:00
|
|
|
};
|
|
|
|
|
2020-09-09 15:42:55 +02:00
|
|
|
outputs = [ "out" "man" "doc" ];
|
|
|
|
|
2020-08-04 17:47:29 +02:00
|
|
|
inherit cargoSha256;
|
2019-11-05 11:57:05 +01:00
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
BUILD_REV_COUNT = src.revCount or 1;
|
2021-03-05 16:49:05 +01:00
|
|
|
RUN_TIME_CLOSURE = pkgs.callPackage ./runtime.nix { };
|
2019-11-05 11:57:05 +01:00
|
|
|
|
2021-03-05 16:49:05 +01:00
|
|
|
nativeBuildInputs = [ rustPackages.rustfmt ];
|
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [ CoreServices Security ];
|
2019-11-05 11:57:05 +01:00
|
|
|
|
2020-07-29 00:12:37 +02:00
|
|
|
# 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
|
|
|
|
'';
|
|
|
|
|
2019-11-05 11:57:05 +01:00
|
|
|
passthru = {
|
2020-06-30 02:09:13 +02:00
|
|
|
updater = writers.writeBash "copy-runtime-nix.sh" ''
|
2019-11-05 11:57:05 +01:00
|
|
|
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 ];
|
|
|
|
};
|
2020-07-29 00:12:37 +02:00
|
|
|
})
|