CASCADE/pkgs/k3s-killall/default.nix

29 lines
724 B
Nix
Raw Normal View History

2022-10-19 21:54:04 +00:00
{pkgs ? import "${import <cascade-local/nixpkgs-path.nix>}" {}, ...}:
with builtins;
with pkgs.lib;
let
shq = escapeShellArg;
installSh = fetchurl {
url = "https://raw.githubusercontent.com/k3s-io/k3s/master/install.sh";
sha256 = "0f26m5yqwpg8kvwyy2sqsd9kzzyf9jbffplqrsfk4mmwr25r2kvh";
};
in
pkgs.runCommand "k3s-killall" {
name = "k3s-killall";
version = "0f26m5yqwpg8kvwyy2sqsd9kzzyf9jbffplqrsfk4mmwr25r2kvh";
} ''
set -x
set -e
mkdir -p $out/bin
cat ${shq installSh} | awk '
/create_killall[(][)] [{]/ {ka=1;}
ka && /^#!.*sh/ {p=1;}
ka && once && p && /EOF/ {p=0;once=0;}
once && p {print;}
BEGIN { once = 1;}
' > $out/bin/k3s-killall
chmod +x $out/bin/k3s-killall
''