2022-03-10 21:52:12 +01:00
|
|
|
{
|
|
|
|
|
config,
|
|
|
|
|
lib,
|
|
|
|
|
pkgs,
|
|
|
|
|
...
|
2025-12-27 22:22:54 +01:00
|
|
|
}:
|
|
|
|
|
{
|
2025-04-15 14:22:28 +02:00
|
|
|
systemd.user.services.systemd-tmpfiles-clean = {
|
|
|
|
|
enable = true;
|
|
|
|
|
wantedBy = [ "default.target" ];
|
|
|
|
|
startAt = "daily";
|
|
|
|
|
script = "systemd-tmpfiles --user --clean";
|
|
|
|
|
serviceConfig = {
|
|
|
|
|
Type = "oneshot";
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2025-12-27 22:22:54 +01:00
|
|
|
systemd.user.tmpfiles.users.me.rules =
|
|
|
|
|
map pkgs.lib.niveum.tmpfilesConfig [
|
|
|
|
|
{
|
|
|
|
|
type = "d";
|
|
|
|
|
mode = "0755";
|
|
|
|
|
age = "7d";
|
|
|
|
|
path = "${config.users.users.me.home}/sync/Downloads";
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
type = "d";
|
|
|
|
|
mode = "0755";
|
|
|
|
|
age = "7d";
|
|
|
|
|
path = "${config.users.users.me.home}/cloud/nextcloud/tmp";
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
++
|
|
|
|
|
map
|
|
|
|
|
(
|
|
|
|
|
path:
|
|
|
|
|
pkgs.lib.niveum.tmpfilesConfig {
|
|
|
|
|
type = "L+";
|
|
|
|
|
user = config.users.users.me.name;
|
|
|
|
|
group = config.users.users.me.group;
|
|
|
|
|
mode = "0755";
|
|
|
|
|
argument = "${config.users.users.me.home}/sync/${path}";
|
|
|
|
|
path = "${config.users.users.me.home}/${path}";
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
[
|
|
|
|
|
".ssh"
|
|
|
|
|
".gnupg"
|
|
|
|
|
".pki"
|
|
|
|
|
".local/share/aerc"
|
|
|
|
|
];
|
2020-04-22 17:42:45 +02:00
|
|
|
|
2024-01-09 07:59:41 +01:00
|
|
|
services.gnome.gnome-keyring.enable = true;
|
2024-03-20 08:12:50 +01:00
|
|
|
security.pam.services.lightdm.enableGnomeKeyring = true;
|
2024-01-09 07:59:41 +01:00
|
|
|
|
2020-10-24 13:26:39 +02:00
|
|
|
home-manager.users.me = {
|
2022-01-08 10:18:33 +01:00
|
|
|
services.nextcloud-client = {
|
2023-07-17 08:31:34 +02:00
|
|
|
enable = true;
|
2022-01-08 10:18:33 +01:00
|
|
|
startInBackground = true;
|
|
|
|
|
};
|
2022-04-17 10:48:32 +02:00
|
|
|
};
|
|
|
|
|
|
2022-09-27 19:18:42 +02:00
|
|
|
systemd.user.services.nextcloud-syncer = {
|
2023-07-04 09:40:00 +02:00
|
|
|
enable = false;
|
2025-12-27 22:22:54 +01:00
|
|
|
wants = [ "network-online.target" ];
|
|
|
|
|
wantedBy = [ "default.target" ];
|
2022-09-27 19:18:42 +02:00
|
|
|
startAt = "*:00/10";
|
2025-12-27 22:22:54 +01:00
|
|
|
script =
|
|
|
|
|
let
|
|
|
|
|
kieran = {
|
|
|
|
|
user = "kieran";
|
|
|
|
|
passwordFile = config.age.secrets.nextcloud-password-kieran.path;
|
|
|
|
|
endpoint = "https://cloud.kmein.de";
|
|
|
|
|
target = "${config.users.users.me.home}/notes";
|
|
|
|
|
};
|
|
|
|
|
in
|
|
|
|
|
''
|
|
|
|
|
mkdir -p ${lib.escapeShellArg kieran.target}
|
|
|
|
|
${pkgs.nextcloud-client}/bin/nextcloudcmd --non-interactive --user ${kieran.user} --password "$(cat ${kieran.passwordFile})" --path /Notes ${lib.escapeShellArg kieran.target} ${kieran.endpoint}
|
|
|
|
|
'';
|
2022-09-27 19:18:42 +02:00
|
|
|
serviceConfig = {
|
|
|
|
|
Type = "oneshot";
|
|
|
|
|
Restart = "on-failure";
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-11-19 13:40:32 +01:00
|
|
|
environment.systemPackages = [
|
2021-11-20 09:39:27 +01:00
|
|
|
(pkgs.writers.writeDashBin "book" ''
|
2021-11-19 13:40:32 +01:00
|
|
|
set -efu
|
|
|
|
|
book="$({
|
|
|
|
|
${pkgs.findutils}/bin/find ${config.users.users.me.home}/cloud/syncthing/library -type f
|
2023-07-17 08:31:34 +02:00
|
|
|
${pkgs.findutils}/bin/find ${config.users.users.me.home}/cloud/nextcloud/Books -type f
|
2021-11-19 13:40:32 +01:00
|
|
|
} | ${pkgs.fzf}/bin/fzf)"
|
2022-09-27 22:07:03 +02:00
|
|
|
exec ${pkgs.zathura}/bin/zathura "$book"
|
2021-11-19 13:40:32 +01:00
|
|
|
'')
|
2025-12-27 22:22:54 +01:00
|
|
|
(
|
|
|
|
|
let
|
|
|
|
|
kieran = {
|
|
|
|
|
user = "kieran.meinhardt@gmail.com";
|
|
|
|
|
passwordFile = config.age.secrets.mega-password.path;
|
|
|
|
|
};
|
|
|
|
|
megatools =
|
|
|
|
|
command:
|
|
|
|
|
''${pkgs.megatools}/bin/megatools ${command} --username ${lib.escapeShellArg kieran.user} --password "$(cat ${kieran.passwordFile})"'';
|
|
|
|
|
in
|
2022-09-27 22:07:03 +02:00
|
|
|
pkgs.writers.writeDashBin "book-mega" ''
|
|
|
|
|
set -efu
|
|
|
|
|
selection="$(${megatools "ls"} | ${pkgs.fzf}/bin/fzf)"
|
|
|
|
|
test -n "$selection" || exit 1
|
|
|
|
|
|
2025-12-27 07:29:47 +01:00
|
|
|
tmpdir="$(mktemp -p "$XDG_RUNTIME_DIR" -d)"
|
2022-09-27 22:07:03 +02:00
|
|
|
trap clean EXIT
|
|
|
|
|
clean() {
|
|
|
|
|
rm -rf "$tmpdir"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
(
|
|
|
|
|
cd "$tmpdir"
|
|
|
|
|
${megatools "get"} "$selection"
|
|
|
|
|
exec ${pkgs.zathura}/bin/zathura "$(basename "$selection")"
|
|
|
|
|
)
|
2025-12-27 22:22:54 +01:00
|
|
|
''
|
|
|
|
|
)
|
2021-11-19 13:40:32 +01:00
|
|
|
];
|
|
|
|
|
|
2023-02-24 23:10:45 +01:00
|
|
|
age.secrets.mega-password = {
|
2023-07-04 16:28:26 +02:00
|
|
|
file = ../secrets/mega-password.age;
|
2023-02-24 23:10:45 +01:00
|
|
|
owner = config.users.users.me.name;
|
|
|
|
|
group = config.users.users.me.group;
|
|
|
|
|
mode = "400";
|
|
|
|
|
};
|
2023-02-22 10:02:55 +01:00
|
|
|
|
2023-12-06 14:41:49 +01:00
|
|
|
services.syncthing = {
|
2019-04-19 03:11:51 +02:00
|
|
|
enable = true;
|
2019-05-29 17:23:38 +02:00
|
|
|
user = "kfm";
|
2019-04-19 03:11:51 +02:00
|
|
|
openDefaultPorts = true;
|
2019-05-29 17:23:38 +02:00
|
|
|
configDir = "/home/kfm/.config/syncthing";
|
|
|
|
|
dataDir = "/home/kfm/.config/syncthing";
|
2023-02-22 10:02:55 +01:00
|
|
|
cert = config.age.secrets.syncthing-cert.path;
|
|
|
|
|
key = config.age.secrets.syncthing-key.path;
|
2023-12-06 14:41:49 +01:00
|
|
|
settings = {
|
2025-12-25 14:00:03 +01:00
|
|
|
devices = pkgs.lib.niveum.syncthingIds;
|
2024-04-03 15:15:35 +02:00
|
|
|
folders = {
|
|
|
|
|
"${config.users.users.me.home}/sync" = {
|
2025-12-27 22:22:54 +01:00
|
|
|
devices = [
|
|
|
|
|
"kabsa"
|
|
|
|
|
"manakish"
|
|
|
|
|
"fatteh"
|
|
|
|
|
];
|
2024-04-03 15:15:35 +02:00
|
|
|
label = "sync";
|
2024-04-04 14:06:01 +02:00
|
|
|
versioning.type = "trashcan";
|
|
|
|
|
versioning.params.cleanoutDays = 100;
|
2024-04-03 15:15:35 +02:00
|
|
|
};
|
|
|
|
|
"${config.users.users.me.home}/mobile" = {
|
2025-12-27 22:22:54 +01:00
|
|
|
devices = [
|
|
|
|
|
"kabsa"
|
|
|
|
|
"manakish"
|
|
|
|
|
"fatteh"
|
|
|
|
|
"kibbeh"
|
|
|
|
|
];
|
2024-04-03 15:15:35 +02:00
|
|
|
id = "mobile";
|
|
|
|
|
label = "mobile";
|
2024-04-04 14:06:01 +02:00
|
|
|
versioning.type = "trashcan";
|
|
|
|
|
versioning.params.cleanoutDays = 100;
|
2023-12-06 14:41:49 +01:00
|
|
|
};
|
2021-12-01 17:38:47 +01:00
|
|
|
};
|
2022-03-10 21:52:12 +01:00
|
|
|
};
|
2019-04-19 03:11:51 +02:00
|
|
|
};
|
|
|
|
|
}
|