From c36b5d5799ca53519f3a8938eaa63863d27e32c7 Mon Sep 17 00:00:00 2001 From: 06kellyjac Date: Sun, 4 Oct 2020 15:32:20 +0100 Subject: [PATCH 1/4] kube3d: nixpkgs-fmt the file to fit contributing guidelines --- pkgs/applications/networking/cluster/kube3d/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/networking/cluster/kube3d/default.nix b/pkgs/applications/networking/cluster/kube3d/default.nix index 9421951547c..ee0c67c1d51 100644 --- a/pkgs/applications/networking/cluster/kube3d/default.nix +++ b/pkgs/applications/networking/cluster/kube3d/default.nix @@ -8,9 +8,9 @@ buildGoModule rec { excludedPackages = ''tools''; src = fetchFromGitHub { - owner = "rancher"; - repo = "k3d"; - rev = "v${version}"; + owner = "rancher"; + repo = "k3d"; + rev = "v${version}"; sha256 = "1pq5x4fyn98f01mzfjv335gx29c61zd85qc5vhx9rk27hi825ima"; }; From 7a03c0f5feceb6aaf1da2c48af172086730f0704 Mon Sep 17 00:00:00 2001 From: 06kellyjac Date: Sun, 4 Oct 2020 15:35:35 +0100 Subject: [PATCH 2/4] kube3d: add a longDescription to provide detail and help searches search.nixos.org was able to show me `deno` when searching for "executable" which was in the longDescription --- pkgs/applications/networking/cluster/kube3d/default.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/networking/cluster/kube3d/default.nix b/pkgs/applications/networking/cluster/kube3d/default.nix index ee0c67c1d51..68be8614cb0 100644 --- a/pkgs/applications/networking/cluster/kube3d/default.nix +++ b/pkgs/applications/networking/cluster/kube3d/default.nix @@ -36,7 +36,12 @@ buildGoModule rec { meta = with stdenv.lib; { homepage = "https://github.com/rancher/k3d"; - description = "A helper to run k3s (Lightweight Kubernetes. 5 less than k8s) in a docker container"; + longDescription = '' + k3s is the lightweight Kubernetes distribution by Rancher: rancher/k3s + + k3d creates containerized k3s clusters. This means, that you can spin up a + multi-node k3s cluster on a single machine using docker. + ''; license = licenses.mit; platforms = platforms.linux; maintainers = with maintainers; [ kuznero jlesquembre ngerstle jk ]; From 168df5f4ffab1ad33e4a953712ce001aeed5ee94 Mon Sep 17 00:00:00 2001 From: 06kellyjac Date: Sun, 4 Oct 2020 15:46:48 +0100 Subject: [PATCH 3/4] kube3d: mention k3d in the short description While I was able to find `deno` by searching for "executable" from it's longDescription on search.nixos.org, I couldn't find it using `nix search` `nix search` seems to only look at the short description so it's worth including there too. --- pkgs/applications/networking/cluster/kube3d/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/applications/networking/cluster/kube3d/default.nix b/pkgs/applications/networking/cluster/kube3d/default.nix index 68be8614cb0..31b23159054 100644 --- a/pkgs/applications/networking/cluster/kube3d/default.nix +++ b/pkgs/applications/networking/cluster/kube3d/default.nix @@ -36,6 +36,7 @@ buildGoModule rec { meta = with stdenv.lib; { homepage = "https://github.com/rancher/k3d"; + description = "A helper to run k3s (Lightweight Kubernetes. 5 less than k8s) in a docker container - k3d"; longDescription = '' k3s is the lightweight Kubernetes distribution by Rancher: rancher/k3s From cdfa9b0c26184fc6850a5f27ab14514427f3a87a Mon Sep 17 00:00:00 2001 From: 06kellyjac Date: Tue, 17 Nov 2020 22:53:44 +0000 Subject: [PATCH 4/4] kube3d: re-order the derivation and general cleanup Moved k3sVersion to be a variable. Converted buildFlagsArray to an array Moved vendorSha256 closer to src Moved doCheck between build and install related bits (like where the phase happens) Replaced stdenv.lib with lib --- .../networking/cluster/kube3d/default.nix | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/pkgs/applications/networking/cluster/kube3d/default.nix b/pkgs/applications/networking/cluster/kube3d/default.nix index 31b23159054..9163347d7b2 100644 --- a/pkgs/applications/networking/cluster/kube3d/default.nix +++ b/pkgs/applications/networking/cluster/kube3d/default.nix @@ -1,11 +1,13 @@ -{ stdenv, buildGoModule, fetchFromGitHub, installShellFiles }: +{ lib, buildGoModule, fetchFromGitHub, installShellFiles }: +let + k3sVersion = "1.19.3-k3s3"; +in buildGoModule rec { pname = "kube3d"; version = "3.3.0"; - k3sVersion = "1.19.3-k3s3"; - excludedPackages = ''tools''; + excludedPackages = "tools"; src = fetchFromGitHub { owner = "rancher"; @@ -14,15 +16,20 @@ buildGoModule rec { sha256 = "1pq5x4fyn98f01mzfjv335gx29c61zd85qc5vhx9rk27hi825ima"; }; - buildFlagsArray = '' - -ldflags= - -w -s - -X github.com/rancher/k3d/v3/version.Version=v${version} - -X github.com/rancher/k3d/v3/version.K3sVersion=v${k3sVersion} - ''; + vendorSha256 = null; nativeBuildInputs = [ installShellFiles ]; + buildFlagsArray = [ + "-ldflags=" + "-w" + "-s" + "-X github.com/rancher/k3d/v3/version.Version=v${version}" + "-X github.com/rancher/k3d/v3/version.K3sVersion=v${k3sVersion}" + ]; + + doCheck = false; + postInstall = '' installShellCompletion --cmd k3d \ --bash <($out/bin/k3d completion bash) \ @@ -30,11 +37,7 @@ buildGoModule rec { --zsh <($out/bin/k3d completion zsh) ''; - vendorSha256 = null; - - doCheck = false; - - meta = with stdenv.lib; { + meta = with lib; { homepage = "https://github.com/rancher/k3d"; description = "A helper to run k3s (Lightweight Kubernetes. 5 less than k8s) in a docker container - k3d"; longDescription = ''