Comments (14)
@DieracDelta solved submodules issue somehow recently. May have used the same technique
As for jsonrpc - as I noted above workaround is to tell Nix to fetch it https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/rust.section.md#importing-a-cargolock-file (have not tried it tho)
So this is not really relevant for naersk, but it does work(at least for fetching dependencies) - naersk has the upside of providing some form of caching, while buildRustPackage does not. I'm trying to get a build working locally.
from helix.
The jsonrpc folks tagged a new release, but did not push a new version to crates.io.
The other problem with building via flake:s submodules aren't visible during the build (NixOS/nix#4423), so all of the syntax definitions are missing and the build fails. The workaround seems to be to re-clone the repo via fetchGit
from helix.
@DieracDelta solved submodules issue somehow recently. May have used the same technique 🤔
As for jsonrpc - as I noted above workaround is to tell Nix to fetch it https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/rust.section.md#importing-a-cargolock-file (have not tried it tho)
from helix.
update: edited the snippet to include workarounds for the syntax builds; sadly this fails in checkPhase.
For some reason two tests are failing and I can't manage to reproduce this in a local nix-shell.
Something like this works by fetching the repo:
{
description = "A port-modern text editor.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, utils }:
utils.lib.eachDefaultSystem (system:
let pkgs = import nixpkgs { inherit system; };
in {
defaultPackage = with pkgs;
rustPlatform.buildRustPackage {
pname = "helix";
version = "0.0.10";
src = fetchgit {
url = "https://github.com/helix-editor/helix"; # could probably pass a local git repo here
fetchSubmodules = true;
rev = "14830e75ff9316f8a5a428a06f3b3c8c4706d35a";
sha256 = "sha256-6OQmkTR1c3TuIMiToWSoS8skCdNRZvXR5oWFBY/JpM8=";
};
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"jsonrpc-core-17.1.0" = "sha256-FsdoqN6GWtmDxt5fOeGcoGwywiHVO4+GJpMFzD88EAI=";
};
};
nativeBuildInputs = [ ];
buildInputs = [ cargo rustc ];
};
devShell = pkgs.callPackage ./shell.nix {};
});
}
Depencies get correctly fetched but nix build is very nitpicky about the correct sha being used( the Cargo.lock has to be identical to the pinned upstream one ).
Then the build finishes correctly but fails while running tests:
> failures:
> buffer::tests::index_of_panics_on_out_of_bounds
> buffer::tests::pos_of_panics_on_out_of_bounds
in helix-tui
from helix.
We use crate.io deps now again: d5de918
I think the test failure could be from warnings? We fixed some warnings in buffer.rs
today.
from helix.
We use crate.io deps now again: d5de918
I think the test failure could be from warnings? We fixed some warnings in
buffer.rs
today.
I think you are correct here.
the following builds correctly, It pulls all submodules into the scope of the build:
{
description = "A post-modern text editor.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
naersk.url = "github:nmattia/naersk";
};
outputs = inputs@{ self, nixpkgs, naersk, rust-overlay, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; overlays = [ rust-overlay.overlay ]; };
rust = (pkgs.rustChannelOf {
date = "2021-05-01";
channel = "nightly";
}).minimal; # cargo, rustc and rust-std
naerskLib = naersk.lib."${system}".override {
# naersk can't build with stable?!
# inherit (pkgs.rust-bin.stable.latest) rustc cargo;
rustc = rust;
cargo = rust;
};
in rec {
packages.helix = naerskLib.buildPackage {
pname = "helix";
root = ./.;
src = pkgs.fetchgit {
url = "https://github.com/helix-editor/helix"; # could probably pass a local git repo here
fetchSubmodules = true;
rev = "68affa3c598723a8b9451ef3dcceda83ae161e39";
sha256 = "sha256-6RF1GmqDNqEeiPnFDErkNc0+gPTg3KJp8JfCD1FoUCI=";
};
};
defaultPackage = packages.helix;
devShell = pkgs.callPackage ./shell.nix {};
});
}
This flake.nix build is based on the commit 68affa3;
It is probably unfeasible to have nix-flake build from the master branch since this can often result in a cargo.lock mismatch. Updating it manually is not difficult though. (change rev, build, replace sha, build)
from helix.
I think you could use fetchGithub
and fetch the latest tagged release for the time being? Then if/when the submodule support gets integrated we can switch to always building latest master.
Other than that, feel free to open a PR with these changes :)
from helix.
I think you could use
fetchGithub
and fetch the latest tagged release for the time being? Then if/when the submodule support gets integrated we can switch to always building latest master.Other than that, feel free to open a PR with these changes :)
Latest release sadly does not have d5de918 so the build will always fail.
I will wait for v0.0.11 and start a PR, meanwhile for the hell of it:
nix shell github:itzmjauz/helix/nix-flake --command hx (if you have nix flakes enabled )
gets you helix :)
from helix.
I think we should add nix builds to CI to prevent regression.
from helix.
we could add helix itself as a flake input to pull submodules:
helix = {
flake = false;
url = "https://github.com/helix-editor/helix";
type = "git";
submodules = true;
};
Doing this, I was able to build the package from the flake like so:
packages.helix = naerskLib.buildPackage {
pname = "helix";
root = inputs.helix;
};
from helix.
we could add helix itself as a flake input to pull submodules:
helix = { flake = false; url = "https://github.com/helix-editor/helix"; type = "git"; submodules = true; };
Doing this, I was able to build the package from the flake like so:
packages.helix = naerskLib.buildPackage { pname = "helix"; root = inputs.helix; };
Does this also work when using root = ./.; ? (since you'd want to be able to run nix build with local changes ) I will test when I have the time.
Edit:
I imagine using root = ./. , src = inputs.helix
, should include local changes.
from helix.
@itzmjauz I gave it a try, but it doesn't appear to take local changes into account.
from helix.
@itzmjauz I gave it a try, but it doesn't appear to take local changes into account.
Yeah I'm seeing that too.. It might be building all helix modules ( helix-term helix-syntax etc) from upstream as well..
from helix.
After reviewing naersk docs, root is only used to read Cargo.toml and Cargo.lock so I guess it's no surprise. Perhaps something like a symlinkJoin
could help us merge the local repo with the remote? I'll see if I can get something like that to work.
from helix.
Related Issues (20)
- When building from source, Helix won't add itself to path HOT 1
- Cannot configure [editor.auto-save] section HOT 2
- Implement movement based on unicode segmentation HOT 5
- Soft wrapping does a line break in the middle of ".," HOT 1
- Running command status HOT 1
- support "expand macro recursively" HOT 2
- Allow configuration of file picker prompt position
- Build error on Windows from repo
- flexible way to add a lsp to many languages at once HOT 2
- Auto indent do not handle C/C++ documentation comments correctly
- ecma scm doesn't map private properties to highlight scopes HOT 4
- hx executable name conflicts with hex HOT 2
- pylsp error occured and formatter doesn't work
- Soft-hyphen character breaks render and movement HOT 1
- failed to build HOT 1
- Display LSP provider information in diagnostics
- Allow customizing lsp gutter symbols
- Allow to disable themes background HOT 1
- File autocomplete in :open breaks with symlinks HOT 1
- `CTRL+c` causes Helix to crash after Nushell LSP crashes HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from helix.