diff options
author | Alyssa Ross <hi@alyssa.is> | 2019-01-07 02:18:36 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2019-01-07 02:18:47 +0000 |
commit | 36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 (patch) | |
tree | b3faaf573407b32aa645237a4d16b82778a39a92 /nixpkgs/pkgs/applications/networking/syncthing | |
parent | 4e31070265257dc67d120c27e0f75c2344fdfa9a (diff) | |
parent | abf060725d7614bd3b9f96764262dfbc2f9c2199 (diff) | |
download | nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.gz nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.bz2 nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.lz nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.xz nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.zst nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.zip |
Add 'nixpkgs/' from commit 'abf060725d7614bd3b9f96764262dfbc2f9c2199'
git-subtree-dir: nixpkgs git-subtree-mainline: 4e31070265257dc67d120c27e0f75c2344fdfa9a git-subtree-split: abf060725d7614bd3b9f96764262dfbc2f9c2199
Diffstat (limited to 'nixpkgs/pkgs/applications/networking/syncthing')
-rw-r--r-- | nixpkgs/pkgs/applications/networking/syncthing/add-stcli-target.patch | 17 | ||||
-rw-r--r-- | nixpkgs/pkgs/applications/networking/syncthing/default.nix | 109 |
2 files changed, 126 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/networking/syncthing/add-stcli-target.patch b/nixpkgs/pkgs/applications/networking/syncthing/add-stcli-target.patch new file mode 100644 index 000000000000..58ac15253aed --- /dev/null +++ b/nixpkgs/pkgs/applications/networking/syncthing/add-stcli-target.patch @@ -0,0 +1,17 @@ +diff --git i/build.go w/build.go +index 7d400d6f..1b5e1d25 100644 +--- i/build.go ++++ w/build.go +@@ -175,6 +175,12 @@ var targets = map[string]target{ + {src: "AUTHORS", dst: "deb/usr/share/doc/syncthing-relaypoolsrv/AUTHORS.txt", perm: 0644}, + }, + }, ++ "stcli": { ++ name: "stcli", ++ description: "Syncthing CLI", ++ buildPkg: "github.com/syncthing/syncthing/cmd/stcli", ++ binaryName: "stcli", // .exe will be added automatically for Windows builds ++ }, + } + + func init() { diff --git a/nixpkgs/pkgs/applications/networking/syncthing/default.nix b/nixpkgs/pkgs/applications/networking/syncthing/default.nix new file mode 100644 index 000000000000..b084e4af972a --- /dev/null +++ b/nixpkgs/pkgs/applications/networking/syncthing/default.nix @@ -0,0 +1,109 @@ +{ buildGoPackage, fetchpatch, stdenv, lib, procps, fetchFromGitHub }: + +let + common = { stname, target, postInstall ? "" }: + buildGoPackage rec { + version = "0.14.54"; + name = "${stname}-${version}"; + + src = fetchFromGitHub { + owner = "syncthing"; + repo = "syncthing"; + rev = "v${version}"; + sha256 = "0l73ka71l6gxv46wmlyzj8zhfpfj3vf6nv6x3x0z25ymr3wa2fza"; + }; + + goPackagePath = "github.com/syncthing/syncthing"; + + patches = [ + ./add-stcli-target.patch + (fetchpatch { + url = "https://github.com/syncthing/syncthing/commit/e7072feeb7669948c3e43f55d21aec15481c33ba.patch"; + sha256 = "1pcybww2vdx45zhd1sd53v7fp40vfgkwqgy8flv7hxw2paq8hxd4"; + }) + ]; + BUILD_USER="nix"; + BUILD_HOST="nix"; + + buildPhase = '' + runHook preBuild + pushd go/src/${goPackagePath} + go run build.go -no-upgrade -version v${version} build ${target} + popd + runHook postBuild + ''; + + installPhase = '' + pushd go/src/${goPackagePath} + runHook preInstall + install -Dm755 ${target} $bin/bin/${target} + runHook postInstall + popd + ''; + + inherit postInstall; + + meta = with lib; { + homepage = https://www.syncthing.net/; + description = "Open Source Continuous File Synchronization"; + license = licenses.mpl20; + maintainers = with maintainers; [ pshendry joko peterhoeg andrew-d ]; + platforms = platforms.unix; + }; + }; + +in { + syncthing = common { + stname = "syncthing"; + target = "syncthing"; + + postInstall = '' + # This installs man pages in the correct directory according to the suffix + # on the filename + for mf in man/*.[1-9]; do + mantype="$(echo "$mf" | awk -F"." '{print $NF}')" + mandir="$out/share/man/man$mantype" + install -Dm644 "$mf" "$mandir/$(basename "$mf")" + done + + '' + lib.optionalString (stdenv.isLinux) '' + mkdir -p $out/lib/systemd/{system,user} + + substitute etc/linux-systemd/system/syncthing-resume.service \ + $out/lib/systemd/system/syncthing-resume.service \ + --replace /usr/bin/pkill ${procps}/bin/pkill + + substitute etc/linux-systemd/system/syncthing@.service \ + $out/lib/systemd/system/syncthing@.service \ + --replace /usr/bin/syncthing $out/bin/syncthing + + substitute etc/linux-systemd/user/syncthing.service \ + $out/lib/systemd/user/syncthing.service \ + --replace /usr/bin/syncthing $out/bin/syncthing + ''; + }; + + syncthing-cli = common { + stname = "syncthing-cli"; + + target = "stcli"; + }; + + syncthing-discovery = common { + stname = "syncthing-discovery"; + target = "stdiscosrv"; + }; + + syncthing-relay = common { + stname = "syncthing-relay"; + target = "strelaysrv"; + + postInstall = lib.optionalString (stdenv.isLinux) '' + mkdir -p $out/lib/systemd/system + + substitute cmd/strelaysrv/etc/linux-systemd/strelaysrv.service \ + $out/lib/systemd/system/strelaysrv.service \ + --replace /usr/bin/strelaysrv $out/bin/strelaysrv + ''; + }; +} |