1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 18:21:07 +01:00
Files
niveum/configs/cloud.nix

115 lines
3.1 KiB
Nix
Raw Normal View History

2022-03-10 21:52:12 +01:00
{
config,
lib,
pkgs,
...
2022-04-10 19:38:41 +02:00
}: let
inherit (import <niveum/lib>) tmpfilesConfig;
in {
2019-04-19 03:11:51 +02:00
imports = [
2019-10-26 13:43:30 +02:00
<niveum/modules/dropbox.nix>
2019-04-19 03:11:51 +02:00
];
niveum = {
2021-07-25 09:48:43 +02:00
dropbox.enable = false;
2019-04-19 03:11:51 +02:00
};
2022-04-10 19:38:41 +02:00
systemd.tmpfiles.rules = map tmpfilesConfig [
{
type = "L+";
user = config.users.users.me.name;
group = "users";
mode = "0755";
argument = "${config.users.users.me.home}/cloud/Seafile/Uni";
path = "${config.users.users.me.home}/uni";
}
{
type = "L+";
user = config.users.users.me.name;
group = "users";
mode = "0755";
argument = "${config.users.users.me.home}/cloud/syncthing/common/mahlzeit";
path = "${config.users.users.me.home}/mahlzeit";
}
];
2020-10-24 13:26:39 +02:00
home-manager.users.me = {
2022-09-27 19:19:14 +02:00
services.gnome-keyring.enable = false;
2022-01-08 10:18:33 +01:00
services.nextcloud-client = {
2022-09-27 19:19:14 +02:00
enable = false;
2022-01-08 10:18:33 +01:00
startInBackground = true;
};
systemd.user.services.nextcloud-client = {
Unit = {
Wants = ["gnome-keyring.service"];
After = ["gnome-keyring.service"];
};
};
};
systemd.user.services.nextcloud-syncer = {
enable = true;
wants = ["network-online.target"];
wantedBy = ["default.target"];
startAt = "*:00/10";
script = let
kieran = {
user = "kieran";
password = lib.fileContents <secrets/nextcloud/password>;
endpoint = "https://cloud.xn--kiern-0qa.de";
};
in ''
KIERAN_TARGET=${config.users.users.me.home}/notes
mkdir -p "$KIERAN_TARGET"
${pkgs.nextcloud-client}/bin/nextcloudcmd --user ${kieran.user} --password ${lib.escapeShellArg kieran.password} --path /Notes "$KIERAN_TARGET" ${kieran.endpoint}
'';
serviceConfig = {
Type = "oneshot";
Restart = "on-failure";
};
};
environment.systemPackages = [
(pkgs.writers.writeDashBin "book" ''
set -efu
book="$({
${pkgs.findutils}/bin/find ${config.users.users.me.home}/cloud/syncthing/library -type f
${pkgs.findutils}/bin/find ${config.users.users.me.home}/cloud/Seafile/Books -type f
} | ${pkgs.fzf}/bin/fzf)"
${pkgs.zathura}/bin/zathura "$book"
'')
];
2021-09-18 15:53:21 +02:00
fileSystems."/media/moodle" = {
device = "zaatar.r:/moodle";
fsType = "nfs";
options = [
"x-systemd.idle-timeout=600"
"noauto"
"x-systemd.automount"
];
};
2019-04-19 03:11:51 +02:00
services.syncthing = rec {
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";
2021-12-01 17:38:47 +01:00
cert = toString <system-secrets/syncthing/cert.pem>;
key = toString <system-secrets/syncthing/key.pem>;
inherit ((import <niveum/lib>).syncthing) devices;
2022-03-10 21:52:12 +01:00
folders = let
cloud-dir = "${config.users.users.me.home}/cloud";
in {
"${cloud-dir}/syncthing/common".devices = ["kabsa" "manakish"];
"${cloud-dir}/syncthing/library".devices = ["kabsa" "manakish" "heym"];
"${cloud-dir}/syncthing/mundoiu".devices = ["kabsa" "manakish" "heym"];
"${cloud-dir}/syncthing/music" = {
devices = ["kabsa" "manakish" "heym" "zaatar"];
id = "music";
2021-12-01 17:38:47 +01:00
};
2022-03-10 21:52:12 +01:00
};
2019-04-19 03:11:51 +02:00
};
}