aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-10-23 08:48:03 +0100
committerAkshay <[email protected]>2021-10-23 08:48:03 +0100
commit05b11f14b7f4a3d8c1ab68fb0846ae881433b326 (patch)
treedcc80687438718e55d2af79034748a86bf32c55e /flake.nix
parentc2f0582d1907dbef69e9ad42ba9d4301337fe1e8 (diff)
simplify flake
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix21
1 files changed, 13 insertions, 8 deletions
diff --git a/flake.nix b/flake.nix
index 8a7c97a..c086684 100644
--- a/flake.nix
+++ b/flake.nix
@@ -21,6 +21,7 @@
21 }: 21 }:
22 let 22 let
23 inherit (import-cargo.builders) importCargo; 23 inherit (import-cargo.builders) importCargo;
24
24 supportedSystems = [ "x86_64-linux" ]; 25 supportedSystems = [ "x86_64-linux" ];
25 forAllSystems = nixpkgs.lib.genAttrs supportedSystems; 26 forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
26 nixpkgsFor = forAllSystems (system: 27 nixpkgsFor = forAllSystems (system:
@@ -28,26 +29,31 @@
28 inherit system; 29 inherit system;
29 overlays = [ self.overlay ]; 30 overlays = [ self.overlay ];
30 }); 31 });
32
31 mozilla = p: p.callPackage (mozillapkgs + "/package-set.nix") { }; 33 mozilla = p: p.callPackage (mozillapkgs + "/package-set.nix") { };
32 chanspec = { 34 chanspec = {
33 date = "2021-09-30"; 35 date = "2021-09-30";
34 channel = "nightly"; 36 channel = "nightly";
35 sha256 = "Elqn7GDBDE/QT1XTDyj0EvivbC//uwjWX8d+J3Pi0dY="; # set zeros after modifying channel or date 37 sha256 = "Elqn7GDBDE/QT1XTDyj0EvivbC//uwjWX8d+J3Pi0dY="; # set zeros after modifying channel or date
36 }; 38 };
39 rustChannel = p: (mozilla p).rustChannelOf chanspec;
40
37 in 41 in
38 { 42 {
39 43
40 overlay = final: prev: 44 overlay = final: prev:
41 let 45 let
42 rustChannel = (mozilla final.pkgs).rustChannelOf chanspec; 46 inherit (rustChannel final.pkgs) rust rust-src;
43 inherit (rustChannel) rust rustc rust-src;
44 in 47 in
45 { 48 {
46 49
47 statix = with final; pkgs.stdenv.mkDerivation { 50 statix = with final; pkgs.stdenv.mkDerivation {
48 pname = "statix"; 51 pname = "statix";
49 version = "v0.1.0"; 52 version = "v0.1.0";
50 src = ./.; 53 src = builtins.path {
54 path = ./.;
55 name = "statix";
56 };
51 nativeBuildInputs = [ 57 nativeBuildInputs = [
52 (importCargo { lockFile = ./Cargo.lock; inherit pkgs; }).cargoHome 58 (importCargo { lockFile = ./Cargo.lock; inherit pkgs; }).cargoHome
53 rust 59 rust
@@ -73,21 +79,20 @@
73 devShell = forAllSystems (system: 79 devShell = forAllSystems (system:
74 let 80 let
75 pkgs = nixpkgsFor.${system}; 81 pkgs = nixpkgsFor.${system};
76 rustChannel = (mozilla pkgs).rustChannelOf chanspec; 82 inherit (rustChannel pkgs) rust rust-src;
77 in 83 in
78 with pkgs; 84 with pkgs;
79 mkShell rec { 85 mkShell rec {
80 buildInputs = 86 buildInputs =
81 (with pkgs; [ 87 [
82 rust-analyzer 88 rust-analyzer
83 rustfmt 89 rustfmt
84 cargo 90 cargo
85 cargo-watch 91 cargo-watch
86 ]) ++ (with rustChannel; [
87 rust 92 rust
88 rust-src 93 rust-src
89 ]); 94 ];
90 RUST_SRC_PATH = "${rustChannel.rust-src}/lib/rustlib/src/rust/library"; 95 RUST_SRC_PATH = "${rust-src}/lib/rustlib/src/rust/library";
91 RUST_LOG = "info"; 96 RUST_LOG = "info";
92 RUST_BACKTRACE = 1; 97 RUST_BACKTRACE = 1;
93 }); 98 });