1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 10:41:16 +02:00

Write just ./.version on all components

This way it's easier to get right. See previous commit.
This commit is contained in:
Robert Hensing 2025-02-18 11:41:35 +01:00
parent bba4e6b061
commit 3556f6bf4c
23 changed files with 16 additions and 178 deletions

View file

@ -42,6 +42,18 @@ let
mkPackageBuilder = mkPackageBuilder =
exts: userFn: stdenv.mkDerivation (lib.extends (lib.composeManyExtensions exts) userFn); exts: userFn: stdenv.mkDerivation (lib.extends (lib.composeManyExtensions exts) userFn);
setVersionLayer = finalAttrs: prevAttrs: {
preConfigure =
prevAttrs.prevAttrs or ""
+
# Update the repo-global .version file.
# Symlink ./.version points there, but by default only workDir is writable.
''
chmod u+w ./.version
echo ${finalAttrs.version} > ./.version
'';
};
localSourceLayer = localSourceLayer =
finalAttrs: prevAttrs: finalAttrs: prevAttrs:
let let
@ -180,12 +192,14 @@ scope:
mkMesonDerivation = mkPackageBuilder [ mkMesonDerivation = mkPackageBuilder [
miscGoodPractice miscGoodPractice
localSourceLayer localSourceLayer
setVersionLayer
mesonLayer mesonLayer
]; ];
mkMesonExecutable = mkPackageBuilder [ mkMesonExecutable = mkPackageBuilder [
miscGoodPractice miscGoodPractice
bsdNoLinkAsNeeded bsdNoLinkAsNeeded
localSourceLayer localSourceLayer
setVersionLayer
mesonLayer mesonLayer
mesonBuildLayer mesonBuildLayer
]; ];
@ -194,6 +208,7 @@ scope:
bsdNoLinkAsNeeded bsdNoLinkAsNeeded
localSourceLayer localSourceLayer
mesonLayer mesonLayer
setVersionLayer
mesonBuildLayer mesonBuildLayer
mesonLibraryLayer mesonLibraryLayer
]; ];

View file

