i execute go run main.go in terminal resulting in this
/nix/store/klw1ipjsqx1np7pkk833x7sad7f3ivv9-go-1.23.2/share/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/etc/profiles/per-user/yoda/bin/gcc -m64 -s -o $WORK/b001/exe/main -rdynamic /tmp/go-link-2957759374/go.o /tmp/go-link-2957759374/000000.o /tmp/go-link-2957759374/000001.o /tmp/go-link-2957759374/000002.o /tmp/go-link-2957759374/000003.o /tmp/go-link-2957759374/000004.o /tmp/go-link-2957759374/000005.o /tmp/go-link-2957759374/000006.o /tmp/go-link-2957759374/000007.o /tmp/go-link-2957759374/000008.o /tmp/go-link-2957759374/000009.o /tmp/go-link-2957759374/000010.o /tmp/go-link-2957759374/000011.o /tmp/go-link-2957759374/000012.o /tmp/go-link-2957759374/000013.o /tmp/go-link-2957759374/000014.o /tmp/go-link-2957759374/000015.o /tmp/go-link-2957759374/000016.o /tmp/go-link-2957759374/000017.o /tmp/go-link-2957759374/000018.o /tmp/go-link-2957759374/000019.o -O2 -g -lresolv -O2 -g -lpthread
/nix/store/vcvhwiilizhijk7ywyn58p9l005n9sbn-binutils-2.43.1/bin/ld: cannot find crt1.o: No such file or directory
/nix/store/vcvhwiilizhijk7ywyn58p9l005n9sbn-binutils-2.43.1/bin/ld: cannot find crti.o: No such file or directory
/nix/store/vcvhwiilizhijk7ywyn58p9l005n9sbn-binutils-2.43.1/bin/ld: cannot find -lgcc_s: No such file or directory
collect2: error: ld returned 1 exit status
i already installed gcc and glibc in both my home-manager and systemPackages.
but when i exec nix-shell -p glibc gcc then go run main.go, its working
same with exec nix develop then go run main.go with this flake.nix below
what is the problem?
{
description = "A Nix-flake-based Node.js development environment";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
};
outputs = { self , nixpkgs ,... }: let
system = "x86_64-linux";
in {
devShells."${system}".default = let
pkgs = import nixpkgs {
inherit system;
};
in pkgs.mkShell {
packages = with pkgs; [
gcc
glibc
go
];
shellHook = ''
echo 'ready to rock!';
'';
};
};
}