mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 23:03:40 +01:00
gnvim: init at 0.1.5
This commit is contained in:
parent
98c4a3338b
commit
4e7364abab
3 changed files with 94 additions and 0 deletions
47
pkgs/applications/editors/neovim/gnvim/default.nix
Normal file
47
pkgs/applications/editors/neovim/gnvim/default.nix
Normal file
|
@ -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;
|
||||
};
|
||||
}
|
41
pkgs/applications/editors/neovim/gnvim/wrapper.nix
Normal file
41
pkgs/applications/editors/neovim/gnvim/wrapper.nix
Normal file
|
@ -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;
|
||||
}
|
||||
|
|
@ -21123,6 +21123,12 @@ in
|
|||
|
||||
neovim-qt = libsForQt5.callPackage ../applications/editors/neovim/qt.nix { };
|
||||
|
||||
gnvim-unwrapped = callPackage ../applications/editors/neovim/gnvim {
|
||||
gtk = pkgs.gtk3;
|
||||
};
|
||||
|
||||
gnvim = callPackage ../applications/editors/neovim/gnvim/wrapper.nix { };
|
||||
|
||||
neovim-remote = callPackage ../applications/editors/neovim/neovim-remote.nix { pythonPackages = python3Packages; };
|
||||
|
||||
vis = callPackage ../applications/editors/vis {
|
||||
|
|
Loading…
Reference in a new issue