Skip to content

Commit

Permalink
build(nix): fetch submodules lazily
Browse files Browse the repository at this point in the history
  • Loading branch information
yusdacra authored and archseer committed Jun 22, 2021
1 parent a70de6e commit 6dddd5c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 43 deletions.
37 changes: 9 additions & 28 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 22 additions & 15 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,9 @@
url = "github:edolstra/flake-compat";
flake = false;
};
helix = {
url = "https://github.com/helix-editor/helix.git";
type = "git";
flake = false;
submodules = true;
};
};

outputs = inputs@{ nixCargoIntegration, helix, ... }:
outputs = inputs@{ self, nixCargoIntegration, ... }:
nixCargoIntegration.lib.makeOutputs {
root = ./.;
buildPlatform = "crate2nix";
Expand All @@ -29,18 +23,31 @@
defaultOutputs = { app = "hx"; package = "helix"; };
overrides = {
crateOverrides = common: _: {
helix-term = prev: { buildInputs = (prev.buildInputs or [ ]) ++ [ common.cCompiler.cc.lib ]; };
helix-term = prev: {
# link languages and theme toml files since helix-term expects them (for tests)
preConfigure = "ln -s ${common.root}/{languages.toml,theme.toml} ..";
buildInputs = (prev.buildInputs or [ ]) ++ [ common.cCompiler.cc.lib ];
};
# link runtime since helix-core expects it because of embed_runtime feature
helix-core = _: { preConfigure = "ln -s ${common.root + "/runtime"} ../runtime"; };
# link languages and theme toml files since helix-view expects them
helix-view = _: { preConfigure = "ln -s ${common.root}/{languages.toml,theme.toml} .."; };
helix-syntax = prev: {
src = common.pkgs.runCommand prev.src.name { } ''
mkdir -p $out
ln -s ${prev.src}/* $out
ln -sf ${helix}/helix-syntax/languages $out
'';
};
helix-syntax = prev:
let
helix = common.pkgs.fetchgit {
url = "https://github.com/helix-editor/helix.git";
rev = "9fd17d4ff5b81211317da1a28d2b30442a512ffc";
fetchSubmodules = true;
sha256 = "sha256-y652sn/tCc1XoKr3YxDZv6bS2Cmr6+9K/wzzNAMFZJw=";
};
in
{
src = common.pkgs.runCommand prev.src.name { } ''
mkdir -p $out
ln -s ${prev.src}/* $out
ln -sf ${helix}/helix-syntax/languages $out
'';
};
};
shell = common: prev: {
packages = prev.packages ++ (with common.pkgs; [ lld_10 lldb ]);
Expand Down

0 comments on commit 6dddd5c

Please sign in to comment.