nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildNimPackage,
4 fetchFromGitHub,
5 nim,
6 makeWrapper,
7}:
8
9buildNimPackage (finalAttrs: {
10 pname = "balls";
11 version = "5.4.0";
12
13 src = fetchFromGitHub {
14 owner = "disruptek";
15 repo = "balls";
16 rev = finalAttrs.version;
17 hash = "sha256-CMYkMkekVI0C1WUds+KBbRfjMte42kBAB2ddtQp8d+k=";
18 };
19
20 nativeBuildInputs = [ makeWrapper ];
21
22 lockFile = ./lock.json;
23
24 postPatch =
25 # Trim comments from the Nimble file.
26 ''
27 sed \
28 -e 's/[[:space:]]* # .*$//g' \
29 -i balls.nimble
30 '';
31
32 preCheck = ''
33 echo 'path:"$projectDir/.."' > tests/nim.cfg
34 '';
35
36 postFixup =
37 let
38 lockAttrs = builtins.fromJSON (builtins.readFile finalAttrs.lockFile);
39 pathFlagOfFod = { path, srcDir, ... }: ''"--path:${path}/${srcDir}"'';
40 pathFlags = map pathFlagOfFod lockAttrs.depends;
41 in
42 ''
43 wrapProgram $out/bin/balls \
44 --suffix PATH : ${lib.makeBinPath [ nim ]} \
45 --append-flags '--path:"${finalAttrs.src}" ${toString pathFlags}'
46 '';
47
48 meta = finalAttrs.src.meta // {
49 description = "Testing framework with balls";
50 homepage = "https://github.com/disruptek/balls";
51 mainProgram = "balls";
52 license = lib.licenses.mit;
53 platforms = lib.platforms.linux;
54 };
55})