I am building a go project using nix flake but it fails in buildPhase. I have no idea why but it builds fine when I run go build in dev shell.
The project: https://github.com/charmbracelet/freeze
{
description = "freeze";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
gomod2nix = {
url = "github:tweag/gomod2nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
};
outputs = {
self,
nixpkgs,
flake-utils,
gomod2nix,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
overlays = [gomod2nix.overlays.default];
#charm-freeze = pkgs.buildPackages.freeze;
in rec {
packages = {
charm-freeze = pkgs.stdenvNoCC.mkDerivation rec {
name = "freeze";
src = ./.;
#modules = ./gomod2nix.toml;
buildInputs = with pkgs; [
go
gomod2nix.packages.${system}.default
];
devShell = pkgs.mkShell {
name = "freeze";
};
#packages = pkgs.buildPackages.default;
buildPhase = ''
gomod2nix generate
go build
'';
installPhase = ''
mkdir $out/
cp freeze $out/
'';
};
};
defaultPackage = packages.charm-freeze;
});
}
Embed Notice
HTML Code
Corresponding Notice
- Embed this notice
Emi Yusa (gnuxeava@mk.absturztau.be)'s status on Friday, 29-Mar-2024 13:16:43 JSTEmi Yusa