add k3s-killall package

This commit is contained in:
James Andariese 2022-10-19 16:54:04 -05:00
parent 520f815651
commit 258b9ef494
8 changed files with 152 additions and 0 deletions

1
pkgs/k3s-killall.nix Normal file
View File

@ -0,0 +1 @@
import ./k3s-killall

4
pkgs/k3s-killall/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
.*
\#*
*~
!.gitignore

21
pkgs/k3s-killall/LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 James Andariese
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,26 @@
# `juicefs`
A nix flake involving juicefs.
## Usage
After [configuring your nix install to work with flakes][EnableFlakes]:
```bash
nix run github:kryptkitty/juicefs#
```
or
```bash
nix run github:kryptkitty/juicefs#juicefs
```
or, if you don't have nix and don't know if you want it yet, here's a docker command that will do the same
```bash
docker run -ti nixos/nix nix run github:kryptkitty/juicefs# --extra-experimental-features nix-command --extra-experimental-features flakes
```
[EnableFlakes]: https://nixos.wiki/wiki/Flakes#Enable_flakes

View File

@ -0,0 +1,28 @@
{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
''

View File

@ -0,0 +1,42 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1665259268,
"narHash": "sha256-ONFhHBLv5nZKhwV/F2GOH16197PbvpyWhoO0AOyktkU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c5924154f000e6306030300592f4282949b2db6c",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View File

@ -0,0 +1,23 @@
# to use this file as a template, search for EDIT and modify the associated variable as needed
{
# EDIT: package/flake description to be shared
description = "k3s-killall packaged as a flake";
# EDIT: set desired nixpkgs release to track
inputs.nixpkgs.url = "nixpkgs/nixos-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = ({ self, nixpkgs, flake-utils}:
(flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
# EDIT: bring in all the packages we're exposing
packages = pkgs.callPackage ./default.nix { inherit pkgs; };
# EDIT: set the default package when running the flake as `nix run repo#`
defaultPackage = packages.k3s-killall;
in { inherit packages defaultPackage; }
))
);
}

View File

@ -0,0 +1,7 @@
awk '
/create_killall[(][)] [{]/ {ka=1;}
ka && /^#!.*sh/ {p=1;}
ka && once && p && /EOF/ {p=0;once=0;}
once && p {print;}
BEGIN { once = 1;}
'