-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathflake.nix
66 lines (60 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
{
description = "mdsh - a markdown shell pre-processor";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
};
outputs =
{
self,
nixpkgs,
systems,
}:
let
version = (lib.importTOML "${self}/Cargo.toml").package.version;
inherit (nixpkgs) lib;
fs = lib.fileset;
eachSystem = f: lib.genAttrs (import systems) (system: f nixpkgs.legacyPackages.${system});
in
{
devShells = eachSystem (pkgs: {
default = pkgs.mkShell {
buildInputs = [
pkgs.cargo
pkgs.gitAndTools.git-extras
pkgs.gitAndTools.pre-commit
pkgs.libiconv
pkgs.rust-analyzer
pkgs.rustc
pkgs.rustfmt
];
shellHook = ''
export PATH=$PWD/target/debug:$PATH
export RUST_SRC_PATH="${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
'';
};
});
packages = eachSystem (pkgs: {
default = pkgs.rustPlatform.buildRustPackage {
pname = "mdsh";
inherit version;
src = fs.toSource {
root = ./.;
fileset = fs.unions [
./Cargo.toml
./Cargo.lock
./src
];
};
cargoLock.lockFile = ./Cargo.lock;
meta = with lib; {
description = "Markdown shell pre-processor";
homepage = "https://github.com/zimbatm/mdsh";
license = with licenses; [ mit ];
maintainers = with maintainers; [ zimbatm ];
mainProgram = "mdsh";
};
};
});
};
}