Skip to content
This repository has been archived by the owner on Feb 26, 2025. It is now read-only.

Commit

Permalink
feat: Move talosctl from brew to nix
Browse files Browse the repository at this point in the history
  • Loading branch information
szinn committed Mar 21, 2024
1 parent 19e3ecf commit a05223e
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 10 deletions.
13 changes: 4 additions & 9 deletions .github/renovate/customManagers.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"regexManagers": [
{
"description": "Process various dependencies in YAML files",
"fileMatch": ["\\.ya?ml$"],
"description": ["Process various dependencies in YAML files"],
"fileMatch": [".+\\.ya?ml$",".+\\.nix$"],
"matchStrings": [
// Inline
"\\S+: \"?(?<currentValue>[^\"\\s]+)\"? # ?renovate: depName=(?<depName>\\S+)( datasource=(?<datasource>\\S+))?( versioning=(?<versioning>\\S+))?( extractVersion=(?<extractVersion>\\S+))?",
// Newline
"(?m:^\\s+# ?renovate: depName=(?<depName>\\S+)( datasource=(?<datasource>\\S+))?( versioning=(?<versioning>\\S+))?( extractVersion=(?<extractVersion>\\S+))?\\n[ \\t ]*? \\S+: \"?(?<currentValue>[^\" ]+)\"?$)",
// Old style newline
"(?m:^\\s+# ?renovate: datasource=(?<datasource>\\S+) depName=(?<depName>\\S+)( versioning=(?<versioning>\\S+))?( versionTemplate=(?<extractVersion>\\S+))?\\n[ \\t ]*? \\S+: \"?(?<currentValue>[^\" ]+)\"?$)"
"# renovate: datasource=(?<datasource>.*?) depName=(?<depName>.*?)( versioning=(?<versioning>.*=?))?( versionTemplate=(?<versionTemplate>.*=?))?\\n.*(\"?(?<currentValue>[^\"\\n]+=?)\"?)",
],
"datasourceTemplate": "{{#if datasource}}{{{datasource}}}{{else}}github-releases{{/if}}",
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}",
"extractVersionTemplate": "{{#if extractVersion}}{{{extractVersion}}}{{else}}^v?(?<version>.*)${{/if}}"
"extractVersionTemplate": "{{#if versionTemplate}}{{{versionTemplate}}}{{else}}{{/if}}"
}
]
}
1 change: 1 addition & 0 deletions homes/modules/devops/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ in {
minio-client
opentofu
pulumi-bin
talosctl
terraform
];

Expand Down
1 change: 0 additions & 1 deletion hosts/odin/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
brews = [
"postgresql@16"
"talhelper"
"talosctl"
];
casks = [
"1password"
Expand Down
6 changes: 6 additions & 0 deletions pkgs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Makefile to quickly iterate on building the overlays
build:
nix-build -E 'with import <nixpkgs> {}; callPackage ./default.nix {}'

clean:
rm result*
1 change: 1 addition & 0 deletions pkgs/default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{pkgs ? import <nixpkgs> {}}: rec {
tesla-auth = pkgs.callPackage ./tesla-auth.nix {};
talosctl = pkgs.callPackage ./talosctl.nix {};
}
52 changes: 52 additions & 0 deletions pkgs/talosctl.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
lib,
buildGo122Module,
fetchFromGitHub,
installShellFiles,
}:
buildGo122Module rec {
pname = "talosctl";
# renovate: datasource=docker depName=ghcr.io/siderolabs/installer
version = "1.6.6";

src = fetchFromGitHub {
owner = "siderolabs";
repo = "talos";
rev = "v${version}";
# hash = lib.fakeHash;
hash = "sha256-94oQe0wmrDU9MDWA1IdHDXu6ECtzQFHPh6dZhOvidUg==";
};

# vendorHash = lib.fakeHash;
vendorHash = "sha256-raBqjLoH7DwA8ZaO1tIR1JRWb27lHusHAwqJ5UQhxt4=";

ldflags = ["-s" "-w"];

# This is needed to deal with workspace issues during the build
overrideModAttrs = _: {
preConfigure = ''
export GOWORK=off
'';
};
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 = "A CLI for out-of-band management of Kubernetes nodes created by Talos";
homepage = "https://www.talos.dev/";
license = licenses.mpl20;
maintainers = with maintainers; [flokli];
};
}

0 comments on commit a05223e

Please sign in to comment.