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
106
107
108
|
{
lib,
boost,
rustPlatform,
fetchFromGitHub,
python3,
versionCheckHook,
pkg-config,
nix,
nix-update-script,
enableNixImport ? true,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "nickel";
version = "1.10.0";
src = fetchFromGitHub {
owner = "tweag";
repo = "nickel";
tag = finalAttrs.version;
hash = "sha256-CnEGC4SnLRfAPl3WTv83xertH2ulG5onseZpq3vxfwc=";
};
useFetchCargoVendor = true;
cargoHash = "sha256-CyO+W4332fJmeF2CL+9CCdPuion8MrxzkPotLA7my3U=";
cargoBuildFlags = [
"-p nickel-lang-cli"
"-p nickel-lang-lsp"
];
nativeBuildInputs =
[
python3
]
++ lib.optionals enableNixImport [
pkg-config
];
buildInputs = lib.optionals enableNixImport [
nix
boost
];
buildFeatures = lib.optionals enableNixImport [ "nix-experimental" ];
outputs = [
"out"
"nls"
];
# This fixes the way comrak is defined as a dependency, without it the build fails:
#
# cargo metadata failure: error: Package `nickel-lang-core v0.10.0
# (/build/source/core)` does not have feature `comrak`. It has an optional
# dependency with that name, but that dependency uses the "dep:" syntax in
# the features table, so it does not have an implicit feature with that name.
preBuild = ''
substituteInPlace core/Cargo.toml \
--replace-fail "dep:comrak" "comrak"
'';
checkFlags = [
# https://github.com/tweag/nickel/blob/1.10.0/git/tests/main.rs#L60
# fails because src is not a git repo
# `cmd.current_dir(repo.path()).output()` errors with `NotFound`
"--skip=fetch_targets"
];
postInstall = ''
mkdir -p $nls/bin
mv $out/bin/nls $nls/bin/nls
'';
nativeInstallCheckInputs = [
versionCheckHook
];
versionCheckProgramArg = [ "--version" ];
doInstallCheck = true;
passthru.updateScript = nix-update-script { };
meta = {
homepage = "https://nickel-lang.org/";
description = "Better configuration for less";
longDescription = ''
Nickel is the cheap configuration language.
Its purpose is to automate the generation of static configuration files -
think JSON, YAML, XML, or your favorite data representation language -
that are then fed to another system. It is designed to have a simple,
well-understood core: it is in essence JSON with functions.
'';
changelog = "https://github.com/tweag/nickel/blob/${finalAttrs.version}/RELEASES.md";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
felschr
matthiasbeyer
];
mainProgram = "nickel";
badPlatforms = [
# collect2: error: ld returned 1 exit status
# undefined reference to `PyExc_TypeError'
"aarch64-linux"
];
};
})
|