autosuspend: 9.0.1 -> 10.0.0 (#490855)
This commit is contained in:
@@ -37,6 +37,7 @@ let
|
||||
|
||||
# Dependencies needed by specific checks
|
||||
dependenciesForChecks = {
|
||||
"Ping" = [ pkgs.iputils ];
|
||||
"Smb" = pkgs.samba;
|
||||
"XIdleTime" = [
|
||||
pkgs.xprintidle
|
||||
@@ -225,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" ];
|
||||
@@ -235,16 +243,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 = {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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")
|
||||
'';
|
||||
}
|
||||
@@ -2,21 +2,46 @@
|
||||
lib,
|
||||
dbus,
|
||||
fetchFromGitHub,
|
||||
nixosTests,
|
||||
python3,
|
||||
sphinxHook,
|
||||
withDocs ? true,
|
||||
withMan ? true,
|
||||
}:
|
||||
|
||||
python3.pkgs.buildPythonApplication (finalAttrs: {
|
||||
pname = "autosuspend";
|
||||
version = "9.0.1";
|
||||
version = "10.0.0";
|
||||
pyproject = true;
|
||||
|
||||
outputs = [
|
||||
"out"
|
||||
]
|
||||
++ lib.optionals withDocs [ "doc" ]
|
||||
++ lib.optionals withMan [ "man" ];
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "languitar";
|
||||
repo = "autosuspend";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-PVxsdCPGu+bhjfAF5Hu4Xa3lETARitbBUKuy7ursAUE=";
|
||||
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
|
||||
];
|
||||
@@ -27,8 +52,8 @@ python3.pkgs.buildPythonApplication (finalAttrs: {
|
||||
jsonpath-ng
|
||||
lxml
|
||||
mpd2
|
||||
portalocker
|
||||
psutil
|
||||
pygobject3
|
||||
python-dateutil
|
||||
requests
|
||||
requests-file
|
||||
@@ -36,6 +61,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
|
||||
@@ -53,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";
|
||||
|
||||
Reference in New Issue
Block a user