From 6bf4d7361b189f65cd319f3924cf52ceabf8c7f3 Mon Sep 17 00:00:00 2001 From: Anthony Roussel Date: Sun, 15 Feb 2026 23:34:44 +0100 Subject: [PATCH 1/5] autosuspend: 9.0.1 -> 10.0.0 Notable upstream changes: * The presuspend SystemD unit has been removed Diff: https://github.com/languitar/autosuspend/compare/v9.0.1...v10.0.0 Changelog: https://github.com/languitar/autosuspend/releases/tag/v10.0.0 --- nixos/modules/services/misc/autosuspend.nix | 10 ---------- pkgs/by-name/au/autosuspend/package.nix | 6 +++--- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/nixos/modules/services/misc/autosuspend.nix b/nixos/modules/services/misc/autosuspend.nix index fed0e2c9a06a..3ca2794892b8 100644 --- a/nixos/modules/services/misc/autosuspend.nix +++ b/nixos/modules/services/misc/autosuspend.nix @@ -235,16 +235,6 @@ in ExecStart = "${autosuspend}/bin/autosuspend -l ${autosuspend}/etc/autosuspend-logging.conf -c ${autosuspend-conf} daemon"; }; }; - - systemd.services.autosuspend-detect-suspend = { - description = "Notifies autosuspend about suspension"; - documentation = [ "https://autosuspend.readthedocs.io/en/latest/systemd_integration.html" ]; - wantedBy = [ "sleep.target" ]; - after = [ "sleep.target" ]; - serviceConfig = { - ExecStart = "${autosuspend}/bin/autosuspend -l ${autosuspend}/etc/autosuspend-logging.conf -c ${autosuspend-conf} presuspend"; - }; - }; }; meta = { diff --git a/pkgs/by-name/au/autosuspend/package.nix b/pkgs/by-name/au/autosuspend/package.nix index 2f8862c465d9..f6dd6ed15447 100644 --- a/pkgs/by-name/au/autosuspend/package.nix +++ b/pkgs/by-name/au/autosuspend/package.nix @@ -7,14 +7,14 @@ python3.pkgs.buildPythonApplication (finalAttrs: { pname = "autosuspend"; - version = "9.0.1"; + version = "10.0.0"; pyproject = true; src = fetchFromGitHub { owner = "languitar"; repo = "autosuspend"; tag = "v${finalAttrs.version}"; - hash = "sha256-PVxsdCPGu+bhjfAF5Hu4Xa3lETARitbBUKuy7ursAUE="; + hash = "sha256-o9Jpb4i2/SJ3s3h5sclNjpaN/UFk1YbpPf7b3rGXLRg="; }; build-system = with python3.pkgs; [ @@ -27,8 +27,8 @@ python3.pkgs.buildPythonApplication (finalAttrs: { jsonpath-ng lxml mpd2 - portalocker psutil + pygobject3 python-dateutil requests requests-file From 3b636d180f30008b969a18cea38461aff1fc6b27 Mon Sep 17 00:00:00 2001 From: Anthony Roussel Date: Sun, 15 Feb 2026 23:35:03 +0100 Subject: [PATCH 2/5] autosuspend: generate doc and man --- pkgs/by-name/au/autosuspend/package.nix | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/pkgs/by-name/au/autosuspend/package.nix b/pkgs/by-name/au/autosuspend/package.nix index f6dd6ed15447..f03d0d0e9de0 100644 --- a/pkgs/by-name/au/autosuspend/package.nix +++ b/pkgs/by-name/au/autosuspend/package.nix @@ -3,6 +3,9 @@ dbus, fetchFromGitHub, python3, + sphinxHook, + withDocs ? true, + withMan ? true, }: python3.pkgs.buildPythonApplication (finalAttrs: { @@ -10,6 +13,12 @@ python3.pkgs.buildPythonApplication (finalAttrs: { version = "10.0.0"; pyproject = true; + outputs = [ + "out" + ] + ++ lib.optionals withDocs [ "doc" ] + ++ lib.optionals withMan [ "man" ]; + src = fetchFromGitHub { owner = "languitar"; repo = "autosuspend"; @@ -17,6 +26,21 @@ python3.pkgs.buildPythonApplication (finalAttrs: { hash = "sha256-o9Jpb4i2/SJ3s3h5sclNjpaN/UFk1YbpPf7b3rGXLRg="; }; + postPatch = '' + # This mapping triggers network access on docs generation + substituteInPlace doc/source/conf.py \ + --replace-fail 'intersphinx_mapping' '# intersphinx_mapping' + ''; + + nativeBuildInputs = lib.optionals (withDocs || withMan) ( + [ + sphinxHook + ] + ++ finalAttrs.passthru.optional-dependencies.docs + ); + + sphinxBuilders = lib.optionals withDocs [ "html" ] ++ lib.optionals withMan [ "man" ]; + build-system = with python3.pkgs; [ setuptools ]; @@ -36,6 +60,16 @@ python3.pkgs.buildPythonApplication (finalAttrs: { tzlocal ]; + optional-dependencies = { + docs = with python3.pkgs; [ + furo + recommonmark + sphinx-autodoc-typehints + sphinx-issues + sphinxcontrib-plantuml + ]; + }; + nativeCheckInputs = with python3.pkgs; [ dbus freezegun From 33befa88a13a7529f5cf75addd2b255bd7482103 Mon Sep 17 00:00:00 2001 From: Anthony Roussel Date: Sun, 15 Feb 2026 21:32:46 +0100 Subject: [PATCH 3/5] nixosTests.autosuspend: init --- nixos/tests/all-tests.nix | 1 + nixos/tests/autosuspend.nix | 30 +++++++++++++++++++++++++ pkgs/by-name/au/autosuspend/package.nix | 5 +++++ 3 files changed, 36 insertions(+) create mode 100644 nixos/tests/autosuspend.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 0ad508dd87ec..3432558f8afd 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -257,6 +257,7 @@ in authelia = runTest ./authelia.nix; auto-cpufreq = runTest ./auto-cpufreq.nix; autobrr = runTest ./autobrr.nix; + autosuspend = runTest ./autosuspend.nix; avahi = runTest { imports = [ ./avahi.nix ]; _module.args.networkd = false; diff --git a/nixos/tests/autosuspend.nix b/nixos/tests/autosuspend.nix new file mode 100644 index 000000000000..ef78e3215dc8 --- /dev/null +++ b/nixos/tests/autosuspend.nix @@ -0,0 +1,30 @@ +{ lib, pkgs, ... }: + +{ + name = "autosuspend"; + meta.maintainers = [ lib.maintainers.anthonyroussel ]; + + nodes = { + machine = { + services.autosuspend = { + enable = true; + + settings = { + interval = 5; + idle_time = 5; + suspend_cmd = "${pkgs.coreutils}/bin/touch /tmp/suspended"; + }; + + # Return exit code 1 to trigger suspend + checks.ExternalCommand.command = "exit 1"; + }; + }; + }; + + testScript = '' + start_all() + + machine.wait_for_unit("autosuspend.service") + machine.wait_for_file("/tmp/suspended") + ''; +} diff --git a/pkgs/by-name/au/autosuspend/package.nix b/pkgs/by-name/au/autosuspend/package.nix index f03d0d0e9de0..bc8dfbc8a694 100644 --- a/pkgs/by-name/au/autosuspend/package.nix +++ b/pkgs/by-name/au/autosuspend/package.nix @@ -2,6 +2,7 @@ lib, dbus, fetchFromGitHub, + nixosTests, python3, sphinxHook, withDocs ? true, @@ -87,6 +88,10 @@ python3.pkgs.buildPythonApplication (finalAttrs: { "test_multiple_sessions" ]; + passthru.tests = { + inherit (nixosTests) autosuspend; + }; + meta = { description = "Daemon to automatically suspend and wake up a system"; homepage = "https://autosuspend.readthedocs.io"; From 7521b2779bc0891cc7ebf95ce2ee80499777c538 Mon Sep 17 00:00:00 2001 From: Anthony Roussel Date: Sun, 15 Feb 2026 22:35:15 +0100 Subject: [PATCH 4/5] nixos/autosuspend: add iputils Ping check dependency Add missing `iputils` dependency for the Ping check. --- nixos/modules/services/misc/autosuspend.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos/modules/services/misc/autosuspend.nix b/nixos/modules/services/misc/autosuspend.nix index 3ca2794892b8..c5e61ad57bbf 100644 --- a/nixos/modules/services/misc/autosuspend.nix +++ b/nixos/modules/services/misc/autosuspend.nix @@ -37,6 +37,7 @@ let # Dependencies needed by specific checks dependenciesForChecks = { + "Ping" = [ pkgs.iputils ]; "Smb" = pkgs.samba; "XIdleTime" = [ pkgs.xprintidle From bb08d48579f6a6815836c90e28d6c00301213883 Mon Sep 17 00:00:00 2001 From: Anthony Roussel Date: Sun, 15 Feb 2026 22:35:29 +0100 Subject: [PATCH 5/5] nixos/autosuspend: assert at least one check is configured Otherwise autosuspend will fail at startup. --- nixos/modules/services/misc/autosuspend.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nixos/modules/services/misc/autosuspend.nix b/nixos/modules/services/misc/autosuspend.nix index c5e61ad57bbf..9bbc9b2e7af8 100644 --- a/nixos/modules/services/misc/autosuspend.nix +++ b/nixos/modules/services/misc/autosuspend.nix @@ -226,6 +226,13 @@ in }; config = mkIf cfg.enable { + assertions = [ + { + assertion = cfg.checks != { }; + message = "`services.autosuspend.checks` must contain at least one activity check."; + } + ]; + systemd.services.autosuspend = { description = "A daemon to suspend your server in case of inactivity"; documentation = [ "https://autosuspend.readthedocs.io/en/latest/systemd_integration.html" ];