-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
default.nix
105 lines (93 loc) · 2.26 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
{
lib,
rustPlatform,
curl,
installShellFiles,
pkg-config,
bzip2,
libgit2,
openssl,
zlib,
zstd,
stdenv,
darwin,
spdx-license-list-data,
nix,
nurl,
get-nix-license,
license-store-cache,
enableClippy ? false,
}:
rustPlatform.buildRustPackage rec {
pname = "nix-init";
version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).workspace.package.version;
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes."cargo-0.82.0" = "sha256-1G14vLW3FhLxOWGxuHXcWgb+XXS1vOOyQYKVbrJWlmI=";
};
nativeBuildInputs = [
curl
installShellFiles
pkg-config
];
buildInputs =
[
bzip2
curl
libgit2
openssl
zlib
zstd
]
++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ]
++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
darwin.apple_sdk.frameworks.CoreFoundation
];
buildNoDefaultFeatures = true;
checkFlags = [
# requires internet access
"--skip=lang::rust::tests"
];
postPatch = ''
mkdir -p data
ln -s ${get-nix-license} data/get_nix_license.rs
'';
shellHook = ''
mkdir -p data
ln -sf ${get-nix-license} data/get_nix_license.rs
ln -sf ${license-store-cache} data/license-store-cache.zstd
'';
preBuild = ''
cargo run -p license-store-cache \
-j $NIX_BUILD_CORES --frozen \
data/license-store-cache.zstd ${spdx-license-list-data.json}/json/details
'';
postInstall = ''
installManPage artifacts/nix-init.1
installShellCompletion artifacts/nix-init.{bash,fish} --zsh artifacts/_nix-init
'';
env = {
GEN_ARTIFACTS = "artifacts";
LIBGIT2_NO_VENDOR = 1;
NIX = lib.getExe nix;
NURL = lib.getExe nurl;
ZSTD_SYS_USE_PKG_CONFIG = true;
};
meta = {
description = "Command line tool to generate Nix packages from URLs";
mainProgram = "nix-init";
homepage = "https://github.com/nix-community/nix-init";
changelog = "https://github.com/nix-community/nix-init/blob/${src.rev}/CHANGELOG.md";
license = lib.licenses.mpl20;
maintainers = with lib.maintainers; [ figsoda ];
};
}
// lib.optionalAttrs enableClippy {
buildPhase = ''
cargo clippy --all-targets --all-features -- -D warnings
'';
installPhase = ''
touch $out
'';
}