forked from erg-lang/erg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
67 lines (62 loc) · 1.68 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
{
description = "Nix Flake for Erg Programming Language";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
# develop
devshell.url = "github:numtide/devshell";
flake-utils.url = "github:numtide/flake-utils";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = {
self,
nixpkgs,
devshell,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (
system: let
pkgs = import nixpkgs {
inherit system;
overlays = [
devshell.overlay
];
};
cargoToml = with builtins; (fromTOML (readFile ./Cargo.toml));
inherit (pkgs) lib;
in {
packages.erg = pkgs.rustPlatform.buildRustPackage {
inherit (cargoToml.package) name version;
src = builtins.path {
path = ./.;
filter = name: type:
(name == toString ./Cargo.toml)
|| (name == toString ./Cargo.lock)
|| (lib.hasPrefix (toString ./compiler) name)
|| (lib.hasPrefix (toString ./src) name);
};
cargoLock.lockFile = ./Cargo.lock;
};
packages.default = self.packages.${system}.erg;
devShells.default = pkgs.devshell.mkShell {
packages = with pkgs; [
gcc
rustc
cargo
# Dev
python3
treefmt # cli to run all formatters
alejandra # Nix formatter
# rustfmt # Rust Formatter
# taplo-cli # TOML formatter
];
};
checks = {
erg = self.packages.${system}.erg;
};
}
);
}