-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
100 lines (95 loc) · 2.81 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
{
description = "A library and client implementation of luarocks";
nixConfig = {
extra-substituters = "https://neorocks.cachix.org";
extra-trusted-public-keys = "neorocks.cachix.org-1:WqMESxmVTOJX7qoBC54TwrMMoVI1xAM+7yFin8NRfwk=";
};
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
git-hooks = {
url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @ {
self,
nixpkgs,
flake-parts,
git-hooks,
...
}:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = builtins.attrNames nixpkgs.legacyPackages;
perSystem = attrs @ {
system,
pkgs,
...
}: let
pkgs = attrs.pkgs.extend self.overlays.default;
git-hooks-check = git-hooks.lib.${system}.run {
src = self;
hooks = {
# NOTE: When adding/removing hooks, make sure
# to update CONTRIBUTING.md for non-nix users.
alejandra.enable = true;
rustfmt.enable = true;
clippy = {
enable = true;
settings = {
denyWarnings = true;
allFeatures = true;
};
extraPackages = pkgs.rocks.buildInputs ++ pkgs.rocks.nativeBuildInputs;
};
cargo-check.enable = true;
};
settings.rust.check.cargoDeps = pkgs.rocks.cargoDeps;
};
in {
packages = with pkgs; {
default = rocks;
inherit rocks;
};
devShells = let
mkDevShell = lua_pkg:
pkgs.mkShell {
name = "rocks devShell";
inherit (git-hooks-check) shellHook;
buildInputs =
(with pkgs; [
rust-analyzer
ra-multiplex
cargo-nextest
lua_pkg
# Needed for integration test builds
pkg-config
libxcrypt
cmakeMinimal
zlib
])
++ self.checks.${system}.git-hooks-check.enabledPackages
++ pkgs.rocks.buildInputs
++ pkgs.rocks.nativeBuildInputs;
};
in rec {
default = lua51;
lua51 = mkDevShell pkgs.lua5_1;
lua52 = mkDevShell pkgs.lua5_2;
lua53 = mkDevShell pkgs.lua5_3;
lua54 = mkDevShell pkgs.lua5_4;
luajit = mkDevShell pkgs.luajit;
};
checks = rec {
default = tests;
inherit
git-hooks-check
;
tests = pkgs.rocks-debug;
};
};
flake = {
overlays.default = import ./nix/overlay.nix {inherit self;};
};
};
}