use latest nix-cargo-integration which depends on dream2nix (#1758)
https://github.com/nix-community/dream2nix is a fairly new and cool-looking project for adapting upstream package manager outputs (lockfiles mostly it would seem) for nix. This should improve the ability to cross-compile. As a more concrete measure of improvement, `nix flake check' now succeeds 🎉
This commit is contained in:
parent
24352b2729
commit
f31e85aca4
2 changed files with 149 additions and 63 deletions
131
flake.lock
131
flake.lock
|
@ -1,12 +1,35 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"devshell": {
|
"crane": {
|
||||||
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1641980203,
|
"lastModified": 1644785799,
|
||||||
"narHash": "sha256-RiWJ3+6V267Ji+P54K1Xrj1Nsah9BfG/aLfIhqgVyBY=",
|
"narHash": "sha256-VpAJO1L0XeBvtCuNGK4IDKp6ENHIpTrlaZT7yfBCvwo=",
|
||||||
|
"owner": "ipetkov",
|
||||||
|
"repo": "crane",
|
||||||
|
"rev": "fc7a94f841347c88f2cb44217b2a3faa93e2a0b2",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "ipetkov",
|
||||||
|
"repo": "crane",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"devshell": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixCargoIntegration",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1646322147,
|
||||||
|
"narHash": "sha256-XwrdjThHPq/APV7B6mXJwYvN/3RmsjX1W4zPgjvCp0A=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "devshell",
|
"repo": "devshell",
|
||||||
"rev": "d897c1ddb4eab66cc2b783c7868d78555b9880ad",
|
"rev": "2cc45675b223a35ca1d8af6383752c3d4b66f484",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -15,7 +38,73 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"dream2nix": {
|
||||||
|
"inputs": {
|
||||||
|
"alejandra": [
|
||||||
|
"nixCargoIntegration",
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"crane": "crane",
|
||||||
|
"flake-utils-pre-commit": [
|
||||||
|
"nixCargoIntegration",
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"gomod2nix": [
|
||||||
|
"nixCargoIntegration",
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"mach-nix": [
|
||||||
|
"nixCargoIntegration",
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixCargoIntegration",
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"node2nix": [
|
||||||
|
"nixCargoIntegration",
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"poetry2nix": [
|
||||||
|
"nixCargoIntegration",
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"pre-commit-hooks": [
|
||||||
|
"nixCargoIntegration",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1646647374,
|
||||||
|
"narHash": "sha256-sFGoE9LbHfP5t8NGcNkX4sPVq9kp8+ae8ODnW5eOkzo=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "dream2nix",
|
||||||
|
"rev": "76412363073ea1252700eb48901849cf8480e138",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"ref": "main",
|
||||||
|
"repo": "dream2nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1642700792,
|
||||||
|
"narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "846b2ae0fc4cc943637d3d1def4454213e203cba",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-utils_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1637014545,
|
"lastModified": 1637014545,
|
||||||
"narHash": "sha256-26IZAc5yzlD9FlDT54io1oqG/bBoyka+FJk5guaX4x4=",
|
"narHash": "sha256-26IZAc5yzlD9FlDT54io1oqG/bBoyka+FJk5guaX4x4=",
|
||||||
|
@ -30,9 +119,28 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"helix": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1646500939,
|
||||||
|
"narHash": "sha256-M0QvrRuluDkBWUfd5CYwvj9WtgalKlm5stJUAwnhrwI=",
|
||||||
|
"ref": "master",
|
||||||
|
"rev": "7633c5acd30258fc9caca926bfaa264d07d508ec",
|
||||||
|
"revCount": 2438,
|
||||||
|
"submodules": true,
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/helix-editor/helix.git"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"submodules": true,
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/helix-editor/helix.git"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixCargoIntegration": {
|
"nixCargoIntegration": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"devshell": "devshell",
|
"devshell": "devshell",
|
||||||
|
"dream2nix": "dream2nix",
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
],
|
||||||
|
@ -41,11 +149,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1642054253,
|
"lastModified": 1646681124,
|
||||||
"narHash": "sha256-kHh9VmaB7gbS6pheheC4x0uT84LEmhfbsbWEQJgU2E4=",
|
"narHash": "sha256-1ytR1z6RyBbxhk0LiO18QBH6Mu1JfAEWuUVBdbD4Bw8=",
|
||||||
"owner": "yusdacra",
|
"owner": "yusdacra",
|
||||||
"repo": "nix-cargo-integration",
|
"repo": "nix-cargo-integration",
|
||||||
"rev": "f8fa9af990195a3f63fe2dde84aa187e193da793",
|
"rev": "3b08d21177cecd5d69bdf76400a6145a021d1e49",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -56,11 +164,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1641887635,
|
"lastModified": 1646254136,
|
||||||
"narHash": "sha256-kDGpufwzVaiGe5e1sBUBPo9f1YN+nYHJlYqCaVpZTQQ=",
|
"narHash": "sha256-8nQx02tTzgYO21BP/dy5BCRopE8OwE8Drsw98j+Qoaw=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "b2737d4980a17cc2b7d600d7d0b32fd7333aca88",
|
"rev": "3e072546ea98db00c2364b81491b893673267827",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -72,6 +180,7 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"helix": "helix",
|
||||||
"nixCargoIntegration": "nixCargoIntegration",
|
"nixCargoIntegration": "nixCargoIntegration",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"rust-overlay": "rust-overlay"
|
"rust-overlay": "rust-overlay"
|
||||||
|
@ -79,7 +188,7 @@
|
||||||
},
|
},
|
||||||
"rust-overlay": {
|
"rust-overlay": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils_2",
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
]
|
]
|
||||||
|
|
81
flake.nix
81
flake.nix
|
@ -12,68 +12,45 @@
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
inputs.rustOverlay.follows = "rust-overlay";
|
inputs.rustOverlay.follows = "rust-overlay";
|
||||||
};
|
};
|
||||||
|
# NOTE: the flake looks like it is hanging when it pulls this input because
|
||||||
|
# the submodules take a long time to clone. This will be fixed in #1659.
|
||||||
|
helix = {
|
||||||
|
url = "https://github.com/helix-editor/helix.git";
|
||||||
|
type = "git";
|
||||||
|
submodules = true;
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs@{ self, nixCargoIntegration, ... }:
|
outputs = inputs@{ nixCargoIntegration, helix, ... }:
|
||||||
nixCargoIntegration.lib.makeOutputs {
|
nixCargoIntegration.lib.makeOutputs {
|
||||||
root = ./.;
|
root = ./.;
|
||||||
buildPlatform = "crate2nix";
|
|
||||||
renameOutputs = { "helix-term" = "helix"; };
|
renameOutputs = { "helix-term" = "helix"; };
|
||||||
# Set default app to hx (binary is from helix-term release build)
|
# Set default app to hx (binary is from helix-term release build)
|
||||||
# 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: _: rec {
|
crateOverrides = common: _: rec {
|
||||||
# link languages and theme toml files since helix-core/helix-view expects them
|
helix-term = prev: {
|
||||||
helix-core = _: { preConfigure = "ln -s ${common.root}/{languages.toml,theme.toml,base16_theme.toml} .."; };
|
buildInputs = (prev.buildInputs or [ ]) ++ [ common.cCompiler.cc.lib ];
|
||||||
helix-view = _: { preConfigure = "ln -s ${common.root}/{languages.toml,theme.toml,base16_theme.toml} .."; };
|
nativeBuildInputs = (prev.nativeBuildInputs or [ ]) ++ [ common.pkgs.makeWrapper ];
|
||||||
helix-syntax = prev: {
|
preConfigure = ''
|
||||||
src =
|
${prev.preConfigure}
|
||||||
let
|
rm -r helix-syntax/languages
|
||||||
pkgs = common.pkgs;
|
ln -s ${helix}/helix-syntax/languages helix-syntax/languages
|
||||||
helix = pkgs.fetchgit {
|
ln -s "$PWD/helix-syntax/languages" languages
|
||||||
url = "https://github.com/helix-editor/helix.git";
|
mkdir -p runtime/grammars
|
||||||
rev = "d62ad8b595a4f901b9c5dba1bb6e8f70ece395bf";
|
'';
|
||||||
fetchSubmodules = true;
|
postInstall = ''
|
||||||
sha256 = "sha256-X0N2clg2DQQ2bwyBrZVeaXLoSKaQ7NALydnd2eJzECg=";
|
${prev.postInstall or ""}
|
||||||
};
|
mkdir -p $out/lib
|
||||||
in
|
cp -r runtime $out/lib
|
||||||
pkgs.runCommand prev.src.name { } ''
|
wrapProgram "$out/bin/hx" --set HELIX_RUNTIME "$out/lib/runtime"
|
||||||
mkdir -p $out
|
'';
|
||||||
ln -s ${prev.src}/* $out
|
|
||||||
ln -sf ${helix}/helix-syntax/languages $out
|
|
||||||
'';
|
|
||||||
preConfigure = "mkdir -p ../runtime/grammars";
|
|
||||||
postInstall = "cp -r ../runtime $out/runtime";
|
|
||||||
};
|
};
|
||||||
helix-term = prev:
|
|
||||||
let
|
|
||||||
inherit (common) pkgs lib;
|
|
||||||
helixSyntax = lib.buildCrate {
|
|
||||||
root = self;
|
|
||||||
memberName = "helix-syntax";
|
|
||||||
defaultCrateOverrides = {
|
|
||||||
helix-syntax = helix-syntax;
|
|
||||||
};
|
|
||||||
release = false;
|
|
||||||
};
|
|
||||||
runtimeDir = pkgs.runCommand "helix-runtime" { } ''
|
|
||||||
mkdir -p $out
|
|
||||||
ln -s ${common.root}/runtime/* $out
|
|
||||||
ln -sf ${helixSyntax}/runtime/grammars $out
|
|
||||||
'';
|
|
||||||
in
|
|
||||||
{
|
|
||||||
# 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 ];
|
|
||||||
postFixup = ''
|
|
||||||
if [ -f "$out/bin/hx" ]; then
|
|
||||||
wrapProgram "$out/bin/hx" --set HELIX_RUNTIME "${runtimeDir}"
|
|
||||||
fi
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
shell = common: prev: {
|
shell = common: prev: {
|
||||||
packages = prev.packages ++ (with common.pkgs; [ lld_13 lldb cargo-tarpaulin cargo-flamegraph ]);
|
packages = prev.packages ++ (with common.pkgs; [ lld_13 lldb cargo-tarpaulin cargo-flamegraph ]);
|
||||||
|
|
Loading…
Reference in a new issue