on 3756c21 help sign in
helix/flake.nix
56 lines 2.1 kB history raw
1{
2 description = "A post-modern text editor.";
4 inputs = {
5 nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
6 nixCargoIntegration = {
7 url = "github:yusdacra/nix-cargo-integration";
8 inputs.nixpkgs.follows = "nixpkgs";
9 };
10 flakeCompat = {
11 url = "github:edolstra/flake-compat";
12 flake = false;
13 };
14 helix = {
15 url = "https://github.com/helix-editor/helix.git";
16 type = "git";
17 flake = false;
18 submodules = true;
19 };
20 };
22 outputs = inputs@{ nixCargoIntegration, helix, ... }:
23 nixCargoIntegration.lib.makeOutputs {
24 root = ./.;
25 buildPlatform = "crate2nix";
26 renameOutputs = { "helix-term" = "helix"; };
27 # Set default app to hx (binary is from helix-term release build)
28 # Set default package to helix-term release build
29 defaultOutputs = { app = "hx"; package = "helix"; };
30 overrides = {
31 crateOverrides = common: _: {
32 helix-term = prev: { buildInputs = (prev.buildInputs or [ ]) ++ [ common.cCompiler.cc.lib ]; };
33 # link runtime since helix-core expects it because of embed_runtime feature
34 helix-core = _: { preConfigure = "ln -s ${common.root + "/runtime"} ../runtime"; };
35 # link languages and theme toml files since helix-view expects them
36 helix-view = _: { preConfigure = "ln -s ${common.root}/{languages.toml,theme.toml} .."; };
37 helix-syntax = prev: {
38 src = common.pkgs.runCommand prev.src.name { } ''
39 mkdir -p $out
40 ln -s ${prev.src}/* $out
41 ln -sf ${helix}/helix-syntax/languages $out
42 '';
43 };
44 };
45 shell = common: prev: {
46 packages = prev.packages ++ (with common.pkgs; [ lld_10 lldb ]);
47 env = prev.env ++ [
48 { name = "HELIX_RUNTIME"; eval = "$PWD/runtime"; }
49 { name = "RUST_BACKTRACE"; value = "1"; }
50 { name = "RUSTFLAGS"; value = "-C link-arg=-fuse-ld=lld -C target-cpu=native"; }
51 ];
52 };
53 build = _: prev: { rootFeatures = prev.rootFeatures ++ [ "embed_runtime" ]; };
54 };
55 };