You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
helix/flake.nix

57 lines
1.6 KiB
Nix

{
description = "A post-modern text editor.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
4 years ago
rust-overlay.url = "github:oxalica/rust-overlay";
naersk.url = "github:nmattia/naersk";
helix = {
flake = false;
url = "https://github.com/helix-editor/helix";
type = "git";
submodules = true;
};
};
outputs = inputs@{ self, nixpkgs, naersk, rust-overlay, flake-utils, ... }:
3 years ago
let
rust = pkgs:
(pkgs.rustChannelOf {
date = "2021-05-01";
channel = "nightly";
}).minimal; # cargo, rustc and rust-std
3 years ago
mkNaerskLib = system: pkgs:
naersk.lib."${system}".override {
# naersk can't build with stable?!
# inherit (pkgs.rust-bin.stable.latest) rustc cargo;
3 years ago
rustc = rust pkgs;
cargo = rust pkgs;
};
3 years ago
pkg = naerskLib:
naerskLib.buildPackage {
pname = "helix";
root = inputs.helix;
3 years ago
cargoBuildOptions = self: self ++ [ ''--features "embed_runtime"'' ];
};
3 years ago
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;
defaultPackage = packages.helix;
3 years ago
devShell = pkgs.callPackage ./shell.nix { };
}) // {
overlay = final: prev:
let naerskLib = mkNaerskLib prev.system final;
in (rust-overlay.overlay final prev) // { helix = pkg naerskLib; };
};
}