|
|
@ -7,128 +7,169 @@
|
|
|
|
url = "github:oxalica/rust-overlay";
|
|
|
|
url = "github:oxalica/rust-overlay";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
nixCargoIntegration = {
|
|
|
|
nci = {
|
|
|
|
url = "github:yusdacra/nix-cargo-integration";
|
|
|
|
url = "github:yusdacra/nix-cargo-integration";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
inputs.rust-overlay.follows = "rust-overlay";
|
|
|
|
inputs.rust-overlay.follows = "rust-overlay";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
outputs = inputs @ {
|
|
|
|
outputs = {
|
|
|
|
|
|
|
|
self,
|
|
|
|
nixpkgs,
|
|
|
|
nixpkgs,
|
|
|
|
nixCargoIntegration,
|
|
|
|
nci,
|
|
|
|
...
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
}: let
|
|
|
|
outputs = config:
|
|
|
|
lib = nixpkgs.lib;
|
|
|
|
nixCargoIntegration.lib.makeOutputs {
|
|
|
|
mkRootPath = rel:
|
|
|
|
root = ./.;
|
|
|
|
builtins.path {
|
|
|
|
renameOutputs = {"helix-term" = "helix";};
|
|
|
|
path = "${toString ./.}/${rel}";
|
|
|
|
# Set default app to hx (binary is from helix-term release build)
|
|
|
|
name = rel;
|
|
|
|
# Set default package to helix-term release build
|
|
|
|
};
|
|
|
|
defaultOutputs = {
|
|
|
|
outputs = nci.lib.makeOutputs {
|
|
|
|
app = "hx";
|
|
|
|
root = ./.;
|
|
|
|
package = "helix";
|
|
|
|
renameOutputs = {"helix-term" = "helix";};
|
|
|
|
};
|
|
|
|
# Set default app to hx (binary is from helix-term release build)
|
|
|
|
overrides = {
|
|
|
|
# Set default package to helix-term release build
|
|
|
|
cCompiler = common:
|
|
|
|
defaultOutputs = {
|
|
|
|
with common.pkgs;
|
|
|
|
app = "hx";
|
|
|
|
if stdenv.isLinux
|
|
|
|
package = "helix";
|
|
|
|
then gcc
|
|
|
|
};
|
|
|
|
else clang;
|
|
|
|
overrides = {
|
|
|
|
crateOverrides = common: _: {
|
|
|
|
cCompiler = common:
|
|
|
|
helix-term = prev: let
|
|
|
|
with common.pkgs;
|
|
|
|
inherit (common) pkgs;
|
|
|
|
if stdenv.isLinux
|
|
|
|
mkRootPath = rel:
|
|
|
|
then gcc
|
|
|
|
builtins.path {
|
|
|
|
else clang;
|
|
|
|
path = "${common.root}/${rel}";
|
|
|
|
crateOverrides = common: _: {
|
|
|
|
name = rel;
|
|
|
|
helix-term = prev: {
|
|
|
|
};
|
|
|
|
src = builtins.path {
|
|
|
|
grammars = pkgs.callPackage ./grammars.nix config;
|
|
|
|
name = "helix-source";
|
|
|
|
runtimeDir = pkgs.runCommandNoCC "helix-runtime" {} ''
|
|
|
|
path = toString ./.;
|
|
|
|
mkdir -p $out
|
|
|
|
# filter out unneeded stuff that cause rebuilds
|
|
|
|
ln -s ${mkRootPath "runtime"}/* $out
|
|
|
|
filter = path: type:
|
|
|
|
rm -r $out/grammars
|
|
|
|
lib.all
|
|
|
|
ln -s ${grammars} $out/grammars
|
|
|
|
(n: builtins.baseNameOf path != n)
|
|
|
|
'';
|
|
|
|
[
|
|
|
|
overridedAttrs = {
|
|
|
|
".envrc"
|
|
|
|
# disable fetching and building of tree-sitter grammars in the helix-term build.rs
|
|
|
|
".ignore"
|
|
|
|
HELIX_DISABLE_AUTO_GRAMMAR_BUILD = "1";
|
|
|
|
".github"
|
|
|
|
# link languages and theme toml files since helix-term expects them (for tests)
|
|
|
|
"runtime"
|
|
|
|
preConfigure =
|
|
|
|
"screenshot.png"
|
|
|
|
pkgs.lib.concatMapStringsSep
|
|
|
|
"book"
|
|
|
|
"\n"
|
|
|
|
"contrib"
|
|
|
|
(path: "ln -sf ${mkRootPath path} ..")
|
|
|
|
"docs"
|
|
|
|
["languages.toml" "theme.toml" "base16_theme.toml"];
|
|
|
|
"README.md"
|
|
|
|
buildInputs = (prev.buildInputs or []) ++ [common.cCompiler.cc.lib];
|
|
|
|
"shell.nix"
|
|
|
|
nativeBuildInputs = [pkgs.makeWrapper];
|
|
|
|
"default.nix"
|
|
|
|
|
|
|
|
"grammars.nix"
|
|
|
|
|
|
|
|
"flake.nix"
|
|
|
|
|
|
|
|
"flake.lock"
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
# disable fetching and building of tree-sitter grammars in the helix-term build.rs
|
|
|
|
if [ -f "$out/bin/hx" ]; then
|
|
|
|
HELIX_DISABLE_AUTO_GRAMMAR_BUILD = "1";
|
|
|
|
wrapProgram "$out/bin/hx" ''${makeWrapperArgs[@]} --set HELIX_RUNTIME "${runtimeDir}"
|
|
|
|
|
|
|
|
fi
|
|
|
|
buildInputs = (prev.buildInputs or []) ++ [common.cCompiler.cc.lib];
|
|
|
|
'';
|
|
|
|
|
|
|
|
};
|
|
|
|
# link languages and theme toml files since helix-term expects them (for tests)
|
|
|
|
in
|
|
|
|
preConfigure = ''
|
|
|
|
overridedAttrs
|
|
|
|
${prev.preConfigure or ""}
|
|
|
|
// (
|
|
|
|
${
|
|
|
|
pkgs.lib.optionalAttrs
|
|
|
|
lib.concatMapStringsSep
|
|
|
|
(config ? makeWrapperArgs)
|
|
|
|
"\n"
|
|
|
|
{inherit (config) makeWrapperArgs;}
|
|
|
|
(path: "ln -sf ${mkRootPath path} ..")
|
|
|
|
);
|
|
|
|
["languages.toml" "theme.toml" "base16_theme.toml"]
|
|
|
|
};
|
|
|
|
}
|
|
|
|
shell = common: prev: {
|
|
|
|
'';
|
|
|
|
packages =
|
|
|
|
|
|
|
|
prev.packages
|
|
|
|
meta.mainProgram = "hx";
|
|
|
|
++ (
|
|
|
|
|
|
|
|
with common.pkgs;
|
|
|
|
|
|
|
|
[lld_13 lldb cargo-flamegraph rust-analyzer] ++
|
|
|
|
|
|
|
|
(lib.optional (stdenv.isx86_64 && stdenv.isLinux) cargo-tarpaulin)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
env =
|
|
|
|
|
|
|
|
prev.env
|
|
|
|
|
|
|
|
++ [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
name = "HELIX_RUNTIME";
|
|
|
|
|
|
|
|
eval = "$PWD/runtime";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
name = "RUST_BACKTRACE";
|
|
|
|
|
|
|
|
value = "1";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
name = "RUSTFLAGS";
|
|
|
|
|
|
|
|
value =
|
|
|
|
|
|
|
|
if common.pkgs.stdenv.isLinux
|
|
|
|
|
|
|
|
then "-C link-arg=-fuse-ld=lld -C target-cpu=native -Clink-arg=-Wl,--no-rosegment"
|
|
|
|
|
|
|
|
else "";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
shell = common: prev: {
|
|
|
|
|
|
|
|
packages =
|
|
|
|
|
|
|
|
prev.packages
|
|
|
|
|
|
|
|
++ (
|
|
|
|
|
|
|
|
with common.pkgs;
|
|
|
|
|
|
|
|
[lld_13 lldb cargo-flamegraph rust-analyzer]
|
|
|
|
|
|
|
|
++ (lib.optional (stdenv.isx86_64 && stdenv.isLinux) cargo-tarpaulin)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
env =
|
|
|
|
|
|
|
|
prev.env
|
|
|
|
|
|
|
|
++ [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
name = "HELIX_RUNTIME";
|
|
|
|
|
|
|
|
eval = "$PWD/runtime";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
name = "RUST_BACKTRACE";
|
|
|
|
|
|
|
|
value = "1";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
name = "RUSTFLAGS";
|
|
|
|
|
|
|
|
value =
|
|
|
|
|
|
|
|
if common.pkgs.stdenv.isLinux
|
|
|
|
|
|
|
|
then "-C link-arg=-fuse-ld=lld -C target-cpu=native -Clink-arg=-Wl,--no-rosegment"
|
|
|
|
|
|
|
|
else "";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
defaultOutputs = outputs {};
|
|
|
|
};
|
|
|
|
makeOverridableHelix = system: old:
|
|
|
|
makeOverridableHelix = system: old: config: let
|
|
|
|
old
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
// {
|
|
|
|
grammars = pkgs.callPackage ./grammars.nix config;
|
|
|
|
override = args:
|
|
|
|
runtimeDir = pkgs.runCommand "helix-runtime" {} ''
|
|
|
|
makeOverridableHelix
|
|
|
|
mkdir -p $out
|
|
|
|
system
|
|
|
|
ln -s ${mkRootPath "runtime"}/* $out
|
|
|
|
(outputs args).packages.${system}.helix;
|
|
|
|
rm -r $out/grammars
|
|
|
|
};
|
|
|
|
ln -s ${grammars} $out/grammars
|
|
|
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
helix-wrapped =
|
|
|
|
|
|
|
|
pkgs.runCommand "${old.name}-wrapped"
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
inherit (old) pname version meta;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nativeBuildInputs = [pkgs.makeWrapper];
|
|
|
|
|
|
|
|
makeWrapperArgs = config.makeWrapperArgs or [];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
''
|
|
|
|
|
|
|
|
mkdir -p $out
|
|
|
|
|
|
|
|
cp -r --no-preserve=mode,ownership ${old}/* $out/
|
|
|
|
|
|
|
|
chmod +x $out/bin/*
|
|
|
|
|
|
|
|
wrapProgram "$out/bin/hx" ''${makeWrapperArgs[@]} --set HELIX_RUNTIME "${runtimeDir}"
|
|
|
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
helix-wrapped
|
|
|
|
|
|
|
|
// {override = makeOverridableHelix system old;};
|
|
|
|
in
|
|
|
|
in
|
|
|
|
defaultOutputs
|
|
|
|
outputs
|
|
|
|
// {
|
|
|
|
// {
|
|
|
|
|
|
|
|
apps =
|
|
|
|
|
|
|
|
lib.mapAttrs
|
|
|
|
|
|
|
|
(
|
|
|
|
|
|
|
|
system: apps: rec {
|
|
|
|
|
|
|
|
default = hx;
|
|
|
|
|
|
|
|
hx = {
|
|
|
|
|
|
|
|
type = "app";
|
|
|
|
|
|
|
|
program = lib.getExe self.${system}.packages.helix;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
outputs.apps;
|
|
|
|
packages =
|
|
|
|
packages =
|
|
|
|
nixpkgs.lib.mapAttrs
|
|
|
|
lib.mapAttrs
|
|
|
|
(
|
|
|
|
(
|
|
|
|
system: packages:
|
|
|
|
system: packages: rec {
|
|
|
|
packages
|
|
|
|
default = helix;
|
|
|
|
// rec {
|
|
|
|
helix = makeOverridableHelix system helix-unwrapped {};
|
|
|
|
default = helix;
|
|
|
|
helix-debug = makeOverridableHelix system helix-unwrapped-debug {};
|
|
|
|
helix = makeOverridableHelix system packages.helix;
|
|
|
|
helix-unwrapped = packages.helix;
|
|
|
|
}
|
|
|
|
helix-unwrapped-debug = packages.helix-debug;
|
|
|
|
|
|
|
|
}
|
|
|
|
)
|
|
|
|
)
|
|
|
|
defaultOutputs.packages;
|
|
|
|
outputs.packages;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
nixConfig = {
|
|
|
|
nixConfig = {
|
|
|
|