Modularize nextcloud and remove need for GUI application

This commit is contained in:
DashieTM 2024-08-04 03:48:07 +02:00
parent 8d35835f89
commit ee2b51bbc1
6 changed files with 74 additions and 47 deletions

View file

@ -89,5 +89,24 @@ in
greetd = { greetd = {
resolution = "3440x1440@180"; resolution = "3440x1440@180";
}; };
nextcloud = {
synclist = [
{
name = "document_sync";
remote = "Documents";
local = "/home/${config.conf.username}/Documents";
}
{
name = "picture_sync";
remote = "Pictures";
local = "/home/${config.conf.username}/Pictures";
}
{
name = "phone_sync";
remote = "Phone/Stuff";
local = "/home/${config.conf.username}/Videos/Phone/Stuff";
}
];
};
}; };
} }

View file

@ -305,7 +305,8 @@
"ironbar" "ironbar"
"firefox" "firefox"
"oxipaste_daemon" "oxipaste_daemon"
"nextcloud --background" # should be taken care of with the new systemd services
# "nextcloud --background"
"oxinoti" "oxinoti"
] ++ config.mods.hyprland.extra_autostart; ] ++ config.mods.hyprland.extra_autostart;

View file

@ -36,46 +36,4 @@
}; };
}; };
# config =
# let
# username = config.mods.nextcloud.username;
# password = config.sops.secrets.nextcloud;
# url = config.mods.nextcloud.url;
# synclist = config.mods.nextcloud.synclist;
# name = "test";
# local = "test";
# remote = "test";
# in
# lib.mkIf config.mods.nextcloud.enable
# (lib.optionalAttrs (options?systemd.user.startServices) #{
# builtins.listToAttrs
# (map
# ({ name, remote, local }: {
# systemd.user = {
# services."${name}" = {
# Unit = {
# Description = "Auto sync Nextcloud";
# After = "network-online.target";
# };
# Service = {
# Type = "simple";
# ExecStart = "${pkgs.nextcloud-client}/bin/nextcloudcmd -h --path ${remote} ${local} https://${username}:${password}@${url}";
# TimeoutStopSec = "180";
# KillMode = "process";
# KillSignal = "SIGINT";
# };
# Install.WantedBy = [ "multi-user.target" ];
# };
# timers.${name} = {
# Unit.Description = "Automatic sync files with Nextcloud when booted up after 1 minute then rerun every 60 minutes";
# Timer.OnBootSec = "1min";
# Timer.OnUnitActiveSec = "60min";
# Install.WantedBy = [ "multi-user.target" "timers.target" ];
# };
# startServices = true;
# };
# # });
# }))
# synclist
# );
} }

View file

@ -37,6 +37,7 @@ in
./oxi/default.nix ./oxi/default.nix
./themes/default.nix ./themes/default.nix
./individual_configs/default.nix ./individual_configs/default.nix
./sync.nix
] ++ base_imports ] ++ base_imports
++ lib.optional (builtins.pathExists mod) mod; ++ lib.optional (builtins.pathExists mod) mod;
}; };

48
programs/sync.nix Normal file
View file

@ -0,0 +1,48 @@
{ config, pkgs, options, lib, ... }:
let
username = config.mods.nextcloud.username;
password = config.sops.secrets.nextcloud.path;
url = config.mods.nextcloud.url;
synclist = config.mods.nextcloud.synclist;
in
lib.mkIf config.mods.nextcloud.enable {
systemd.user = {
services =
(builtins.listToAttrs
(map
(opts: {
name = "${opts.name}";
value = {
Unit = {
Description = "Auto sync Nextcloud";
After = "network-online.target";
};
Service = {
Type = "simple";
ExecStart = "${pkgs.nextcloud-client}/bin/nextcloudcmd -h --path ${opts.remote} ${opts.local} https://${username}:$(bat ${password})@${url}";
TimeoutStopSec = "180";
KillMode = "process";
KillSignal = "SIGINT";
};
Install.WantedBy = [ "multi-user.target" ];
};
})
synclist
));
timers =
(builtins.listToAttrs
(map
(opts: {
name = "${opts.name}";
value = {
Unit.Description = "Automatic sync files with Nextcloud when booted up after 1 minute then rerun every 60 minutes";
Timer.OnBootSec = "1min";
Timer.OnUnitActiveSec = "60min";
Install.WantedBy = [ "multi-user.target" "timers.target" ];
};
})
synclist
));
startServices = true;
};
}

View file

