nixpkgs/pkgs/applications/editors/neovim/gnvim/default.nix
Maximilian Bosch 068beb2c07
gnvim: fix build
When running the default builder for Rust, the artifacts would be stored
in `target/<arch>/<profile>`, however the `install`-target expects the
default structure (`target/<profile>`) of `cargo`-builds.

When using the Makefile for building as well, the expected structure is
created instead.
2020-05-13 22:19:47 +02:00

51 lines
1.2 KiB
Nix

{ stdenv, rustPlatform, fetchFromGitHub, gtk, webkitgtk }:
rustPlatform.buildRustPackage rec {
pname = "gnvim-unwrapped";
version = "0.1.5";
src = fetchFromGitHub {
owner = "vhakulinen";
repo = "gnvim";
rev = version;
sha256 = "11gb59lhc1sp5dxj2fdm6072f4nxxay0war3kmchdwsk41nvxlrh";
};
cargoSha256 = "0ay7hx5bzchp772ywgxzia12c44kbyarrshl689cmqh59wphsrx5";
buildInputs = [ gtk webkitgtk ];
# The default build script tries to get the version through Git, so we
# replace it
prePatch = ''
cat << EOF > build.rs
use std::env;
use std::fs::File;
use std::io::Write;
use std::path::Path;
fn main() {
let out_dir = env::var("OUT_DIR").unwrap();
let dest_path = Path::new(&out_dir).join("gnvim_version.rs");
let mut f = File::create(&dest_path).unwrap();
f.write_all(b"const VERSION: &str = \"${version}\";").unwrap();
}
EOF
'';
buildPhase = ''
make build
'';
installPhase = ''
make install PREFIX="${placeholder "out"}"
'';
meta = with stdenv.lib; {
description = "GUI for neovim, without any web bloat";
homepage = "https://github.com/vhakulinen/gnvim";
license = licenses.mit;
maintainers = with maintainers; [ minijackson ];
};
}