git.iko.soy/typeable/compaREST
on latest help sign in
typeable/compaREST/default.nix
71 lines 2.2 kB history raw
1{ sources ? import ./nix/sources.nix
2, haskellNix ? import sources.haskellNix { inherit system; }
3, pkgs ? import haskellNix.sources.nixpkgs-2105 (haskellNix.nixpkgsArgs // { inherit system; })
4, system ? builtins.currentSystem
5, nix-filter ? import sources.nix-filter
6}:
7let
8 hsPkgs = pkgs.haskell-nix.stackProject {
9 src = nix-filter {
10 root = ./.;
11 name = "compaREST";
12 include = [
13 ./stack.yaml
14 ./stack.yaml.lock
15 ./comparest.cabal
16 ];
17 };
19 modules = [
20 {
21 dontStrip = false;
22 dontPatchELF = false;
23 enableDeadCodeElimination = true;
24 packages.comparest.src = nix-filter {
25 root = ./.;
26 name = "compaREST-src";
27 include = with nix-filter; [
28 (./comparest.cabal)
29 (inDirectory ./test)
30 (inDirectory ./src)
31 (inDirectory ./app)
32 (inDirectory ./github-action)
33 ./awsm-css/dist/awsm.min.css
34 ./LICENSE
35 ];
36 };
37 }
38 ];
39 };
41 staticify = name: drv: pkgs.runCommand name { } ''
42 mkdir -p $out/bin
43 cp ${drv + "/bin"}/* $out/bin
45 ${pkgs.nukeReferences}/bin/nuke-refs $out/bin/*
46 '';
48 compaREST = pkgs.dockerTools.buildImage {
49 name = "compaREST";
50 contents = [ (staticify "compaREST-static" hsPkgs.projectCross.musl64.hsPkgs.comparest.components.exes.comparest) ];
51 config = {
52 Entrypoint = [ "/bin/comparest" ];
53 };
54 };
56 compaRESTGithubAction =
57 let
58 action = staticify "compaREST-github-action-static" hsPkgs.projectCross.musl64.hsPkgs.comparest.components.exes.comparest-github-action;
59 wrapped = pkgs.runCommand "wrapped-compaREST-github-action" { buildInputs = [ pkgs.makeWrapper ]; } ''
60 makeWrapper ${action}/bin/comparest-github-action $out/bin/pre --add-flags "pre"
61 makeWrapper ${action}/bin/comparest-github-action $out/bin/run --add-flags "run"
62 '';
63 in
64 pkgs.dockerTools.buildImage {
65 name = "typeable/comparest-github-action";
66 tag = "latest";
67 contents = [ wrapped pkgs.cacert ];
68 };
70in
71{ inherit compaREST compaRESTGithubAction hsPkgs haskellNix; }