Compare commits

...

8 commits
0.1.0 ... main

4 changed files with 48 additions and 8 deletions

View file

@ -11,10 +11,10 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v4 uses: actions/setup-go@v5
with: with:
go-version: '1.21' go-version: '1.21'

View file

@ -10,9 +10,11 @@ jobs:
tests: tests:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: cachix/install-nix-action@v22 - run: apt-get update && apt-get install -y sudo
- run: mkdir /var/empty && chown root:root /var/empty && chmod 555 /var/empty
- uses: cachix/install-nix-action@v25
with: with:
github_access_token: ${{ secrets.GITHUB_TOKEN }} github_access_token: ${{ secrets.GH_TOKEN }}
- run: nix build - run: nix build
- run: nix flake check - run: nix flake check

View file

@ -9,11 +9,12 @@
}; };
outputs = inputs @ {flake-parts, ...}: outputs = inputs @ {flake-parts, ...}:
flake-parts.lib.mkFlake {inherit inputs;} { flake-parts.lib.mkFlake {inherit inputs;} ({withSystem, ...}: {
imports = [ imports = [
inputs.treefmt-nix.flakeModule inputs.treefmt-nix.flakeModule
]; ];
systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"]; systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"];
perSystem = { perSystem = {
config, config,
self', self',
@ -32,12 +33,38 @@
packages.default = pkgs.buildGoApplication { packages.default = pkgs.buildGoApplication {
pname = "sealme"; pname = "sealme";
version = "0.1"; version = "0.2.0";
pwd = ./.; pwd = ./.;
src = ./.; src = ./.;
modules = ./gomod2nix.toml; modules = ./gomod2nix.toml;
}; };
packages.sealme = config.packages.default;
packages.ksecret = let
build-inputs = with pkgs; [kubectl yq-go];
script = (pkgs.writeScriptBin "ksecret" (builtins.readFile ./scripts/ksecret.sh)).overrideAttrs (old: {
buildComamnd = "${old.buildCommand}\n patchShebangs $out";
});
completion-zsh =
pkgs.writeTextDir "share/zsh/site-functions/_ksecret"
''
compdef _ksecret ksecret
_ksecret() {
service=kubectl
CURRENT+=2
words="kubectl get secrets ''${words[@]:1}"
_kubectl
}
'';
in
pkgs.symlinkJoin {
name = "ksecret";
paths = [script completion-zsh];
buildInputs = [pkgs.makeWrapper];
postBuild = "wrapProgram $out/bin/ksecret --prefix PATH : ${pkgs.lib.makeBinPath build-inputs}";
};
treefmt = { treefmt = {
projectRootFile = ".git/config"; projectRootFile = ".git/config";
programs = { programs = {
@ -55,7 +82,15 @@
]; ];
}; };
}; };
flake = { flake = {
}; overlays.default = final: prev:
}; withSystem prev.stdenv.hostPlatform.system (
{config, ...}: {
sealme = config.packages.sealme;
ksecret = config.packages.ksecret;
}
);
};
});
} }

3
scripts/ksecret.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
kubectl get secrets $@ -o yaml | yq '.stringData = .data | del(.data) | .stringData.* |= @base64d'