author | Pierre-Yves David <pierre-yves.david@octobus.net> |
Wed, 30 Aug 2023 13:28:09 +0200 | |
changeset 50919 | b2b8c25f9462 |
parent 50490 | be676c313c7b |
child 51765 | 541292a02e09 |
permissions | -rw-r--r-- |
50490
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
1 |
# flake.nix - Nix-defined package and devel env for the Mercurial project. |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
2 |
# |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
3 |
# Copyright 2021-2023 Pacien TRAN-GIRARD <pacien.trangirard@pacien.net> |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
4 |
# |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
5 |
# This software may be used and distributed according to the terms of the |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
6 |
# GNU General Public License version 2 or any later version. |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
7 |
|
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
8 |
# Usage summary, from the root of this repository: |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
9 |
# |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
10 |
# Enter a shell with development tools: |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
11 |
# nix develop 'hg+file:.?dir=contrib/nix' |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
12 |
# |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
13 |
# Running mercurial: |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
14 |
# nix run 'hg+file:.?dir=contrib/nix' -- version |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
15 |
# |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
16 |
# Running the test suite in a sandbox: |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
17 |
# nix build 'hg+file:.?dir=contrib/nix#mercurial-tests' -L |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
18 |
|
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
19 |
{ |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
20 |
inputs = { |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
21 |
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11"; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
22 |
nixpkgs-black.url = "github:NixOS/nixpkgs/c7cb72b0"; # black 20.8b1 |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
23 |
# rust-overlay.url = "github:oxalica/rust-overlay"; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
24 |
flake-utils.url = "github:numtide/flake-utils"; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
25 |
flaky-utils.url = "git+https://cgit.pacien.net/libs/flaky-utils"; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
26 |
}; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
27 |
|
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
28 |
outputs = { |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
29 |
self |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
30 |
, nixpkgs |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
31 |
, nixpkgs-black |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
32 |
# , rust-overlay |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
33 |
, flake-utils |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
34 |
, flaky-utils |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
35 |
}: |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
36 |
flake-utils.lib.eachDefaultSystem (system: |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
37 |
let |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
38 |
# overlays = [ (import rust-overlay) ]; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
39 |
pkgs = import nixpkgs { inherit system; }; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
40 |
|
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
41 |
# We're in the contrib/nix sub-directory. |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
42 |
src = ../..; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
43 |
|
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
44 |
# For snapshots, to satisfy extension minimum version requirements. |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
45 |
dummyVersion = "99.99"; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
46 |
|
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
47 |
pin = { |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
48 |
# The test suite has issues with the latest/current versions of Python. |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
49 |
# Use an older recommended version instead, matching the CI. |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
50 |
python = pkgs.python39; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
51 |
|
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
52 |
# The project uses a pinned version (rust/clippy.toml) for compiling, |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
53 |
# but uses formatter features from nightly. |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
54 |
# TODO: make cargo use the formatter from nightly automatically |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
55 |
# (not supported by rustup/cargo yet? workaround?) |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
56 |
# rustPlatform = pkgs.rust-bin.stable."1.61.0".default; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
57 |
# rustPlatformFormatter = pkgs.rust-bin.nightly."2023-04-20".default; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
58 |
|
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
59 |
# The CI uses an old version of the Black code formatter, |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
60 |
# itself depending on old Python libraries. |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
61 |
# The formatting rules have changed in more recent versions. |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
62 |
inherit (import nixpkgs-black { inherit system; }) black; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
63 |
}; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
64 |
|
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
65 |
in rec { |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
66 |
apps.mercurial = apps.mercurial-rust; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
67 |
apps.default = apps.mercurial; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
68 |
apps.mercurial-c = flake-utils.lib.mkApp { |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
69 |
drv = packages.mercurial-c; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
70 |
}; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
71 |
apps.mercurial-rust = flake-utils.lib.mkApp { |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
72 |
drv = packages.mercurial-rust; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
73 |
}; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
74 |
|
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
75 |
packages.mercurial = packages.mercurial-rust; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
76 |
packages.default = packages.mercurial; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
77 |
|
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
78 |
packages.mercurial-c = pin.python.pkgs.buildPythonApplication { |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
79 |
format = "other"; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
80 |
pname = "mercurial"; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
81 |
version = "SNAPSHOT"; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
82 |
passthru.exePath = "/bin/hg"; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
83 |
inherit src; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
84 |
|
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
85 |
postPatch = '' |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
86 |
echo 'version = b"${toString dummyVersion}"' \ |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
87 |
> mercurial/__version__.py |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
88 |
|
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
89 |
patchShebangs . |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
90 |
|
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
91 |
for f in **/*.{py,c,t}; do |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
92 |
# not only used in shebangs |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
93 |
substituteAllInPlace "$f" '/bin/sh' '${pkgs.stdenv.shell}' |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
94 |
done |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
95 |
''; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
96 |
|
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
97 |
buildInputs = with pin.python.pkgs; [ |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
98 |
docutils |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
99 |
]; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
100 |
|
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
101 |
nativeBuildInputs = with pkgs; [ |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
102 |
gettext |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
103 |
installShellFiles |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
104 |
]; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
105 |
|
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
106 |
makeFlags = [ |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
107 |
"PREFIX=$(out)" |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
108 |
]; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
109 |
|
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
110 |
buildPhase = '' |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
111 |
make local |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
112 |
''; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
113 |
|
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
114 |
# Test suite is huge ; run on-demand in a separate package instead. |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
115 |
doCheck = false; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
116 |
}; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
117 |
|
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
118 |
packages.mercurial-rust = packages.mercurial-c.overrideAttrs (super: { |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
119 |
cargoRoot = "rust"; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
120 |
cargoDeps = pkgs.rustPlatform.importCargoLock { |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
121 |
lockFile = "${src}/rust/Cargo.lock"; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
122 |
}; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
123 |
|
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
124 |
nativeBuildInputs = (super.nativeBuildInputs or []) ++ ( |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
125 |
with pkgs.rustPlatform; [ |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
126 |
cargoSetupHook |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
127 |
rust.cargo |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
128 |
rust.rustc |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
129 |
] |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
130 |
); |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
131 |
|
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
132 |
makeFlags = (super.makeFlags or []) ++ [ |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
133 |
"PURE=--rust" |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
134 |
]; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
135 |
}); |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
136 |
|
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
137 |
packages.mercurial-tests = pkgs.stdenv.mkDerivation { |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
138 |
pname = "mercurial-tests"; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
139 |
version = "SNAPSHOT"; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
140 |
inherit src; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
141 |
|
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
142 |
buildInputs = with pkgs; [ |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
143 |
pin.python |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
144 |
pin.black |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
145 |
unzip |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
146 |
which |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
147 |
sqlite |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
148 |
]; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
149 |
|
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
150 |
postPatch = (packages.mercurial.postPatch or "") + '' |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
151 |
# * paths emitted by our wrapped hg look like ..hg-wrapped-wrapped |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
152 |
# * 'hg' is a wrapper; don't run using python directly |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
153 |
for f in **/*.t; do |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
154 |
substituteInPlace 2>/dev/null "$f" \ |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
155 |
--replace '*/hg:' '*/*hg*:' \ |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
156 |
--replace '"$PYTHON" "$BINDIR"/hg' '"$BINDIR"/hg' |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
157 |
done |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
158 |
''; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
159 |
|
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
160 |
buildPhase = '' |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
161 |
export HGTEST_REAL_HG="${packages.mercurial}/bin/hg" |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
162 |
export HGMODULEPOLICY="rust+c" |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
163 |
export HGTESTFLAGS="--blacklist blacklists/nix" |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
164 |
make check 2>&1 | tee "$out" |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
165 |
''; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
166 |
}; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
167 |
|
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
168 |
devShell = flaky-utils.lib.mkDevShell { |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
169 |
inherit pkgs; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
170 |
|
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
171 |
tools = [ |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
172 |
pin.python |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
173 |
pin.black |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
174 |
]; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
175 |
}; |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
176 |
}); |
be676c313c7b
nix: add nix-defined package and devel env (flake)
pacien <pacien.trangirard@pacien.net>
parents:
diff
changeset
|
177 |
} |