helix-mods/flake.nix

57 lines
1.6 KiB
Nix
Raw Normal View History

{
description = "A post-modern text editor.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
2021-02-09 07:39:52 +01:00
rust-overlay.url = "github:oxalica/rust-overlay";
2021-02-22 09:02:59 +01:00
naersk.url = "github:nmattia/naersk";
2021-06-09 01:00:04 +02:00
helix = {
flake = false;
url = "https://github.com/helix-editor/helix";
type = "git";
submodules = true;
};
};
2021-02-22 09:02:59 +01:00
outputs = inputs@{ self, nixpkgs, naersk, rust-overlay, flake-utils, ... }:
2021-06-09 23:56:11 +02:00
let
rust = pkgs:
(pkgs.rustChannelOf {
date = "2021-05-01";
channel = "nightly";
}).minimal; # cargo, rustc and rust-std
2021-06-09 23:56:11 +02:00
mkNaerskLib = system: pkgs:
naersk.lib."${system}".override {
# naersk can't build with stable?!
# inherit (pkgs.rust-bin.stable.latest) rustc cargo;
2021-06-09 23:56:11 +02:00
rustc = rust pkgs;
cargo = rust pkgs;
2021-02-22 09:02:59 +01:00
};
2021-06-09 23:56:11 +02:00
pkg = naerskLib:
naerskLib.buildPackage {
2021-02-22 09:02:59 +01:00
pname = "helix";
2021-06-09 01:00:04 +02:00
root = inputs.helix;
2021-06-10 03:17:14 +02:00
cargoBuildOptions = self: self ++ [ ''--features "embed_runtime"'' ];
2021-02-22 09:02:59 +01:00
};
2021-06-09 23:56:11 +02:00
in flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ rust-overlay.overlay ];
};
naerskLib = mkNaerskLib system pkgs;
in rec {
packages.helix = pkg naerskLib;
2021-02-22 09:02:59 +01:00
defaultPackage = packages.helix;
2021-06-09 23:56:11 +02:00
devShell = pkgs.callPackage ./shell.nix { };
}) // {
overlay = final: prev:
let naerskLib = mkNaerskLib prev.system final;
in (rust-overlay.overlay final prev) // { helix = pkg naerskLib; };
};
}