diff --git a/nixos/modules/services/misc/atuin.nix b/nixos/modules/services/misc/atuin.nix index 7637e06141ca..7e89929884d6 100644 --- a/nixos/modules/services/misc/atuin.nix +++ b/nixos/modules/services/misc/atuin.nix @@ -54,10 +54,13 @@ in }; uri = mkOption { - type = types.str; + type = types.nullOr types.str; default = "postgresql:///atuin?host=/run/postgresql"; example = "postgresql://atuin@localhost:5432/atuin"; - description = mdDoc "URI to the database"; + description = mdDoc '' + URI to the database. + Can be set to null in which case ATUIN_DB_URI should be set through an EnvironmentFile + ''; }; }; }; @@ -134,9 +137,10 @@ in ATUIN_PORT = toString cfg.port; ATUIN_MAX_HISTORY_LENGTH = toString cfg.maxHistoryLength; ATUIN_OPEN_REGISTRATION = lib.boolToString cfg.openRegistration; - ATUIN_DB_URI = cfg.database.uri; ATUIN_PATH = cfg.path; ATUIN_CONFIG_DIR = "/run/atuin"; # required to start, but not used as configuration is via environment variables + } // lib.optionalAttrs (cfg.database.uri != null) { + ATUIN_DB_URI = cfg.database.uri; }; }; diff --git a/pkgs/by-name/at/atuin/package.nix b/pkgs/by-name/at/atuin/package.nix index db9bc233cb9a..88e9609075fe 100644 --- a/pkgs/by-name/at/atuin/package.nix +++ b/pkgs/by-name/at/atuin/package.nix @@ -1,6 +1,7 @@ { lib , stdenv , fetchFromGitHub +, fetchpatch , installShellFiles , rustPlatform , libiconv @@ -19,12 +20,28 @@ rustPlatform.buildRustPackage rec { hash = "sha256-fuVSn1vhKn2+Tw5f6zBYHFW3QSL4eisZ6d5pxsj5hh4="; }; + patches = [ + # atuin with bash-preexec wasn't recording history properly after searching, + # backport recent fix until next release + (fetchpatch { + url = "https://github.com/atuinsh/atuin/commit/cb11af25afddbad552d337a9c82e74ac4302feca.patch"; + sha256 = "sha256-cG99aLKs5msatT7vXiX9Rn5xur2WUjQ/U33nOxuon7I="; + }) + ]; + # TODO: unify this to one hash because updater do not support this cargoHash = if stdenv.isLinux then "sha256-lHWgsVnjSeBmd7O4Fn0pUtTn4XbkBOAouaRHRozil50=" else "sha256-LxfpllzvgUu7ZuD97n3W+el3bdOt5QGXzJbDQ0w8seo="; + # 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" + ]; + nativeBuildInputs = [ installShellFiles ]; buildInputs = lib.optionals stdenv.isDarwin [