-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
42 lines (35 loc) · 1.18 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
{
description = "Plain text Zettelkasten based on mdBook";
inputs = {
utils.url = "github:numtide/flake-utils";
rust.url = "github:oxalica/rust-overlay";
};
outputs = { self, nixpkgs, utils, rust }:
utils.lib.eachDefaultSystem (system:
let
pname = "mdzk-language-server";
version =
(builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version;
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust) ];
};
rust-toolchain = pkgs.rust-bin.selectLatestNightlyWith (toolchain:
toolchain.default.override {
extensions = [ "rust-std" "rust-src" ];
});
mdzk-ls-pkg = pkgs.callPackage ./default.nix {
inherit pkgs pname version rust-toolchain;
};
in rec {
# `nix build`
packages.${pname} = mdzk-ls-pkg;
packages.default = packages.${pname};
# `nix run`
apps.${pname} = utils.lib.mkApp { drv = packages.${pname}; };
defaultApp = apps.${pname};
# `nix develop`
devShells.default =
pkgs.mkShell { nativeBuildInputs = with pkgs; [ rust-toolchain ]; };
});
}