From ede6d1d95e55ac8833de35b51167697d269c9f4c Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Wed, 11 Feb 2026 23:19:57 -0600 Subject: [PATCH] tests/flameshot: add darwin tests Signed-off-by: Austin Horstman --- tests/darwinScrublist.nix | 1 + tests/modules/services/flameshot/default.nix | 8 ++++- .../services/flameshot/launchd-agent.nix | 36 +++++++++++++++++++ tests/modules/services/flameshot/service.nix | 33 +++++++++++++++++ 4 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 tests/modules/services/flameshot/launchd-agent.nix create mode 100644 tests/modules/services/flameshot/service.nix diff --git a/tests/darwinScrublist.nix b/tests/darwinScrublist.nix index 9487b456..a3a1fcf4 100644 --- a/tests/darwinScrublist.nix +++ b/tests/darwinScrublist.nix @@ -50,6 +50,7 @@ let "eza" "fastfetch" "feh" + "flameshot" "fzf" "gallery-dl" "getconf" diff --git a/tests/modules/services/flameshot/default.nix b/tests/modules/services/flameshot/default.nix index 417411c3..ac50855b 100644 --- a/tests/modules/services/flameshot/default.nix +++ b/tests/modules/services/flameshot/default.nix @@ -1,6 +1,12 @@ { lib, pkgs, ... }: -lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux { +{ flameshot-empty-settings = ./empty-settings.nix; flameshot-example-settings = ./example-settings.nix; } +// lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux { + flameshot-service = ./service.nix; +} +// lib.optionalAttrs pkgs.stdenv.hostPlatform.isDarwin { + flameshot-agent = ./launchd-agent.nix; +} diff --git a/tests/modules/services/flameshot/launchd-agent.nix b/tests/modules/services/flameshot/launchd-agent.nix new file mode 100644 index 00000000..f7b2dbe8 --- /dev/null +++ b/tests/modules/services/flameshot/launchd-agent.nix @@ -0,0 +1,36 @@ +{ + services.flameshot = { + enable = true; + }; + + nmt.script = '' + serviceFile="LaunchAgents/org.nix-community.home.flameshot.plist" + assertFileExists "$serviceFile" + assertFileContent "$serviceFile" ${builtins.toFile "expected-agent.plist" '' + + + + + KeepAlive + + Crashed + + SuccessfulExit + + + Label + org.nix-community.home.flameshot + ProcessType + Interactive + ProgramArguments + + /bin/sh + -c + /bin/wait4path /nix/store && exec @flameshot@/bin/flameshot + + RunAtLoad + + + ''} + ''; +} diff --git a/tests/modules/services/flameshot/service.nix b/tests/modules/services/flameshot/service.nix new file mode 100644 index 00000000..d976c2b1 --- /dev/null +++ b/tests/modules/services/flameshot/service.nix @@ -0,0 +1,33 @@ +{ + services.flameshot = { + enable = true; + }; + + nmt.script = '' + serviceFile="home-files/.config/systemd/user/flameshot.service" + assertFileExists "$serviceFile" + assertFileContent "$serviceFile" ${builtins.toFile "expected.service" '' + [Install] + WantedBy=graphical-session.target + + [Service] + Environment=PATH=/home/hm-user/.nix-profile/bin + ExecStart=@flameshot@/bin/flameshot + LockPersonality=true + MemoryDenyWriteExecute=true + NoNewPrivileges=true + PrivateUsers=true + Restart=on-abort + RestrictNamespaces=true + SystemCallArchitectures=native + SystemCallFilter=@system-service + + [Unit] + After=graphical-session.target + After=tray.target + Description=Flameshot screenshot tool + PartOf=graphical-session.target + Requires=tray.target + ''} + ''; +}