Open ldeck opened 4 years ago
As per the above linked discourse discussion, the following two options seem to do the trick:
{ stdenv, fetchFromGitHub, go, lib }:
stdenv.mkDerivation rec {
name = "kr-${version}";
version = "2.4.15";
src = fetchFromGitHub {
owner = "kryptco";
repo = "kr";
rev = "1937e31606e4dc0f7263133334d429f956502276";
sha256 = "13ch85f1y4j2n4dbc6alsxbxfd6xnidwi2clibssk5srkz3mx794";
};
buildInputs = [ go ];
makeFlags = [
"PREFIX=$(out)"
"GOPATH=$(out)/share/go"
"GOCACHE=$(TMPDIR)/go-cache"
];
preInstall = ''
mkdir -p $out/share/go
'';
meta = with lib; {
description = "A dev tool for SSH auth + Git commit/tag signing using a key stored in Krypton.";
homepage = "https://krypt.co";
license = licenses.unfreeRedistributable;
platforms = platforms.linux ++ platforms.darwin;
};
}
The other option, was to use vgo2nix from the src
directory to generate a deps.nix
file.
The recommended approach for go modules is to use the buildGoModule
function with the given nix dependencies deps.nix
.
{ buildGoModule, fetchFromGitHub, lib }:
buildGoModule rec {
name = "kr-${version}";
version = "2.4.15";
src = fetchFromGitHub {
owner = "kryptco";
repo = "kr";
rev = "1937e31606e4dc0f7263133334d429f956502276";
sha256 = "13ch85f1y4j2n4dbc6alsxbxfd6xnidwi2clibssk5srkz3mx794";
};
modRoot = "./src";
goDeps = ./deps.nix;
modSha256 = "1q6vhdwz26qkpzmsnk6d9j6hjgliwkgma50mq7w2rl6rkwashvay";
meta = with lib; {
description = "A dev tool for SSH auth + Git commit/tag signing using a key stored in Krypton.";
homepage = "https://krypt.co";
license = licenses.unfreeRedistributable;
platforms = platforms.linux ++ platforms.darwin;
};
}
Does kryptco have interest in maintaining/contributing a derivation to nixpkgs for kr?
The one question worth answering is with respect to the license.
Hi @ldeck, thank you! We're not currently interested in maintaining a nix package for kr but we're open to third party maintainers and can help with feedback/technical information about how kr works.
I’m looking to install kr via nix.
There isn’t a package / derivation for kr as yet.
My WIP derivation looks like this so far:
/tmp/kr/default.nix
$ nix-build -E 'with import <nixpkgs> { }; callPackage ./default.nix { }’
This fails as follows:
I’m relatively new to nix, but it’d be great to have kr officially available via it.
Any help in fixing the above derivation?
See also https://discourse.nixos.org/t/help-creating-a-makefile-derivation-for-kryptco-kr-2fa-with-go-modules/6085.
Things I assume need solving / confirmation: