I’m trying to package GitHub - gravitl/netmaker: Netmaker makes networks with WireGuard. Netmaker automates fast, secure, and distributed virtual networks., which will be my first package. I’m nearly successful but have a bit of learning still to go.
I have a successful build doing nix-build. I see the result/bin/netclient package, and if I run it directly it works! However, if I type nix-shell to “activate” it, I get the following errors:
ln: failed to create symbolic link '/run/user/1000/tmp.AcxDXIfgUZ-netclient-0433347c629cfb3e99283dd31d21cebefc3e8251/src/github.com/cpuguy83/go-md2man/v2': Read-only file system
ln: failed to create symbolic link '/run/user/1000/tmp.AcxDXIfgUZ-netclient-0433347c629cfb3e99283dd31d21cebefc3e8251/src/github.com/russross/blackfriday/v2': Read-only file system
ln: failed to create symbolic link '/run/user/1000/tmp.AcxDXIfgUZ-netclient-0433347c629cfb3e99283dd31d21cebefc3e8251/src/golang.zx2c4.com/wireguard/wgctrl': Read-only file system
These are indeed 3 of the dependencies that I generated using vgo2nix.
In the nix-shell netclient is not available, presumably due to the errors.
Here is the project folder I’ve come up with so far:
default.nix
with import <nixpkgs> {};
callPackage ./netclient.nix {}
netclient.nix
{ buildGoPackage, fetchFromGitHub, lib }:
buildGoPackage rec {
name = "netclient-${version}";
#version = "v0.8.5" # github won't download properly for some reason
version = "0433347c629cfb3e99283dd31d21cebefc3e8251"; # v0.8.5
goPackagePath = "github.com/gravitl/netmaker"; # Incomplete
subPackages = [ "netclient" ];
src = fetchFromGitHub {
owner = "gravitl";
repo = "netmaker";
rev = "${version}";
#sha256 = lib.fakeSha256;
sha256 = "sha256:05m1bd84mycw2kmxbn6rs5rblzv2gk8h67dcx7yxvivxh9y9agin";
};
goDeps = ./deps.nix;
#buildFlags = "";
}
deps.nix
# file generated from go.mod using vgo2nix (https://github.com/nix-community/vgo2nix)
[
{
goPackagePath = "cloud.google.com/go";
fetch = {
type = "git";
url = "https://github.com/googleapis/google-cloud-go";
rev = "v0.34.0";
sha256 = "1kclgclwar3r37zbvb9gg3qxbgzkb50zk3s9778zlh2773qikmai";
moduleDir = "";
};
}
...
I’ve omitted the rest of the auto-generated deps.nix