Compare commits

..

1 commit
main ... 0.1.0

Author SHA1 Message Date
f2c2be56b7
feat: add package.sealme and overlay 2023-09-03 18:34:56 +02:00
4 changed files with 13 additions and 44 deletions

View file

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

View file

@ -10,11 +10,9 @@ jobs:
tests: tests:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
- run: apt-get update && apt-get install -y sudo - uses: cachix/install-nix-action@v22
- 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.GH_TOKEN }} github_access_token: ${{ secrets.GITHUB_TOKEN }}
- run: nix build - run: nix build
- run: nix flake check - run: nix flake check

View file

@ -9,8 +9,9 @@
}; };
outputs = inputs @ {flake-parts, ...}: outputs = inputs @ {flake-parts, ...}:
flake-parts.lib.mkFlake {inherit inputs;} ({withSystem, ...}: { flake-parts.lib.mkFlake {inherit inputs;} {
imports = [ imports = [
inputs.flake-parts.flakeModules.easyOverlay
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"];
@ -33,7 +34,7 @@
packages.default = pkgs.buildGoApplication { packages.default = pkgs.buildGoApplication {
pname = "sealme"; pname = "sealme";
version = "0.2.0"; version = "0.1";
pwd = ./.; pwd = ./.;
src = ./.; src = ./.;
modules = ./gomod2nix.toml; modules = ./gomod2nix.toml;
@ -41,30 +42,6 @@
packages.sealme = config.packages.default; 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 = {
@ -81,16 +58,13 @@
gomod2nix gomod2nix
]; ];
}; };
overlayAttrs = {
inherit (config.packages) sealme;
};
}; };
flake = { flake = {
overlays.default = final: prev:
withSystem prev.stdenv.hostPlatform.system (
{config, ...}: {
sealme = config.packages.sealme;
ksecret = config.packages.ksecret;
}
);
}; };
}); };
} }

View file

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