From 2239e0e9833c2d139a507f99fcd74ce0ec4a58aa Mon Sep 17 00:00:00 2001 From: Bloxx12 Date: Wed, 4 Jun 2025 08:26:52 +0200 Subject: [PATCH] helix: rework --- flake.nix | 9 +++------ hosts/common.nix | 4 ++-- packages/default.nix | 13 ++++++------- packages/helix/default.nix | 23 +++++++++++++++++++---- packages/helix/languages.nix | 28 +++++++++++++++++++++++++--- 5 files changed, 55 insertions(+), 22 deletions(-) diff --git a/flake.nix b/flake.nix index cc6af58..b2418bd 100644 --- a/flake.nix +++ b/flake.nix @@ -21,10 +21,9 @@ inherit (import ./packages { inherit pkgs; - helix = inputs.helix.packages.${system}.default; }) fish - wrapped-helix + helix kakoune ; } @@ -32,7 +31,7 @@ pkgsFor; apps = eachSystem (system: let - inherit (inputs.self.packages.${system}) fish wrapped-helix; + inherit (inputs.self.packages.${system}) fish helix; in { default = { type = "app"; @@ -40,7 +39,7 @@ }; helix = { type = "app"; - program = "${wrapped-helix}/bin/hx"; + program = "${helix}/bin/hx"; }; }); }; @@ -71,8 +70,6 @@ inputs.systems.follows = "systems"; }; - helix.url = "github:helix-editor/helix"; - quickshell = { url = "git+https://git.outfoxxed.me/outfoxxed/quickshell"; # THIS IS IMPORTANT diff --git a/hosts/common.nix b/hosts/common.nix index 999772c..b94adb7 100644 --- a/hosts/common.nix +++ b/hosts/common.nix @@ -9,7 +9,7 @@ ... }: let inherit (lib.meta) hiPrioSet; - inherit (self.packages.${pkgs.stdenv.system}) wrapped-helix fish; + inherit (self.packages.${pkgs.stdenv.system}) helix fish; in { environment.systemPackages = builtins.attrValues { @@ -46,7 +46,7 @@ in { ; } ++ builtins.attrValues (hiPrioSet { - inherit wrapped-helix fish; + inherit helix fish; }); # helix as the only editor, a reasonable choice. environment.sessionVariables.EDITOR = "hx"; diff --git a/packages/default.nix b/packages/default.nix index 4ede96b..4d313ce 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -1,10 +1,9 @@ -{ - pkgs, - helix, -}: let - wrapped-helix = pkgs.callPackage ./helix {inherit helix;}; +{pkgs}: let + inherit (pkgs) lib; + wrapped-helix = pkgs.callPackage ./helix {}; kakoune = pkgs.callPackage ./kakoune.nix {}; - fish = pkgs.callPackage ./shell {}; + fish = pkgs.callPackage ./shell {inherit lib;}; in { - inherit wrapped-helix kakoune fish; + inherit kakoune fish; + helix = wrapped-helix; } diff --git a/packages/helix/default.nix b/packages/helix/default.nix index 6b73924..e93d18d 100644 --- a/packages/helix/default.nix +++ b/packages/helix/default.nix @@ -2,6 +2,8 @@ symlinkJoin, makeWrapper, callPackage, + fetchzip, + rustPlatform, alejandra, basedpyright, bash-language-server, @@ -21,7 +23,6 @@ lazygit, lib, lldb_19, - nil, nixd, ruff, rust-analyzer, @@ -40,6 +41,21 @@ }: let inherit (lib.meta) getExe; + custom-helix = helix.overrideAttrs (_: rec { + version = "25.06.1"; + src = fetchzip { + url = "https://github.com/bloxx12/helix/releases/download/${version}/helix-${version}-source.tar.xz"; + hash = "sha256-941moaBUF+aGsbFapK1cp5+NFdecSfRCTdnVUtkDQps="; + stripRoot = false; + }; + + doInstallCheck = false; + cargoDeps = rustPlatform.fetchCargoVendor { + inherit (custom-helix) src; + hash = "sha256-w07ZV1tR3lzYz4N+hI9alvFp0AHCcsItPRhVt9Sluo8="; + }; + }); + toml = formats.toml {}; helix-languages = callPackage ./languages.nix {inherit lib;}; @@ -116,7 +132,7 @@ wrapped-helix = symlinkJoin { name = "helix-wrapped"; paths = [ - helix + custom-helix # Bash bash-language-server @@ -128,8 +144,7 @@ lldb_19 # Markdown taplo - # Nix - nil + nixd rust-analyzer rustfmt diff --git a/packages/helix/languages.nix b/packages/helix/languages.nix index 39fec6b..c71a6e0 100644 --- a/packages/helix/languages.nix +++ b/packages/helix/languages.nix @@ -1,22 +1,25 @@ { + fetchFromGitHub, + rustPlatform, alejandra, basedpyright, bash-language-server, clang-tools, cmake-format, cmake-language-server, + deadnix, deno, dprint, formats, gdb, + kdePackages, lib, nil, ruff, shfmt, - kdePackages, + simple-completion-language-server, typescript-language-server, vscode-langservers-extracted, - simple-completion-language-server, zls, ... }: let @@ -24,6 +27,22 @@ toml = formats.toml {}; + # a newer nil version, for pipes support. + newer-nil = nil.overrideAttrs (_: { + version = "unstable-02-06-2025"; + + src = fetchFromGitHub { + owner = "oxalica"; + repo = "nil"; + rev = "577d160da311cc7f5042038456a0713e9863d09e"; + hash = "sha256-ggXU3RHv6NgWw+vc+HO4/9n0GPufhTIUjVuLci8Za8c="; + }; + cargoDeps = rustPlatform.fetchCargoVendor { + inherit (newer-nil) src; + hash = "sha256-uZsLlFU9GKLvFllF7Kf5Q7HfN26KQojf4rvOb9p7Rjs="; + }; + }); + helix-languages = { language = let mark = lang: { @@ -186,10 +205,13 @@ }; nil = { - command = getExe nil; + command = getExe newer-nil; # alejandro config.nil.formatting.command = ["${getExe alejandra}" "-q"]; }; + deadnix = { + command = getExe deadnix; + }; scls = { command = getExe simple-completion-language-server;