|
|
@ -12,16 +12,10 @@
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
inputs.rust-overlay.follows = "rust-overlay";
|
|
|
|
inputs.rust-overlay.follows = "rust-overlay";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
parts.url = "github:hercules-ci/flake-parts";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
outputs = {
|
|
|
|
outputs = inp: let
|
|
|
|
self,
|
|
|
|
|
|
|
|
nixpkgs,
|
|
|
|
|
|
|
|
nci,
|
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
}: let
|
|
|
|
|
|
|
|
lib = nixpkgs.lib;
|
|
|
|
|
|
|
|
ncl = nci.lib.nci-lib;
|
|
|
|
|
|
|
|
mkRootPath = rel:
|
|
|
|
mkRootPath = rel:
|
|
|
|
builtins.path {
|
|
|
|
builtins.path {
|
|
|
|
path = "${toString ./.}/${rel}";
|
|
|
|
path = "${toString ./.}/${rel}";
|
|
|
@ -32,6 +26,12 @@
|
|
|
|
".envrc"
|
|
|
|
".envrc"
|
|
|
|
".ignore"
|
|
|
|
".ignore"
|
|
|
|
".github"
|
|
|
|
".github"
|
|
|
|
|
|
|
|
".gitignore"
|
|
|
|
|
|
|
|
"logo.svg"
|
|
|
|
|
|
|
|
"logo_dark.svg"
|
|
|
|
|
|
|
|
"logo_light.svg"
|
|
|
|
|
|
|
|
"rust-toolchain.toml"
|
|
|
|
|
|
|
|
"rustfmt.toml"
|
|
|
|
"runtime"
|
|
|
|
"runtime"
|
|
|
|
"screenshot.png"
|
|
|
|
"screenshot.png"
|
|
|
|
"book"
|
|
|
|
"book"
|
|
|
@ -46,6 +46,7 @@
|
|
|
|
"flake.lock"
|
|
|
|
"flake.lock"
|
|
|
|
];
|
|
|
|
];
|
|
|
|
ignorePaths = path: type: let
|
|
|
|
ignorePaths = path: type: let
|
|
|
|
|
|
|
|
inherit (inp.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
|
|
|
@ -61,53 +62,22 @@
|
|
|
|
# filter out unnecessary paths
|
|
|
|
# filter out unnecessary paths
|
|
|
|
filter = ignorePaths;
|
|
|
|
filter = ignorePaths;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
outputs = nci.lib.makeOutputs {
|
|
|
|
in
|
|
|
|
root = ./.;
|
|
|
|
inp.parts.lib.mkFlake {inputs = inp;} {
|
|
|
|
config = common: {
|
|
|
|
imports = [inp.nci.flakeModule];
|
|
|
|
outputs = {
|
|
|
|
systems = [
|
|
|
|
# rename helix-term to helix since it's our main package
|
|
|
|
"x86_64-linux"
|
|
|
|
rename = {"helix-term" = "helix";};
|
|
|
|
"x86_64-darwin"
|
|
|
|
# Set default app to hx (binary is from helix-term release build)
|
|
|
|
"aarch64-linux"
|
|
|
|
# Set default package to helix-term release build
|
|
|
|
"aarch64-darwin"
|
|
|
|
defaults = {
|
|
|
|
"i686-linux"
|
|
|
|
app = "hx";
|
|
|
|
|
|
|
|
package = "helix";
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
cCompiler.package = with common.pkgs;
|
|
|
|
|
|
|
|
if stdenv.isLinux
|
|
|
|
|
|
|
|
then gcc
|
|
|
|
|
|
|
|
else clang;
|
|
|
|
|
|
|
|
shell = {
|
|
|
|
|
|
|
|
packages = with common.pkgs;
|
|
|
|
|
|
|
|
[lld_13 cargo-flamegraph rust-analyzer]
|
|
|
|
|
|
|
|
++ (lib.optional (stdenv.isx86_64 && stdenv.isLinux) cargo-tarpaulin)
|
|
|
|
|
|
|
|
++ (lib.optional stdenv.isLinux lldb)
|
|
|
|
|
|
|
|
++ (lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.CoreFoundation);
|
|
|
|
|
|
|
|
env = [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
name = "HELIX_RUNTIME";
|
|
|
|
|
|
|
|
eval = "$PWD/runtime";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
name = "RUST_BACKTRACE";
|
|
|
|
|
|
|
|
value = "1";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
name = "RUSTFLAGS";
|
|
|
|
|
|
|
|
eval =
|
|
|
|
|
|
|
|
if common.pkgs.stdenv.isLinux
|
|
|
|
|
|
|
|
then "$RUSTFLAGS\" -C link-arg=-fuse-ld=lld -C target-cpu=native -Clink-arg=-Wl,--no-rosegment\""
|
|
|
|
|
|
|
|
else "$RUSTFLAGS";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
];
|
|
|
|
];
|
|
|
|
};
|
|
|
|
perSystem = {
|
|
|
|
};
|
|
|
|
config,
|
|
|
|
pkgConfig = common: {
|
|
|
|
pkgs,
|
|
|
|
helix-term = let
|
|
|
|
lib,
|
|
|
|
# Wrap helix with runtime
|
|
|
|
...
|
|
|
|
wrapper = _: old: let
|
|
|
|
}: let
|
|
|
|
inherit (common) pkgs;
|
|
|
|
|
|
|
|
makeOverridableHelix = old: config: let
|
|
|
|
makeOverridableHelix = old: config: let
|
|
|
|
grammars = pkgs.callPackage ./grammars.nix config;
|
|
|
|
grammars = pkgs.callPackage ./grammars.nix config;
|
|
|
|
runtimeDir = pkgs.runCommand "helix-runtime" {} ''
|
|
|
|
runtimeDir = pkgs.runCommand "helix-runtime" {} ''
|
|
|
@ -117,66 +87,79 @@
|
|
|
|
ln -s ${grammars} $out/grammars
|
|
|
|
ln -s ${grammars} $out/grammars
|
|
|
|
'';
|
|
|
|
'';
|
|
|
|
helix-wrapped =
|
|
|
|
helix-wrapped =
|
|
|
|
common.internal.pkgsSet.utils.wrapDerivation old
|
|
|
|
pkgs.runCommand
|
|
|
|
|
|
|
|
old.name
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
inherit (old) pname version;
|
|
|
|
|
|
|
|
meta = old.meta or {};
|
|
|
|
|
|
|
|
passthru =
|
|
|
|
|
|
|
|
(old.passthru or {})
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
unwrapped = old;
|
|
|
|
|
|
|
|
};
|
|
|
|
nativeBuildInputs = [pkgs.makeWrapper];
|
|
|
|
nativeBuildInputs = [pkgs.makeWrapper];
|
|
|
|
makeWrapperArgs = config.makeWrapperArgs or [];
|
|
|
|
makeWrapperArgs = config.makeWrapperArgs or [];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
''
|
|
|
|
''
|
|
|
|
rm -rf $out/bin
|
|
|
|
cp -rs --no-preserve=mode,ownership ${old} $out
|
|
|
|
mkdir -p $out/bin
|
|
|
|
|
|
|
|
ln -sf ${old}/bin/* $out/bin/
|
|
|
|
|
|
|
|
wrapProgram "$out/bin/hx" ''${makeWrapperArgs[@]} --set HELIX_RUNTIME "${runtimeDir}"
|
|
|
|
wrapProgram "$out/bin/hx" ''${makeWrapperArgs[@]} --set HELIX_RUNTIME "${runtimeDir}"
|
|
|
|
'';
|
|
|
|
'';
|
|
|
|
in
|
|
|
|
in
|
|
|
|
helix-wrapped
|
|
|
|
helix-wrapped
|
|
|
|
// {
|
|
|
|
// {
|
|
|
|
override = makeOverridableHelix old;
|
|
|
|
override = makeOverridableHelix old;
|
|
|
|
passthru = helix-wrapped.passthru // {wrapper = wrapper {};};
|
|
|
|
passthru =
|
|
|
|
|
|
|
|
helix-wrapped.passthru
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
wrapper = old: makeOverridableHelix old config;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
};
|
|
|
|
makeOverridableHelix old {};
|
|
|
|
stdenv =
|
|
|
|
|
|
|
|
if pkgs.stdenv.isLinux
|
|
|
|
|
|
|
|
then pkgs.stdenv
|
|
|
|
|
|
|
|
else pkgs.clangStdenv;
|
|
|
|
|
|
|
|
rustFlagsEnv =
|
|
|
|
|
|
|
|
if stdenv.isLinux
|
|
|
|
|
|
|
|
then "$RUSTFLAGS\" -C link-arg=-fuse-ld=lld -C target-cpu=native -Clink-arg=-Wl,--no-rosegment\""
|
|
|
|
|
|
|
|
else "$RUSTFLAGS";
|
|
|
|
in {
|
|
|
|
in {
|
|
|
|
inherit wrapper;
|
|
|
|
nci.projects."helix-project".relPath = "";
|
|
|
|
overrides.fix-build.overrideAttrs = prev: {
|
|
|
|
nci.crates."helix-term" = {
|
|
|
|
src = filteredSource;
|
|
|
|
overrides = {
|
|
|
|
|
|
|
|
add-meta.override = _: {meta.mainProgram = "hx";};
|
|
|
|
|
|
|
|
add-inputs.overrideAttrs = prev: {
|
|
|
|
|
|
|
|
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 = ncl.addBuildInputs prev [common.config.cCompiler.package.cc.lib];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# link languages and theme toml files since helix-term expects them (for tests)
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
|
|
|
|
${prev.preConfigure or ""}
|
|
|
|
|
|
|
|
${
|
|
|
|
|
|
|
|
lib.concatMapStringsSep
|
|
|
|
|
|
|
|
"\n"
|
|
|
|
|
|
|
|
(path: "ln -sf ${mkRootPath path} ..")
|
|
|
|
|
|
|
|
["languages.toml" "theme.toml" "base16_theme.toml"]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
checkPhase = ":";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
meta.mainProgram = "hx";
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
disable-tests = {checkPhase = ":";};
|
|
|
|
|
|
|
|
set-stdenv.override = _: {inherit stdenv;};
|
|
|
|
|
|
|
|
set-filtered-src.override = _: {src = filteredSource;};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
packages.helix-unwrapped = config.nci.outputs."helix-term".packages.release;
|
|
|
|
|
|
|
|
packages.helix-unwrapped-dev = config.nci.outputs."helix-term".packages.dev;
|
|
|
|
|
|
|
|
packages.helix = makeOverridableHelix config.packages.helix-unwrapped {};
|
|
|
|
|
|
|
|
packages.helix-dev = makeOverridableHelix config.packages.helix-unwrapped-dev {};
|
|
|
|
|
|
|
|
packages.default = config.packages.helix;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
devShells.default = config.nci.outputs."helix-project".devShell.overrideAttrs (old: {
|
|
|
|
|
|
|
|
nativeBuildInputs =
|
|
|
|
|
|
|
|
(old.nativeBuildInputs or [])
|
|
|
|
|
|
|
|
++ (with pkgs; [lld_13 cargo-flamegraph rust-analyzer])
|
|
|
|
|
|
|
|
++ (lib.optional (stdenv.isx86_64 && stdenv.isLinux) pkgs.cargo-tarpaulin)
|
|
|
|
|
|
|
|
++ (lib.optional stdenv.isLinux pkgs.lldb)
|
|
|
|
|
|
|
|
++ (lib.optional stdenv.isDarwin pkgs.darwin.apple_sdk.frameworks.CoreFoundation);
|
|
|
|
|
|
|
|
shellHook = ''
|
|
|
|
|
|
|
|
export HELIX_RUNTIME="$PWD/runtime"
|
|
|
|
|
|
|
|
export RUST_BACKTRACE="1"
|
|
|
|
|
|
|
|
export RUSTFLAGS="${rustFlagsEnv}"
|
|
|
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
|
|
|
|
outputs
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
packages =
|
|
|
|
|
|
|
|
lib.mapAttrs
|
|
|
|
|
|
|
|
(
|
|
|
|
|
|
|
|
system: packages:
|
|
|
|
|
|
|
|
packages
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
helix-unwrapped = packages.helix.passthru.unwrapped;
|
|
|
|
|
|
|
|
helix-unwrapped-dev = packages.helix-dev.passthru.unwrapped;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
outputs.packages;
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
nixConfig = {
|
|
|
|
nixConfig = {
|
|
|
|