Skip to content

Commit 268a137

Browse files
liesnikovjespercockx
authored andcommitted
bring back the previous formatting and reference the original file
1 parent 69a47fd commit 268a137

File tree

1 file changed

+27
-42
lines changed

1 file changed

+27
-42
lines changed

nix/agda2hs.nix

Lines changed: 27 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,32 @@
1-
2-
{
3-
stdenv,
4-
lib,
5-
self,
6-
agda2hs,
7-
runCommandNoCC,
8-
makeWrapper,
9-
writeText,
10-
mkShell,
11-
ghcWithPackages,
12-
}:
1+
# this file should be very close to a copy of nixpkgs/pkgs/build-support/agda/default.nix
2+
# I think I took the version from https://github.com/NixOS/nixpkgs/blob/bbe6402ecacfc3a0e2c65e3527c2cbe148b98ff8/pkgs/build-support/agda/default.nix
3+
# but it would be nice to expose this in upstream so that we don't have to duplicate the file
4+
{stdenv, lib, self, agda2hs, runCommandNoCC, makeWrapper, writeText, mkShell, ghcWithPackages}:
135
with lib.strings;
146
let
15-
withPackages' =
16-
{
7+
withPackages' = {
178
pkgs,
18-
ghc ? ghcWithPackages (p: with p; [ ieee754 ]),
19-
}:
20-
let
21-
pkgs' = if builtins.isList pkgs then pkgs else pkgs self;
22-
library-file = writeText "libraries" ''
23-
${(concatMapStringsSep "\n" (p: "${p}/${p.libraryFile}") pkgs')}
24-
'';
25-
pname = "agda2hsWithPackages";
26-
version = agda2hs.version;
27-
in
28-
runCommandNoCC "${pname}-${version}"
29-
{
30-
inherit pname version;
31-
nativeBuildInputs = [ makeWrapper ];
32-
passthru.unwrapped = agda2hs;
33-
}
34-
''
35-
mkdir -p $out/bin
36-
makeWrapper ${agda2hs}/bin/agda2hs $out/bin/agda2hs \
37-
--add-flags "--with-compiler=${ghc}/bin/ghc" \
38-
--add-flags "--library-file=${library-file}" \
39-
--add-flags "--local-interfaces"
40-
''; # Local interfaces has been added for now: See https://github.com/agda/agda/issues/4526
41-
withPackages =
42-
arg: if builtins.isAttrs arg then withPackages' arg else withPackages' { pkgs = arg; };
43-
in
44-
{
9+
ghc ? ghcWithPackages (p: with p; [ ieee754 ])
10+
}: let
11+
pkgs' = if builtins.isList pkgs then pkgs else pkgs self;
12+
library-file = writeText "libraries" ''
13+
${(concatMapStringsSep "\n" (p: "${p}/${p.libraryFile}") pkgs')}
14+
'';
15+
pname = "agda2hsWithPackages";
16+
version = agda2hs.version;
17+
in runCommandNoCC "${pname}-${version}" {
18+
inherit pname version;
19+
nativeBuildInputs = [ makeWrapper ];
20+
passthru.unwrapped = agda2hs;
21+
} ''
22+
mkdir -p $out/bin
23+
makeWrapper ${agda2hs}/bin/agda2hs $out/bin/agda2hs \
24+
--add-flags "--with-compiler=${ghc}/bin/ghc" \
25+
--add-flags "--library-file=${library-file}" \
26+
--add-flags "--local-interfaces"
27+
''; # Local interfaces has been added for now: See https://github.com/agda/agda/issues/4526
28+
withPackages = arg: if builtins.isAttrs arg then withPackages' arg else withPackages' { pkgs = arg; };
29+
in {
4530
inherit withPackages;
46-
agda2hs = withPackages [ ];
31+
agda2hs = withPackages [];
4732
}

0 commit comments

Comments
 (0)