syncthing go brrr

This commit is contained in:
Peder Bergebakken Sundt 2024-09-27 18:07:05 +02:00
parent a3b3378118
commit 804ca52ae8
2 changed files with 19 additions and 15 deletions

View File

@ -59,8 +59,8 @@ push hostname=`just _a_host` cmd=`gum choose test switch boot --header "Select m
inspect: inspect:
nix run -- nixpkgs#nix-inspect -p . nix run -- nixpkgs#nix-inspect -p .
inspect-config host=`just _a_host`: inspect-config host=`just _a_host` prefix="":
nix run -- nixpkgs#nix-inspect -e '(builtins.getFlake "'"$PWD"'").nixosConfigurations.{{host}}.config' nix run -- nixpkgs#nix-inspect -e '(builtins.getFlake "'"$PWD"'").nixosConfigurations.{{host}}.config{{ if prefix == "" { "" } else { "." + prefix } }}'
@_a_host: @_a_host:
hostnames="$(nix eval .#nixosConfigurations --apply builtins.attrNames --json 2>/dev/null | jq '.[]' -r)"; \ hostnames="$(nix eval .#nixosConfigurations --apply builtins.attrNames --json 2>/dev/null | jq '.[]' -r)"; \

View File

@ -2,12 +2,6 @@
# todo: portable service and system-manager # todo: portable service and system-manager
let
inherit (config.services.syncthing)
dataDir
;
in
{ {
environment.systemPackages = lib.mkIf config.services.syncthing.enable [ environment.systemPackages = lib.mkIf config.services.syncthing.enable [
@ -38,15 +32,25 @@ in
# TODO: somehow don't create ~/Sync # TODO: somehow don't create ~/Sync
# nix run -- nixpkgs#syncthing generate --config="$HOME"/syncthing/.config/syncthing # nix run -- nixpkgs#syncthing generate --config="$HOME"/syncthing/.config/syncthing
devices."bjarte".id = "C7QQYJU-PMJDP2Z-CKTAV4A-V6IFEG5-YFBGCNU-PJPCZFC-QSXKZY3-NC5WRAL"; devices."bjarte".id = "C7QQYJU-PMJDP2Z-CKTAV4A-V6IFEG5-YFBGCNU-PJPCZFC-QSXKZY3-NC5WRAL";
devices."rocm".id = "UFW6V4E-LMEDTYR-23BU6BP-2HEMWYB-2ARCJ4X-T67WHZX-BNCCHZ4-5GPSZQV"; devices."pjudduzen".id = "JCNX5AC-YMXJZBP-5LQRLAL-BGTSXKK-X6AJPXL-IXDWJGW-IHSBTPT-AFXKFAK";
devices."sopp".id = "ZQJEWAX-GALDJDO-FBOE5ON-M5XKXNT-PRZD3CY-S7L3XDR-PR27NYL-RZ6O7QW"; devices."rocm".id = "UFW6V4E-LMEDTYR-23BU6BP-2HEMWYB-2ARCJ4X-T67WHZX-BNCCHZ4-5GPSZQV";
devices."sopp".id = "ZQJEWAX-GALDJDO-FBOE5ON-M5XKXNT-PRZD3CY-S7L3XDR-PR27NYL-RZ6O7QW";
/* devices."sopp".autoAcceptFolders = true; # TODO */ /* devices."sopp".autoAcceptFolders = true; # TODO */
folders."ntnu" = { folders = lib.flip lib.pipe [
path = "${dataDir}/ntnu"; (lib.mapAttrs (name: attrs: { path = lib.mkDefault "${config.services.syncthing.dataDir}/${name}"; } // attrs ))
devices = [ "bjarte" "sopp" "rocm" ]; (lib.mapAttrsToList (name: attrs: lib.mkIf (builtins.elem config.networking.hostName (attrs.devices or [])) { ${name} = attrs; } ))
/* ignorePerms = false; # `false` means sync file permissions */ lib.mkMerge
] {
/* "ntnu".ignorePerms = false; # `false` means sync file permissions */
"DCIM".devices = [ "bjarte" "sopp" "rocm" "pjudduzen" ];
"ntnu".devices = [ "bjarte" "sopp" "rocm" ];
"pjudduzen-clover".devices = [ "pjudduzen" "sopp" ];
"pjudduzen-movies".devices = [ "pjudduzen" "sopp" ];
"pjudduzen-music".devices = [ "pjudduzen" "sopp" ];
"pjudduzen-pictures".devices = [ "pjudduzen" "sopp" ];
"pjudduzen-snapchat".devices = [ "pjudduzen" "sopp" ];
}; };
}; };