tests/flameshot: add darwin tests
Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
parent
2363f5a377
commit
ede6d1d95e
4 changed files with 77 additions and 1 deletions
|
|
@ -50,6 +50,7 @@ let
|
|||
"eza"
|
||||
"fastfetch"
|
||||
"feh"
|
||||
"flameshot"
|
||||
"fzf"
|
||||
"gallery-dl"
|
||||
"getconf"
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
36
tests/modules/services/flameshot/launchd-agent.nix
Normal file
36
tests/modules/services/flameshot/launchd-agent.nix
Normal 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 && exec @flameshot@/bin/flameshot</string>
|
||||
</array>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>''}
|
||||
'';
|
||||
}
|
||||
33
tests/modules/services/flameshot/service.nix
Normal file
33
tests/modules/services/flameshot/service.nix
Normal 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
|
||||
''}
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue