-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathflake.nix
More file actions
71 lines (65 loc) · 1.63 KB
/
Copy pathflake.nix
File metadata and controls
71 lines (65 loc) · 1.63 KB
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
{
description = "Exercism Nix track exercises";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs =
{ nixpkgs, ... }:
let
inherit (nixpkgs) lib;
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = lib.genAttrs systems;
pkgsFor = system: nixpkgs.legacyPackages.${system};
in
{
devShells = forAllSystems (
system:
let
pkgs = pkgsFor system;
in
{
default = import ./shell.nix { inherit pkgs; };
}
);
formatter = forAllSystems (system: (pkgsFor system).nixfmt-tree);
checks = forAllSystems (
system:
let
pkgs = pkgsFor system;
in
{
linting = pkgs.runCommand "linting-check" { } ''
${pkgs.statix}/bin/statix check ${./.}
touch $out
'';
formatting = pkgs.runCommand "formatting-check" { } ''
cp -r ${./.} repo
chmod -R +w repo
${pkgs.nixfmt-tree}/bin/treefmt --ci --tree-root repo
touch $out
'';
unit-tests =
pkgs.runCommand "verify-exercises"
{
buildInputs = with pkgs; [
jq
nix
nix-unit
];
NIX_PATH = "nixpkgs=${nixpkgs}";
}
''
export HOME=$TMPDIR
cd ${./.}
bash bin/verify-exercises
touch $out
'';
}
);
};
}