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

View file

@ -18,13 +18,13 @@
outputs = { self, nixpkgs, utils, rust-overlay, crate2nix, ... }: outputs = { self, nixpkgs, utils, rust-overlay, crate2nix, ... }:
utils.lib.eachDefaultSystem utils.lib.eachDefaultSystem
(system: (system:
let let
name = "himalaya"; name = "himalaya";
# Imports # Imports
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
overlays = [ overlays = [
rust-overlay.overlay rust-overlay.overlay
(self: super: { (self: super: {
# Because rust-overlay bundles multiple rust packages into one # Because rust-overlay bundles multiple rust packages into one
@ -61,8 +61,23 @@
# Configuration for the non-Rust dependencies # Configuration for the non-Rust dependencies
buildInputs = with pkgs; [ openssl.dev ]; buildInputs = with pkgs; [ openssl.dev ];
nativeBuildInputs = with pkgs; [ rustc cargo pkgconfig ]; nativeBuildInputs = with pkgs; [ rustc cargo pkgconfig ];
in rec { in
packages.${name} = project.rootCrate.build; 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` # `nix build`
defaultPackage = packages.${name}; defaultPackage = packages.${name};