2 description = "A post-modern text editor.";
5 nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
7 url = "github:oxalica/rust-overlay";
8 inputs.nixpkgs.follows = "nixpkgs";
11 url = "github:yusdacra/nix-cargo-integration";
12 inputs.nixpkgs.follows = "nixpkgs";
13 inputs.rust-overlay.follows = "rust-overlay";
15 parts.url = "github:hercules-ci/flake-parts";
21 path = "${toString ./.}/${rel}";
48 ignorePaths = path: type: let
49 inherit (inp.nixpkgs) lib;
50 # split the nix store path into its components
51 components = lib.splitString "/" path;
52 # drop off the `/nix/hash-source` section from the path
53 relPathComponents = lib.drop 4 components;
54 # reassemble the path components
55 relPath = lib.concatStringsSep "/" relPathComponents;
57 lib.all (p: ! (lib.hasPrefix p relPath)) pathsToIgnore;
60 name = "helix-source";
62 # filter out unnecessary paths
66 inp.parts.lib.mkFlake {inputs = inp;} {
67 imports = [inp.nci.flakeModule];
81 makeOverridableHelix = old: config: let
82 grammars = pkgs.callPackage ./grammars.nix config;
83 runtimeDir = pkgs.runCommand "helix-runtime" {} ''
85 ln -s ${mkRootPath "runtime"}/* $out
87 ln -s ${grammars} $out/grammars
93 inherit (old) pname version;
94 meta = old.meta or {};
100 nativeBuildInputs = [pkgs.makeWrapper];
101 makeWrapperArgs = config.makeWrapperArgs or [];
104 cp -rs --no-preserve=mode,ownership ${old} $out
105 wrapProgram "$out/bin/hx" ''${makeWrapperArgs[@]} --set HELIX_RUNTIME "${runtimeDir}"
110 override = makeOverridableHelix old;
112 helix-wrapped.passthru
114 wrapper = old: makeOverridableHelix old config;
118 if pkgs.stdenv.isLinux
120 else pkgs.clangStdenv;
123 then ''$RUSTFLAGS -C link-arg=-fuse-ld=lld -C target-cpu=native -Clink-arg=-Wl,--no-rosegment''
126 # by default NCI adds rust-analyzer component, but helix toolchain doesn't have rust-analyzer
127 nci.toolchains.shell.components = ["rust-src" "rustfmt" "clippy"];
128 nci.projects."helix-project".relPath = "";
129 nci.crates."helix-term" = {
131 add-meta.override = _: {meta.mainProgram = "hx";};
132 add-inputs.overrideAttrs = prev: {
133 buildInputs = (prev.buildInputs or []) ++ [stdenv.cc.cc.lib];
135 disable-grammar-builds = {
136 # disable fetching and building of tree-sitter grammars in the helix-term build.rs
137 HELIX_DISABLE_AUTO_GRAMMAR_BUILD = "1";
139 disable-tests = {checkPhase = ":";};
140 set-stdenv.override = _: {inherit stdenv;};
141 set-filtered-src.override = _: {src = filteredSource;};
145 packages.helix-unwrapped = config.nci.outputs."helix-term".packages.release;
146 packages.helix-unwrapped-dev = config.nci.outputs."helix-term".packages.dev;
147 packages.helix = makeOverridableHelix config.packages.helix-unwrapped {};
148 packages.helix-dev = makeOverridableHelix config.packages.helix-unwrapped-dev {};
149 packages.default = config.packages.helix;
151 devShells.default = config.nci.outputs."helix-project".devShell.overrideAttrs (old: {
153 (old.nativeBuildInputs or [])
154 ++ (with pkgs; [lld_13 cargo-flamegraph rust-analyzer])
155 ++ (lib.optional (stdenv.isx86_64 && stdenv.isLinux) pkgs.cargo-tarpaulin)
156 ++ (lib.optional stdenv.isLinux pkgs.lldb)
157 ++ (lib.optional stdenv.isDarwin pkgs.darwin.apple_sdk.frameworks.CoreFoundation);
159 export HELIX_RUNTIME="$PWD/runtime"
160 export RUST_BACKTRACE="1"
161 export RUSTFLAGS="${rustFlagsEnv}"
168 extra-substituters = ["https://helix.cachix.org"];
169 extra-trusted-public-keys = ["helix.cachix.org-1:ejp9KQpR1FBI2onstMQ34yogDm4OgU2ru6lIwPvuCVs="];
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list