more cleanup

This commit is contained in:
xunuwu 2025-01-12 15:48:32 +01:00
parent 6cf86a3827
commit 88f9bd9dd7
Signed by: xun
SSH key fingerprint: SHA256:Uot/1WoAjWAeqLOHA5vYy4phhVydsH7jCPmBjaPZfgI
36 changed files with 59 additions and 627 deletions

144
flake.lock generated
View file

@ -144,22 +144,6 @@
}
},
"flake-compat_3": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_4": {
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
@ -173,7 +157,7 @@
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
}
},
"flake-compat_5": {
"flake-compat_4": {
"flake": false,
"locked": {
"lastModified": 1696426674,
@ -269,11 +253,11 @@
"systems": "systems_2"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"lastModified": 1726560853,
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
"type": "github"
},
"original": {
@ -287,11 +271,11 @@
"systems": "systems_3"
},
"locked": {
"lastModified": 1726560853,
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
@ -319,24 +303,6 @@
}
},
"flake-utils_6": {
"inputs": {
"systems": "systems_5"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_7": {
"inputs": {
"systems": [
"stylix",
@ -393,11 +359,11 @@
]
},
"locked": {
"lastModified": 1733318908,
"narHash": "sha256-SVQVsbafSM1dJ4fpgyBqLZ+Lft+jcQuMtEL3lQWx2Sk=",
"lastModified": 1734797603,
"narHash": "sha256-ulZN7ps8nBV31SE+dwkDvKIzvN6hroRY8sYOT0w+E28=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "6f4e2a2112050951a314d2733a994fbab94864c6",
"rev": "f0f0dc4920a903c3e08f5bdb9246bb572fcae498",
"type": "github"
},
"original": {
@ -490,11 +456,11 @@
]
},
"locked": {
"lastModified": 1733389730,
"narHash": "sha256-KZMu4ddMll5khS0rYkJsVD0hVqjMNHlhTM3PCQar0Ag=",
"lastModified": 1734862405,
"narHash": "sha256-bXZJvUMJ2A6sIpYcCUAGjYCD5UDzmpmQCdmJSkPhleU=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "65912bc6841cf420eb8c0a20e03df7cbbff5963f",
"rev": "cb27edb5221d2f2920a03155f8becc502cf60e35",
"type": "github"
},
"original": {
@ -585,11 +551,11 @@
]
},
"locked": {
"lastModified": 1733351379,
"narHash": "sha256-MTMsAhXxMMVHVN99jT8E0afOAOtt3JQWjYpTja94PAU=",
"lastModified": 1733570843,
"narHash": "sha256-sQJAxY1TYWD1UyibN/FnN97paTFuwBw3Vp3DNCyKsMk=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "55d07816a0944f06a9df5ef174999a72fa4060c7",
"rev": "a35b08d09efda83625bef267eb24347b446c80b8",
"type": "github"
},
"original": {
@ -618,7 +584,7 @@
"type": "github"
}
},
"nix-vscode-extensions": {
"nixos-wsl": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils_3",
@ -626,28 +592,6 @@
"nixpkgs"
]
},
"locked": {
"lastModified": 1733536536,
"narHash": "sha256-gTlpRSELDSHMRa1/BwZR7eX5mka5y3YQbb1efLuyovs=",
"owner": "nix-community",
"repo": "nix-vscode-extensions",
"rev": "7aa26ebccf778efe880fda1290db9c1da56ffa4f",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nix-vscode-extensions",
"type": "github"
}
},
"nixos-wsl": {
"inputs": {
"flake-compat": "flake-compat_2",
"flake-utils": "flake-utils_4",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1733516684,
"narHash": "sha256-yz3mZyTnPlxZW2f51kJyfofDsBeX7WxAPvTXZtr2lW4=",
@ -714,7 +658,7 @@
"nixvim": {
"inputs": {
"devshell": "devshell",
"flake-compat": "flake-compat_4",
"flake-compat": "flake-compat_3",
"flake-parts": "flake-parts_2",
"git-hooks": "git-hooks",
"home-manager": "home-manager_2",
@ -727,11 +671,11 @@
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1733498727,
"narHash": "sha256-R+n4JfXjGrJG2gbhJPsZPTwdDsHoJvwxxpWcRY4KjyQ=",
"lastModified": 1735378670,
"narHash": "sha256-A8aQA+YhJfA8mUpzXOZdlXNnKiZg2EcpCn1srgtBjTs=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "ae78face8d6a09abe2504d41c035b6460c15a17b",
"rev": "f4b0b81ef9eb4e37e75f32caf1f02d5501594811",
"type": "github"
},
"original": {
@ -742,7 +686,7 @@
},
"nuschtosSearch": {
"inputs": {
"flake-utils": "flake-utils_6",
"flake-utils": "flake-utils_5",
"ixx": "ixx",
"nixpkgs": [
"nvim-nix",
@ -751,11 +695,11 @@
]
},
"locked": {
"lastModified": 1733411491,
"narHash": "sha256-315rJ7O9cOllPDaFscnJhcMleORHbxon0Kq9LAKJ5p4=",
"lastModified": 1733773348,
"narHash": "sha256-Y47y+LesOCkJaLvj+dI/Oa6FAKj/T9sKVKDXLNsViPw=",
"owner": "NuschtOS",
"repo": "search",
"rev": "68e9fad70d95d08156cf10a030bd39487bed8ffe",
"rev": "3051be7f403bff1d1d380e4612f0c70675b44fc9",
"type": "github"
},
"original": {
@ -766,8 +710,8 @@
},
"nvfetcher": {
"inputs": {
"flake-compat": "flake-compat_3",
"flake-utils": "flake-utils_5",
"flake-compat": "flake-compat_2",
"flake-utils": "flake-utils_4",
"nixpkgs": [
"nixpkgs"
]
@ -794,11 +738,11 @@
"nixvim": "nixvim"
},
"locked": {
"lastModified": 1733583273,
"narHash": "sha256-RaRZYTK+hU8X8BZq16Xek1EZBgIB6B6RUVrN+mBlT7E=",
"lastModified": 1736692407,
"narHash": "sha256-KiqAcwCXi6vEf1W74SfZWgiWV8oxr4uD8aALP4e23+k=",
"owner": "xunuwu",
"repo": "nvim-nix",
"rev": "82e25c9a056bea6a5edc5df35d443df9b0167c92",
"rev": "8ae275a311eb7b1f5b82c540f653a45742d7d256",
"type": "github"
},
"original": {
@ -815,7 +759,6 @@
"home-manager": "home-manager",
"microvm": "microvm",
"nix-index-database": "nix-index-database",
"nix-vscode-extensions": "nix-vscode-extensions",
"nixos-wsl": "nixos-wsl",
"nixpkgs": "nixpkgs",
"nvfetcher": "nvfetcher",
@ -886,12 +829,12 @@
"base16-fish": "base16-fish",
"base16-helix": "base16-helix",
"base16-vim": "base16-vim",
"flake-compat": "flake-compat_5",
"flake-utils": "flake-utils_7",
"flake-compat": "flake-compat_4",
"flake-utils": "flake-utils_6",
"gnome-shell": "gnome-shell",
"home-manager": "home-manager_3",
"nixpkgs": "nixpkgs_3",
"systems": "systems_6",
"systems": "systems_5",
"tinted-foot": "tinted-foot",
"tinted-kitty": "tinted-kitty",
"tinted-tmux": "tinted-tmux"
@ -985,21 +928,6 @@
"type": "github"
}
},
"systems_6": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"tinted-foot": {
"flake": false,
"locked": {
@ -1059,11 +987,11 @@
]
},
"locked": {
"lastModified": 1733440889,
"narHash": "sha256-qKL3vjO+IXFQ0nTinFDqNq/sbbnnS5bMI1y0xX215fU=",
"lastModified": 1734704479,
"narHash": "sha256-MMi74+WckoyEWBRcg/oaGRvXC9BVVxDZNRMpL+72wBI=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "50862ba6a8a0255b87377b9d2d4565e96f29b410",
"rev": "65712f5af67234dad91a5a4baee986a8b62dbf8f",
"type": "github"
},
"original": {

View file

@ -55,7 +55,6 @@
};
sops-nix.url = "github:Mic92/sops-nix";
nix-index-database.url = "github:Mic92/nix-index-database";
nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions";
nixos-wsl.url = "github:nix-community/NixOS-WSL/main";
nvfetcher.url = "github:berberman/nvfetcher";
microvm.url = "github:astro/microvm.nix";
@ -68,7 +67,6 @@
nixpkgs.follows = "nixpkgs";
};
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
nix-vscode-extensions.inputs.nixpkgs.follows = "nixpkgs";
nixos-wsl.inputs.nixpkgs.follows = "nixpkgs";
nvfetcher.inputs.nixpkgs.follows = "nixpkgs";
microvm.inputs.nixpkgs.follows = "nixpkgs";

View file

@ -1,7 +0,0 @@
{
imports = [
./nix.nix
./docs.nix
./lsps.nix
];
}

View file

@ -1,5 +0,0 @@
{pkgs, ...}: {
home.packages = with pkgs; [
clang-tools # clangd
];
}

View file

@ -1,26 +0,0 @@
{
pkgs,
inputs,
...
}: let
exts = inputs.nix-vscode-extensions.extensions.${pkgs.system};
vsce = exts.vscode-marketplace;
ovsx = exts.open-vsx;
in {
programs.vscode = {
enable = true;
enableUpdateCheck = false;
enableExtensionUpdateCheck = false;
package = pkgs.vscodium;
mutableExtensionsDir = true;
extensions = with vsce; [
vadimcn.vscode-lldb
mkhl.direnv
editorconfig.editorconfig
pkief.material-icon-theme
eamodio.gitlens
hediet.debug-visualizer
];
};
}

View file

@ -1,19 +0,0 @@
{
lib,
pkgs,
...
}: {
stylix.targets = {
firefox.profileNames = ["xun"];
};
gtk = {
# theme = lib.mkForce {
# package = pkgs.whitesur-gtk-theme;
# name = "WhiteSur-Dark";
# };
iconTheme = {
name = "WhiteSur-dark";
package = pkgs.whitesur-icon-theme;
};
};
}

View file

@ -23,7 +23,6 @@
../../editors/emacs.nix
../../editors/nvim.nix
../../editors/vscode.nix
../../editors/jetbrains
../../editors/jetbrains/android-studio.nix
@ -57,36 +56,28 @@
../../programs/misc/discord.nix
../../programs/misc/obs.nix
../../programs/misc/krita.nix
#../../programs/misc/ardour.nix
../../programs/misc/foliate.nix
../../programs/misc/blender.nix
../../programs/misc/obsidian.nix
../../programs/misc/pwvucontrol.nix
../../programs/misc/qpwgraph.nix
../../programs/misc/libreoffice.nix
# ../../programs/misc/thunderbird.nix
#../../programs/music
#../../programs/music/yams.nix
# ../../programs/music/spotify.nix
../../programs/music/puddletag.nix
../../programs/music/picard.nix
../../programs/music/cmus.nix
../../programs/media
../../programs/media/mpv.nix
../../programs/media/jellyfin.nix
# gaming
../../programs/games
../../programs/games/lutris.nix
../../programs/games/heroic.nix
../../programs/games/minecraft.nix
../../programs/games/roblox.nix
../../programs/games/krunker.nix
#../../programs/games/ludusavi.nix
# ./dark.nix
# media services
../../services/media/playerctl.nix
# system services
../../services/system/polkit-agent.nix
../../services/system/udiskie.nix # although i dont need this for usb memory, it is quite convenient for flashing qmk
../../services/playerctl.nix
../../services/polkit-agent.nix
../../services/udiskie.nix # although i dont need this for usb memory, it is quite convenient for flashing qmk
];
qt = {

View file

@ -10,7 +10,6 @@
../common/wob.nix
../common/wl-clipboard.nix
./waybar.nix
./headless-remote.nix
];
services.cliphist = {
@ -99,7 +98,6 @@
in
lib.mkOptionDefault (
{
"${mod}+m" = "exec ${pkgs.nwg-launchers}/bin/nwggrid";
"${mod}+n" = "exec ${pkgs.swaynotificationcenter}/bin/swaync-client -t";
"${mod}+Shift+v" = "exec ${lib.getExe pkgs.cliphist} list | ${lib.getExe pkgs.wofi} --dmenu | ${lib.getExe pkgs.cliphist} decode | ${pkgs.wl-clipboard}/bin/wl-copy";
"${mod}+Ctrl+${dir.left}" = "focus output left";

View file

@ -1,41 +0,0 @@
{pkgs, ...}: {
## TODO MAKE THIS REMOVE ALL PREV HEADLESS MONITORS
home.packages = [
(pkgs.writeShellApplication {
name = "xun-start-headless";
runtimeInputs = [pkgs.sway pkgs.wayvnc pkgs.jq];
text = ''
headless_numbers() {
swaymsg -t get_outputs | jq -r '.[].name | select (. | startswith("HEADLESS-")) | ltrimstr("HEADLESS-")'
}
new_lines() {
diff <(echo "$1") <(echo "$2") | grep -E "^>" | cut -c3- || true
}
create_output() {
outputs1=$(headless_numbers)
swaymsg create_output >/dev/null
outputs2=$(headless_numbers)
new_lines "$outputs1" "$outputs2"
}
remove_outputs() {
for n in $(headless_numbers); do
swaymsg output "HEADLESS-$n" unplug
done
}
remove_outputs
outputid=$(create_output)
swaymsg output "HEADLESS-$outputid" scale 2
swaymsg output "HEADLESS-$outputid" mode "2400x1080@30Hz"
swaymsg output "HEADLESS-$outputid" position "0 1080" # below primary monitor
wayvnc --gpu -o "HEADLESS-$outputid" 0.0.0.0
'';
})
];
}

View file

@ -3,11 +3,6 @@
self,
...
}: {
home.packages = with pkgs; [
heroic
lutris
prismlauncher
self.packages.${pkgs.system}.gamesand
];
home.packages = [self.packages.${pkgs.system}.gamesand];
programs.mangohud.enable = true;
}

View file

@ -0,0 +1,3 @@
{pkgs, ...}: {
home.packages = with pkgs; [heroic];
}

View file

@ -1,6 +0,0 @@
{pkgs, ...}: {
home.packages = with pkgs; [
ludusavi
rclone
];
}

View file

@ -0,0 +1,3 @@
{pkgs, ...}: {
home.packages = with pkgs; [lutris];
}

View file

@ -0,0 +1,3 @@
{pkgs, ...}: {
home.packages = with pkgs; [prismlauncher];
}

View file

@ -1,5 +0,0 @@
{
imports = [
./mpv.nix
];
}

View file

@ -1,7 +0,0 @@
{pkgs, ...}: {
home.packages = with pkgs; [
ardour
lsp-plugins
sunvox
];
}

View file

@ -1,8 +0,0 @@
{
programs.thunderbird = {
enable = true;
profiles.xun = {
isDefault = true;
};
};
}

View file

@ -1,6 +0,0 @@
{
imports = [
./mpd.nix
./ncmpcpp.nix
];
}

View file

@ -1,26 +0,0 @@
{
pkgs,
config,
...
}: {
services.mpd = {
enable = true;
extraConfig = ''
audio_output {
type "pipewire"
name "PipeWire Sound Server"
}
audio_output {
type "fifo"
name "Visualizer feed"
path "/tmp/mpd.fifo"
format "44100:16:2"
}
replaygain "track"
'';
musicDirectory = config.xdg.userDirs.music;
};
home.packages = [pkgs.mpc-cli];
}

View file

@ -1,48 +0,0 @@
{pkgs, ...}: {
programs.ncmpcpp = {
enable = true;
package = pkgs.ncmpcpp.override {
visualizerSupport = true;
clockSupport = true;
};
bindings = [
{
key = "j";
command = "scroll_down";
}
{
key = "k";
command = "scroll_up";
}
{
key = "J";
command = ["select_item" "scroll_down"];
}
{
key = "K";
command = ["select_item" "scroll_up"];
}
];
settings = {
## Visualizer
visualizer_data_source = "/tmp/mpd.fifo";
visualizer_output_name = "Visualizer feed";
visualizer_in_stereo = "yes";
visualizer_type = "spectrum";
visualizer_look = "";
## Lyrics
lyrics_fetchers = builtins.concatStringsSep "," [
"musixmatch"
"sing365"
"metrolyrics"
"justsomelyrics"
"jahlyrics"
"plyrics"
"tekstowo"
"zeneszoveg"
"internet"
];
};
};
}

View file

@ -1,3 +0,0 @@
{pkgs, ...}: {
home.packages = [pkgs.spotify];
}

View file

@ -1,20 +0,0 @@
{pkgs, ...}: {
# authentication needs to be done manually once
# TODO automatic authentication thing
home.packages = with pkgs; [yams];
systemd.user.services.yams = {
Unit = {
Description = "yams";
Requires = ["mpd.service"];
After = ["mpd.service"];
};
Install = {
WantedBy = ["default.target"];
};
Service = {
Type = "simple";
Environment = "NON_INTERACTIVE=1";
ExecStart = "${pkgs.yams}/bin/yams -N";
};
};
}

View file

@ -1,6 +0,0 @@
{...}: {
imports = [
./programs
./shell/zsh.nix
];
}

View file

@ -1,88 +0,0 @@
let
musicDir = "/home/xun/music/library";
in {
programs.beets = {
enable = true;
settings = {
directory = "${musicDir}/data";
library = "${musicDir}/beets/beets.db";
import = {
log = "${musicDir}/beets/import.log";
incremental = true;
};
plugins = [
"embedart"
"fetchart"
"discogs"
#"advancedrewrite"
#"lyrics"
"spotify"
"scrub"
"duplicates"
"unimported"
];
genres = true;
spotify.source_weight = 0.7;
embedart = {
auto = true;
ifempty = false;
remove_art_file = false;
};
unimported = {
ignore_extensions = ["jpg" "png"];
ignore_subdirectories = [];
};
fetchart = {
auto = true;
cautious = true;
minwidth = 500;
maxwidth = 1200;
cover_format = "jpeg";
sources = [
{"coverart" = "release";}
{"coverart" = "releasegroup";}
"albumart"
"amazon"
"google"
"itunes"
"fanarttv"
"lastfm"
"wikipedia"
];
#lyrics = {
# fallback = "''";
# sources = ["musicmatch" "google"];
#};
replace = {
"[\\\\]" = "'";
"[_]" = "-";
"[\\]" = "-";
"^\\." = "'";
"[\\x00-\\x1f]" = "'";
"[<>:\"\\?\\*\\|]" = "'";
"\\.$" = "'";
"\\s+$" = "'";
"^\\s+" = "'";
"^-" = "'";
"" = "'";
"" = "'";
"" = "'";
"" = "-";
};
aunique = {
keys = ["albumartist" "albumtype" "year" "album"];
disambuguators = ["format" "mastering" "media" "label" "albumdisambig" "releasegroupdisambig"];
bracket = "[]";
};
};
};
};
}

View file

@ -1,4 +1,6 @@
{config, ...}: {
programs.fzf.enable = true;
programs.zsh = {
enable = true;
autocd = true;

View file

@ -2,9 +2,6 @@
self,
inputs,
homeImports,
lib,
pkgs,
config,
...
}: let
inherit (inputs.nixpkgs.lib) nixosSystem;

View file

@ -1,150 +0,0 @@
{
pkgs,
lib,
config,
...
}: {
networking.firewall.allowedTCPPorts = [
# 4444
];
systemd.services."static-web-server".after = ["brawlstats.timer"];
services.static-web-server = {
enable = true;
root = "/var/lib/brawlstats";
listen = "[::]:3434";
};
systemd.sockets."brawlstats-web" = {
wantedBy = ["sockets.target"];
socketConfig = {
ListenStream = "4444";
TriggerLimitIntervalSec = 0;
Accept = "yes";
};
};
systemd.services."brawlstats-web@" = {
serviceConfig = {
StandardInput = "socket";
ExecStart = "${pkgs.writeShellScript "brawlstats-web.sh" ''
parameters=$(head -n1 | ${lib.getExe pkgs.gawk} '{print $2}' | ${lib.getExe pkgs.gnused} 's/,/ /g')
response=""
tosvg() {
${lib.getExe pkgs.gnuplot} -c ${pkgs.writeText "gnuplotcmds" ''
set xdata time
set timefmt '%Y%m%dT%H%M%S.000Z'
set format x '%m/%d-%H:%M'
set xlabel 'Time'
set ylabel 'Trophies'
set term svg
plot "/dev/stdin" u 1:2 w lines notitle
''}
}
rm /tmp/brawlstatslog
case ''${parameters:1} in
total*)
id=$(echo $parameters | ${lib.getExe pkgs.gawk} '{print $2}')
trophies=$(cat "/var/lib/brawlstats/$id-player.json" | ${lib.getExe pkgs.jq} '.trophies')
response=$(${lib.getExe pkgs.jq} -r \
"sort_by(.battleTime)
| reverse | .[]
| .battleTime, .battle.trophyChange" "/var/lib/brawlstats/$id-log.json" \
| paste - - \
| ${lib.getExe pkgs.gawk} -v total=$trophies '{total -= $2; $2 = total}2' \
| tosvg)
;;
brawler*)
id=$(echo $parameters | ${lib.getExe pkgs.gawk} '{print $2}')
brawler=$(echo $parameters | ${lib.getExe pkgs.gawk} '{print $3}' | ${lib.getExe pkgs.gnused} 's/%20/ /g')
response=$(${lib.getExe pkgs.jq} -r \
"sort_by(.battleTime)
| reverse
| map (select (.. | .tag? == \"#$id\" and .brawler.name == \"$brawler\")).[]
| select (.battle.type == \"ranked\")
| .battleTime,
(.battle | (.teams[]?,.players) | select(.)[] | select(.tag == \"#$id\") | .brawler.trophies) + .battle.trophyChange" "/var/lib/brawlstats/$id-log.json" \
| paste - - \
| tosvg)
;;
*)
response="parameters: $parameters | firstparam: $(echo "$parameters" | ${lib.getExe pkgs.gawk} '{print $1}')"
;;
esac
echo -e "HTTP/1.1 200 OK\r\nContent-Length: $(echo "$response" | wc -c)\r\nContent-Type: text/html\r\n\r\n$response"
''}";
};
};
systemd.timers."brawlstats" = {
wantedBy = ["timers.target"];
timerConfig = {
OnCalendar = "*:0/30";
Unit = "brawlstats.service";
};
};
systemd.services."brawlstats" = {
serviceConfig = {
Type = "oneshot";
User = "root";
StateDirectory = "brawlstats";
PrivateTmp = true;
LoadCredential = "apitoken:${config.sops.secrets.brawlstars-api-key.path}";
Environment = "TOKEN=%d/apitoken";
ExecStart = pkgs.writers.writeBash "brawlstats.sh" ''
TOKEN=$(cat $TOKEN)
cd "$STATE_DIRECTORY"
ids=("VLJY22GY" "VLJV2CYL")
for id in ''${ids[@]}; do
echo "id: $id"
sleep 1
battlelogout=$(mktemp)
${lib.getExe pkgs.curl} -H "Authorization: Bearer $TOKEN" "https://api.brawlstars.com/v1/players/%23$id/battlelog" | ${lib.getExe pkgs.jq} '[.items[]]' > "$battlelogout"
sleep 1
${lib.getExe pkgs.curl} -H "Authorization: Bearer $TOKEN" "https://api.brawlstars.com/v1/players/%23$id" > "$id-player.json"
if [ ! -s "$battlelogout" ]; then
echo "battlelogout is empty"
rm "$battlelogout"
continue
fi
if [ ! -s "$id-player.json" ]; then
echo "$id-player.json is empty"
continue
fi
tmplog=$(mktemp)
cat "$battlelogout" "$id-log.json" | ${lib.getExe pkgs.jq} -s 'add | unique' > "$tmplog"
cat "$tmplog" > "$id-log.json"
rm -f "$tmplog"
rm -f "$battlelogout"
# create backup
cp "$id-log.json" "$id-log-$(date +'%s').json"
# remove old backups
find . -type f -name "$id-log-*.json" | sort | head -n -5 | xargs -r rm
done
'';
};
};
}

View file

@ -1,14 +1,11 @@
{inputs, ...}: {
imports = with inputs.hardware.nixosModules; [
common-cpu-intel
imports = [
inputs.hardware.nixosModules.common-cpu-intel
inputs.vpn-confinement.nixosModules.default
./hardware.nix
./newlab.nix
# ./brawlstats.nix
# ./lab.nix
# ./hardening.nix
];
networking.hostName = "hopper";

View file

@ -1,5 +0,0 @@
{
fileSystems."/".options = ["noexec"];
fileSystems."/home".options = ["noexec"];
fileSystems."/boot".options = ["noexec"];
}

View file

@ -99,11 +99,11 @@ in {
}
{
port = config.services.slskd.settings.soulseek.listen_port;
protocol = "both"; # TODO figure out which one its actually using lol
protocol = "both";
}
{
port = config.services.transmission.settings.peer-port;
protocol = "both"; # TODO figure out which one its actually using lol
protocol = "both";
}
];

View file

@ -1,4 +0,0 @@
{
#TODO: add stuff here
# use lynis mayb
}

View file

@ -8,6 +8,4 @@
dnssec = "true";
domains = ["~."];
};
# TODO use networkd-dispatcher to do some things when network connectivity changes maybe
}

View file

@ -3,6 +3,5 @@
enable = true;
openFirewall = true;
useRoutingFeatures = "client";
#authKeyFile = config.sops.secrets.tailscale-auth.path;
};
}