-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflake.nix
More file actions
74 lines (66 loc) · 1.91 KB
/
flake.nix
File metadata and controls
74 lines (66 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# SPDX-FileCopyrightText: 2025 Ryan Cao <hello@ryanccn.dev>
#
# SPDX-License-Identifier: GPL-3.0-or-later
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
ferrix.url = "github:ryanccn/ferrix";
};
outputs =
{ nixpkgs, ferrix, ... }@inputs:
ferrix.lib.mkFlake inputs {
root = ./.;
systems = nixpkgs.lib.platforms.darwin;
flake.homeModules = {
am-discord =
{
lib,
config,
pkgs,
...
}:
let
cfg = config.services.am-discord;
inherit (lib)
mkEnableOption
mkIf
mkOption
mkPackageOption
types
;
in
{
options.services.am-discord = {
enable = mkEnableOption "am-discord";
package = mkPackageOption pkgs "am" { };
logFile = mkOption {
type = types.nullOr types.path;
default = null;
description = ''
Path to where am's Discord presence will store its log file
'';
example = ''''${config.xdg.cacheHome}/am-discord.log'';
};
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "launchd.agents.am-discord" pkgs lib.platforms.darwin)
];
launchd.agents.am-discord = {
enable = true;
config = {
ProgramArguments = [
"${lib.getExe cfg.package}"
"discord"
];
KeepAlive = true;
RunAtLoad = true;
StandardOutPath = cfg.logFile;
StandardErrorPath = cfg.logFile;
};
};
};
};
};
};
}