Nix + Go | 228 Members | |
| Go packaging for and with Nixpkgs. | Be excellent to each other. | 48 Servers |
| Sender | Message | Time |
|---|---|---|
| 6 Jan 2025 | ||
| 12:31:55 | ||
| 8 Jan 2025 | ||
| 14:37:04 | ||
| I don't know if this is the right channel for this question, but seeing as how I'm trying to build a Go application with devenv I figure it would be worth a shot. I have a project that I'm using devenv to manage the development environment, and I have everyithng setup already so I can build the project with What I do know from trial and error:
If it helps here is my default.nix file: | 15:34:39 | |
| 9 Jan 2025 | ||
In reply to@vendion:matrix.orginstallPhase should already both build and move the binary into $out/bin, so you shouldn't be overriding it like that in buildGoApplication | 00:46:45 | |
the only case where that wouldn't be true is if you don't have a package main, but it should complain I think | 00:47:13 | |
what's the output of tree $out after building everything without overriding any phase? | 00:47:25 | |
| also I think you're trying to modify the source directory to add the build output? you can't do that | 00:48:02 | |
$src is immutable | 00:48:16 | |
$src is immutable (practically it's an immutable snapshot of the source code at the point of building) | 00:48:36 | |
In reply to @diamondburned:matrix.orgYeah, that is exactly what I was trying to do. Okay I'll have to rethink my approach as I was wanting to be able to use a CI pipeline to build the artifacts and use them as downloadable releases. The end users are not using Nix so having to work out deployment strategy | 00:51:12 | |
so based on https://devenv.sh/outputs/#defining-outputs, devenv build's functionality is merely to build the packages and print out the outputs to stdout. if you want to make it also put that to a build artifact directory (why?), you might want to use a task to wrap it | 00:51:18 | |
In reply to@vendion:matrix.orgyou can put the path to a variable then give that to the artifact upload command | 00:51:44 | |
| are you using GHA? | 00:51:48 | |
consider something like echo "build_output=$(devenv build [optional name])" >> $GITHUB_OUTPUT then give build_output to the upload-artifacts action | 00:52:25 | |
| No, using SourceHut and their build process | 00:52:31 | |
consider something like echo "build_output=$(devenv build [optional name])" >> $GITHUB_OUTPUT then give build_output to the upload-artifacts action using gha variables | 00:52:32 | |
| hmm | 00:52:36 | |
| then you want an extra step to symlink the output path to a known constant path maybe | 00:53:37 | |
something like ln -s $(devenv build [package]) /tmp/build-output | 00:53:50 | |
or even cp -r if you hate that for some reason | 00:53:54 | |
In reply to @diamondburned:matrix.orgYeah, I was just thinking that | 00:54:13 | |
then you should be able to give it - /tmp/build-output/bin/$name | 00:54:14 | |
| Thanks for clarifying that, I think that approach should work for my use case. | 00:55:25 | |
| yeah np! | 00:55:30 | |
| 21 Jan 2025 | ||
| 00:26:13 | ||
| 12:11:12 | ||
| 25 Jan 2025 | ||
| 20:16:08 | ||
| 27 Jan 2025 | ||
| 20:02:30 | ||
so I have a derivation here where I'd like to disable building with CGO. Previously, I'd do CGO_ENABLED = 0, but now that warns: "specify CGO_ENABLED with env.CGO_ENABLED instead."; so now I'm setting env.CGO_ENABLED = 0; and am getting this error: "error: The env attribute set cannot contain any attributes passed to derivation. The following attributes are overlapping:- CGO_ENABLED: in env: 0; in derivation arguments: 1" | 20:04:30 | |
| here's the build in CI where that happens https://github.com/boinkor-net/hoopsnake/actions/runs/12997213156/job/36247707654?pr=80#step:5:323 and here's the PR: https://github.com/boinkor-net/hoopsnake/pull/80/files | 20:04:52 | |