infra/environments/dev/rust.nix

33 lines
738 B
Nix
Raw Normal View History

2017-02-07 20:16:11 +01:00
{ gitpkgs ? import /home/steveej/src/github/NixOS/nixpkgs {}
, pkgs ? gitpkgs
, name ? "generic"
, version ? "Stable"
, extraBuildInputs ? []
}:
2016-05-23 00:39:45 +02:00
let
rustPackages = builtins.getAttr "rust${version}" pkgs;
2017-02-07 20:16:11 +01:00
rustc = rustPackages.rustc;
rustShellHook = { rustc, name }: ''
rustname=rust_${rustc.version}_${name}
setPS1 $rustname
unset name
'';
commonVimRC = ''
'';
2016-05-23 00:39:45 +02:00
in pkgs.stdenv.mkDerivation {
inherit name;
2017-02-07 20:16:11 +01:00
buildInputs = with rustPackages;[
( import ./vim-rust.nix { pkgs=gitpkgs; commonRC=commonVimRC;
inherit rustc;
racerd=pkgs.rustracerd;
})
rustc cargo
] ++ [
pkgs.rustfmt
] ++ extraBuildInputs;
shellHook = (rustShellHook){
inherit name;
inherit rustc;
};
2016-05-23 00:39:45 +02:00
}