@ -64,14 +64,6 @@ mkMesonLibrary (finalAttrs: {
nlohmann_json nlohmann_json
]; ];
preConfigure =
# "Inline" .version so it's not a symlink, and includes the suffix.
# Do the meson utils, without modification.
''
chmod u+w ./.version
echo ${version} > ../../.version
'';
mesonFlags = [ mesonFlags = [
(lib.mesonEnable "markdown" enableMarkdown) (lib.mesonEnable "markdown" enableMarkdown)
(lib.mesonOption "readline-flavor" readlineFlavor) (lib.mesonOption "readline-flavor" readlineFlavor)

View file

@ -36,14 +36,6 @@ mkMesonLibrary (finalAttrs: {
nix-expr nix-expr
]; ];
preConfigure =
# "Inline" .version so it's not a symlink, and includes the suffix.
# Do the meson utils, without modification.
''
chmod u+w ./.version
echo ${version} > ../../.version
'';
mesonFlags = [ mesonFlags = [
]; ];

View file

@ -40,14 +40,6 @@ mkMesonLibrary (finalAttrs: {
rapidcheck rapidcheck
]; ];
preConfigure =
# "Inline" .version so it's not a symlink, and includes the suffix.
# Do the meson utils, without modification.
''
chmod u+w ./.version
echo ${version} > ../../.version
'';
mesonFlags = [ mesonFlags = [
]; ];

View file

@ -46,14 +46,6 @@ mkMesonExecutable (finalAttrs: {
gtest gtest
]; ];
preConfigure =
# "Inline" .version so it's not a symlink, and includes the suffix.
# Do the meson utils, without modification.
''
chmod u+w ./.version
echo ${version} > ../../.version
'';
mesonFlags = [ mesonFlags = [
]; ];

View file

@ -77,14 +77,6 @@ mkMesonLibrary (finalAttrs: {
nlohmann_json nlohmann_json
] ++ lib.optional enableGC boehmgc; ] ++ lib.optional enableGC boehmgc;
preConfigure =
# "Inline" .version so it's not a symlink, and includes the suffix.
# Do the meson utils, without modification.
''
chmod u+w ./.version
echo ${version} > ../../.version
'';
mesonFlags = [ mesonFlags = [
(lib.mesonEnable "gc" enableGC) (lib.mesonEnable "gc" enableGC)
]; ];

View file

@ -44,14 +44,6 @@ mkMesonExecutable (finalAttrs: {
gtest gtest
]; ];
preConfigure =
# "Inline" .version so it's not a symlink, and includes the suffix.
# Do the meson utils, without modification.
''
chmod u+w ./.version
echo ${version} > ../../.version
'';
mesonFlags = [ mesonFlags = [
]; ];

View file

@ -41,14 +41,6 @@ mkMesonLibrary (finalAttrs: {
nlohmann_json nlohmann_json
]; ];
preConfigure =
# "Inline" .version so it's not a symlink, and includes the suffix.
# Do the meson utils, without modification.
''
chmod u+w ./.version
echo ${version} > ../../.version
'';
meta = { meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows; platforms = lib.platforms.unix ++ lib.platforms.windows;
}; };

View file

@ -38,14 +38,6 @@ mkMesonLibrary (finalAttrs: {
nix-flake nix-flake
]; ];
preConfigure =
# "Inline" .version so it's not a symlink, and includes the suffix.
# Do the meson utils, without modification.
''
chmod u+w ./.version
echo ${version} > ../../.version
'';
mesonFlags = [ mesonFlags = [
]; ];

View file

@ -46,14 +46,6 @@ mkMesonExecutable (finalAttrs: {
gtest gtest
]; ];
preConfigure =
# "Inline" .version so it's not a symlink, and includes the suffix.
# Do the meson utils, without modification.
''
chmod u+w ./.version
echo ${version} > ../../.version
'';
mesonFlags = [ mesonFlags = [
]; ];

View file

@ -40,14 +40,6 @@ mkMesonLibrary (finalAttrs: {
nlohmann_json nlohmann_json
]; ];
preConfigure =
# "Inline" .version so it's not a symlink, and includes the suffix.
# Do the meson utils, without modification.
''
chmod u+w ./.version
echo ${version} > ../../.version
'';
meta = { meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows; platforms = lib.platforms.unix ++ lib.platforms.windows;
}; };

View file

@ -40,14 +40,6 @@ mkMesonLibrary (finalAttrs: {
nix-main nix-main
]; ];
preConfigure =
# "Inline" .version so it's not a symlink, and includes the suffix.
# Do the meson utils, without modification.
''
chmod u+w ./.version
echo ${version} > ../../.version
'';
mesonFlags = [ mesonFlags = [
]; ];

View file

@ -37,14 +37,6 @@ mkMesonLibrary (finalAttrs: {
openssl openssl
]; ];
preConfigure =
# "Inline" .version so it's not a symlink, and includes the suffix.
# Do the meson utils, without modification.
''
chmod u+w ./.version
echo ${version} > ../../.version
'';
meta = { meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows; platforms = lib.platforms.unix ++ lib.platforms.windows;
}; };

View file

@ -36,14 +36,6 @@ mkMesonLibrary (finalAttrs: {
nix-store nix-store
]; ];
preConfigure =
# "Inline" .version so it's not a symlink, and includes the suffix.
# Do the meson utils, without modification.
''
chmod u+w ./.version
echo ${version} > ../../.version
'';
mesonFlags = [ mesonFlags = [
]; ];

View file

@ -40,14 +40,6 @@ mkMesonLibrary (finalAttrs: {
rapidcheck rapidcheck
]; ];
preConfigure =
# "Inline" .version so it's not a symlink, and includes the suffix.
# Do the meson utils, without modification.
''
chmod u+w ./.version
echo ${version} > ../../.version
'';
mesonFlags = [ mesonFlags = [
]; ];

