-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservices.nix
120 lines (114 loc) · 3.16 KB
/
services.nix
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
{
config,
pkgs,
lib,
...
}:
let
# Create a derivation for the script
createRcloneMountService =
{
name,
remote ? "${name}",
mountPath ? "/home/${config.home.username}/${name}",
remotePath ? "/",
}:
{
Unit = {
Description = "Rclone mount service for ${name}";
};
Service = {
ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p ${mountPath}";
ExecStart = ''
${pkgs.rclone}/bin/rclone mount \
--config /home/${config.home.username}/.config/rclone/rclone.conf \
--allow-other \
--attr-timeout 1h \
--buffer-size=0 \
--dir-cache-time 3h0m0s \
--poll-interval 30s \
--use-server-modtime \
--vfs-cache-mode full \
--vfs-fast-fingerprint \
${remote}:${remotePath} ${mountPath}
'';
ExecStop = "fusermount -u ${mountPath}";
Type = "notify";
Restart = "on-failure";
RestartSec = "10s";
};
Install = {
WantedBy = [ "default.target" ];
};
};
in
{
services = {
emacs.defaultEditor = true;
unclutter = {
enable = true;
timeout = 5;
};
ssh-agent.enable = true;
easyeffects.enable = true;
mpris-proxy.enable = true;
# random-background = {
# enable = true;
# display = "fill";
# imageDirectory = "%h/dropbox-private/Andet/Favorites";
# };
};
systemd.user.startServices = true;
systemd.user.services = {
# Create the rclone mount services by calling the function with the desired parameters using named arguments
rclone-mount-dropbox-private = createRcloneMountService {
name = "dropbox-private";
};
rclone-mount-onedrive-ku-crypt = createRcloneMountService {
name = "onedrive-ku-crypt";
};
rclone-mount-onedrive-ku = createRcloneMountService {
name = "onedrive-ku";
};
# rclone-mount-gdrive-private = createRcloneMountService {
# name = "gdrive-private";
# remote = "gdrive-private";
# };
};
# pywal auto change
systemd.user.services.pywal-apply-variety = {
Unit = {
Description = "Apply pywal theme based on Variety wallpaper";
After = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Service = {
ExecStart = "${pkgs.writeShellScript "pywal-apply" ''
set -e
${pkgs.pywal16}/bin/wal -ni "$(${pkgs.coreutils}/bin/cat ${config.xdg.configHome}/variety/wallpaper/wallpaper.jpg.txt)" && ${pkgs.pywal16}/bin/wal -R
''}";
Restart = "on-failure";
RestartSec = 5;
StandardOutput = "journal";
StandardError = "journal";
Environment = [
"SYSTEMD_LOG_LEVEL=debug"
"PATH=${pkgs.imagemagick}/bin:$PATH"
];
};
};
systemd.user.paths.pywal-apply-variety = {
Unit = {
Description = "Monitor wallpaper file for changes";
Wants = [ "pywal-apply-variety.service" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Path = {
PathModified = "${config.xdg.configHome}/variety/wallpaper/wallpaper.jpg.txt";
};
};
}