diff options
author | Minijackson <minijackson@riseup.net> | 2019-09-18 13:06:42 +0200 |
---|---|---|
committer | Matthieu Coudron <coudron@iij.ad.jp> | 2019-10-02 14:08:40 +0900 |
commit | 4e7364abab5443212f33f21846a73d46b63f1990 (patch) | |
tree | 5621eff398fe560b7ec430145a4111a98e46d891 /pkgs/applications/editors | |
parent | 98c4a3338b05cf331a991b7b6548b3e80ae572ee (diff) | |
download | nixlib-4e7364abab5443212f33f21846a73d46b63f1990.tar nixlib-4e7364abab5443212f33f21846a73d46b63f1990.tar.gz nixlib-4e7364abab5443212f33f21846a73d46b63f1990.tar.bz2 nixlib-4e7364abab5443212f33f21846a73d46b63f1990.tar.lz nixlib-4e7364abab5443212f33f21846a73d46b63f1990.tar.xz nixlib-4e7364abab5443212f33f21846a73d46b63f1990.tar.zst nixlib-4e7364abab5443212f33f21846a73d46b63f1990.zip |
gnvim: init at 0.1.5
Diffstat (limited to 'pkgs/applications/editors')
-rw-r--r-- | pkgs/applications/editors/neovim/gnvim/default.nix | 47 | ||||
-rw-r--r-- | pkgs/applications/editors/neovim/gnvim/wrapper.nix | 41 |
2 files changed, 88 insertions, 0 deletions
diff --git a/pkgs/applications/editors/neovim/gnvim/default.nix b/pkgs/applications/editors/neovim/gnvim/default.nix new file mode 100644 index 000000000000..764d7004940d --- /dev/null +++ b/pkgs/applications/editors/neovim/gnvim/default.nix @@ -0,0 +1,47 @@ +{ 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 = "00r5jf5qdw02vcv3522qqrnwj14mip0l58prcncbvyg4pxlm2rb2"; + + 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 + ''; + + 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 ]; + inherit version; + }; +} diff --git a/pkgs/applications/editors/neovim/gnvim/wrapper.nix b/pkgs/applications/editors/neovim/gnvim/wrapper.nix new file mode 100644 index 000000000000..e16fe8a8adc7 --- /dev/null +++ b/pkgs/applications/editors/neovim/gnvim/wrapper.nix @@ -0,0 +1,41 @@ +{ stdenv, gnvim-unwrapped, neovim, makeWrapper }: + +stdenv.mkDerivation { + pname = "gnvim"; + version = gnvim-unwrapped.version; + buildCommand = if stdenv.isDarwin then '' + mkdir -p $out/Applications + cp -r ${gnvim-unwrapped}/bin/gnvim.app $out/Applications + + chmod -R a+w "$out/Applications/gnvim.app/Contents/MacOS" + wrapProgram "$out/Applications/gnvim.app/Contents/MacOS/gnvim" \ + --prefix PATH : "${neovim}/bin" \ + --set GNVIM_RUNTIME_PATH "${gnvim-unwrapped}/share/gnvim/runtime" + '' else '' + makeWrapper '${gnvim-unwrapped}/bin/gnvim' "$out/bin/gnvim" \ + --prefix PATH : "${neovim}/bin" \ + --set GNVIM_RUNTIME_PATH "${gnvim-unwrapped}/share/gnvim/runtime" + + mkdir -p "$out/share" + ln -s '${gnvim-unwrapped}/share/icons' "$out/share/icons" + + # copy and fix .desktop file + cp -r '${gnvim-unwrapped}/share/applications' "$out/share/applications" + # Sed needs a writable directory to do inplace modifications + chmod u+rw "$out/share/applications" + for file in $out/share/applications/*.desktop; do + sed -e "s|Exec=.\\+gnvim\\>|Exec=$out/bin/gnvim|" -i "$file" + done + ''; + + preferLocalBuild = true; + + nativeBuildInputs = [ + makeWrapper + ]; + + passthru.unwrapped = gnvim-unwrapped; + + inherit (gnvim-unwrapped) meta; +} + |