kubernetes-deployments/scripts/default.nix

32 lines
812 B
Nix
Raw Normal View History

2024-10-28 15:05:06 +00:00
{
nixpkgs,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
2024-09-07 19:59:41 +00:00
pkgs = nixpkgs.legacyPackages.${system};
2024-10-28 15:05:06 +00:00
createScript = {
name,
runtimeInputs,
scriptPath,
extraWrapperFlags ? "",
...
}: let
script = (pkgs.writeScriptBin name (builtins.readFile scriptPath)).overrideAttrs (old: {
buildCommand = "${old.buildCommand}\n patchShebangs $out";
});
in
2024-09-07 19:59:41 +00:00
pkgs.symlinkJoin {
inherit name;
2024-10-28 15:05:06 +00:00
paths = [script] ++ runtimeInputs;
buildInputs = [pkgs.makeWrapper];
2024-09-07 19:59:41 +00:00
postBuild = "wrapProgram $out/bin/${name} --set PATH $out/bin ${extraWrapperFlags}";
};
2024-10-28 15:05:06 +00:00
in {
2024-09-07 19:59:41 +00:00
packages.gen-k3s-cert = createScript {
name = "create-k3s-cert";
2024-10-28 15:05:06 +00:00
runtimeInputs = with pkgs; [openssl coreutils openssh yq];
2024-09-07 19:59:41 +00:00
scriptPath = ./gen-k3s-cert.sh;
};
})