@ -5,15 +5,15 @@ hub_pub: ENC[AES256_GCM,data:6vIAQWFMIR+HnERg+A4jKu/MW+e7eLQplmdJyBeuBL9tvxH1idT
lab_pub: ENC[AES256_GCM,data:rlHCiqGnoaPiQBaZQRT+bEjfNF7jNO4CGPoCOKJ1o7nv7i2jPy6Bq9OMBHXsMHI9oGfEhyKCDHdpJ65aI07KJC/fMoMoAyiNmalwNOn26jbgj84mfENS3IYbfKxQVXAUCJHE5m1cFsm7,iv:8SLdHLYq2tlfHBjdeDoByEzGuu3TURj4+KJvQfPuaWA=,tag:mmGXlRwQ0UoVIAJE6d1OUQ==,type:str] lab_pub: ENC[AES256_GCM,data:rlHCiqGnoaPiQBaZQRT+bEjfNF7jNO4CGPoCOKJ1o7nv7i2jPy6Bq9OMBHXsMHI9oGfEhyKCDHdpJ65aI07KJC/fMoMoAyiNmalwNOn26jbgj84mfENS3IYbfKxQVXAUCJHE5m1cFsm7,iv:8SLdHLYq2tlfHBjdeDoByEzGuu3TURj4+KJvQfPuaWA=,tag:mmGXlRwQ0UoVIAJE6d1OUQ==,type:str]
dashie_pub: ENC[AES256_GCM,data:k6JIJOKDJcGSW47Z8y0EYxNl/vaPRVbIn35CSA57snEzYnk5GpU+1NfPDniWoAGRkpIwicgN6kpzssRlKOmVudvwMejSLv4VkLRBjrsApVFECwoIBLUNGUSDaMcIwC/BYu4jfjGaozBj,iv:0EZ0rptLdmcuTU1BGOILaaDTrc7aZGJCCxgjUESqi0M=,tag:dlQs/ugBGxnSrNj/bRSJSw==,type:str] dashie_pub: ENC[AES256_GCM,data:k6JIJOKDJcGSW47Z8y0EYxNl/vaPRVbIn35CSA57snEzYnk5GpU+1NfPDniWoAGRkpIwicgN6kpzssRlKOmVudvwMejSLv4VkLRBjrsApVFECwoIBLUNGUSDaMcIwC/BYu4jfjGaozBj,iv:0EZ0rptLdmcuTU1BGOILaaDTrc7aZGJCCxgjUESqi0M=,tag:dlQs/ugBGxnSrNj/bRSJSw==,type:str]
server_pub: ENC[AES256_GCM,data:87nTYzA8CykOPjfZS2As8+JB/ysJvHXFYbPIBA8Nus8Y3nI3Tl2F/f7mUVFBT+4mmOFTTwxghEnkpgTg/vzUm6W4wb19rIcv11eM7HYaGl5oI44a44rBJn2+PKlfIgXVgaY=,iv:O7I7kkZ44McXzCt3wH1cM3MJCShxu2O+0U0+Y6rwePo=,tag:q5D5AGMmFyiNhQNR8dRB+g==,type:str] server_pub: ENC[AES256_GCM,data:87nTYzA8CykOPjfZS2As8+JB/ysJvHXFYbPIBA8Nus8Y3nI3Tl2F/f7mUVFBT+4mmOFTTwxghEnkpgTg/vzUm6W4wb19rIcv11eM7HYaGl5oI44a44rBJn2+PKlfIgXVgaY=,iv:O7I7kkZ44McXzCt3wH1cM3MJCShxu2O+0U0+Y6rwePo=,tag:q5D5AGMmFyiNhQNR8dRB+g==,type:str]
nextcloud: ENC[AES256_GCM,data:gJOgw6lYjEDt3Xgqm4Y2P8uqyCpP8hYXkbU=,iv:9J6ksbxnmWBqOMGcRzcV7/4pnEfeltn9JuSFownXZSk=,tag:trnz5520V01aPsef9sxJuw==,type:str] nextcloud: ENC[AES256_GCM,data:hjpS1WKsQJ6U2XX3GAbVP93VBAE8hKUdBRD9nI5Yiw==,iv:QaJNScNaxLLArzHLutIWdgN4m+9F0+Ym0FOcL53ygeQ=,tag:PamHgZJ+rsb3Dno2kEZRpQ==,type:str]
sops: sops:
kms: [] kms: []
gcp_kms: [] gcp_kms: []
azure_kv: [] azure_kv: []
hc_vault: [] hc_vault: []
age: [] age: []
lastmodified: "2024-08-03T20:23:57Z" lastmodified: "2024-08-04T00:37:58Z"
mac: ENC[AES256_GCM,data:e3fQXTDmWZpPt0ymvVxbuE4FLusChsVKVDZqx1pOfXSZMTphosUW5nghoQnER6Yvi2V5paaAVFhSM/FTSu7/5YU0nffgaMFRSxsao9ds9YZV2b/4cWwveGRB07C0OKPDSYX3+NDIPBmDMM2hVLBexvS0Z0BC5bKloCFw1OFprcg=,iv:fniuutOwbeEvVObNI48TZmiv16WWYudeFMSmWo69h+g=,tag:P1z44JgBuTnXyZVCVgZwLg==,type:str] mac: ENC[AES256_GCM,data:zpPT060VGVh16KA70at4k2Q57zmT6PpYwHgGLfXLoPTu+aq3UhwQDnV/7gOUEquzopAT/lanbYjZ70uZZkXgU/HkBHNF3MLLULPK4HrOWgcsm277WPrgLqT9yUG2H8yxZGxDmKvFA7wHQ4TWyvqOmfuGv89UPoyV9PBGZ7anO6s=,iv:JtPVYsvg+2qgUlf6IF157lmorK2FrK1A6Fo15rkEnXA=,tag:iLWhUcFqY5Mip++SUZEj3Q==,type:str]
pgp: pgp:
- created_at: "2024-05-14T14:35:02Z" - created_at: "2024-05-14T14:35:02Z"
enc: |- enc: |-