Skip to content

Commit da51098

Browse files
authored
Merge pull request #12498 from NixOS/fix-cli-fine-version
Restore detailed Nix CLI version
2 parents dfb5b2c + 2b5365b commit da51098

File tree

28 files changed

+34
-181
lines changed

28 files changed

+34
-181
lines changed

packaging/dependencies.nix

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,18 @@ let
4242
mkPackageBuilder =
4343
exts: userFn: stdenv.mkDerivation (lib.extends (lib.composeManyExtensions exts) userFn);
4444

45+
setVersionLayer = finalAttrs: prevAttrs: {
46+
preConfigure =
47+
prevAttrs.prevAttrs or ""
48+
+
49+
# Update the repo-global .version file.
50+
# Symlink ./.version points there, but by default only workDir is writable.
51+
''
52+
chmod u+w ./.version
53+
echo ${finalAttrs.version} > ./.version
54+
'';
55+
};
56+
4557
localSourceLayer =
4658
finalAttrs: prevAttrs:
4759
let
@@ -180,12 +192,14 @@ scope:
180192
mkMesonDerivation = mkPackageBuilder [
181193
miscGoodPractice
182194
localSourceLayer
195+
setVersionLayer
183196
mesonLayer
184197
];
185198
mkMesonExecutable = mkPackageBuilder [
186199
miscGoodPractice
187200
bsdNoLinkAsNeeded
188201
localSourceLayer
202+
setVersionLayer
189203
mesonLayer
190204
mesonBuildLayer
191205
];
@@ -194,6 +208,7 @@ scope:
194208
bsdNoLinkAsNeeded
195209
localSourceLayer
196210
mesonLayer
211+
setVersionLayer
197212
mesonBuildLayer
198213
mesonLibraryLayer
199214
];

src/libcmd/package.nix

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,6 @@ mkMesonLibrary (finalAttrs: {
6464
nlohmann_json
6565
];
6666

67-
preConfigure =
68-
# "Inline" .version so it's not a symlink, and includes the suffix.
69-
# Do the meson utils, without modification.
70-
''
71-
chmod u+w ./.version
72-
echo ${version} > ../../.version
73-
'';
74-
7567
mesonFlags = [
7668
(lib.mesonEnable "markdown" enableMarkdown)
7769
(lib.mesonOption "readline-flavor" readlineFlavor)

src/libexpr-c/package.nix

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,6 @@ mkMesonLibrary (finalAttrs: {
3636
nix-expr
3737
];
3838

39-
preConfigure =
40-
# "Inline" .version so it's not a symlink, and includes the suffix.
41-
# Do the meson utils, without modification.
42-
''
43-
chmod u+w ./.version
44-
echo ${version} > ../../.version
45-
'';
46-
4739
mesonFlags = [
4840
];
4941

src/libexpr-test-support/package.nix

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,6 @@ mkMesonLibrary (finalAttrs: {
4040
rapidcheck
4141
];
4242

43-
preConfigure =
44-
# "Inline" .version so it's not a symlink, and includes the suffix.
45-
# Do the meson utils, without modification.
46-
''
47-
chmod u+w ./.version
48-
echo ${version} > ../../.version
49-
'';
50-
5143
mesonFlags = [
5244
];
5345

src/libexpr-tests/package.nix

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,6 @@ mkMesonExecutable (finalAttrs: {
4646
gtest
4747
];
4848

49-
preConfigure =
50-
# "Inline" .version so it's not a symlink, and includes the suffix.
51-
# Do the meson utils, without modification.
52-
''
53-
chmod u+w ./.version
54-
echo ${version} > ../../.version
55-
'';
56-
5749
mesonFlags = [
5850
];
5951

src/libexpr/package.nix

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,6 @@ mkMesonLibrary (finalAttrs: {
7777
nlohmann_json
7878
] ++ lib.optional enableGC boehmgc;
7979

80-
preConfigure =
81-
# "Inline" .version so it's not a symlink, and includes the suffix.
82-
# Do the meson utils, without modification.
83-
''
84-
chmod u+w ./.version
85-
echo ${version} > ../../.version
86-
'';
87-
8880
mesonFlags = [
8981
(lib.mesonEnable "gc" enableGC)
9082
];

src/libfetchers-tests/package.nix

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,6 @@ mkMesonExecutable (finalAttrs: {
4444
gtest
4545
];
4646

47-
preConfigure =
48-
# "Inline" .version so it's not a symlink, and includes the suffix.
49-
# Do the meson utils, without modification.
50-
''
51-
chmod u+w ./.version
52-
echo ${version} > ../../.version
53-
'';
54-
5547
mesonFlags = [
5648
];
5749

src/libfetchers/package.nix

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,6 @@ mkMesonLibrary (finalAttrs: {
4141
nlohmann_json
4242
];
4343

44-
preConfigure =
45-
# "Inline" .version so it's not a symlink, and includes the suffix.
46-
# Do the meson utils, without modification.
47-
''
48-
chmod u+w ./.version
49-
echo ${version} > ../../.version
50-
'';
51-
5244
meta = {
5345
platforms = lib.platforms.unix ++ lib.platforms.windows;
5446
};

src/libflake-c/package.nix

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,6 @@ mkMesonLibrary (finalAttrs: {
3838
nix-flake
3939
];
4040

41-
preConfigure =
42-
# "Inline" .version so it's not a symlink, and includes the suffix.
43-
# Do the meson utils, without modification.
44-
''
45-
chmod u+w ./.version
46-
echo ${version} > ../../.version
47-
'';
48-
4941
mesonFlags = [
5042
];
5143

src/libflake-tests/package.nix

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,6 @@ mkMesonExecutable (finalAttrs: {
4646
gtest
4747
];
4848

49-
preConfigure =
50-
# "Inline" .version so it's not a symlink, and includes the suffix.
51-
# Do the meson utils, without modification.
52-
''
53-
chmod u+w ./.version
54-
echo ${version} > ../../.version
55-
'';
56-
5749
mesonFlags = [
5850
];
5951

0 commit comments

Comments
 (0)