-
Notifications
You must be signed in to change notification settings - Fork 35
/
flake.nix
106 lines (93 loc) · 3.82 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# TODO 2023-07-20T22:19:36+0100 raehik
# * they build with GHC 9.2.5 (check Stack resolver in stack.yaml I guess)
# * granule-interpreter/gr-golden had 7 fails (tests disabled here)
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
haskell-flake.url = "github:srid/haskell-flake";
haskell-src-exts = {
url = "github:jackohughes/haskell-src-exts";
flake = false;
};
};
outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = nixpkgs.lib.systems.flakeExposed;
imports = [ inputs.haskell-flake.flakeModule ];
perSystem = { self', pkgs, config, ... }: {
packages.default = self'.packages.granule-repl;
# TODO shame I have to create a full derivation for this, I'd like to
# just copy files with a name. alas
packages.granule-stdlib = pkgs.stdenv.mkDerivation {
name = "granule-stdlib";
src = ./StdLib;
phases = [ "unpackPhase" "installPhase" ];
installPhase = ''
mkdir -p $out
cp $src/* $out
'';
};
packages.granule-repl-with-stdlib = pkgs.writeShellScriptBin "grepl" ''
${self'.packages.granule-repl}/bin/grepl \
--include-path ${self'.packages.granule-stdlib} \
$@
'';
#haskellProjects.ghc96 = import ./haskell-flake-ghc96.nix pkgs;
haskellProjects.default = {
#basePackages = config.haskellProjects.ghc96.outputs.finalPackages;
packages = {
# need Jack H's haskell-src-exts fork
haskell-src-exts.source = inputs.haskell-src-exts;
};
settings = {
sbv = {
# 2023-04-18 raehik: sbv-9.0 broken; seems tests fail. ignore
check = false;
broken = false;
};
granule-interpreter = {
# TODO 2023-07-20 raehik: tests access files outside directory
check = false;
};
granule-frontend = {
# TODO 2023-07-24 raehik:
# `/Language.Granule.Synthesis.Synth/Construcor test for
# Either/Branch on (Left : a -> Either a b)/` fails. dorchard
# unsure if it should be failing or not. Skip tests while
# unresolved.
check = false;
};
};
devShell = {
hoogle = false; # haskell-src-exts override breaks it
tools = hp: {
ghcid = null; # broken on GHC 9.6? old fsnotify
hlint = null; # broken on GHC 9.6? old
haskell-language-server = null; # TAKES AGES TO BUILD FFS
};
};
};
# prep a Docker/OSI image build
# uses streamLayeredImage so as to not place the image in the Nix store
# to use, run result script and load into your container daemon. e.g.
# for podman, `nix build .#image && ./result | podman load`
# for some reason, I don't need justStaticExecutables to get a small
# image here. not sure why but sure!
packages.image-granule-repl = pkgs.dockerTools.streamLayeredImage {
name = "granule-repl";
# equivalent to `git rev-parse HEAD`
# only exists on clean working tree, else set to "dev"
tag = self.rev or "dev";
config = {
Entrypoint = [ "${self'.packages.granule-repl-with-stdlib}/bin/grepl" ];
# Granule syntax is UTF-8
# C.UTF-8 is builtin. to use en_US.UTF-8 etc, add glibcLocales into
# contents and point LOCALE_ARCHIVE to it
Env = [ "LANG=C.UTF-8" ];
};
maxLayers = 100; # less than Docker max layers to allow extending
};
};
};
}