From 9e0def2655871208b05878aff64fba4b6f135a54 Mon Sep 17 00:00:00 2001 From: Joseph Hanson Date: Thu, 4 Jul 2024 03:33:02 -0500 Subject: [PATCH] Full talosctl overlay for 1.7.5 and partial go 1.22.4 --- nixos/home/jahanson/workstation.nix | 2 +- nixos/overlays/default.nix | 11 ++++-- nixos/overlays/go/default.nix | 2 +- nixos/overlays/talosctl/default.nix | 3 +- nixos/overlays/talosctl/talosctl-custom.nix | 43 +++++++++++++++++++++ nixos/profiles/role-dev.nix | 1 + shell.nix | 1 - 7 files changed, 56 insertions(+), 7 deletions(-) create mode 100644 nixos/overlays/talosctl/talosctl-custom.nix diff --git a/nixos/home/jahanson/workstation.nix b/nixos/home/jahanson/workstation.nix index 09538f2..b68970f 100644 --- a/nixos/home/jahanson/workstation.nix +++ b/nixos/home/jahanson/workstation.nix @@ -33,7 +33,7 @@ with config; termius obsidian jetbrains.datagrip - # talosctl + talosctl # cli brightnessctl diff --git a/nixos/overlays/default.nix b/nixos/overlays/default.nix index 9bfb253..961b3f5 100644 --- a/nixos/overlays/default.nix +++ b/nixos/overlays/default.nix @@ -4,15 +4,20 @@ let inherit (inputs.nixpkgs) lib; }; termiusOverlay = import ./termius { }; - talosctlOverlay = import ./talosctl { }; + # Partial overlay + # talosctlOverlay = import ./talosctl { }; + # Full overlay + talosctlOverlay = self: super: { + talosctl = super.callPackage ./talosctl/talosctl-custom.nix { }; + }; goOverlay = import ./go { }; in { nur = inputs.nur.overlay; warp-terminal = warpTerminalOverlay; termius = termiusOverlay; - # talosctl = talosctlOverlay; - # go = goOverlay; + talosctl = talosctlOverlay; + go = goOverlay; # The unstable nixpkgs set (declared in the flake inputs) will # be accessible through 'pkgs.unstable' diff --git a/nixos/overlays/go/default.nix b/nixos/overlays/go/default.nix index 92b9d11..c0a51d2 100644 --- a/nixos/overlays/go/default.nix +++ b/nixos/overlays/go/default.nix @@ -3,7 +3,7 @@ let finalVersion = "1.22.4"; in (final: prev: { - go = prev.go.overrideAttrs (oldAttrs: { + go_1_22 = prev.go_1_22.overrideAttrs (oldAttrs: { version = finalVersion; src = prev.fetchurl { url = "https://go.dev/dl/go${finalVersion}.src.tar.gz"; diff --git a/nixos/overlays/talosctl/default.nix b/nixos/overlays/talosctl/default.nix index 387d84a..530ebc5 100644 --- a/nixos/overlays/talosctl/default.nix +++ b/nixos/overlays/talosctl/default.nix @@ -1,4 +1,4 @@ -{ ...}: +{ ... }: let finalVersion = "1.7.5"; in @@ -11,6 +11,7 @@ in rev = "v${finalVersion}"; hash = "sha256-lmDLlxiPyVhlSPplYkIaS5Uw19hir6XD8MAk8q+obhY="; }; + vendorHash = "sha256-8UIey+r1tdVRN1RBK5xxcAzaHb0VFdgenUXSFgoWh1g="; passthru = oldAttrs.passthru // { updateScript = ./update.sh; }; diff --git a/nixos/overlays/talosctl/talosctl-custom.nix b/nixos/overlays/talosctl/talosctl-custom.nix new file mode 100644 index 0000000..47f93c8 --- /dev/null +++ b/nixos/overlays/talosctl/talosctl-custom.nix @@ -0,0 +1,43 @@ +{ lib, buildGo122Module, fetchFromGitHub, installShellFiles }: + +buildGo122Module rec { + pname = "talosctl"; + version = "1.7.5"; + src = fetchFromGitHub { + owner = "siderolabs"; + repo = "talos"; + rev = "v${version}"; + hash = "sha256-lmDLlxiPyVhlSPplYkIaS5Uw19hir6XD8MAk8q+obhY="; + }; + + passthru = { + updateScript = ./update.sh; + }; + + vendorHash = "sha256-8UIey+r1tdVRN1RBK5xxcAzaHb0VFdgenUXSFgoWh1g="; + + ldflags = [ "-s" "-w" ]; + + env.GOWORK = "off"; + + subPackages = [ "cmd/talosctl" ]; + + nativeBuildInputs = [ installShellFiles ]; + + postInstall = '' + installShellCompletion --cmd talosctl \ + --bash <($out/bin/talosctl completion bash) \ + --fish <($out/bin/talosctl completion fish) \ + --zsh <($out/bin/talosctl completion zsh) + ''; + + doCheck = false; # no tests + + meta = with lib; { + description = "CLI for out-of-band management of Kubernetes nodes created by Talos"; + mainProgram = "talosctl"; + homepage = "https://www.talos.dev/"; + license = licenses.mpl20; + maintainers = with maintainers; [ flokli ]; + }; +} \ No newline at end of file diff --git a/nixos/profiles/role-dev.nix b/nixos/profiles/role-dev.nix index fc604b8..3b1146a 100644 --- a/nixos/profiles/role-dev.nix +++ b/nixos/profiles/role-dev.nix @@ -18,6 +18,7 @@ with config; nixpkgs-fmt statix gh + go # bind # for dns utils like named-checkconf inputs.nix-inspect.packages.${pkgs.system}.default diff --git a/shell.nix b/shell.nix index f55ffad..d1fc12c 100644 --- a/shell.nix +++ b/shell.nix @@ -17,7 +17,6 @@ pkgs.mkShell { NIX_CONFIG = "experimental-features = nix-command flakes"; nativeBuildInputs = with pkgs; [ - buildPackages.go_1_22 nix home-manager git