Fix Nix flake (#1455)

This commit is contained in:
Jared Ramirez 2022-01-12 16:40:07 -08:00 committed by GitHub
parent f77dbc7c83
commit a2fad4fcb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 51 additions and 38 deletions

View File

@ -2,11 +2,11 @@
"nodes": { "nodes": {
"devshell": { "devshell": {
"locked": { "locked": {
"lastModified": 1639692811, "lastModified": 1640301433,
"narHash": "sha256-wOOBH0fVsfNqw/5ZWRoKspyesoXBgiwEOUBH4c7JKEo=", "narHash": "sha256-eplae8ZNiEmxbOgwUn9IihaJfEUxoUilkwciRPGskYE=",
"owner": "numtide", "owner": "numtide",
"repo": "devshell", "repo": "devshell",
"rev": "d3a1f5bec3632b33346865b1c165bf2420bb2f52", "rev": "f87fb932740abe1c1b46f6edd8a36ade17881666",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -41,11 +41,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1639807801, "lastModified": 1641449444,
"narHash": "sha256-y32tMq1LTRVbMW3QN5i98iOQjQt2QSsif3ayUkD1o3g=", "narHash": "sha256-InqsyCVafPqXmK7YqUfFVpb6eVYJWUWbYXEvey0J+3c=",
"owner": "yusdacra", "owner": "yusdacra",
"repo": "nix-cargo-integration", "repo": "nix-cargo-integration",
"rev": "b5bbaa4f5239e6f0619846f9a5380f07baa853d3", "rev": "d1aa15a832db331a97082b7f8c7da737a6789c77",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -20,27 +20,36 @@
# Set default package to helix-term release build # Set default package to helix-term release build
defaultOutputs = { app = "hx"; package = "helix"; }; defaultOutputs = { app = "hx"; package = "helix"; };
overrides = { overrides = {
crateOverrides = common: _: { crateOverrides = common: _: rec {
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 languages and theme toml files since helix-view expects them # link languages and theme toml files since helix-view expects them
helix-view = _: { preConfigure = "ln -s ${common.root}/{languages.toml,theme.toml} .."; }; helix-view = _: { preConfigure = "ln -s ${common.root}/{languages.toml,theme.toml,base16_theme.toml} .."; };
helix-syntax = _prev: { helix-syntax = prev: {
src =
let
pkgs = common.pkgs;
helix = pkgs.fetchgit {
url = "https://github.com/helix-editor/helix.git";
rev = "a8fd33ac012a79069ef1409503a2edcf3a585153";
fetchSubmodules = true;
sha256 = "sha256-5AtOC55ttWT+7RYMboaFxpGZML51ix93wAkYJTt+8JI=";
};
in
pkgs.runCommand prev.src.name { } ''
mkdir -p $out
ln -s ${prev.src}/* $out
ln -sf ${helix}/helix-syntax/languages $out
'';
preConfigure = "mkdir -p ../runtime/grammars"; preConfigure = "mkdir -p ../runtime/grammars";
postInstall = "cp -r ../runtime $out/runtime"; postInstall = "cp -r ../runtime $out/runtime";
}; };
}; helix-term = prev:
mainBuild = common: prev:
let let
inherit (common) pkgs lib; inherit (common) pkgs lib;
helixSyntax = lib.buildCrate { helixSyntax = lib.buildCrate {
root = self; root = self;
memberName = "helix-syntax"; memberName = "helix-syntax";
defaultCrateOverrides = { defaultCrateOverrides = {
helix-syntax = common.crateOverrides.helix-syntax; helix-syntax = helix-syntax;
}; };
release = false; release = false;
}; };
@ -50,7 +59,10 @@
ln -sf ${helixSyntax}/runtime/grammars $out ln -sf ${helixSyntax}/runtime/grammars $out
''; '';
in in
lib.optionalAttrs (common.memberName == "helix-term") { {
# link languages and theme toml files since helix-term expects them (for tests)
preConfigure = "ln -s ${common.root}/{languages.toml,theme.toml,base16_theme.toml} ..";
buildInputs = (prev.buildInputs or [ ]) ++ [ common.cCompiler.cc.lib ];
nativeBuildInputs = [ pkgs.makeWrapper ]; nativeBuildInputs = [ pkgs.makeWrapper ];
postFixup = '' postFixup = ''
if [ -f "$out/bin/hx" ]; then if [ -f "$out/bin/hx" ]; then
@ -58,6 +70,7 @@
fi fi
''; '';
}; };
};
shell = common: prev: { shell = common: prev: {
packages = prev.packages ++ (with common.pkgs; [ lld_13 lldb cargo-tarpaulin ]); packages = prev.packages ++ (with common.pkgs; [ lld_13 lldb cargo-tarpaulin ]);
env = prev.env ++ [ env = prev.env ++ [