tests/flameshot: add darwin tests

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
Austin Horstman 2026-02-11 23:19:57 -06:00
parent 2363f5a377
commit ede6d1d95e
4 changed files with 77 additions and 1 deletions

View file

@ -50,6 +50,7 @@ let
"eza"
"fastfetch"
"feh"
"flameshot"
"fzf"
"gallery-dl"
"getconf"

View file

@ -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;
}

View file

@ -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" ''
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<dict>
<key>Crashed</key>
<true/>
<key>SuccessfulExit</key>
<false/>
</dict>
<key>Label</key>
<string>org.nix-community.home.flameshot</string>
<key>ProcessType</key>
<string>Interactive</string>
<key>ProgramArguments</key>
<array>
<string>/bin/sh</string>
<string>-c</string>
<string>/bin/wait4path /nix/store &amp;&amp; exec @flameshot@/bin/flameshot</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>''}
'';
}

View file

@ -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
''}
'';
}