Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/languages-frameworks/go.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ In the following is an example expression using `buildGoModule`, the following a

To obtain the actual hash, set `vendorHash = lib.fakeSha256;` and run the build ([more details here](#sec-source-hashes)).
- `proxyVendor`: Fetches (go mod download) and proxies the vendor directory. This is useful if your code depends on c code and go mod tidy does not include the needed sources to build or if any dependency has case-insensitive conflicts which will produce platform-dependent `vendorHash` checksums.
- `modPostBuild`: Shell commands to run after the build of the go-modules executes `go mod vendor`, and before calculating fixed output derivation's `vendorHash` (or `vendorSha256`). Note that if you change this attribute, you need to update `vendorHash` (or `vendorSha256`) attribute.
- `modPostBuild`: Shell commands to run after the build of the goModules executes `go mod vendor`, and before calculating fixed output derivation's `vendorHash` (or `vendorSha256`). Note that if you change this attribute, you need to update `vendorHash` (or `vendorSha256`) attribute.

```nix
pet = buildGoModule rec {
Expand Down Expand Up @@ -115,7 +115,7 @@ done

## Attributes used by the builders {#ssec-go-common-attributes}

Many attributes [controlling the build phase](#variables-controlling-the-build-phase) are respected by both `buildGoModule` and `buildGoPackage`. Note that `buildGoModule` reads the following attributes also when building the `vendor/` go-modules fixed output derivation as well:
Many attributes [controlling the build phase](#variables-controlling-the-build-phase) are respected by both `buildGoModule` and `buildGoPackage`. Note that `buildGoModule` reads the following attributes also when building the `vendor/` goModules fixed output derivation as well:

- [`sourceRoot`](#var-stdenv-sourceRoot)
- [`prePatch`](#var-stdenv-prePatch)
Expand Down
2 changes: 2 additions & 0 deletions nixos/doc/manual/release-notes/rl-2311.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@

- DocBook option documentation is no longer supported, all module documentation now uses markdown.

- `buildGoModule` `go-modules` attrs have been renamed to `goModules`.

- `services.fail2ban.jails` can now be configured with attribute sets defining settings and filters instead of lines. The stringed options `daemonConfig` and `extraSettings` have respectively been replaced by `daemonSettings` and `jails.DEFAULT.settings` which use attribute sets.

- The module [services.ankisyncd](#opt-services.ankisyncd.package) has been switched to [anki-sync-server-rs](https://github.com/ankicommunity/anki-sync-server-rs) from the old python version, which was difficult to update, had not been updated in a while, and did not support recent versions of anki.
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/networking/cluster/k3s/update-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ cat >versions.nix <<EOF
EOF

set +e
K3S_VENDOR_SHA256=$(nix-prefetch -I nixpkgs=${NIXPKGS_ROOT} "{ sha256 }: (import ${NIXPKGS_ROOT}. {}).k3s_1_${MINOR_VERSION}.go-modules.overrideAttrs (_: { vendorSha256 = sha256; })")
K3S_VENDOR_SHA256=$(nix-prefetch -I nixpkgs=${NIXPKGS_ROOT} "{ sha256 }: (import ${NIXPKGS_ROOT}. {}).k3s_1_${MINOR_VERSION}.goModules.overrideAttrs (_: { vendorSha256 = sha256; })")
set -e

if [ -n "${K3S_VENDOR_SHA256:-}" ]; then
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/networking/cluster/kfctl/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ buildGoModule rec {
homepage = "https://github.com/kubeflow/kfctl";
license = licenses.asl20;
maintainers = with maintainers; [ mvnetbiz ];
broken = true; # vendor isn't reproducible with go > 1.17: nix-build -A $name.go-modules --check
broken = true; # vendor isn't reproducible with go > 1.17: nix-build -A $name.goModules --check
};
}
2 changes: 1 addition & 1 deletion pkgs/applications/networking/cluster/kubemqctl/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ buildGoModule rec {
description = "Kubemqctl is a command line interface (CLI) for Kubemq Kubernetes Message Broker.";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ brianmcgee ];
broken = true; # vendor isn't reproducible with go > 1.17: nix-build -A $name.go-modules --check
broken = true; # vendor isn't reproducible with go > 1.17: nix-build -A $name.goModules --check
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ update_attr hash "${hash}"
old_vendor_hash="$(read_attr vendorHash)"
if [[ ${old_vendor_hash} != null ]]; then
echo_provider "calculating vendorHash"
vendorHash=$(generate_hash go-modules)
vendorHash=$(generate_hash goModules)
update_attr vendorHash "${vendorHash}"
fi

Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/system/mgmt/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ buildGoModule rec {
hash = "sha256-jurZvEtiaTjWeDkmCJDIFlTzR5EVglfoDxkFgOilo8s=";
};

# patching must be done in prebuild, so it is shared with go-modules
# patching must be done in prebuild, so it is shared with goModules
# see https://github.com/NixOS/nixpkgs/issues/208036
preBuild = ''
for file in `find -name Makefile -type f`; do
Expand Down
3 changes: 1 addition & 2 deletions pkgs/applications/terminal-emulators/kitty/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ buildPythonApplication rec {
pname = "kitty-go-modules";
inherit src version;
vendorHash = "sha256-jk2EcYVuhV/UQfHAIfpnn8ZIZnwjA/o8YRXmpoC85Vc=";
}).go-modules;
}).goModules;

buildInputs = [
harfbuzz
Expand Down Expand Up @@ -224,7 +224,6 @@ buildPythonApplication rec {
'';

passthru = {
go-modules = goModules; # allow for updateScript to handle vendorHash
tests.test = nixosTests.terminal-emulators.kitty;
updateScript = nix-update-script {};
};
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/version-management/forgejo/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ buildGoModule rec {
--prefix PATH : ${lib.makeBinPath [ bash git gzip openssh ]}
'';

# $data is not available in go-modules.drv and preBuild isn't needed
# $data is not available in goModules.drv and preBuild isn't needed
overrideModAttrs = (_: {
postPatch = null;
preBuild = null;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/version-management/git-hound/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ buildGoModule rec {
homepage = "https://github.com/tillson/git-hound";
license = with licenses; [ mit ];
maintainers = with maintainers; [ fab ];
broken = true; # vendor isn't reproducible with go > 1.17: nix-build -A $name.go-modules --check
broken = true; # vendor isn't reproducible with go > 1.17: nix-build -A $name.goModules --check
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
}:
{
overrideModAttrs = (_: {
# No need to workaround -trimpath: it's not used in go-modules,
# No need to workaround -trimpath: it's not used in goModules,
# but do download `go generate`'s dependencies nonetheless.
preBuild = ''
go generate ./loaders
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/virtualization/singularity/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ in
inherit pname version src;

# Override vendorHash with the output got from
# nix-prefetch -E "{ sha256 }: ((import ./. { }).apptainer.override { vendorHash = sha256; }).go-modules"
# nix-prefetch -E "{ sha256 }: ((import ./. { }).apptainer.override { vendorHash = sha256; }).goModules"
# or with `null` when using vendored source tarball.
inherit vendorHash deleteVendor proxyVendor;

Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/virtualization/singularity/packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ let
};

# Update by running
# nix-prefetch -E "{ sha256 }: ((import ./. { }).apptainer.override { vendorHash = sha256; }).go-modules"
# nix-prefetch -E "{ sha256 }: ((import ./. { }).apptainer.override { vendorHash = sha256; }).goModules"
# at the root directory of the Nixpkgs repository
vendorHash = "sha256-PfFubgR/W1WBXIsRO+Kg7hA6ebeAcRiJlTlAZbnl19A=";

Expand Down Expand Up @@ -49,7 +49,7 @@ let
};

# Update by running
# nix-prefetch -E "{ sha256 }: ((import ./. { }).singularity.override { vendorHash = sha256; }).go-modules"
# nix-prefetch -E "{ sha256 }: ((import ./. { }).singularity.override { vendorHash = sha256; }).goModules"
# at the root directory of the Nixpkgs repository
vendorHash = "sha256-mBhlH6LSmcJuc6HbU/3Q9ii7vJkW9jcikBWCl8oeMOk=";

Expand Down
12 changes: 6 additions & 6 deletions pkgs/build-support/go/module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
, passthru ? { }
, patches ? [ ]

# A function to override the go-modules derivation
# A function to override the goModules derivation
, overrideModAttrs ? (_oldAttrs: { })

# path to go.mod and go.sum directory
Expand Down Expand Up @@ -52,9 +52,9 @@ assert (args' ? vendorHash && args' ? vendorSha256) -> throw "both `vendorHash`
let
args = removeAttrs args' [ "overrideModAttrs" "vendorSha256" "vendorHash" ];

go-modules = if (vendorHash == null) then "" else
goModules = if (vendorHash == null) then "" else
(stdenv.mkDerivation {
name = "${name}-go-modules";
name = "${name}-goModules";

nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ go git cacert ];

Expand Down Expand Up @@ -163,10 +163,10 @@ let
cd "$modRoot"
'' + lib.optionalString (vendorHash != null) ''
${if proxyVendor then ''
export GOPROXY=file://${go-modules}
export GOPROXY=file://${goModules}
'' else ''
rm -rf vendor
cp -r --reflink=auto ${go-modules} vendor
cp -r --reflink=auto ${goModules} vendor
''}
'' + ''

Expand Down Expand Up @@ -288,7 +288,7 @@ let

disallowedReferences = lib.optional (!allowGoReference) go;

passthru = passthru // { inherit go go-modules vendorHash; } // { inherit (args') vendorSha256; };
passthru = passthru // { inherit go goModules vendorHash; } // { inherit (args') vendorSha256; };

meta = {
# Add default meta information
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/tools/kcli/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ buildGoModule rec {
homepage = "https://github.com/cswank/kcli";
license = licenses.mit;
maintainers = with maintainers; [ cswank ];
broken = true; # vendor isn't reproducible with go > 1.17: nix-build -A $name.go-modules --check
broken = true; # vendor isn't reproducible with go > 1.17: nix-build -A $name.goModules --check
};
}
2 changes: 1 addition & 1 deletion pkgs/servers/authelia/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ clean_up
OLD_GO_VENDOR_HASH="$(instantiateClean authelia.vendorHash)"
echo "Old go vendor hash $OLD_GO_VENDOR_HASH"
replace "$OLD_GO_VENDOR_HASH" "$TMP_HASH" "$DRV_DIR/sources.nix"
NEW_GO_VENDOR_HASH="$(fetchNewSha authelia.go-modules)"
NEW_GO_VENDOR_HASH="$(fetchNewSha authelia.goModules)"
echo "New go vendor hash $NEW_GO_VENDOR_HASH"
replace "$TMP_HASH" "$NEW_GO_VENDOR_HASH" "$DRV_DIR/sources.nix"
2 changes: 1 addition & 1 deletion pkgs/servers/dns/ncdns/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ buildGoModule {

vendorSha256 = "sha256-ENtTnDsz5WhRz1kiqnWQ5vyEpZtgi7ZeYvksffgW78k=";

# Override the go-modules fetcher derivation to apply
# Override the goModules fetcher derivation to apply
# upstream's patch of the crypto/x509 library.
modBuildPhase = ''
go mod init github.com/namecoin/x509-compressed
Expand Down
2 changes: 1 addition & 1 deletion pkgs/servers/geospatial/pg_featureserv/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ buildGoModule rec {
homepage = "https://github.com/CrunchyData/pg_featureserv";
license = licenses.asl20;
maintainers = with maintainers; [ sikmir ];
broken = true; # vendor isn't reproducible with go > 1.17: nix-build -A $name.go-modules --check
broken = true; # vendor isn't reproducible with go > 1.17: nix-build -A $name.goModules --check
};
}
2 changes: 1 addition & 1 deletion pkgs/servers/gobetween/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ buildGoModule rec {
homepage = "https://gobetween.io";
license = licenses.mit;
maintainers = with maintainers; [ tomberek ];
broken = true; # vendor isn't reproducible with go > 1.17: nix-build -A $name.go-modules --check
broken = true; # vendor isn't reproducible with go > 1.17: nix-build -A $name.goModules --check
};
}
2 changes: 1 addition & 1 deletion pkgs/servers/memos/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fi

extractVendorHash() {
original="${1?original hash missing}"
result="$(nix-build -A memos.go-modules 2>&1 | tail -n3 | grep 'got:' | cut -d: -f2- | xargs echo || true)"
result="$(nix-build -A memos.goModules 2>&1 | tail -n3 | grep 'got:' | cut -d: -f2- | xargs echo || true)"
[ -z "$result" ] && { echo "$original"; } || { echo "$result"; }
}

Expand Down
2 changes: 1 addition & 1 deletion pkgs/servers/monitoring/alertmanager-bot/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ buildGoModule rec {
homepage = "https://github.com/metalmatze/alertmanager-bot";
license = licenses.mit;
maintainers = with maintainers; [ mmahut ];
broken = true; # vendor isn't reproducible with go > 1.17: nix-build -A $name.go-modules --check
broken = true; # vendor isn't reproducible with go > 1.17: nix-build -A $name.goModules --check
};
}
2 changes: 1 addition & 1 deletion pkgs/servers/monitoring/grafana/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ replaceHash() {
}
extractVendorHash() {
original="${1?original hash missing}"
result="$(nix-build -A grafana.go-modules 2>&1 | tail -n3 | grep 'got:' | cut -d: -f2- | xargs echo || true)"
result="$(nix-build -A grafana.goModules 2>&1 | tail -n3 | grep 'got:' | cut -d: -f2- | xargs echo || true)"
[ -z "$result" ] && { echo "$original"; } || { echo "$result"; }
}

Expand Down
6 changes: 3 additions & 3 deletions pkgs/tools/networking/mozillavpn/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ let
})
];

netfilter-go-modules = (buildGoModule {
netfilter-goModules = (buildGoModule {
inherit pname version src patches;
modRoot = "linux/netfilter";
vendorHash = "sha256-Cmo0wnl0z5r1paaEf1MhCPbInWeoMhGjnxCxGh0cyO8=";
}).go-modules;
}).goModules;

extensionBridgeDeps = rustPlatform.fetchCargoTarball {
inherit src patches;
Expand Down Expand Up @@ -132,7 +132,7 @@ stdenv.mkDerivation {
substituteInPlace extension/CMakeLists.txt \
--replace '/etc' "$out/etc"

ln -s '${netfilter-go-modules}' linux/netfilter/vendor
ln -s '${netfilter-goModules}' linux/netfilter/vendor

pushd extension/bridge
cargoDepsCopy="$extensionBridgeDepsCopy" cargoSetupPostPatchHook
Expand Down
2 changes: 1 addition & 1 deletion pkgs/tools/networking/shadowfox/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ buildGoModule rec {
license = licenses.mit;
maintainers = with maintainers; [ infinisil ];
mainProgram = "shadowfox-updater";
broken = true; # vendor isn't reproducible with go > 1.17: nix-build -A $name.go-modules --check
broken = true; # vendor isn't reproducible with go > 1.17: nix-build -A $name.goModules --check
};
}
2 changes: 1 addition & 1 deletion pkgs/tools/networking/waitron/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ buildGoModule rec {
license = licenses.asl20;
maintainers = with maintainers; [ guibert ];
platforms = platforms.linux;
broken = true; # vendor isn't reproducible with go > 1.17: nix-build -A $name.go-modules --check
broken = true; # vendor isn't reproducible with go > 1.17: nix-build -A $name.goModules --check
};
}
2 changes: 1 addition & 1 deletion pkgs/tools/networking/wuzz/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ buildGoModule rec {
description = "Interactive cli tool for HTTP inspection";
license = licenses.agpl3;
maintainers = with maintainers; [ pradeepchhetri ];
broken = true; # vendor isn't reproducible with go > 1.17: nix-build -A $name.go-modules --check
broken = true; # vendor isn't reproducible with go > 1.17: nix-build -A $name.goModules --check
};
}
2 changes: 1 addition & 1 deletion pkgs/tools/security/deepsea/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ buildGoModule rec {
homepage = "https://github.com/dsnezhkov/deepsea";
license = with licenses; [ asl20 ];
maintainers = with maintainers; [ fab ];
broken = true; # vendor isn't reproducible with go > 1.17: nix-build -A $name.go-modules --check
broken = true; # vendor isn't reproducible with go > 1.17: nix-build -A $name.goModules --check
};
}
2 changes: 1 addition & 1 deletion pkgs/tools/security/shhgit/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ buildGoModule rec {
homepage = "https://github.com/eth0izzle/shhgit";
license = with licenses; [ mit ];
maintainers = with maintainers; [ fab ];
broken = true; # vendor isn't reproducible with go > 1.17: nix-build -A $name.go-modules --check
broken = true; # vendor isn't reproducible with go > 1.17: nix-build -A $name.goModules --check
};
}
2 changes: 1 addition & 1 deletion pkgs/tools/security/ssb/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ buildGoModule rec {
homepage = "https://github.com/kitabisa/ssb";
license = with licenses; [ asl20 ];
maintainers = with maintainers; [ fab ];
broken = true; # vendor isn't reproducible with go > 1.17: nix-build -A $name.go-modules --check
broken = true; # vendor isn't reproducible with go > 1.17: nix-build -A $name.goModules --check
};
}
2 changes: 1 addition & 1 deletion pkgs/tools/text/wrap/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ buildGoModule rec {
homepage = "https://github.com/Wraparound/wrap";
license = licenses.gpl3Only;
maintainers = [ maintainers.austinbutler ];
broken = true; # vendor isn't reproducible with go > 1.17: nix-build -A $name.go-modules --check
broken = true; # vendor isn't reproducible with go > 1.17: nix-build -A $name.goModules --check
};
}