This repository has been archived by the owner on Oct 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 69
/
default.nix
73 lines (64 loc) · 2.18 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{ nixpkgs ? ./nix/nixpkgs-stable.nix
, pkgs ? import nixpkgs
}:
let
src = pkgs.nix-gitignore.gitignoreSource [
".git/"
".github/"
"assets/"
] ./.;
cargoLorri =
(
pkgs.callPackage ./Cargo.nix {
cratesIO = pkgs.callPackage ./nix/carnix/crates-io.nix {};
}
).lorri {};
in
cargoLorri.override {
crateOverrides = pkgs.defaultCrateOverrides // {
lorri = attrs: {
name = "lorri";
inherit src;
# add man and doc outputs to put our documentation into
outputs = cargoLorri.outputs ++ [ "man" "doc" ];
# This is implicitely set by `builtins.fetchGit`
# (which we use in `src/ops/upgrade/upgrade.nix`).
# So if a user upgrades from a branch of the repository,
# it will return a revCount. Default to `1` for e.g.
# `self-upgrade local`.
BUILD_REV_COUNT = src.revCount or 1;
RUN_TIME_CLOSURE = pkgs.callPackage ./nix/runtime.nix {};
NIX_PATH = "nixpkgs=${./nix/bogus-nixpkgs}";
# required by human-panic, because carnix doesn’t
# set the cargo environment variables correctly.
# see https://doc.rust-lang.org/cargo/reference/environment-variables.html
homepage = "https://github.com/target/lorri";
preConfigure = ''
. ${./nix/pre-check.sh}
# Do an immediate, light-weight test to ensure logged-evaluation
# is valid, prior to doing expensive compilations.
nix-build --show-trace ./src/logged-evaluation.nix \
--arg src ./tests/integration/basic/shell.nix \
--arg runTimeClosure "$RUN_TIME_CLOSURE" \
--no-out-link
'';
buildInputs = with pkgs; [
nix # required for the preConfigure test
rustPackages.rustfmt
] ++ stdenv.lib.optionals stdenv.isDarwin [
darwin.Security
darwin.apple_sdk.frameworks.CoreServices
];
# 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
'';
};
};
}