aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-09-10 15:12:30 +0100
committerAkshay <[email protected]>2021-09-10 15:12:30 +0100
commit336e97961ce6cf496ca177ab7ae11f3779bad868 (patch)
tree417d300b3fad61dfe3adc52d141c75a210851eaa /flake.nix
init
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix76
1 files changed, 76 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..ceccfc8
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,76 @@
1{
2 inputs = {
3 utils.url = "github:numtide/flake-utils";
4 naersk.url = "github:nmattia/naersk";
5 mozillapkgs = {
6 url = "github:mozilla/nixpkgs-mozilla";
7 flake = false;
8 };
9 gitignore = {
10 url = "github:hercules-ci/gitignore";
11 flake = false;
12 };
13 flake-compat = {
14 url = "github:edolstra/flake-compat";
15 flake = false;
16 };
17 };
18
19 outputs = { self, nixpkgs, utils, naersk, mozillapkgs, gitignore, ... }:
20 utils.lib.eachDefaultSystem (system:
21 let
22 pkgs = nixpkgs.legacyPackages."${system}";
23 inherit (import gitignore { inherit (pkgs) lib; }) gitignoreSource;
24
25 # Get a specific rust version
26 mozilla = pkgs.callPackage (mozillapkgs + "/package-set.nix") { };
27 chanspec = {
28 date = "2021-03-31";
29 channel = "nightly";
30 sha256 = "oK5ebje09MRn988saJMT3Zze/tRE7u9zTeFPV1CEeLc="; # set zeros after modifying channel or date
31 };
32
33 rustChannel = mozilla.rustChannelOf chanspec;
34 rust = rustChannel.rust;
35 rust-src = rustChannel.rust-src;
36
37 naersk-lib = naersk.lib."${system}".override {
38 cargo = rust;
39 rustc = rust;
40 };
41
42 nativeBuildInputs = with pkgs; [ ];
43
44 in
45 rec {
46 packages.nix-analyzer = naersk-lib.buildPackage {
47 pname = "nix-analyzer";
48 version = "0.1.0";
49 root = gitignoreSource ./.;
50 inherit nativeBuildInputs;
51 };
52 defaultPackage = packages.nix-analyzer;
53 apps.nix-analyzer = utils.lib.mkApp {
54 drv = packages.nix-analyzer;
55 };
56 apps.check = {
57 type = "app";
58 program = "${pkgs.cargo-watch}/bin/cargo-watch";
59 };
60 defaultApp = apps.nix-analyzer;
61 devShell = pkgs.mkShell {
62 nativeBuildInputs = nativeBuildInputs ++ [
63 rust
64 rust-src
65 pkgs.rust-analyzer
66 pkgs.rustfmt
67 pkgs.cargo
68 pkgs.cargo-watch
69 pkgs.cargo-tarpaulin
70 ];
71 RUST_SRC_PATH = "${rust-src}/lib/rustlib/src/rust/library";
72 RUST_LOG = "info";
73 RUST_BACKTRACE = 1;
74 };
75 });
76}