From bfe457eaf0903350381ef50bf917cb05ff740191 Mon Sep 17 00:00:00 2001 From: billy4479 Date: Tue, 24 Dec 2024 14:25:11 +0100 Subject: [PATCH] Use existing docker images --- containers/syncthing.nix | 60 ++++++---------------------------------- 1 file changed, 8 insertions(+), 52 deletions(-) diff --git a/containers/syncthing.nix b/containers/syncthing.nix index 02ebdb2..4088f56 100644 --- a/containers/syncthing.nix +++ b/containers/syncthing.nix @@ -1,62 +1,11 @@ { pkgs, ... }: -let - # https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/networking/syncthing.nix - # https://github.com/linuxserver/docker-syncthing/blob/master/Dockerfile - syncthingImage = pkgs.dockerTools.buildImage { - name = "syncthing"; - tag = "latest"; - - runAsRoot = '' - #!${pkgs.stdenv.shell} - ${pkgs.dockerTools.shadowSetup} - groupadd -r syncthing - useradd -r -g syncthing -d /data -M syncthing - mkdir /config - chown syncthing:syncthing /config - ''; - - copyToRoot = pkgs.buildEnv { - name = "image-root"; - paths = [ pkgs.syncthing ]; - pathsToLink = [ "/bin" ]; - }; - - config = { - Env = [ - "HOME=/config" - "STNORESTART=yes" - "STNOUPGRADE=yes" - ]; - - Volumes = { - "/config" = { }; - }; - - ExposedPorts = { - "8384" = { }; - "22000/tcp" = { }; - "22000/udp" = { }; - "21027/udp" = { }; - }; - - Cmd = [ - "/bin/syncthing" - "-no-browser" - "-no-restart" - "--gui-address=0.0.0.0:8384" - ]; - }; - }; -in { virtualisation.oci-containers.containers = { syncthing = { autoStart = true; - # image = "lscr.io/linuxserver/syncthing:latest"; - image = "syncthing:latest"; - imageFile = syncthingImage; + image = "lscr.io/linuxserver/syncthing:latest"; ports = [ "8384:8384" "22000:22000/tcp" @@ -64,8 +13,15 @@ in "21027:21027/udp" ]; + environment = { + UID = "1000"; + GID = "1000"; + TZ = "Europe/Rome"; + }; + volumes = [ "/mnt/SSD/apps/syncthing/config:/config" + "/mnt/HDD/generic/syncthing-data:/data" ]; extraOptions = [ "--ip=10.0.1.2" ];