-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
54 lines (49 loc) · 1.75 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# © 2019-2024 Serokell <[email protected]>
# © 2019-2024 Lars Jellema <[email protected]>
#
# SPDX-License-Identifier: MPL-2.0
{
inputs = {
haskellNix.url = "github:input-output-hk/haskell.nix";
nixpkgs.follows = "haskellNix/nixpkgs-unstable";
nixfmt-src.url = "github:NixOS/nixfmt";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, haskellNix, flake-utils, nixfmt-src, ...}@inputs:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [ haskellNix.overlay ];
inherit (haskellNix) config;
};
inherit (pkgs.pkgsCross.ghcjs) haskell-nix;
nixfmt-js = haskell-nix.cabalProject {
compiler-nix-name = "ghc98";
src = ./.;
pkg-def-extras = [
(_: {
# override nixfmt with a newer version
packages.nixfmt = {...}: (haskell-nix.cabalProject {
compiler-nix-name = "ghc98";
src = nixfmt-src;
# we need base version to be at least 4.19, so we're relaxing the upper bound
configureArgs = "--allow-newer base";
}).pkg-set.config.packages.nixfmt;
})
];
};
in {
packages = {
nixfmt-js = nixfmt-js.nixfmt-js.components.exes.js-interface;
nixfmt-webdemo = pkgs.runCommandNoCC "nixfmt-webdemo" { } ''
mkdir $out
cp ${./js/index.html} $out/index.html
cp ${./js/404.html} $out/404.html
${pkgs.closurecompiler}/bin/closure-compiler --assume_function_wrapper \
--js ${self.packages.${system}.nixfmt-js}/bin/js-interface \
--js_output_file $out/nixfmt.js
'';
inherit (pkgs) awscli;
};
});
}