Merge pull request #324503 from ncfavier/agda-mk-library-file

build-support/agda: expose mkLibraryFile
This commit is contained in:
Naïm Favier 2024-07-11 00:44:48 +02:00 committed by GitHub
commit 0764f58ca3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 7 deletions

View File

@ -19,14 +19,17 @@ let
optionalString optionalString
; ;
mkLibraryFile = pkgs: let
pkgs' = if isList pkgs then pkgs else pkgs self;
in writeText "libraries" ''
${(concatMapStringsSep "\n" (p: "${p}/${p.libraryFile}") pkgs')}
'';
withPackages' = { withPackages' = {
pkgs, pkgs,
ghc ? ghcWithPackages (p: with p; [ ieee754 ]) ghc ? ghcWithPackages (p: with p; [ ieee754 ])
}: let }: let
pkgs' = if isList pkgs then pkgs else pkgs self; library-file = mkLibraryFile pkgs;
library-file = writeText "libraries" ''
${(concatMapStringsSep "\n" (p: "${p}/${p.libraryFile}") pkgs')}
'';
pname = "agdaWithPackages"; pname = "agdaWithPackages";
version = Agda.version; version = Agda.version;
in runCommand "${pname}-${version}" { in runCommand "${pname}-${version}" {
@ -118,5 +121,5 @@ in
{ {
mkDerivation = args: stdenv.mkDerivation (args // defaults args); mkDerivation = args: stdenv.mkDerivation (args // defaults args);
inherit withPackages withPackages'; inherit mkLibraryFile withPackages withPackages';
} }

View File

@ -7,9 +7,9 @@ let
inherit (callPackage ../build-support/agda { inherit (callPackage ../build-support/agda {
inherit Agda self; inherit Agda self;
inherit (pkgs.haskellPackages) ghcWithPackages; inherit (pkgs.haskellPackages) ghcWithPackages;
}) withPackages mkDerivation; }) withPackages mkLibraryFile mkDerivation;
in { in {
inherit mkDerivation; inherit mkLibraryFile mkDerivation;
lib = lib.extend (final: prev: import ../build-support/agda/lib.nix { lib = prev; }); lib = lib.extend (final: prev: import ../build-support/agda/lib.nix { lib = prev; });