From e8b83724ca640ae17af2939b3a2924805647fef8 Mon Sep 17 00:00:00 2001 From: Riley Apeldoorn Date: Sat, 27 Apr 2024 12:13:43 +0200 Subject: [PATCH] Update rust treesitter grammar for helix --- flake.lock | 133 +++++++++++++++++++++++++++++++++--- flake.nix | 3 +- shared/core/nix.nix | 5 +- shared/home/nix/default.nix | 4 +- shared/overlay.nix | 10 ++- 5 files changed, 141 insertions(+), 14 deletions(-) diff --git a/flake.lock b/flake.lock index 0795758..91c6927 100644 --- a/flake.lock +++ b/flake.lock @@ -20,6 +20,27 @@ "type": "github" } }, + "crane": { + "inputs": { + "nixpkgs": [ + "helix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709610799, + "narHash": "sha256-5jfLQx0U9hXbi2skYMGodDJkIgffrjIOgMRjZqms2QE=", + "owner": "ipetkov", + "repo": "crane", + "rev": "81c393c776d5379c030607866afef6406ca1be57", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, "darwin": { "inputs": { "nixpkgs": [ @@ -46,6 +67,24 @@ "inputs": { "systems": "systems" }, + "locked": { + "lastModified": 1709126324, + "narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "d465f4819400de7c8d874d50b982301f28a84605", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, "locked": { "lastModified": 1681202837, "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", @@ -60,7 +99,7 @@ "type": "github" } }, - "flake-utils_2": { + "flake-utils_3": { "locked": { "lastModified": 1667395993, "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", @@ -75,6 +114,27 @@ "type": "github" } }, + "helix": { + "inputs": { + "crane": "crane", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs_2", + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1714168229, + "narHash": "sha256-EzNJ7L1XgqSIo3myFl/dFVqm6BXa8oV9qzSJpMBGYWU=", + "owner": "helix-editor", + "repo": "helix", + "rev": "5ee7411450021df3854b62f61b8722451e40277c", + "type": "github" + }, + "original": { + "owner": "helix-editor", + "repo": "helix", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -98,7 +158,7 @@ }, "home-manager_2": { "inputs": { - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_3" }, "locked": { "lastModified": 1703265279, @@ -178,6 +238,22 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1709479366, + "narHash": "sha256-n6F0n8UV6lnTZbYPl1A9q1BS0p4hduAv1mGAP17CVd0=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "b8697e57f10292a6165a20f03d2f42920dfaf973", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1702312524, "narHash": "sha256-gkZJRDBUCpTPBvQk25G0B7vfbpEYM5s5OZqghkjZsnE=", @@ -193,7 +269,7 @@ "type": "github" } }, - "nixpkgs_3": { + "nixpkgs_4": { "locked": { "lastModified": 1703013332, "narHash": "sha256-+tFNwMvlXLbJZXiMHqYq77z/RfmpfpiI3yjL6o/Zo9M=", @@ -209,7 +285,7 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_5": { "locked": { "lastModified": 1681358109, "narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=", @@ -227,8 +303,8 @@ }, "oxalica": { "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs_4" + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_5" }, "locked": { "lastModified": 1703297543, @@ -246,7 +322,7 @@ }, "pwnix": { "inputs": { - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils_3", "jwt-tool": "jwt-tool", "nixpkgs": [ "nixpkgs" @@ -286,14 +362,40 @@ "root": { "inputs": { "agenix": "agenix", + "helix": "helix", "home-manager": "home-manager_2", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_4", "nixpkgs-latest": "nixpkgs-latest", "oxalica": "oxalica", "pwnix": "pwnix" } }, + "rust-overlay": { + "inputs": { + "flake-utils": [ + "helix", + "flake-utils" + ], + "nixpkgs": [ + "helix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709604635, + "narHash": "sha256-le4fwmWmjGRYWwkho0Gr7mnnZndOOe4XGbLw68OvF40=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "e86c0fb5d3a22a5f30d7f64ecad88643fe26449d", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, "systems": { "locked": { "lastModified": 1681028828, @@ -308,6 +410,21 @@ "repo": "default", "type": "github" } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 0bd58a2..ea744ee 100644 --- a/flake.nix +++ b/flake.nix @@ -11,6 +11,7 @@ agenix.url = github:ryantm/agenix; nixos-hardware.url = github:NixOS/nixos-hardware; oxalica.url = github:oxalica/rust-overlay; + helix.url = "github:helix-editor/helix"; }; outputs = args@{ home-manager, nixpkgs, agenix, nixos-hardware, oxalica, ... }: with nixpkgs; rec { @@ -77,7 +78,7 @@ }; overlays = { - default = (import ./shared/overlay.nix); + default = (import ./shared/overlay.nix args.helix); }; devShells."x86_64-linux"."utils" = let diff --git a/shared/core/nix.nix b/shared/core/nix.nix index b2ae4d2..244b337 100644 --- a/shared/core/nix.nix +++ b/shared/core/nix.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, config, nixpkgs, pwnix, ... }: +{ pkgs, lib, config, nixpkgs, pwnix, helix, ... }: let cfg = config.custom.nix; @@ -9,11 +9,12 @@ in with lib; { # TODO: Add strawberry as a build machine here config = { nixpkgs.config.allowUnfree = true; - nixpkgs.overlays = [ (import ../overlay.nix) ]; + nixpkgs.overlays = [ (import ../overlay.nix helix) ]; nix.extraOptions = '' experimental-features = nix-command flakes ''; nix.registry.nixpkgs.flake = nixpkgs; + nix.registry.helix.flake = helix; nix.registry.pwnix.flake = pwnix; nix.settings.trusted-users = [ "@wheel" diff --git a/shared/home/nix/default.nix b/shared/home/nix/default.nix index 5873009..1e8e8ff 100644 --- a/shared/home/nix/default.nix +++ b/shared/home/nix/default.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, config, ... }: +{ lib, pkgs, config, helix, ... }: (lib.mkIf (!config.isNixos) { @@ -12,7 +12,7 @@ nixpkgs.config = import ./nix-config.nix; nixpkgs.overlays = [ - (import ../../overlay.nix) + (import ../../overlay.nix helix) ]; xdg.configFile."nixpkgs/config.nix".source = ./nix-config.nix; diff --git a/shared/overlay.nix b/shared/overlay.nix index ed31f9a..031ec84 100644 --- a/shared/overlay.nix +++ b/shared/overlay.nix @@ -1,4 +1,4 @@ -final: prev: +helix: final: prev: with (import ./lib.nix final); { element-web = webApp "element" "https://riot.badat.dev"; @@ -10,6 +10,14 @@ with (import ./lib.nix final); { prev.tor-browser-bundle-bin.override { useHardenedMalloc = false; }; + # We can't just patch it because grammars are fetched at build time. + helix = helix.packages.${prev.stdenv.system}.default.override { + grammarOverlays = [(f: p: { + "rust" = p.rust.overrideAttrs (o: { + rev = "04352146022062c101b8ddd853adf17eadd8cf56"; + }); + })]; + }; # python311Packages.deemix = prev.python311Packages.deemix.overrideAttrs (old: { # patches = [./patch/dont_write_arl.patch]; # });