-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathflake.nix
88 lines (78 loc) · 2.51 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
{
description = "Golden tests for command-line interfaces.";
inputs = {
flake-utils.url = github:numtide/flake-utils;
idris = {
url = "github:idris-lang/Idris2";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
papers = {
url = "github:idris-lang/Idris2?dir=libs/papers";
flake = false;
};
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
replicadhall.url = "github:ReplicaTest/replica-dhall";
};
outputs = { self, nixpkgs, idris, papers, flake-utils, pre-commit-hooks, replicadhall }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
inherit (pkgs)
dhall
lib;
inherit (pkgs.haskellPackages)
dhall-json;
version = import ./version.nix;
idrisPkgs = idris.packages.${system};
callPackage = lib.callPackageWith (pkgs // packages);
packages = {
inherit version;
buildIdris = idris.buildIdris.${system};
papersLib = callPackage ./nix/papersLib.nix { inherit papers; };
replica_dhall = replicadhall.packages.${system}.default;
buildReplica = callPackage ./nix/buildReplica.nix { };
replica = callPackage ./nix/replica.nix { };
replicaTest = callPackage ./nix/replica.nix { };
};
inherit (packages)
replica
replicaTest
replica_dhall
papersLib;
dockerImage = pkgs.dockerTools.buildImage {
name = "replica";
config = {
Cmd = [ "${replica}/bin/replica" ];
};
tag = "v${version}";
};
in
{
packages = {
default = replica;
replica = replica;
docker = dockerImage;
};
checks = {
tests = replicaTest;
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
nixpkgs-fmt.enable = true;
dhall-format.enable = true;
markdownlint.enable = true;
online-tests = import ./nix/online-tests.nix;
};
};
};
devShells.default = pkgs.mkShell {
packages = [ idrisPkgs.idris2 papersLib pkgs.rlwrap dhall dhall-json ];
shellHook = ''
alias idris2="rlwrap -s 1000 idris2 --no-banner"
${self.checks.${system}.pre-commit-check.shellHook}
'';
};
}
);
}