View file

@ -52,14 +52,6 @@ mkMesonExecutable (finalAttrs: {
nix-store-test-support nix-store-test-support
]; ];
preConfigure =
# "Inline" .version so it's not a symlink, and includes the suffix.
# Do the meson utils, without modification.
''
chmod u+w ./.version
echo ${version} > ../../.version
'';
mesonFlags = [ mesonFlags = [
]; ];

View file

@ -69,14 +69,6 @@ mkMesonLibrary (finalAttrs: {
nlohmann_json nlohmann_json
]; ];
preConfigure =
# "Inline" .version so it's not a symlink, and includes the suffix.
# Do the meson utils, without modification.
''
chmod u+w ./.version
echo ${version} > ../../.version
'';
mesonFlags = mesonFlags =
[ [
(lib.mesonEnable "seccomp-sandboxing" stdenv.hostPlatform.isLinux) (lib.mesonEnable "seccomp-sandboxing" stdenv.hostPlatform.isLinux)

View file

@ -34,14 +34,6 @@ mkMesonLibrary (finalAttrs: {
nix-util nix-util
]; ];
preConfigure =
# "Inline" .version so it's not a symlink, and includes the suffix.
# Do the meson utils, without modification.
''
chmod u+w ./.version
echo ${version} > ../../.version
'';
mesonFlags = [ mesonFlags = [
]; ];

View file

@ -38,14 +38,6 @@ mkMesonLibrary (finalAttrs: {
rapidcheck rapidcheck
]; ];
preConfigure =
# "Inline" .version so it's not a symlink, and includes the suffix.
# Do the meson utils, without modification.
''
chmod u+w ./.version
echo ${version} > ../../.version
'';
mesonFlags = [ mesonFlags = [
]; ];

View file

@ -45,14 +45,6 @@ mkMesonExecutable (finalAttrs: {
gtest gtest
]; ];
preConfigure =
# "Inline" .version so it's not a symlink, and includes the suffix.
# Do the meson utils, without modification.
''
chmod u+w ./.version
echo ${version} > ../../.version
'';
mesonFlags = [ mesonFlags = [
]; ];

View file

@ -54,17 +54,6 @@ mkMesonLibrary (finalAttrs: {
nlohmann_json nlohmann_json
]; ];
preConfigure =
# "Inline" .version so it's not a symlink, and includes the suffix.
# Do the meson utils, without modification.
#
# TODO: change release process to add `pre` in `.version`, remove it
# before tagging, and restore after.
''
chmod u+w ./.version
echo ${version} > ../../.version
'';
mesonFlags = [ mesonFlags = [
(lib.mesonEnable "cpuid" stdenv.hostPlatform.isx86_64) (lib.mesonEnable "cpuid" stdenv.hostPlatform.isx86_64)
]; ];

View file

@ -91,14 +91,6 @@ mkMesonExecutable (finalAttrs: {
nix-cmd nix-cmd
]; ];
preConfigure =
# Update the repo-global .version file.
# Symlink ./.version points there, but by default only workDir is writable.
''
chmod u+w ./.version
echo ${version} > ./.version
'';
mesonFlags = [ mesonFlags = [
]; ];

View file

@ -75,16 +75,10 @@ mkMesonDerivation (
]; ];
preConfigure = preConfigure =
# "Inline" .version so it's not a symlink, and includes the suffix.
# Do the meson utils, without modification.
''
chmod u+w ./.version
echo ${version} > ../../../.version
''
# TEMP hack for Meson before make is gone, where # TEMP hack for Meson before make is gone, where
# `src/nix-functional-tests` is during the transition a symlink and # `src/nix-functional-tests` is during the transition a symlink and
# not the actual directory directory. # not the actual directory directory.
+ '' ''
cd $(readlink -e $PWD) cd $(readlink -e $PWD)
echo $PWD | grep tests/functional echo $PWD | grep tests/functional
''; '';