diff options
author | Alyssa Ross <hi@alyssa.is> | 2024-05-03 15:14:25 +0200 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2024-05-07 11:19:19 +0200 |
commit | d92b2b6a1bbd322dd65a8b6f51019610d350046e (patch) | |
tree | 7f7c21927b9cc05676501f297c51eb76b49e326c /nixpkgs/pkgs/build-support/agda/default.nix | |
parent | 93c9e56b40530cc627d921cfc255c05b495d4017 (diff) | |
parent | 49050352f602fe87d16ff7b2b6a05b79eb20dc6f (diff) | |
download | nixlib-d92b2b6a1bbd322dd65a8b6f51019610d350046e.tar nixlib-d92b2b6a1bbd322dd65a8b6f51019610d350046e.tar.gz nixlib-d92b2b6a1bbd322dd65a8b6f51019610d350046e.tar.bz2 nixlib-d92b2b6a1bbd322dd65a8b6f51019610d350046e.tar.lz nixlib-d92b2b6a1bbd322dd65a8b6f51019610d350046e.tar.xz nixlib-d92b2b6a1bbd322dd65a8b6f51019610d350046e.tar.zst nixlib-d92b2b6a1bbd322dd65a8b6f51019610d350046e.zip |
Merge remote-tracking branch 'nixpkgs/nixos-unstable-small'
Conflicts: nixpkgs/nixos/modules/services/mail/mailman.nix nixpkgs/nixos/modules/services/mail/public-inbox.nix nixpkgs/pkgs/build-support/go/module.nix
Diffstat (limited to 'nixpkgs/pkgs/build-support/agda/default.nix')
-rw-r--r-- | nixpkgs/pkgs/build-support/agda/default.nix | 49 |
1 files changed, 32 insertions, 17 deletions
diff --git a/nixpkgs/pkgs/build-support/agda/default.nix b/nixpkgs/pkgs/build-support/agda/default.nix index 893383a759ae..b5d72d9ccf19 100644 --- a/nixpkgs/pkgs/build-support/agda/default.nix +++ b/nixpkgs/pkgs/build-support/agda/default.nix @@ -2,14 +2,28 @@ { stdenv, lib, self, Agda, runCommand, makeWrapper, writeText, ghcWithPackages, nixosTests }: -with lib.strings; - let + inherit (lib) + attrValues + elem + filter + filterAttrs + isAttrs + isList + platforms + ; + + inherit (lib.strings) + concatMapStrings + concatMapStringsSep + optionalString + ; + withPackages' = { pkgs, ghc ? ghcWithPackages (p: with p; [ ieee754 ]) }: let - pkgs' = if builtins.isList pkgs then pkgs else pkgs self; + pkgs' = if isList pkgs then pkgs else pkgs self; library-file = writeText "libraries" '' ${(concatMapStringsSep "\n" (p: "${p}/${p.libraryFile}") pkgs')} ''; @@ -23,20 +37,20 @@ let inherit withPackages; tests = { inherit (nixosTests) agda; - allPackages = withPackages (lib.filter self.lib.isUnbrokenAgdaPackage (lib.attrValues self)); + allPackages = withPackages (filter self.lib.isUnbrokenAgdaPackage (attrValues self)); }; }; - inherit (Agda) meta; + # Agda is a split package with multiple outputs; do not inherit them here. + meta = removeAttrs Agda.meta [ "outputsToInstall" ]; } '' mkdir -p $out/bin - makeWrapper ${Agda}/bin/agda $out/bin/agda \ + makeWrapper ${Agda.bin}/bin/agda $out/bin/agda \ --add-flags "--with-compiler=${ghc}/bin/ghc" \ - --add-flags "--library-file=${library-file}" \ - --add-flags "--local-interfaces" - ln -s ${Agda}/bin/agda-mode $out/bin/agda-mode - ''; # Local interfaces has been added for now: See https://github.com/agda/agda/issues/4526 + --add-flags "--library-file=${library-file}" + ln -s ${Agda.bin}/bin/agda-mode $out/bin/agda-mode + ''; - withPackages = arg: if builtins.isAttrs arg then withPackages' arg else withPackages' { pkgs = arg; }; + withPackages = arg: if isAttrs arg then withPackages' arg else withPackages' { pkgs = arg; }; extensions = [ "agda" @@ -63,7 +77,7 @@ let , extraExtensions ? [] , ... }: let - agdaWithArgs = withPackages (builtins.filter (p: p ? isAgdaDerivation) buildInputs); + agdaWithArgs = withPackages (filter (p: p ? isAgdaDerivation) buildInputs); includePathArgs = concatMapStrings (path: "-i" + path + " ") (includePaths ++ [(dirOf everythingFile)]); in { @@ -76,13 +90,14 @@ let buildPhase = if buildPhase != null then buildPhase else '' runHook preBuild agda ${includePathArgs} ${everythingFile} + rm ${everythingFile} ${lib.interfaceFile Agda.version everythingFile} runHook postBuild ''; installPhase = if installPhase != null then installPhase else '' runHook preInstall mkdir -p $out - find -not \( -path ${everythingFile} -or -path ${lib.interfaceFile everythingFile} \) -and \( ${concatMapStringsSep " -or " (p: "-name '*.${p}'") (extensions ++ extraExtensions)} \) -exec cp -p --parents -t "$out" {} + + find \( ${concatMapStringsSep " -or " (p: "-name '*.${p}'") (extensions ++ extraExtensions)} \) -exec cp -p --parents -t "$out" {} + runHook postInstall ''; @@ -91,13 +106,13 @@ let # darwin, it seems that there is no standard such locale; luckily, # the referenced issue doesn't seem to surface on darwin. Hence let's # set this only on non-darwin. - LC_ALL = lib.optionalString (!stdenv.isDarwin) "C.UTF-8"; + LC_ALL = optionalString (!stdenv.isDarwin) "C.UTF-8"; - meta = if meta.broken or false then meta // { hydraPlatforms = lib.platforms.none; } else meta; + meta = if meta.broken or false then meta // { hydraPlatforms = platforms.none; } else meta; # Retrieve all packages from the finished package set that have the current package as a dependency and build them - passthru.tests = with builtins; - lib.filterAttrs (name: pkg: self.lib.isUnbrokenAgdaPackage pkg && elem pname (map (pkg: pkg.pname) pkg.buildInputs)) self; + passthru.tests = + filterAttrs (name: pkg: self.lib.isUnbrokenAgdaPackage pkg && elem pname (map (pkg: pkg.pname) pkg.buildInputs)) self; }; in { |