aboutsummaryrefslogtreecommitdiffstats
path: root/home/root
diff options
context:
space:
mode:
Diffstat (limited to 'home/root')
-rw-r--r--home/root/arrakis.nix65
-rw-r--r--home/root/caladan.nix14
-rw-r--r--home/root/common/core/default.nix1
-rw-r--r--home/root/common/core/git.nix3
-rw-r--r--home/root/common/core/ssh.nix5
-rw-r--r--home/root/common/core/zsh/default.nix5
-rw-r--r--home/root/darkstar.nix6
-rw-r--r--home/root/fangorn.nix10
-rw-r--r--home/root/kaitain.nix4
-rw-r--r--home/root/richese.nix4
10 files changed, 108 insertions, 9 deletions
diff --git a/home/root/arrakis.nix b/home/root/arrakis.nix
index d9d9162..ea918fe 100644
--- a/home/root/arrakis.nix
+++ b/home/root/arrakis.nix
@@ -5,7 +5,69 @@
];
home.file = {
+ "bin/games-fw" = {
+ executable = true;
+ text = ''
+ #!${pkgs.zsh}/bin/zsh
+
+ # load module to parse command line arguments
+ zmodload zsh/zutil
+ zparseopts -D -E -A opts -- d h l x
+
+ # enable XTRACE shell option for full debugging output of scripts
+ if (( ''${+opts[-x]} )); then
+ set -x
+ fi
+
+ if ! (( ''${+opts[-l]} )) && [[ -z "''${1}" ]] || (( ''${+opts[-h]} )); then
+ echo "usage: ''${0:t} [ -h ] [ -x ] { -d handle | -l | cidr }" >&2
+ echo '
+ -d delete a rule by handle; handle must be specified ( nft -a list ruleset )
+ -h this message
+ -l list games chain
+ -x enable shell debugging
+ cidr IPv4 host or CIDR network address
+ ' >&2
+ exit 1
+ fi
+
+ function list_games_chain {
+ nft -a list ruleset | sed -ne '/\tchain games {/,/\t}$/p'
+ }
+
+ if (( ''${+opts[-d]} )); then
+
+ handle="''${1}"
+ rule=$(nft -a list ruleset | grep ' # handle '"''${handle}"'$')
+
+ if [[ -z "''${rule}" ]]; then
+ echo 'no matching handle found!' >&2
+ exit 1
+ else
+
+ nft delete rule inet nixos-fw games handle ''${handle}
+ list_games_chain
+
+ fi
+
+ elif (( ''${+opts[-l]} )); then
+
+ list_games_chain
+
+ else
+
+ cidr="''${1}"
+ nft insert rule inet nixos-fw games 'ip saddr '"''${cidr}"' counter accept'
+ list_games_chain
+
+ fi
+
+ exit 0
+ '';
+ };
+
"bin/knock".source = ../common/scripts/knock;
+
"bin/vpnctl" = {
executable = true;
text = ''
@@ -20,7 +82,8 @@
function start_vpn {
- ip netns add vpn
+ ip netns add vpn
+ ip netns exec vpn ip link set lo up
ip link add veth.host type veth peer veth.vpn
ip link set dev veth.host up
ip link set veth.vpn netns vpn up
diff --git a/home/root/caladan.nix b/home/root/caladan.nix
new file mode 100644
index 0000000..228bb90
--- /dev/null
+++ b/home/root/caladan.nix
@@ -0,0 +1,14 @@
+{ config, inputs, lib, outputs, pkgs, ... }:
+{
+ imports = [
+ common/core
+ ];
+
+ home.file = {
+ "bin/knock".source = ../common/scripts/knock;
+ };
+
+ nix.extraOptions = ''
+ !include /run/secrets/nix-access-token-github
+ '';
+}
diff --git a/home/root/common/core/default.nix b/home/root/common/core/default.nix
index e2ca7c5..3043d2c 100644
--- a/home/root/common/core/default.nix
+++ b/home/root/common/core/default.nix
@@ -3,7 +3,6 @@
imports = [
./bash.nix
./git.nix
- #./ssh.nix
./tmux
./vim
./zsh
diff --git a/home/root/common/core/git.nix b/home/root/common/core/git.nix
index 49e10df..31af80e 100644
--- a/home/root/common/core/git.nix
+++ b/home/root/common/core/git.nix
@@ -1,6 +1,7 @@
{
programs.git = {
enable = true;
- extraConfig.pull.rebase = true;
+ settings.pull.rebase = true;
+ signing.format = null;
};
}
diff --git a/home/root/common/core/ssh.nix b/home/root/common/core/ssh.nix
deleted file mode 100644
index 929cc51..0000000
--- a/home/root/common/core/ssh.nix
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- programs.ssh = {
- enable = true;
- };
-}
diff --git a/home/root/common/core/zsh/default.nix b/home/root/common/core/zsh/default.nix
index eaec714..58b0c34 100644
--- a/home/root/common/core/zsh/default.nix
+++ b/home/root/common/core/zsh/default.nix
@@ -1,3 +1,4 @@
+{ pkgs, ... }:
{
programs.zsh = {
enable = true;
@@ -19,8 +20,9 @@ export COLORFGBG=";0"
save = 100000;
size = 100000;
};
- initExtra = (builtins.readFile ./zshrc);
+ initContent = (builtins.readFile ./zshrc);
shellAliases = {
+ ftp = "${pkgs.inetutils}/bin/ftp";
grep = "grep --color=auto";
ip = "ip -c=auto";
la = "ls -aF --color=auto";
@@ -28,6 +30,7 @@ export COLORFGBG=";0"
nix-list-derivations = "nix-store --query --requisites /run/current-system | cut -d- -f2- | sort | uniq";
nix-list-generations = "nixos-rebuild list-generations | cat; echo; nix-env --list-generations --profile /nix/var/nix/profiles/system";
pstrace = "bpftrace -e 'tracepoint:syscalls:sys_enter_exec*{ printf(\"pid: %d, comm: %s, args: \", pid, comm); join(args->argv); }'";
+ telnet = "${pkgs.inetutils}/bin/telnet";
zgrep = "zgrep --color=auto";
};
};
diff --git a/home/root/darkstar.nix b/home/root/darkstar.nix
index 72dbda0..7399284 100644
--- a/home/root/darkstar.nix
+++ b/home/root/darkstar.nix
@@ -1,5 +1,11 @@
{ inputs, lib, pkgs, config, outputs, ... }:
{
+ home = {
+ file = {
+ "bin/knock".source = ../common/scripts/knock;
+ };
+ };
+
imports = [
common/core
];
diff --git a/home/root/fangorn.nix b/home/root/fangorn.nix
new file mode 100644
index 0000000..72dbda0
--- /dev/null
+++ b/home/root/fangorn.nix
@@ -0,0 +1,10 @@
+{ inputs, lib, pkgs, config, outputs, ... }:
+{
+ imports = [
+ common/core
+ ];
+
+ nix.extraOptions = ''
+ !include /run/secrets/nix-access-token-github
+ '';
+}
diff --git a/home/root/kaitain.nix b/home/root/kaitain.nix
index 72dbda0..cb4ed48 100644
--- a/home/root/kaitain.nix
+++ b/home/root/kaitain.nix
@@ -4,6 +4,10 @@
common/core
];
+ home.file = {
+ "bin/knock".source = ../common/scripts/knock;
+ };
+
nix.extraOptions = ''
!include /run/secrets/nix-access-token-github
'';
diff --git a/home/root/richese.nix b/home/root/richese.nix
index 72dbda0..cb4ed48 100644
--- a/home/root/richese.nix
+++ b/home/root/richese.nix
@@ -4,6 +4,10 @@
common/core
];
+ home.file = {
+ "bin/knock".source = ../common/scripts/knock;
+ };
+
nix.extraOptions = ''
!include /run/secrets/nix-access-token-github
'';