From 4ef7bf78bb3d4c4ab2bebd08ff3ac23805e5b1a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Thu, 4 Jul 2024 09:48:13 +0200 Subject: [PATCH] build-support/agda: expose mkLibraryFile --- pkgs/build-support/agda/default.nix | 13 ++++++++----- pkgs/top-level/agda-packages.nix | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/pkgs/build-support/agda/default.nix b/pkgs/build-support/agda/default.nix index b5d72d9ccf19..ec0dfe7cc144 100644 --- a/pkgs/build-support/agda/default.nix +++ b/pkgs/build-support/agda/default.nix @@ -19,14 +19,17 @@ let optionalString ; + mkLibraryFile = pkgs: let + pkgs' = if isList pkgs then pkgs else pkgs self; + in writeText "libraries" '' + ${(concatMapStringsSep "\n" (p: "${p}/${p.libraryFile}") pkgs')} + ''; + withPackages' = { pkgs, ghc ? ghcWithPackages (p: with p; [ ieee754 ]) }: let - pkgs' = if isList pkgs then pkgs else pkgs self; - library-file = writeText "libraries" '' - ${(concatMapStringsSep "\n" (p: "${p}/${p.libraryFile}") pkgs')} - ''; + library-file = mkLibraryFile pkgs; pname = "agdaWithPackages"; version = Agda.version; in runCommand "${pname}-${version}" { @@ -118,5 +121,5 @@ in { mkDerivation = args: stdenv.mkDerivation (args // defaults args); - inherit withPackages withPackages'; + inherit mkLibraryFile withPackages withPackages'; } diff --git a/pkgs/top-level/agda-packages.nix b/pkgs/top-level/agda-packages.nix index d1097a48327b..9cde235a1be3 100644 --- a/pkgs/top-level/agda-packages.nix +++ b/pkgs/top-level/agda-packages.nix @@ -7,9 +7,9 @@ let inherit (callPackage ../build-support/agda { inherit Agda self; inherit (pkgs.haskellPackages) ghcWithPackages; - }) withPackages mkDerivation; + }) withPackages mkLibraryFile mkDerivation; in { - inherit mkDerivation; + inherit mkLibraryFile mkDerivation; lib = lib.extend (final: prev: import ../build-support/agda/lib.nix { lib = prev; });