-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bring back the previous formatting and reference the original file
- Loading branch information
1 parent
69a47fd
commit 268a137
Showing
1 changed file
with
27 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,32 @@ | ||
|
||
{ | ||
stdenv, | ||
lib, | ||
self, | ||
agda2hs, | ||
runCommandNoCC, | ||
makeWrapper, | ||
writeText, | ||
mkShell, | ||
ghcWithPackages, | ||
}: | ||
# this file should be very close to a copy of nixpkgs/pkgs/build-support/agda/default.nix | ||
# I think I took the version from https://github.com/NixOS/nixpkgs/blob/bbe6402ecacfc3a0e2c65e3527c2cbe148b98ff8/pkgs/build-support/agda/default.nix | ||
# but it would be nice to expose this in upstream so that we don't have to duplicate the file | ||
{stdenv, lib, self, agda2hs, runCommandNoCC, makeWrapper, writeText, mkShell, ghcWithPackages}: | ||
with lib.strings; | ||
let | ||
withPackages' = | ||
{ | ||
withPackages' = { | ||
pkgs, | ||
ghc ? ghcWithPackages (p: with p; [ ieee754 ]), | ||
}: | ||
let | ||
pkgs' = if builtins.isList pkgs then pkgs else pkgs self; | ||
library-file = writeText "libraries" '' | ||
${(concatMapStringsSep "\n" (p: "${p}/${p.libraryFile}") pkgs')} | ||
''; | ||
pname = "agda2hsWithPackages"; | ||
version = agda2hs.version; | ||
in | ||
runCommandNoCC "${pname}-${version}" | ||
{ | ||
inherit pname version; | ||
nativeBuildInputs = [ makeWrapper ]; | ||
passthru.unwrapped = agda2hs; | ||
} | ||
'' | ||
mkdir -p $out/bin | ||
makeWrapper ${agda2hs}/bin/agda2hs $out/bin/agda2hs \ | ||
--add-flags "--with-compiler=${ghc}/bin/ghc" \ | ||
--add-flags "--library-file=${library-file}" \ | ||
--add-flags "--local-interfaces" | ||
''; # 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; }; | ||
in | ||
{ | ||
ghc ? ghcWithPackages (p: with p; [ ieee754 ]) | ||
}: let | ||
pkgs' = if builtins.isList pkgs then pkgs else pkgs self; | ||
library-file = writeText "libraries" '' | ||
${(concatMapStringsSep "\n" (p: "${p}/${p.libraryFile}") pkgs')} | ||
''; | ||
pname = "agda2hsWithPackages"; | ||
version = agda2hs.version; | ||
in runCommandNoCC "${pname}-${version}" { | ||
inherit pname version; | ||
nativeBuildInputs = [ makeWrapper ]; | ||
passthru.unwrapped = agda2hs; | ||
} '' | ||
mkdir -p $out/bin | ||
makeWrapper ${agda2hs}/bin/agda2hs $out/bin/agda2hs \ | ||
--add-flags "--with-compiler=${ghc}/bin/ghc" \ | ||
--add-flags "--library-file=${library-file}" \ | ||
--add-flags "--local-interfaces" | ||
''; # 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; }; | ||
in { | ||
inherit withPackages; | ||
agda2hs = withPackages [ ]; | ||
agda2hs = withPackages []; | ||
} |