-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
71 lines (61 loc) · 2.22 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
{
description =
"A minimalist pure functional language implemented via recursive descent parsing.";
# ----------------------------------------------------------------------------
# Inputs
# ----------------------------------------------------------------------------
inputs = {
# Using a pinned nixpkgs reference for consistency
nixpkgs.url =
"github:NixOS/nixpkgs?rev=de1864217bfa9b5845f465e771e0ecb48b30e02d";
flake-utils.url = "github:numtide/flake-utils";
};
# ----------------------------------------------------------------------------
# Outputs
# ----------------------------------------------------------------------------
outputs = { nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
manifest = pkgs.lib.importTOML ./Cargo.toml;
package = manifest.package;
# ----------------------------------------------------------------------
# Rust Build
# ----------------------------------------------------------------------
rustApp = pkgs.rustPlatform.buildRustPackage {
pname = package.name;
version = package.version;
src = pkgs.lib.cleanSource ./.;
cargoLock.lockFile = ./Cargo.lock;
meta = with pkgs.lib; {
inherit (package) description homepage repository;
license = licenses.mit;
maintainers = [ maintainers.xosnrdev ];
};
};
# ----------------------------------------------------------------------
# Development Shell
# ----------------------------------------------------------------------
devShell = pkgs.mkShell {
buildInputs = [
# Rust & dev tooling
pkgs.cargo-watch
pkgs.cargo-sort
pkgs.rustc
pkgs.cargo
pkgs.rustfmt
pkgs.clippy
];
shellHook = ''
export RUST_BACKTRACE=1
'';
};
in {
# Formatter
formatter = pkgs.nixfmt-classic;
# Packages
packages = { default = rustApp; };
# Development Shell
devShells.default = devShell;
});
}