<commit_before>{ stdenv, lib, fetchFromGitHub, go, procps, removeReferencesTo }:

stdenv.mkDerivation rec {
  version = "0.14.37";
  name = "syncthing-${version}";

  src = fetchFromGitHub {
    owner  = "syncthing";
    repo   = "syncthing";
    rev    = "v${version}";
    sha256 = "0mk09m5wc6g7w65cf86rrvzb2gfzbg4jrkwpsabn732iyhkkaj4z";
  };

  buildInputs = [ go removeReferencesTo ];

  buildPhase = ''
    mkdir -p src/github.com/syncthing
    ln -s $(pwd) src/github.com/syncthing/syncthing
    export GOPATH=$(pwd)

    # Syncthing's build.go script expects this working directory
    cd src/github.com/syncthing/syncthing

    go run build.go -no-upgrade -version v${version} build
  '';

  installPhase = ''
    mkdir -p $out/lib/systemd/{system,user}

    install -Dm755 syncthing $out/bin/syncthing

  '' + lib.optionalString (stdenv.isLinux) ''
    substitute etc/linux-systemd/system/syncthing-resume.service \
               $out/lib/systemd/system/syncthing-resume.service \<commit_msg>syncthing: 0.14.37 -> 0.14.38<commit_after>{ stdenv, lib, fetchFromGitHub, go, procps, removeReferencesTo }:

stdenv.mkDerivation rec {
  version = "0.14.38";
  name = "syncthing-${version}";

  src = fetchFromGitHub {
    owner  = "syncthing";
    repo   = "syncthing";
    rev    = "v${version}";
    sha256 = "0afid083azvrihv1v2cas09dprr2fflmj9gi7iy18gvwy2pg0jj8";
  };

  buildInputs = [ go removeReferencesTo ];

  buildPhase = ''
    mkdir -p src/github.com/syncthing
    ln -s $(pwd) src/github.com/syncthing/syncthing
    export GOPATH=$(pwd)

    # Syncthing's build.go script expects this working directory
    cd src/github.com/syncthing/syncthing

    go run build.go -no-upgrade -version v${version} build
  '';

  installPhase = ''
    mkdir -p $out/lib/systemd/{system,user}

    install -Dm755 syncthing $out/bin/syncthing

  '' + lib.optionalString (stdenv.isLinux) ''
    substitute etc/linux-systemd/system/syncthing-resume.service \
               $out/lib/systemd/system/syncthing-resume.service \
{'fraction_non_alphanumeric': 0.1311881188118812, 'fraction_numerical': 0.031683168316831684, 'mean_word_length': 3.2368972746331237, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7653786', 'n_tokens_mistral': 803, 'n_tokens_neox': 743, 'n_words': 132}