forked from mdzk-rs/mdzk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
60 lines (51 loc) · 1.49 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
{
description = "Plain text Zettelkasten based on mdBook";
inputs = {
utils.url = "github:numtide/flake-utils";
naersk.url = "github:nmattia/naersk";
rust.url = "github:oxalica/rust-overlay";
};
outputs = { self, nixpkgs, utils, naersk, rust }:
utils.lib.eachDefaultSystem
(
system:
let
name = "mdzk";
rust-overlay = import rust;
pkgs = import nixpkgs {
inherit system;
overlays = [ rust-overlay ];
};
rust-pkg = pkgs.rust-bin.stable.latest.default.override {
extensions = [
"rust-std"
"rust-src"
];
};
naersk-lib = naersk.lib."${system}".override {
rustc = rust-pkg;
};
mdzk-pkg = naersk-lib.buildPackage {
pname = name;
root = pkgs.lib.cleanSource ./.;
};
in
rec {
# `nix build`
packages.${name} = mdzk-pkg;
defaultPackage = packages.${name};
# `nix run`
apps.${name} = utils.lib.mkApp {
drv = packages.${name};
};
defaultApp = apps.${name};
# `nix develop`
devShell = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
rust-pkg
rust-analyzer
];
};
}
);
}