From 05b11f14b7f4a3d8c1ab68fb0846ae881433b326 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sat, 23 Oct 2021 13:18:03 +0530 Subject: simplify flake --- bin/src/config.rs | 2 +- flake.nix | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/bin/src/config.rs b/bin/src/config.rs index 077f73e..cb03a4b 100644 --- a/bin/src/config.rs +++ b/bin/src/config.rs @@ -11,7 +11,7 @@ use vfs::ReadOnlyVfs; use crate::err::ConfigErr; -/// Static analysis and linting for the nix programming language +/// Lints and suggestions for the Nix programming language #[derive(Clap, Debug)] #[clap(version = "0.1.0", author = "Akshay ")] pub struct Opts { diff --git a/flake.nix b/flake.nix index 8a7c97a..c086684 100644 --- a/flake.nix +++ b/flake.nix @@ -21,6 +21,7 @@ }: let inherit (import-cargo.builders) importCargo; + supportedSystems = [ "x86_64-linux" ]; forAllSystems = nixpkgs.lib.genAttrs supportedSystems; nixpkgsFor = forAllSystems (system: @@ -28,26 +29,31 @@ inherit system; overlays = [ self.overlay ]; }); + mozilla = p: p.callPackage (mozillapkgs + "/package-set.nix") { }; chanspec = { date = "2021-09-30"; channel = "nightly"; sha256 = "Elqn7GDBDE/QT1XTDyj0EvivbC//uwjWX8d+J3Pi0dY="; # set zeros after modifying channel or date }; + rustChannel = p: (mozilla p).rustChannelOf chanspec; + in { overlay = final: prev: let - rustChannel = (mozilla final.pkgs).rustChannelOf chanspec; - inherit (rustChannel) rust rustc rust-src; + inherit (rustChannel final.pkgs) rust rust-src; in { statix = with final; pkgs.stdenv.mkDerivation { pname = "statix"; version = "v0.1.0"; - src = ./.; + src = builtins.path { + path = ./.; + name = "statix"; + }; nativeBuildInputs = [ (importCargo { lockFile = ./Cargo.lock; inherit pkgs; }).cargoHome rust @@ -73,21 +79,20 @@ devShell = forAllSystems (system: let pkgs = nixpkgsFor.${system}; - rustChannel = (mozilla pkgs).rustChannelOf chanspec; + inherit (rustChannel pkgs) rust rust-src; in with pkgs; mkShell rec { buildInputs = - (with pkgs; [ + [ rust-analyzer rustfmt cargo cargo-watch - ]) ++ (with rustChannel; [ rust rust-src - ]); - RUST_SRC_PATH = "${rustChannel.rust-src}/lib/rustlib/src/rust/library"; + ]; + RUST_SRC_PATH = "${rust-src}/lib/rustlib/src/rust/library"; RUST_LOG = "info"; RUST_BACKTRACE = 1; }); -- cgit v1.2.3