nixpkgs/pkgs/applications/networking/syncthing/inotify.nix
Peter Hoeg 1026bebee6
syncthing: use service files from upstream
Currently only for the user services as NixOS handles the named system
instances slightly differently.

syncthing and syncthing-inotify are done the same way.

There are 4 parts to this:

 1) Copy in the upstream unit files
 2) Make the nixos module use the definition from upstream
 3) Enable restarting of all instances (system and user) on resume
 4) Allow the traffic in the firewall on default ports if wanted

fixes #18973
2016-10-19 21:20:57 +02:00

38 lines
1.2 KiB
Nix

{ stdenv, buildGoPackage, fetchFromGitHub }:
buildGoPackage rec {
name = "syncthing-inotify-${version}";
version = "0.8.3";
goPackagePath = "github.com/syncthing/syncthing-inotify";
src = fetchFromGitHub {
owner = "syncthing";
repo = "syncthing-inotify";
rev = "v${version}";
sha256 = "194pbz9zzxaz0vri93czpbsxl85znlba2gy61mjgyr0dm2h4s6yw";
};
goDeps = ./inotify-deps.nix;
postInstall = ''
mkdir -p $bin/etc/systemd/{system,user}
substitute $src/etc/linux-systemd/system/syncthing-inotify@.service \
$bin/etc/systemd/system/syncthing-inotify@.service \
--replace /usr/bin/syncthing-inotify $bin/bin/syncthing-inotify
substitute $src/etc/linux-systemd/user/syncthing-inotify.service \
$bin/etc/systemd/user/syncthing-inotify.service \
--replace /usr/bin/syncthing-inotify $bin/bin/syncthing-inotify
'';
meta = with stdenv.lib; {
homepage = https://github.com/syncthing/syncthing-inotify;
description = "File watcher intended for use with Syncthing";
license = licenses.mpl20;
maintainers = with maintainers; [ joko peterhoeg ];
platforms = platforms.unix;
};
}