From 58eed70ed403d109e0e416f765dd2035db6e393b Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Mon, 30 Dec 2024 22:33:46 +0100 Subject: fix(pkgs/{atuin,ctpv}): Extend instead of replace This allows me, to still benefit from upstream version updates. --- modules/by-name/at/atuin/module.nix | 2 + modules/by-name/lf/lf/ctpv/default.nix | 2 +- pkgs/by-name/at/atuin-dvorak/package.nix | 23 ++++++ .../at/atuin-dvorak/set-dvorak-keybindings.patch | 37 +++++++++ pkgs/by-name/at/atuin/package.nix | 94 ---------------------- pkgs/by-name/at/atuin/set-dvorak-keybindings.patch | 37 --------- .../ct/ctpv-64-types/allow-up-to-64-types.patch | 26 ++++++ pkgs/by-name/ct/ctpv-64-types/package.nix | 15 ++++ pkgs/by-name/ct/ctpv/allow-up-to-64-types.patch | 26 ------ pkgs/by-name/ct/ctpv/package.nix | 45 ----------- 10 files changed, 104 insertions(+), 203 deletions(-) create mode 100644 pkgs/by-name/at/atuin-dvorak/package.nix create mode 100644 pkgs/by-name/at/atuin-dvorak/set-dvorak-keybindings.patch delete mode 100644 pkgs/by-name/at/atuin/package.nix delete mode 100644 pkgs/by-name/at/atuin/set-dvorak-keybindings.patch create mode 100644 pkgs/by-name/ct/ctpv-64-types/allow-up-to-64-types.patch create mode 100644 pkgs/by-name/ct/ctpv-64-types/package.nix delete mode 100644 pkgs/by-name/ct/ctpv/allow-up-to-64-types.patch delete mode 100644 pkgs/by-name/ct/ctpv/package.nix diff --git a/modules/by-name/at/atuin/module.nix b/modules/by-name/at/atuin/module.nix index 2b9f32cf..604ee4ef 100644 --- a/modules/by-name/at/atuin/module.nix +++ b/modules/by-name/at/atuin/module.nix @@ -1,6 +1,7 @@ { config, lib, + pkgs, ... }: let cfg = config.soispha.programs.atuin; @@ -20,6 +21,7 @@ in { home-manager.users.soispha = { programs.atuin = { enable = true; + package = pkgs.atuin-dvorak; enableZshIntegration = config.soispha.programs.zsh.enable; settings = { key_path = "${config.age.secrets.atuin_encryption_key.path}"; diff --git a/modules/by-name/lf/lf/ctpv/default.nix b/modules/by-name/lf/lf/ctpv/default.nix index e25fa344..3748eca4 100644 --- a/modules/by-name/lf/lf/ctpv/default.nix +++ b/modules/by-name/lf/lf/ctpv/default.nix @@ -151,7 +151,7 @@ in { default = config.home-manager.users.soispha.xdg.dataHome; }; - package = lib.mkPackageOption pkgs "ctpv" {}; + package = lib.mkPackageOption pkgs "ctpv-64-types" {}; # TODO: This is necessary, as the `./prev` dir is imported separately and as such # cannot access the `./helpers.sh` file in it's parent directory. diff --git a/pkgs/by-name/at/atuin-dvorak/package.nix b/pkgs/by-name/at/atuin-dvorak/package.nix new file mode 100644 index 00000000..c651eb75 --- /dev/null +++ b/pkgs/by-name/at/atuin-dvorak/package.nix @@ -0,0 +1,23 @@ +{atuin}: +atuin.overrideAttrs (finalAttrs: previousAttrs: { + pname = previousAttrs.pname + "-dvorak"; + patches = + previousAttrs.patches + ++ [ + ./set-dvorak-keybindings.patch + ]; + + # atuin's default features include 'check-updates', which do not make sense + # for distribution builds. List all other default features. + buildNoDefaultFeatures = true; + buildFeatures = [ + "client" + # "sync" + # "server" + "clipboard" + # "daemon" + ]; + + # The checks don't compile without the `server` feature + doCheck = false; +}) diff --git a/pkgs/by-name/at/atuin-dvorak/set-dvorak-keybindings.patch b/pkgs/by-name/at/atuin-dvorak/set-dvorak-keybindings.patch new file mode 100644 index 00000000..9ab3700a --- /dev/null +++ b/pkgs/by-name/at/atuin-dvorak/set-dvorak-keybindings.patch @@ -0,0 +1,37 @@ +From f763aef8094c12293570119d9ff0922356dd8c79 Mon Sep 17 00:00:00 2001 +From: Benedikt Peetz +Date: Fri, 18 Oct 2024 23:03:01 +0200 +Subject: [PATCH] fix(client): Change the keymaps to support dvorka vim keys + +--- + crates/atuin/src/command/client/search/interactive.rs | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/crates/atuin/src/command/client/search/interactive.rs b/crates/atuin/src/command/client/search/interactive.rs +index c87fff1c..19e965fe 100644 +--- a/crates/atuin/src/command/client/search/interactive.rs ++++ b/crates/atuin/src/command/client/search/interactive.rs +@@ -322,17 +322,17 @@ impl State { + self.keymap_mode = KeymapMode::VimInsert; + return InputAction::Continue; + } +- KeyCode::Char('j') if !ctrl => { ++ KeyCode::Char('t') if !ctrl => { + return self.handle_search_down(settings, true); + } +- KeyCode::Char('k') if !ctrl => { ++ KeyCode::Char('n') if !ctrl => { + return self.handle_search_up(settings, true); + } + KeyCode::Char('h') if !ctrl => { + self.search.input.left(); + return InputAction::Continue; + } +- KeyCode::Char('l') if !ctrl => { ++ KeyCode::Char('s') if !ctrl => { + self.search.input.right(); + return InputAction::Continue; + } +-- +2.46.0 + diff --git a/pkgs/by-name/at/atuin/package.nix b/pkgs/by-name/at/atuin/package.nix deleted file mode 100644 index 7f58697a..00000000 --- a/pkgs/by-name/at/atuin/package.nix +++ /dev/null @@ -1,94 +0,0 @@ -# This has been taken from nixpkgs at: -# https://github.com/NixOS/nixpkgs/blob/5785b6bb5eaae44e627d541023034e1601455827/pkgs/by-name/at/atuin/package.nix -# I have just removed some features and added a patch for dvorak input. -{ - lib, - stdenv, - fetchFromGitHub, - installShellFiles, - rustPlatform, - libiconv, - buildPackages, - darwin, - nixosTests, -}: -rustPlatform.buildRustPackage rec { - pname = "atuin"; - version = "18.3.0"; - - src = fetchFromGitHub { - owner = "atuinsh"; - repo = "atuin"; - rev = "v${version}"; - hash = "sha256-Q3UI1IUD5Jz2O4xj3mFM7DqY3lTy3WhWYPa8QjJHTKE="; - }; - - # TODO: unify this to one hash because updater do not support this - cargoHash = - if stdenv.hostPlatform.isLinux - then "sha256-K4Vw/d0ZOROWujWr76I3QvfKefLhXLeFufUrgStAyjQ=" - else "sha256-8NAfE7cGFT64ntNXK9RT0D/MbDJweN7vvsG/KlrY4K4="; - - patches = [ - ./set-dvorak-keybindings.patch - ]; - - # atuin's default features include 'check-updates', which do not make sense - # for distribution builds. List all other default features. - buildNoDefaultFeatures = true; - buildFeatures = [ - "client" - # "sync" - # "server" - "clipboard" - # "daemon" - ]; - - nativeBuildInputs = [installShellFiles]; - - buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ - libiconv - darwin.apple_sdk_11_0.frameworks.AppKit - darwin.apple_sdk_11_0.frameworks.Security - darwin.apple_sdk_11_0.frameworks.SystemConfiguration - ]; - - preBuild = '' - export PROTOC=${buildPackages.protobuf}/bin/protoc - export PROTOC_INCLUDE="${buildPackages.protobuf}/include"; - ''; - - postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' - installShellCompletion --cmd atuin \ - --bash <($out/bin/atuin gen-completions -s bash) \ - --fish <($out/bin/atuin gen-completions -s fish) \ - --zsh <($out/bin/atuin gen-completions -s zsh) - ''; - - passthru.tests = { - inherit (nixosTests) atuin; - }; - - # The checks don't compile without the `server` feature - doCheck = false; - checkFlags = [ - # tries to make a network access - "--skip=registration" - # No such file or directory (os error 2) - "--skip=sync" - # PermissionDenied (Operation not permitted) - "--skip=change_password" - "--skip=multi_user_test" - "--skip=store::var::tests::build_vars" - # Tries to touch files - "--skip=build_aliases" - ]; - - meta = with lib; { - description = "Replacement for a shell history which records additional commands context with optional encrypted synchronization between machines"; - homepage = "https://github.com/atuinsh/atuin"; - license = licenses.mit; - maintainers = with maintainers; [SuperSandro2000 sciencentistguy _0x4A6F]; - mainProgram = "atuin"; - }; -} diff --git a/pkgs/by-name/at/atuin/set-dvorak-keybindings.patch b/pkgs/by-name/at/atuin/set-dvorak-keybindings.patch deleted file mode 100644 index 9ab3700a..00000000 --- a/pkgs/by-name/at/atuin/set-dvorak-keybindings.patch +++ /dev/null @@ -1,37 +0,0 @@ -From f763aef8094c12293570119d9ff0922356dd8c79 Mon Sep 17 00:00:00 2001 -From: Benedikt Peetz -Date: Fri, 18 Oct 2024 23:03:01 +0200 -Subject: [PATCH] fix(client): Change the keymaps to support dvorka vim keys - ---- - crates/atuin/src/command/client/search/interactive.rs | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/crates/atuin/src/command/client/search/interactive.rs b/crates/atuin/src/command/client/search/interactive.rs -index c87fff1c..19e965fe 100644 ---- a/crates/atuin/src/command/client/search/interactive.rs -+++ b/crates/atuin/src/command/client/search/interactive.rs -@@ -322,17 +322,17 @@ impl State { - self.keymap_mode = KeymapMode::VimInsert; - return InputAction::Continue; - } -- KeyCode::Char('j') if !ctrl => { -+ KeyCode::Char('t') if !ctrl => { - return self.handle_search_down(settings, true); - } -- KeyCode::Char('k') if !ctrl => { -+ KeyCode::Char('n') if !ctrl => { - return self.handle_search_up(settings, true); - } - KeyCode::Char('h') if !ctrl => { - self.search.input.left(); - return InputAction::Continue; - } -- KeyCode::Char('l') if !ctrl => { -+ KeyCode::Char('s') if !ctrl => { - self.search.input.right(); - return InputAction::Continue; - } --- -2.46.0 - diff --git a/pkgs/by-name/ct/ctpv-64-types/allow-up-to-64-types.patch b/pkgs/by-name/ct/ctpv-64-types/allow-up-to-64-types.patch new file mode 100644 index 00000000..fdecb754 --- /dev/null +++ b/pkgs/by-name/ct/ctpv-64-types/allow-up-to-64-types.patch @@ -0,0 +1,26 @@ +From 069059937741d9a10ac1bdf7cc15e16e26f5da99 Mon Sep 17 00:00:00 2001 +From: Benedikt Peetz +Date: Sun, 24 Nov 2024 17:27:17 +0100 +Subject: [PATCH] fix(config): Allow up to 64 types + +The limit of 16 seems to harsh. +--- + src/config.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/config.c b/src/config.c +index 3556ccf..444fe29 100644 +--- a/src/config.c ++++ b/src/config.c +@@ -274,7 +274,7 @@ static enum Status cmd_preview(Parser *ctx) + Token name = ctx->token; + EXPECT(ctx, TOK_STR); + +- struct TypeSet types[16]; ++ struct TypeSet types[64]; + unsigned int types_len = 0; + + while (accept(ctx, TOK_BLK_OPEN) == STAT_NULL) { +-- +2.47.0 + diff --git a/pkgs/by-name/ct/ctpv-64-types/package.nix b/pkgs/by-name/ct/ctpv-64-types/package.nix new file mode 100644 index 00000000..763b0325 --- /dev/null +++ b/pkgs/by-name/ct/ctpv-64-types/package.nix @@ -0,0 +1,15 @@ +{ctpv}: +ctpv.overrideAttrs (finalAttrs: previousAttrs: { + pname = previousAttrs.pname + "-64-types"; + patches = + (previousAttrs.patches or []) + ++ [ + ./allow-up-to-64-types.patch + ]; + + preFixup = '' + wrapProgram $out/bin/ctpv --set PATH ""; + ''; + + meta.mainProgram = "ctpv"; +}) diff --git a/pkgs/by-name/ct/ctpv/allow-up-to-64-types.patch b/pkgs/by-name/ct/ctpv/allow-up-to-64-types.patch deleted file mode 100644 index fdecb754..00000000 --- a/pkgs/by-name/ct/ctpv/allow-up-to-64-types.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 069059937741d9a10ac1bdf7cc15e16e26f5da99 Mon Sep 17 00:00:00 2001 -From: Benedikt Peetz -Date: Sun, 24 Nov 2024 17:27:17 +0100 -Subject: [PATCH] fix(config): Allow up to 64 types - -The limit of 16 seems to harsh. ---- - src/config.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/config.c b/src/config.c -index 3556ccf..444fe29 100644 ---- a/src/config.c -+++ b/src/config.c -@@ -274,7 +274,7 @@ static enum Status cmd_preview(Parser *ctx) - Token name = ctx->token; - EXPECT(ctx, TOK_STR); - -- struct TypeSet types[16]; -+ struct TypeSet types[64]; - unsigned int types_len = 0; - - while (accept(ctx, TOK_BLK_OPEN) == STAT_NULL) { --- -2.47.0 - diff --git a/pkgs/by-name/ct/ctpv/package.nix b/pkgs/by-name/ct/ctpv/package.nix deleted file mode 100644 index 905366bf..00000000 --- a/pkgs/by-name/ct/ctpv/package.nix +++ /dev/null @@ -1,45 +0,0 @@ -{ - lib, - stdenv, - fetchFromGitHub, - makeWrapper, - file, - openssl, -}: -stdenv.mkDerivation rec { - pname = "ctpv"; - version = "1.1-unstable-2024-11-24"; - - src = fetchFromGitHub { - owner = "NikitaIvanovV"; - repo = pname; - rev = "4efa0f976eaf8cb814e0aba4f4f1a1d12ee9262e"; - hash = "sha256-tFBXCUey1lsNAg1mB0iQjDoH70qL8aytE6h9rhHlBe4="; - }; - - nativeBuildInputs = [makeWrapper]; - - buildInputs = [ - file # libmagic - openssl - ]; - - patches = [ - ./allow-up-to-64-types.patch - ]; - - makeFlags = ["PREFIX=$(out)"]; - - preFixup = '' - wrapProgram $out/bin/ctpv \ - --set PATH "${lib.makeBinPath []}"; - ''; - - meta = with lib; { - description = "File previewer for a terminal"; - homepage = "https://github.com/NikitaIvanovV/ctpv"; - license = licenses.mit; - platforms = platforms.linux; - maintainers = [maintainers.wesleyjrz]; - }; -} -- cgit 1.4.1