about summary refs log tree commit diff stats
path: root/pkgs/by-name
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-18 23:23:56 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-18 23:23:56 +0200
commite7fdb3737774b4d7a5549d6d282944b6f468ab55 (patch)
tree0282a704fbdbc95764810eb029875051f2238993 /pkgs/by-name
parentfix(modules/legacy/conf): Remove outdated imports of migrated modules (diff)
downloadnixos-config-e7fdb3737774b4d7a5549d6d282944b6f468ab55.tar.gz
nixos-config-e7fdb3737774b4d7a5549d6d282944b6f468ab55.zip
feat(modules/atuin): Init
Diffstat (limited to '')
-rw-r--r--pkgs/by-name/at/atuin/package.nix94
-rw-r--r--pkgs/by-name/at/atuin/set-dvorak-keybindings.patch37
2 files changed, 131 insertions, 0 deletions
diff --git a/pkgs/by-name/at/atuin/package.nix b/pkgs/by-name/at/atuin/package.nix
new file mode 100644
index 00000000..7f58697a
--- /dev/null
+++ b/pkgs/by-name/at/atuin/package.nix
@@ -0,0 +1,94 @@
+# 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
new file mode 100644
index 00000000..9ab3700a
--- /dev/null
+++ b/pkgs/by-name/at/atuin/set-dvorak-keybindings.patch
@@ -0,0 +1,37 @@
+From f763aef8094c12293570119d9ff0922356dd8c79 Mon Sep 17 00:00:00 2001
+From: Benedikt Peetz <benedikt.peetz@b-peetz.de>
+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
+