From b7e5446b812f44dbdce19314c84d9384fa51b5e9 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sat, 6 Jul 2024 17:33:06 +0200 Subject: [PATCH 1/5] flake.nix: Remove unused binding --- flake.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/flake.nix b/flake.nix index cfea7d38622..d83c2ecad36 100644 --- a/flake.nix +++ b/flake.nix @@ -25,7 +25,6 @@ let inherit (nixpkgs) lib; - inherit (lib) fileset; officialRelease = false; From 4d0c55ae55c0c36b8f8cf5561b10e35da543de62 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sat, 6 Jul 2024 17:41:05 +0200 Subject: [PATCH 2/5] api docs: Use mkMesonDerivation --- src/external-api-docs/package.nix | 46 ++++++++++++++----------------- src/internal-api-docs/package.nix | 36 +++++++++++------------- 2 files changed, 37 insertions(+), 45 deletions(-) diff --git a/src/external-api-docs/package.nix b/src/external-api-docs/package.nix index 352698360c5..7fd6a988a8f 100644 --- a/src/external-api-docs/package.nix +++ b/src/external-api-docs/package.nix @@ -1,5 +1,5 @@ { lib -, stdenv +, mkMesonDerivation , meson , ninja @@ -14,27 +14,27 @@ let inherit (lib) fileset; in -stdenv.mkDerivation (finalAttrs: { +mkMesonDerivation (finalAttrs: { pname = "nix-external-api-docs"; version = lib.fileContents ./.version + versionSuffix; - src = fileset.toSource { - root = ../..; - fileset = - let - cpp = fileset.fileFilter (file: file.hasExt "cc" || file.hasExt "h"); - in - fileset.unions [ - ./meson.build - ./doxygen.cfg.in - ./README.md - # Source is not compiled, but still must be available for Doxygen - # to gather comments. - (cpp ../libexpr-c) - (cpp ../libstore-c) - (cpp ../libutil-c) - ]; - }; + workDir = ./.; + fileset = + let + cpp = fileset.fileFilter (file: file.hasExt "cc" || file.hasExt "h"); + in + fileset.unions [ + ./.version + ../../.version + ./meson.build + ./doxygen.cfg.in + ./README.md + # Source is not compiled, but still must be available for Doxygen + # to gather comments. + (cpp ../libexpr-c) + (cpp ../libstore-c) + (cpp ../libutil-c) + ]; nativeBuildInputs = [ meson @@ -42,14 +42,10 @@ stdenv.mkDerivation (finalAttrs: { doxygen ]; - postUnpack = '' - sourceRoot=$sourceRoot/src/external-api-docs - ''; - preConfigure = - # "Inline" .version so it's not a symlink, and includes the suffix '' - echo ${finalAttrs.version} > .version + chmod u+w ./.version + echo ${finalAttrs.version} > ./.version ''; postInstall = '' diff --git a/src/internal-api-docs/package.nix b/src/internal-api-docs/package.nix index 6a3bc050155..44ddb00aba8 100644 --- a/src/internal-api-docs/package.nix +++ b/src/internal-api-docs/package.nix @@ -1,5 +1,5 @@ { lib -, stdenv +, mkMesonDerivation , meson , ninja @@ -14,22 +14,22 @@ let inherit (lib) fileset; in -stdenv.mkDerivation (finalAttrs: { +mkMesonDerivation (finalAttrs: { pname = "nix-internal-api-docs"; version = lib.fileContents ./.version + versionSuffix; - src = fileset.toSource { - root = ../..; - fileset = let - cpp = fileset.fileFilter (file: file.hasExt "cc" || file.hasExt "hh"); - in fileset.unions [ - ./meson.build - ./doxygen.cfg.in - # Source is not compiled, but still must be available for Doxygen - # to gather comments. - (cpp ../.) - ]; - }; + workDir = ./.; + fileset = let + cpp = fileset.fileFilter (file: file.hasExt "cc" || file.hasExt "hh"); + in fileset.unions [ + ./.version + ../../.version + ./meson.build + ./doxygen.cfg.in + # Source is not compiled, but still must be available for Doxygen + # to gather comments. + (cpp ../.) + ]; nativeBuildInputs = [ meson @@ -37,14 +37,10 @@ stdenv.mkDerivation (finalAttrs: { doxygen ]; - postUnpack = '' - sourceRoot=$sourceRoot/src/internal-api-docs - ''; - preConfigure = - # "Inline" .version so it's not a symlink, and includes the suffix '' - echo ${finalAttrs.version} > .version + chmod u+w ./.version + echo ${finalAttrs.version} > ./.version ''; postInstall = '' From 4c014e238b9dd9d52c6406b8adfd5bb9b77bb0c2 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sat, 6 Jul 2024 17:43:48 +0200 Subject: [PATCH 3/5] nix-main: Add openssl --- src/libmain/package.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libmain/package.nix b/src/libmain/package.nix index 8c06fd0041b..f6c92bac660 100644 --- a/src/libmain/package.nix +++ b/src/libmain/package.nix @@ -7,6 +7,8 @@ , ninja , pkg-config +, openssl + , nix-util , nix-store @@ -47,6 +49,7 @@ mkMesonDerivation (finalAttrs: { propagatedBuildInputs = [ nix-util nix-store + openssl ]; preConfigure = From efd5f50f5e6ef74e1db77101d9d73a3d3ebf3e84 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sat, 6 Jul 2024 17:47:11 +0200 Subject: [PATCH 4/5] nix-perl: Add deps, use mkMesonDerivation --- src/perl/package.nix | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/perl/package.nix b/src/perl/package.nix index 6b84871487c..08ceaa33e68 100644 --- a/src/perl/package.nix +++ b/src/perl/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , perl , perlPackages , meson @@ -8,38 +9,44 @@ , nix-store , darwin , versionSuffix ? "" +, curl +, bzip2 +, libsodium }: let inherit (lib) fileset; in -perl.pkgs.toPerlModule (stdenv.mkDerivation (finalAttrs: { +perl.pkgs.toPerlModule (mkMesonDerivation (finalAttrs: { pname = "nix-perl"; version = lib.fileContents ./.version + versionSuffix; - src = fileset.toSource { - root = ./.; - fileset = fileset.unions ([ - ./MANIFEST - ./lib - ./meson.build - ./meson.options - ] ++ lib.optionals finalAttrs.doCheck [ - ./.yath.rc.in - ./t - ]); - }; + workDir = ./.; + fileset = fileset.unions ([ + ./.version + ../../.version + ./MANIFEST + ./lib + ./meson.build + ./meson.options + ] ++ lib.optionals finalAttrs.doCheck [ + ./.yath.rc.in + ./t + ]); nativeBuildInputs = [ meson ninja pkg-config perl + curl ]; buildInputs = [ nix-store + bzip2 + libsodium ]; # `perlPackages.Test2Harness` is marked broken for Darwin @@ -52,6 +59,7 @@ perl.pkgs.toPerlModule (stdenv.mkDerivation (finalAttrs: { preConfigure = # "Inline" .version so its not a symlink, and includes the suffix '' + chmod u+w .version echo ${finalAttrs.version} > .version ''; From da4c55995b9fd355c72cca2f47bdbe1d163de454 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sat, 6 Jul 2024 19:15:53 +0200 Subject: [PATCH 5/5] ci.yml: Build non unit-tested components in meson_build --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c4939dd11fb..ca94ff956f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -205,4 +205,6 @@ jobs: - uses: actions/checkout@v4 - uses: DeterminateSystems/nix-installer-action@main - uses: DeterminateSystems/magic-nix-cache-action@main - - run: nix build -L .#hydraJobs.build.{nix-fetchers,nix-store,nix-util}.$(nix-instantiate --eval --expr builtins.currentSystem | sed -e 's/"//g') + # Only meson packages that don't have a tests.run derivation. + # Those that have it are already built and tested as part of nix flake check. + - run: nix build -L .#hydraJobs.build.{nix-cmd,nix-main}.$(nix-instantiate --eval --expr builtins.currentSystem | sed -e 's/"//g')