Skip to content

Instantly share code, notes, and snippets.

@MatrixManAtYrService
Last active March 15, 2023 06:20
Show Gist options
  • Save MatrixManAtYrService/ac040f60d3602fc2df871623b1d09bf7 to your computer and use it in GitHub Desktop.
Save MatrixManAtYrService/ac040f60d3602fc2df871623b1d09bf7 to your computer and use it in GitHub Desktop.
> go: -mod may only be set to readonly when in workspace mode, but it is set to "vendor"
❯ nix log /nix/store/zp4vz01wk21ym5nixhhcva1nmvxqw0kc-kustomize-4.5.4.drv
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/kr8qsxkf90anrkdl98kw6cdyagcpprx1-source
source root is source
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
@nix { "action": "setPhase", "phase": "buildPhase" }
building
Building subPackage .
../kyaml/yaml/fns.go:12:2: github.com/evanphx/[email protected]+incompatible: reading file:///nix/store/nx9lf6v3pbbv1140i112xvzr818pmz3z-kustomize-4.5.4-go-modules/github.com/evanphx/json-patch/@v/v4.11.0+incompatible.mod: no such file or directory
../api/internal/builtins/PatchJson6902Transformer.go:9:2: github.com/evanphx/[email protected]+incompatible: reading file:///nix/store/nx9lf6v3pbbv1140i112xvzr818pmz3z-kustomize-4.5.4-go-modules/github.com/evanphx/json-patch/@v/v4.11.0+incompatible.mod: no such file or directory
../kyaml/errors/errors.go:10:2: github.com/evanphx/[email protected]+incompatible: reading file:///nix/store/nx9lf6v3pbbv1140i112xvzr818pmz3z-kustomize-4.5.4-go-modules/github.com/evanphx/json-patch/@v/v4.11.0+incompatible.mod: no such file or directory
../kyaml/openapi/openapi.go:15:2: github.com/evanphx/[email protected]+incompatible: reading file:///nix/store/nx9lf6v3pbbv1140i112xvzr818pmz3z-kustomize-4.5.4-go-modules/github.com/evanphx/json-patch/@v/v4.11.0+incompatible.mod: no such file or directory
../api/internal/plugins/execplugin/execplugin.go:14:2: github.com/evanphx/[email protected]+incompatible: reading file:///nix/store/nx9lf6v3pbbv1140i112xvzr818pmz3z-kustomize-4.5.4-go-modules/github.com/evanphx/json-patch/@v/v4.11.0+incompatible.mod: no such file or directory
../api/internal/builtins/HelmChartInflationGenerator.go:15:2: github.com/evanphx/[email protected]+incompatible: reading file:///nix/store/nx9lf6v3pbbv1140i112xvzr818pmz3z-kustomize-4.5.4-go-modules/github.com/evanphx/json-patch/@v/v4.11.0+incompatible.mod: no such file or directory
../kyaml/kio/ignorefilesmatcher.go:12:2: github.com/evanphx/[email protected]+incompatible: reading file:///nix/store/nx9lf6v3pbbv1140i112xvzr818pmz3z-kustomize-4.5.4-go-modules/github.com/evanphx/json-patch/@v/v4.11.0+incompatible.mod: no such file or directory
commands/commands.go:12:2: github.com/evanphx/[email protected]+incompatible: reading file:///nix/store/nx9lf6v3pbbv1140i112xvzr818pmz3z-kustomize-4.5.4-go-modules/github.com/evanphx/json-patch/@v/v4.11.0+incompatible.mod: no such file or directory
commands/build/build.go:12:2: github.com/evanphx/[email protected]+incompatible: reading file:///nix/store/nx9lf6v3pbbv1140i112xvzr818pmz3z-kustomize-4.5.4-go-modules/github.com/evanphx/json-patch/@v/v4.11.0+incompatible.mod: no such file or directory
../kyaml/kio/tree.go:14:2: github.com/evanphx/[email protected]+incompatible: reading file:///nix/store/nx9lf6v3pbbv1140i112xvzr818pmz3z-kustomize-4.5.4-go-modules/github.com/evanphx/json-patch/@v/v4.11.0+incompatible.mod: no such file or directory
../kyaml/fn/runtime/starlark/context.go:11:2: github.com/evanphx/[email protected]+incompatible: reading file:///nix/store/nx9lf6v3pbbv1140i112xvzr818pmz3z-kustomize-4.5.4-go-modules/github.com/evanphx/json-patch/@v/v4.11.0+incompatible.mod: no such file or directory
../kyaml/fn/runtime/starlark/context.go:12:2: github.com/evanphx/[email protected]+incompatible: reading file:///nix/store/nx9lf6v3pbbv1140i112xvzr818pmz3z-kustomize-4.5.4-go-modules/github.com/evanphx/json-patch/@v/v4.11.0+incompatible.mod: no such file or directory
commands/internal/kustfile/kustomizationfile.go:15:2: github.com/evanphx/[email protected]+incompatible: reading file:///nix/store/nx9lf6v3pbbv1140i112xvzr818pmz3z-kustomize-4.5.4-go-modules/github.com/evanphx/json-patch/@v/v4.11.0+incompatible.mod: no such file or directory
commands/internal/kustfile/kustomizationfile.go:16:2: github.com/evanphx/[email protected]+incompatible: reading file:///nix/store/nx9lf6v3pbbv1140i112xvzr818pmz3z-kustomize-4.5.4-go-modules/github.com/evanphx/json-patch/@v/v4.11.0+incompatible.mod: no such file or directory
../kyaml/openapi/openapi.go:16:2: github.com/evanphx/[email protected]+incompatible: reading file:///nix/store/nx9lf6v3pbbv1140i112xvzr818pmz3z-kustomize-4.5.4-go-modules/github.com/evanphx/json-patch/@v/v4.11.0+incompatible.mod: no such file or directory
../cmd/config/internal/commands/internal/k8sgen/pkg/api/resource/amount.go:26:2: github.com/evanphx/[email protected]+incompatible: reading file:///nix/store/nx9lf6v3pbbv1140i112xvzr818pmz3z-kustomize-4.5.4-go-modules/github.com/evanphx/json-patch/@v/v4.11.0+incompatible.mod: no su>
../kyaml/yaml/compatibility.go:10:2: github.com/evanphx/[email protected]+incompatible: reading file:///nix/store/nx9lf6v3pbbv1140i112xvzr818pmz3z-kustomize-4.5.4-go-modules/github.com/evanphx/json-patch/@v/v4.11.0+incompatible.mod: no such file or directory
../kyaml/openapi/openapi.go:17:2: github.com/evanphx/[email protected]+incompatible: reading file:///nix/store/nx9lf6v3pbbv1140i112xvzr818pmz3z-kustomize-4.5.4-go-modules/github.com/evanphx/json-patch/@v/v4.11.0+incompatible.mod: no such file or directory
../kyaml/openapi/openapi.go:22:2: github.com/evanphx/[email protected]+incompatible: reading file:///nix/store/nx9lf6v3pbbv1140i112xvzr818pmz3z-kustomize-4.5.4-go-modules/github.com/evanphx/json-patch/@v/v4.11.0+incompatible.mod: no such file or directory
lines 1-30/30 (END)...skipping...
description = "kustomized pinned at 4.5.4";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
kustomize-src = {
url = "github:kubernetes-sigs/kustomize?tag=kustomize/v4.5.4";
flake = false;
};
};
outputs = { self, nixpkgs, flake-utils, kustomize-src }:
flake-utils.lib.eachDefaultSystem (system:
let
pin-kustomize = final: prev: {
kustomize = prev.callPackage "${prev.path}/pkgs/development/tools/kustomize" {
buildGoModule = args: prev.buildGoModule (args // {
version = "4.5.4";
src = kustomize-src;
vendorSha256 = "sha256-k8Rso1bAJbJOz/zGmU2VxQJW20Khof23a86seXt9AGQ=";
# proxyVendor = true; # should disable '-mod=vendor'
# # see: https://github.com/NixOS/nixpkgs/blob/abb2ade261c33516716aa21068d8c10c48d03367/pkgs/build-support/go/module.nix#L176
# # seems like it causes a different problem though
});
};
};
pkgs = nixpkgs.legacyPackages.${system}.extend pin-kustomize;
in rec
{
packages = {
default = pkgs.kustomize;
};
});
}
{
description = "kustomize pinned at v4.5.5";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
kustomize-src = {
url = "github:kubernetes-sigs/kustomize?tag=kustomize/v4.5.5";
flake = false;
};
};
outputs = { self, nixpkgs, flake-utils, kustomize-src }:
flake-utils.lib.eachDefaultSystem (system:
let
version = "4.5.5";
pin-kustomize = final: prev: {
kustomize = prev.kustomize.override {
buildGoModule = args: prev.buildGoModule (args // {
inherit version;
src = kustomize-src;
vendorSha256 = "sha256-k8Rso1bAJbJOz/zGmU2VxQJW20Khof23a86seXt9AGQ=";
ldflags = let t = "sigs.k8s.io/kustomize/api/provenance"; in
[
"-s"
"-w"
"-X ${t}.version=${version}"
"-X ${t}.gitCommit=${kustomize-src.rev}"
];
preBuild = ''
export GOWORK=off
'';
});
};
};
pkgs = nixpkgs.legacyPackages.${system}.extend pin-kustomize;
in rec
{
packages = {
default = pkgs.kustomize;
};
});
}
❯ nix build
error: builder for '/nix/store/12cly8068fk50np4dp4jiw52r2gl53r8-kustomize-4.5.4.drv' failed with exit code 1;
last 10 log lines:
> unpacking sources
> unpacking source archive /nix/store/kr8qsxkf90anrkdl98kw6cdyagcpprx1-source
> source root is source
> patching sources
> configuring
> building
> Building subPackage .
> go: -mod may only be set to readonly when in workspace mode, but it is set to "vendor"
> Remove the -mod flag to use the default readonly value,
> or set GOWORK=off to disable workspace mode.
For full logs, run 'nix log /nix/store/12cly8068fk50np4dp4jiw52r2gl53r8-kustomize-4.5.4.drv'.
@MatrixManAtYrService
Copy link
Author

GPT-4 was able to just look at the broken flake.nix, and also look a the error message, and author a flake.nix that worked the first time. Wow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment