-
-
Save antifuchs/160e25259067bfcb89b47eb67110130c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ config, pkgs, lib, ... }: | |
with lib; | |
let | |
cfg = config.local.startup-items; | |
stdenv = pkgs.stdenv; | |
in | |
{ | |
options = { | |
local.startup-items = mkOption { | |
description = "List of app bundle names to start at login"; | |
type = types.attrsOf types.str; | |
}; | |
}; | |
config = { | |
environment.userLaunchAgents = mkIf (stdenv.isDarwin) | |
( | |
(mapAttrs' | |
(name: bundleName: | |
let | |
label = "net.boinkor.nix-startup-item.${name}"; | |
in | |
nameValuePair ("${label}.plist") | |
{ | |
text = '' | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>${label}</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>open</string> | |
<string>-gjWa</string> | |
<string>${bundleName}</string> | |
</array> | |
<key>RunAtLoad</key> | |
<true/> | |
</dict> | |
</plist> | |
''; | |
} | |
) | |
cfg) | |
); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment