@ -3,19 +3,35 @@
inputs = {
inputs = {
nixpkgs . url = " g i t h u b : n i x o s / n i x p k g s / n i x o s - u n s t a b l e " ;
nixpkgs . url = " g i t h u b : n i x o s / n i x p k g s / n i x o s - u n s t a b l e " ;
flake-utils . url = " g i t h u b : n u m t i d e / f l a k e - u t i l s " ;
rust-overlay = {
rust-overlay = {
url = " g i t h u b : o x a l i c a / r u s t - o v e r l a y " ;
url = " g i t h u b : o x a l i c a / r u s t - o v e r l a y " ;
inputs . nixpkgs . follows = " n i x p k g s " ;
inputs = {
nixpkgs . follows = " n i x p k g s " ;
flake-utils . follows = " f l a k e - u t i l s " ;
} ;
} ;
nci = {
} ;
url = " g i t h u b : y u s d a c r a / n i x - c a r g o - i n t e g r a t i o n " ;
crane = {
inputs. nixpkgs . follows = " n i x p k g s " ;
url = " g i t h u b : i p e t k o v / c r a n e " ;
inputs . rust-overlay . follows = " r u s t - o v e r l a y " ;
inputs . rust-overlay . follows = " r u s t - o v e r l a y " ;
inputs . flake-utils . follows = " f l a k e - u t i l s " ;
inputs . nixpkgs . follows = " n i x p k g s " ;
} ;
} ;
parts . url = " g i t h u b : h e r c u l e s - c i / f l a k e - p a r t s " ;
} ;
} ;
outputs = inp : let
outputs = {
self ,
nixpkgs ,
crane ,
flake-utils ,
rust-overlay ,
. . .
} :
flake-utils . lib . eachDefaultSystem ( system : let
pkgs = import nixpkgs {
inherit system ;
overlays = [ ( import rust-overlay ) ] ;
} ;
mkRootPath = rel :
mkRootPath = rel :
builtins . path {
builtins . path {
path = " ${ toString ./. } / ${ rel } " ;
path = " ${ toString ./. } / ${ rel } " ;
@ -46,7 +62,7 @@
" f l a k e . l o c k "
" f l a k e . l o c k "
] ;
] ;
ignorePaths = path : type : let
ignorePaths = path : type : let
inherit ( inp . nixpkgs ) lib ;
inherit ( nixpkgs ) lib ;
# split the nix store path into its components
# split the nix store path into its components
components = lib . splitString " / " path ;
components = lib . splitString " / " path ;
# drop off the `/nix/hash-source` section from the path
# drop off the `/nix/hash-source` section from the path
@ -62,22 +78,6 @@
# filter out unnecessary paths
# filter out unnecessary paths
filter = ignorePaths ;
filter = ignorePaths ;
} ;
} ;
in
inp . parts . lib . mkFlake { inputs = inp ; } {
imports = [ inp . nci . flakeModule inp . parts . flakeModules . easyOverlay ] ;
systems = [
" x 8 6 _ 6 4 - l i n u x "
" x 8 6 _ 6 4 - d a r w i n "
" a a r c h 6 4 - l i n u x "
" a a r c h 6 4 - d a r w i n "
" i 6 8 6 - l i n u x "
] ;
perSystem = {
config ,
pkgs ,
lib ,
. . .
} : let
makeOverridableHelix = old : config : let
makeOverridableHelix = old : config : let
grammars = pkgs . callPackage ./grammars.nix config ;
grammars = pkgs . callPackage ./grammars.nix config ;
runtimeDir = pkgs . runCommand " h e l i x - r u n t i m e " { } ''
runtimeDir = pkgs . runCommand " h e l i x - r u n t i m e " { } ''
@ -122,38 +122,58 @@
if stdenv . isLinux
if stdenv . isLinux
then '' $R U S T F L A G S - C l i n k - a r g = - f u s e - l d = l l d - C t a r g e t - c p u = n a t i v e - C l i n k - a r g = - W l , - - n o - r o s e g m e n t ''
then '' $R U S T F L A G S - C l i n k - a r g = - f u s e - l d = l l d - C t a r g e t - c p u = n a t i v e - C l i n k - a r g = - W l , - - n o - r o s e g m e n t ''
else " $ R U S T F L A G S " ;
else " $ R U S T F L A G S " ;
in {
rustToolchain = pkgs . pkgsBuildHost . rust-bin . fromRustupToolchainFile ./rust-toolchain.toml ;
nci . projects . " h e l i x - p r o j e c t " . relPath = " " ;
craneLib = ( crane . mkLib pkgs ) . overrideToolchain rustToolchain ;
nci . crates . " h e l i x - t e r m " = {
commonArgs =
overrides = {
{
add-meta . override = _ : { meta . mainProgram = " h x " ; } ;
inherit stdenv ;
add-inputs . overrideAttrs = prev : {
src = filteredSource ;
buildInputs = ( prev . buildInputs or [ ] ) ++ [ stdenv . cc . cc . lib ] ;
} ;
disable-grammar-builds = {
# disable fetching and building of tree-sitter grammars in the helix-term build.rs
# disable fetching and building of tree-sitter grammars in the helix-term build.rs
HELIX_DISABLE_AUTO_GRAMMAR_BUILD = " 1 " ;
HELIX_DISABLE_AUTO_GRAMMAR_BUILD = " 1 " ;
buildInputs = [ stdenv . cc . cc . lib ] ;
# disable tests
doCheck = false ;
meta . mainProgram = " h x " ;
}
// craneLib . crateNameFromCargoToml { cargoToml = ./helix-term/Cargo.toml ; } ;
cargoArtifacts = craneLib . buildDepsOnly commonArgs ;
in {
packages = {
helix-unwrapped = craneLib . buildPackage ( commonArgs
// {
inherit cargoArtifacts ;
} ) ;
helix = makeOverridableHelix self . packages . ${ system } . helix-unwrapped { } ;
default = self . packages . ${ system } . helix ;
} ;
} ;
disable-tests = { checkPhase = " : " ; } ;
set-stdenv . override = _ : { inherit stdenv ; } ;
set-filtered-src . override = _ : { src = filteredSource ; } ;
} ;
} ;
packages . helix-unwrapped = config . nci . outputs . " h e l i x - t e r m " . packages . release ;
checks = {
packages . helix-unwrapped-dev = config . nci . outputs . " h e l i x - t e r m " . packages . dev ;
# Build the crate itself
packages . helix = makeOverridableHelix config . packages . helix-unwrapped { } ;
inherit ( self . packages . ${ system } ) helix ;
packages . helix-dev = makeOverridableHelix config . packages . helix-unwrapped-dev { } ;
packages . default = config . packages . helix ;
clippy = craneLib . cargoClippy ( commonArgs
// {
inherit cargoArtifacts ;
cargoClippyExtraArgs = " - - a l l - t a r g e t s - - - - d e n y w a r n i n g s " ;
} ) ;
overlayAttrs = {
fmt = craneLib . cargoFmt commonArgs ;
inherit ( config . packages ) helix ;
doc = craneLib . cargoDoc ( commonArgs
// {
inherit cargoArtifacts ;
} ) ;
test = craneLib . cargoTest ( commonArgs
// {
inherit cargoArtifacts ;
} ) ;
} ;
} ;
devShells . default = config . nci . outputs . " h e l i x - p r o j e c t " . devShell . overrideAttrs ( old : {
devShells . default = pkgs. mkShell {
nativeBuildInputs =
inputsFrom = builtins . attrValues self . checks . ${ system } ;
( old . nativeBuildInputs or [ ] )
nativeBuildInputs = with pkgs ;
++ ( with pkgs ; [ lld_13 cargo-flamegraph rust-analyzer ] )
[ lld_13 cargo-flamegraph rust-analyzer ]
++ ( lib . optional ( stdenv . isx86_64 && stdenv . isLinux ) pkgs . cargo-tarpaulin )
++ ( lib . optional ( stdenv . isx86_64 && stdenv . isLinux ) pkgs . cargo-tarpaulin )
++ ( lib . optional stdenv . isLinux pkgs . lldb )
++ ( lib . optional stdenv . isLinux pkgs . lldb )
++ ( lib . optional stdenv . isDarwin pkgs . darwin . apple_sdk . frameworks . CoreFoundation ) ;
++ ( lib . optional stdenv . isDarwin pkgs . darwin . apple_sdk . frameworks . CoreFoundation ) ;
@ -162,7 +182,11 @@
export RUST_BACKTRACE = " 1 "
export RUST_BACKTRACE = " 1 "
export RUSTFLAGS = " ${ rustFlagsEnv } "
export RUSTFLAGS = " ${ rustFlagsEnv } "
'' ;
'' ;
} ) ;
} ;
} )
// {
overlays . default = final : prev : {
inherit ( self . packages . ${ final . system } ) helix ;
} ;
} ;
} ;
} ;