From 2d9173f6be4df8616d3697eba7e8287cdd5666de Mon Sep 17 00:00:00 2001 From: LordGrimmauld Date: Mon, 4 Mar 2024 23:34:26 +0100 Subject: [PATCH] cloudsync command (preliminary; need to automate) --- flake.nix | 1 + modules/cloudsync.nix | 27 +++++++++++++++++++++++++++ secrets/nextcloud_pass.age | Bin 0 -> 484 bytes secrets/secrets.nix | 1 + 4 files changed, 29 insertions(+) create mode 100644 modules/cloudsync.nix create mode 100644 secrets/nextcloud_pass.age diff --git a/flake.nix b/flake.nix index 9a1a71d..3a6727d 100644 --- a/flake.nix +++ b/flake.nix @@ -56,6 +56,7 @@ ./modules/kvm.nix ./modules/toolchains.nix ./modules/tui.nix + ./modules/cloudsync.nix # ./cachix.nix { environment.systemPackages = [ agenix.packages.${system}.default ]; } ]; diff --git a/modules/cloudsync.nix b/modules/cloudsync.nix new file mode 100644 index 0000000..172e41f --- /dev/null +++ b/modules/cloudsync.nix @@ -0,0 +1,27 @@ +{pkgs, config, ... }: let +# cloud_cmd = "${pkgs.nextcloud-client}/bin/nextcloudcmd -h -n --path"; + sync_user = "grimmauld"; + sync_user_remote = "Grimmauld"; + sync_server = "cloud.grimmauld.de"; + # cloud_cmd = "${pkgs.nextcloud-client}/bin/nextcloudcmd -u ${sync_user_remote} -p -h -n --path"; +in { + # spotify pass + age.secrets.nextcloud_pass = { + file = ../secrets/nextcloud_pass.age; + owner = sync_user; + mode = "700"; + }; + + environment.systemPackages = let + cloud_cmd = ''${pkgs.nextcloud-client}/bin/nextcloudcmd -u ${sync_user_remote} -p "$(cat ${config.age.secrets.nextcloud_pass.path})" -h -n --path''; + in with pkgs; [ + nextcloud-client + (writeShellScriptBin "cloudsync" '' + # export cloudpass="$(cat ${config.age.secrets.nextcloud_pass.path})" + ${cloud_cmd} /3d /home/${sync_user}/3d https://${sync_server} + ${cloud_cmd} /Pictures /home/${sync_user}/Pictures https://${sync_server} + ${cloud_cmd} /Documents /home/${sync_user}/Documents https://${sync_server} + ${cloud_cmd} /Videos /home/${sync_user}/Videos https://${sync_server} + '') + ]; +} diff --git a/secrets/nextcloud_pass.age b/secrets/nextcloud_pass.age new file mode 100644 index 0000000000000000000000000000000000000000..6d38f401d841f09bcfc7a3061753e9c8d12adc09 GIT binary patch literal 484 zcmWm2JFk;a003a);DCdJgNs8GN5bVoX?wbu0G9%#z%8#r7XuVHJPKSWoWkhjWMX1s zV%*$~gQJ^nF3$b{f~r?e_BswN?O3L_p*+7=Q`>rdJo`e%gc z%b4;jrPWB6)q$i%EM@C;nFXf>uBcmAIa~rXPQ97A*{v^=uxb%0<5a*5{BD~y3I;cc zlzKd0#xPDy(;iSgA3~!Sj!Uzk)@Ck{qQhhYF1V1DcyLB;?OUoj?%-HLZ-LSOUrxg? zlUe}IKsuClm-5;PPj_=zz%EKlwLj9G3Bi`zpQf6~){ej#*^Pe^JA|QW-X8cHCj?`^ zkGEv!1cxH8?0pG01Gh33?u-jnOQYS@(bfwbRr8tG%!DQ$k;%|9X85ob^c6Y-id@yTYzo&`@w6Cmc^CA4 zfv;JNAc%>4tz7Mm^>U*#D+R|})$dVN$?0yTvGX|hj<#Z3)S}A|Ee7iE+MU}Uzc{bN rr~cdU)4g90H2URN`t$uC-+n%Oare!;_qTpO|9kP!d-D3vhewlt+-9dc literal 0 HcmV?d00001 diff --git a/secrets/secrets.nix b/secrets/secrets.nix index b276208..5faa711 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -2,4 +2,5 @@ let laptop_pub = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCy7X5ByG4/9y2XkQSnXcpMGnV5WPGUd+B6FaYCDNmPQ7xIZEteS+kCpu9oiMP6C/H/FT+i9DZvCflkzgdFAyujYLKRYaZbZ3K6F60qN0rkJ0z/ZO5c6rqwIwR6BEoB7dq5inkyH9fZ8/SI+PXxELmeWF9ehT7kkQC+o9Ujpcjd7ZuZllbAz4UQZFRbbpwdVJCEDenu9/63yuYbvMupgGk0edaTiFT0Q9MSzs/3pNP8xlAxmmZ3HzSjeF7gUzBF7CaIroTeguiUjSVybUEx48P8fy878t7dUZf4anEno9MS0B3aqfZvCKuuPdAUdeBfCbFHRqN7GuCylFIXGPe95Mxl grimmauld@grimmauld-nixos"; in { "spotify_pass.age".publicKeys = [ laptop_pub ]; + "nextcloud_pass.age".publicKeys = [ laptop_pub ]; }