<commit_before>{stdenv, lib, buildGoPackage, git, runCommand, go2nix, gopherjs, go-bindata, esc}:
buildGoPackage rec {
    name = "focus";
    version = "git${stdenv.lib.strings.substring 0 7 rev}";
    rev = (builtins.readFile (./.git + ("/" + (builtins.replaceStrings ["\n"] [""] (stdenv.lib.strings.removePrefix "ref: " (builtins.readFile ./.git/HEAD))))));

    goPackagePath = "github.com/mstone/focus";
    goDeps = ./godeps.nix;

    buildInputs = [ go2nix gopherjs gopherjs.bin go-bindata.bin esc.bin ];

    src = runCommand "focus-git" {
        nativeBuildInputs = [ git ];
        preferLocalBuild = true;
        localRev = rev;
    } ''
        mkdir -p $out && git -C ${toString ./.} archive --format=tar $localRev | tar xf - -C $out
        git -C ${toString ./.} submodule foreach 'git -C ${toString ./.}/$path archive HEAD | tar xf - -C $out/$path'
        cp -r ${toString ./.}/.git $out/.git
    '';

    postConfigure = ''
        (export GOPATH="`pwd`/go:$GOPATH"; cd go/src/${goPackagePath}; go generate)
    '';

    excludedPackages = "kitchen-sink";

    shellHook = ''
        if [ -z "${builtins.getEnv "GOPATH"}" ]; then
            echo "WARNING: the focus dev-shell requires that the focus source code working copy be placed or mounted in a standard GOPATH workspace, not accessed via symlink"
            echo "ERROR: GOPATH not set; exiting"
            exit 1
        fi
    '';
}
<commit_msg>nix: add macOS linking fix from NixOS/nixpkgs #18131<commit_after>{stdenv, lib, buildGoPackage, git, runCommand, go2nix, gopherjs, go-bindata, esc}:
buildGoPackage rec {
    name = "focus";
    version = "git${stdenv.lib.strings.substring 0 7 rev}";
    rev = (builtins.readFile (./.git + ("/" + (builtins.replaceStrings ["\n"] [""] (stdenv.lib.strings.removePrefix "ref: " (builtins.readFile ./.git/HEAD))))));

    goPackagePath = "github.com/mstone/focus";
    goDeps = ./godeps.nix;

    buildInputs = [ go2nix gopherjs gopherjs.bin go-bindata.bin esc.bin ];

    src = runCommand "focus-git" {
        nativeBuildInputs = [ git ];
        preferLocalBuild = true;
        localRev = rev;
    } ''
        mkdir -p $out && git -C ${toString ./.} archive --format=tar $localRev | tar xf - -C $out
        git -C ${toString ./.} submodule foreach 'git -C ${toString ./.}/$path archive HEAD | tar xf - -C $out/$path'
        cp -r ${toString ./.}/.git $out/.git
    '';

    postConfigure = ''
        (export GOPATH="`pwd`/go:$GOPATH"; cd go/src/${goPackagePath}; go generate)
    '';

    postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
        # Fix rpaths to avoid derivation output cycles
        for file in $(grep -rl $out/lib $bin); do
            install_name_tool -delete_rpath $out/lib -add_rpath $bin $file
        done
    '';

    excludedPackages = "kitchen-sink";

    shellHook = ''
        if [ -z "${builtins.getEnv "GOPATH"}" ]; then
            echo "WARNING: the focus dev-shell requires that the focus source code working copy be placed or mounted in a standard GOPATH workspace, not accessed via symlink"
            echo "ERROR: GOPATH not set; exiting"
            exit 1
        fi
    '';
}

{'fraction_non_alphanumeric': 0.15041165294490183, 'fraction_numerical': 0.004749841671944269, 'mean_word_length': 2.4983388704318936, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1485532', 'n_tokens_mistral': 1056, 'n_tokens_neox': 1029, 'n_words': 290}