{ lib, pkgs, ... }:
{
  security.wrappers.raceattr =
    let
      inherit (pkgs) buildGoModule;
    in
    {
      setuid = true;
      owner = "root";
      group = "root";
      source = "${
        (buildGoModule rec {
          name = "raceattr";
          pname = name;
          tags = [ "raceattr" ];

          src = builtins.path {
            name = "${pname}-src";
            path = lib.cleanSource ../sharefs;
            filter = path: type: (type == "directory") || (type == "regular" && lib.hasSuffix ".go" path);
          };
          vendorHash = null;

          preBuild = ''
            go mod init hakurei.app/raceattr >& /dev/null
          '';
        })
      }/bin/raceattr";
    };
}
