diff options
author | Philip Taron <philip.taron@gmail.com> | 2024-03-12 13:37:34 -0700 |
---|---|---|
committer | Valentin Gagarin <valentin.gagarin@tweag.io> | 2024-03-19 22:31:19 +0100 |
commit | 8c4a1e8d66579084147e85cf483a91d03f9f1dd1 (patch) | |
tree | 18459f5bd16f4aa4362a23e63311c716318e2591 /pkgs/build-support/agda | |
parent | f41fbee73a0db0cc2ac708e3edba358575a41453 (diff) |
Avoid top-level `with ...;` in pkgs/build-support/agda/default.nix
Diffstat (limited to 'pkgs/build-support/agda')
-rw-r--r-- | pkgs/build-support/agda/default.nix | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/pkgs/build-support/agda/default.nix b/pkgs/build-support/agda/default.nix index 893383a759aec..d8f55226ed134 100644 --- a/pkgs/build-support/agda/default.nix +++ b/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,7 +37,7 @@ 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; @@ -36,7 +50,7 @@ let 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 - 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 { @@ -91,13 +105,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 { |