include vim plugin inside nix package (#157)

This commit is contained in:
toastal 2021-06-03 14:51:48 +00:00 committed by GitHub
parent 7c88896fcc
commit 0d7b490f98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 15 deletions

View file

@ -50,11 +50,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1617636226,
"narHash": "sha256-iZhBWrOR2DoDs1C+0FlnM9AQLMol/qoGQ+d+S43CKJM=",
"lastModified": 1621840840,
"narHash": "sha256-o6h6+d5ZwrFmOTe+ma9s1Z9kyHsCW1C84IA8RZ9/fIU=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "3d1a7716d7f1fccbd7d30ab3b2ed3db831f43bde",
"rev": "ea7d4aa9b8225abd6147339f0d56675d6f1f0fd1",
"type": "github"
},
"original": {
@ -94,11 +94,11 @@
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1617848844,
"narHash": "sha256-nhPuATSHRrzfZNjtl8zmMhZklYFCHiQd7+uf+jQbd+o=",
"lastModified": 1621996674,
"narHash": "sha256-TbqYv4mnCXCpwGsMgpC94lbxtSKet8IkQxlUYXkfA/4=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "70330a767d25daa6063e89e38d68b94b2d971831",
"rev": "b5651a474dd332c6b8f772561eadd0b85ac224a0",
"type": "github"
},
"original": {
@ -109,11 +109,11 @@
},
"utils": {
"locked": {
"lastModified": 1617631617,
"narHash": "sha256-PARRCz55qN3gy07VJZIlFeOX420d0nGF0RzGI/9hVlw=",
"lastModified": 1620759905,
"narHash": "sha256-WiyWawrgmyN0EdmiHyG2V+fqReiVi8bM9cRdMaKQOFg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b2c27d1a81b0dc266270fa8aeecebbd1807fc610",
"rev": "b543720b25df6ffdfcf9227afafc5b8c1fabfae8",
"type": "github"
},
"original": {

View file

@ -18,13 +18,13 @@
outputs = { self, nixpkgs, utils, rust-overlay, crate2nix, ... }:
utils.lib.eachDefaultSystem
(system:
let
let
name = "himalaya";
# Imports
pkgs = import nixpkgs {
inherit system;
overlays = [
pkgs = import nixpkgs {
inherit system;
overlays = [
rust-overlay.overlay
(self: super: {
# Because rust-overlay bundles multiple rust packages into one
@ -61,8 +61,23 @@
# Configuration for the non-Rust dependencies
buildInputs = with pkgs; [ openssl.dev ];
nativeBuildInputs = with pkgs; [ rustc cargo pkgconfig ];
in rec {
packages.${name} = project.rootCrate.build;
in
rec {
packages = {
${name} = project.rootCrate.build;
"${name}-vim" = pkgs.vimUtils.buildVimPluginFrom2Nix {
inherit (packages.${name}) version;
name = "${name}-vim";
src = self;
configurePhase = "cd vim/";
buildInputs = [ packages.${name} ];
postInstall = ''
mkdir -p $out/bin
ln -s ${packages.${name}}/bin/himalaya $out/bin/himalaya
'';
};
};
# `nix build`
defaultPackage = packages.${name};