diff --git a/flake.nix b/flake.nix index 64c82e6..3242cfa 100644 --- a/flake.nix +++ b/flake.nix @@ -134,6 +134,7 @@ # S3 cache write ./modules/nixos/s3_cache_write.nix + { age.secrets.s3_odin = { file = ./secrets/s3_odin.age; owner = "bertof"; }; } ./modules/nixos/pro_audio.nix ./modules/nixos/kdeconnect.nix diff --git a/instances/odin/hm.nix b/instances/odin/hm.nix index fe7fb9c..ec0fc4f 100644 --- a/instances/odin/hm.nix +++ b/instances/odin/hm.nix @@ -130,6 +130,7 @@ ../../modules/hm/pass.nix ../../modules/hm/pro_audio.nix # ../../modules/hm/pycharm.nix + ../../modules/hm/rclone-mount.nix ../../modules/hm/research.nix # ../../modules/hm/rofi.nix # ../../modules/hm/screen_locker.nix diff --git a/modules/hm/rclone-mount.nix b/modules/hm/rclone-mount.nix new file mode 100644 index 0000000..2dc3e5b --- /dev/null +++ b/modules/hm/rclone-mount.nix @@ -0,0 +1,26 @@ +{ pkgs, lib, config, nixosConfig, ... }: +let + + rclone_config = nixosConfig.age.secrets."s3_${nixosConfig.networking.hostName}".path; + mounts = { "minio" = "/home/${config.home.username}/minio/"; }; +in +{ + systemd.user.services = lib.attrsets.mapAttrs' + (name: path: { + name = "rclone-${name}"; + value = { + Unit = { + Description = "rclone mount for ${name}"; + After = [ "default.target" ]; + PartOf = [ "default.target" ]; + }; + Install.WantedBy = [ "default.target" ]; + Service = { + Type = "simple"; + ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p ${path}"; + ExecStart = "${pkgs.rclone}/bin/rclone --config ${rclone_config} mount ${name}:/ ${path} -v --vfs-cache-mode=writes"; + }; + }; + }) + mounts; +} diff --git a/secrets/s3_odin.age b/secrets/s3_odin.age new file mode 100644 index 0000000..39186ce --- /dev/null +++ b/secrets/s3_odin.age @@ -0,0 +1,13 @@ +age-encryption.org/v1 +-> ssh-ed25519 hGQASA tex8+yPPgPvHoVnxPl3fksRVnEkWYemqX16ai1QsMmE +D4T30hAdM/DJhHR0y5tdy1QwpU+2rukhgxwbg6MNWrA +-> ssh-ed25519 4behFA OjLxTHSfVJByBmd6eDCBrDrN0HS9ozRZpvqfUFEmq1M +TTWDCGupocqm5gZVcLLYuFqPCAJUOnLnpXp3u9rIN2Y +-> ssh-ed25519 IvyYug yl7u/tlaBMat6nndTkHPTh6tIjSCp3Q1LQsnxA/M4AE +CteyUsu54DFvcyu9uxh417jQO3CefC9l3qouPMb5QhI +--- kK+rlwK80Eonmw5NkEIJStL3MDmxibN8Ia+DMtnGDLY +,( ⻢.Y'?ލh/D +~D/3MWZcNa_ +ɍ*c&/!)EzD e,&3 +Q# \ No newline at end of file diff --git a/secrets/secrets.nix b/secrets/secrets.nix index f0ea94f..0e0a8c1 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -49,4 +49,5 @@ in "wg_psk.age".publicKeys = devUsers ++ systems; "s3_cache_write.age".publicKeys = devUsers ++ [ thor odin ]; "s3_cache_read.age".publicKeys = devUsers ++ systems; + "s3_odin.age".publicKeys = devUsers ++ [ odin ]; }