-
Notifications
You must be signed in to change notification settings - Fork 12
/
flake.nix
77 lines (76 loc) · 2.87 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
72
73
74
75
76
{
inputs = {
fenix.url = "github:nix-community/fenix";
fenix.inputs.nixpkgs.follows = "nixpkgs";
fenix.inputs.rust-analyzer-src.follows = "rustAnalyzer";
flakeCompat.url = github:edolstra/flake-compat;
flakeCompat.flake = false;
flakeUtils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
rustAnalyzer.url = "github:rust-analyzer/rust-analyzer";
rustAnalyzer.flake = false;
treefmt.url = "github:numtide/treefmt";
treefmt.inputs.flake-utils.follows = "flakeUtils";
treefmt.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
inputs:
inputs.flakeUtils.lib.eachSystem
[ "x86_64-darwin" "x86_64-linux" ]
(
system:
let
nixpkgs = import inputs.nixpkgs { inherit system; };
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
treefmt = inputs.treefmt.defaultPackage.${ system };
fenix = inputs.fenix.packages.${ system };
fenixPlatform = nixpkgs.makeRustPlatform { inherit (fenix.latest) cargo rustc; };
in
{
checks = { defaultPackage = inputs.self.defaultPackage.${ system }; };
defaultApp = {
type = "app";
program = "${ inputs.self.defaultPackage.${ system } }/bin/book-summary";
};
defaultPackage =
fenixPlatform.buildRustPackage
{
pname = cargoToml.package.name;
version =
let
commit = inputs.self.shortRev or "dirty";
date = inputs.self.lastModifiedDate or inputs.self.lastModified or "19700101";
in
"${ builtins.substring 0 8 date }_${ commit }";
src = inputs.self.sourceInfo;
cargoLock.lockFile = ./Cargo.lock;
meta = {
description = cargoToml.package.description;
homepage = "https://github.com/dvogt23/book-summary";
license = nixpkgs.lib.licenses.mit;
};
};
devShell =
nixpkgs.mkShell
{
name = "Book-Summary";
packages = [
fenix.rust-analyzer
fenix.latest.cargo
fenix.latest.clippy
fenix.latest.rust-src
fenix.latest.rustc
fenix.latest.rustfmt
nixpkgs.cargo-tarpaulin
nixpkgs.jq
nixpkgs.nodejs
nixpkgs.nodePackages.prettier
nixpkgs.nodePackages.prettier-plugin-toml
nixpkgs.shfmt
nixpkgs.glibc
treefmt
];
};
}
);
}