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:
nix run -- nixpkgs#nix-inspect -p .
inspect-config host=`just _a_host`:
nix run -- nixpkgs#nix-inspect -e '(builtins.getFlake "'"$PWD"'").nixosConfigurations.{{host}}.config'
inspect-config host=`just _a_host` prefix="":
nix run -- nixpkgs#nix-inspect -e '(builtins.getFlake "'"$PWD"'").nixosConfigurations.{{host}}.config{{ if prefix == "" { "" } else { "." + prefix } }}'
@_a_host:
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
let
inherit (config.services.syncthing)
dataDir
;
in
{
environment.systemPackages = lib.mkIf config.services.syncthing.enable [
@ -39,14 +33,24 @@ in
# nix run -- nixpkgs#syncthing generate --config="$HOME"/syncthing/.config/syncthing
devices."bjarte".id = "C7QQYJU-PMJDP2Z-CKTAV4A-V6IFEG5-YFBGCNU-PJPCZFC-QSXKZY3-NC5WRAL";
devices."pjudduzen".id = "JCNX5AC-YMXJZBP-5LQRLAL-BGTSXKK-X6AJPXL-IXDWJGW-IHSBTPT-AFXKFAK";
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 */
folders."ntnu" = {
path = "${dataDir}/ntnu";
devices = [ "bjarte" "sopp" "rocm" ];
/* ignorePerms = false; # `false` means sync file permissions */
folders = lib.flip lib.pipe [
(lib.mapAttrs (name: attrs: { path = lib.mkDefault "${config.services.syncthing.dataDir}/${name}"; } // attrs ))
(lib.mapAttrsToList (name: attrs: lib.mkIf (builtins.elem config.networking.hostName (attrs.devices or [])) { ${name} = attrs; } ))
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" ];
};
};