atuin: use daemon start subcommand on >= 18.13.0

Atuin 18.13.0 deprecated `atuin daemon` in favour of `atuin daemon start`
and prints a warning on every daemon startup. Keep the old invocation for
older versions so NixOS stable (currently shipping 18.10.0) keeps working.

Also drop the 18.2.0 minimum version assertion since all supported
nixpkgs branches ship newer versions.
This commit is contained in:
r-vdp 2026-03-27 12:57:40 +01:00 committed by Austin Horstman
parent accd450fcd
commit 2b8f732e15

View file

@ -10,6 +10,16 @@ let
tomlFormat = pkgs.formats.toml { };
# atuin 18.13.0 deprecated `atuin daemon` in favour of `atuin daemon start`
daemonArgs =
if lib.versionAtLeast cfg.package.version "18.13.0" then
[
"daemon"
"start"
]
else
[ "daemon" ];
inherit (lib) mkIf mkOption types;
in
{
@ -222,12 +232,6 @@ in
(mkIf daemonCfg.enable {
assertions = [
{
assertion = lib.versionAtLeast cfg.package.version "18.2.0";
message = ''
The Atuin daemon requires at least version 18.2.0 or later.
'';
}
{
assertion = config.systemd.user.enable || config.launchd.enable;
message = "The Atuin daemon can only be configured on systems with systemd or launchd.";
@ -252,7 +256,7 @@ in
WantedBy = [ "default.target" ];
};
Service = {
ExecStart = "${lib.getExe cfg.package} daemon";
ExecStart = "${lib.getExe cfg.package} ${lib.concatStringsSep " " daemonArgs}";
Environment = lib.optionals (daemonCfg.logLevel != null) [ "ATUIN_LOG=${daemonCfg.logLevel}" ];
Restart = "on-failure";
RestartSteps = 3;
@ -281,10 +285,7 @@ in
launchd.agents.atuin-daemon = {
enable = true;
config = {
ProgramArguments = [
"${lib.getExe cfg.package}"
"daemon"
];
ProgramArguments = [ (lib.getExe cfg.package) ] ++ daemonArgs;
EnvironmentVariables = lib.optionalAttrs (daemonCfg.logLevel != null) {
ATUIN_LOG = daemonCfg.logLevel;
};