on 44566ea help sign in
helix/flake.nix
63 lines 2.6 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 };
16 outputs = inputs@{ self, nixCargoIntegration, ... }:
17 nixCargoIntegration.lib.makeOutputs {
18 root = ./.;
19 buildPlatform = "crate2nix";
20 renameOutputs = { "helix-term" = "helix"; };
21 # Set default app to hx (binary is from helix-term release build)
22 # Set default package to helix-term release build
23 defaultOutputs = { app = "hx"; package = "helix"; };
24 overrides = {
25 crateOverrides = common: _: {
26 helix-term = prev: {
27 # link languages and theme toml files since helix-term expects them (for tests)
28 preConfigure = "ln -s ${common.root}/{languages.toml,theme.toml} ..";
29 buildInputs = (prev.buildInputs or [ ]) ++ [ common.cCompiler.cc.lib ];
30 };
31 # link runtime since helix-core expects it because of embed_runtime feature
32 helix-core = _: { preConfigure = "ln -s ${common.root + "/runtime"} ../runtime"; };
33 # link languages and theme toml files since helix-view expects them
34 helix-view = _: { preConfigure = "ln -s ${common.root}/{languages.toml,theme.toml} .."; };
35 helix-syntax = prev:
36 let
37 helix = common.pkgs.fetchgit {
38 url = "https://github.com/helix-editor/helix.git";
39 rev = "9fd17d4ff5b81211317da1a28d2b30442a512ffc";
40 fetchSubmodules = true;
41 sha256 = "sha256-y652sn/tCc1XoKr3YxDZv6bS2Cmr6+9K/wzzNAMFZJw=";
42 };
43 in
44 {
45 src = common.pkgs.runCommand prev.src.name { } ''
46 mkdir -p $out
47 ln -s ${prev.src}/* $out
48 ln -sf ${helix}/helix-syntax/languages $out
49 '';
50 };
51 };
52 shell = common: prev: {
53 packages = prev.packages ++ (with common.pkgs; [ lld_10 lldb ]);
54 env = prev.env ++ [
55 { name = "HELIX_RUNTIME"; eval = "$PWD/runtime"; }
56 { name = "RUST_BACKTRACE"; value = "1"; }
57 { name = "RUSTFLAGS"; value = "-C link-arg=-fuse-ld=lld -C target-cpu=native"; }
58 ];
59 };
60 build = _: prev: { rootFeatures = prev.rootFeatures ++ [ "embed_runtime" ]; };
61 };
62 };