istg i have to make smaller commits
This commit is contained in:
parent
1ed9ce6864
commit
29473532c7
28 changed files with 483 additions and 361 deletions
|
@ -2,16 +2,20 @@
|
|||
self,
|
||||
inputs,
|
||||
homeImports,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
specialArgs = {
|
||||
inherit inputs self;
|
||||
};
|
||||
prependAll = a: b: map (x: a + x) b;
|
||||
rootPaths = prependAll "${self}/";
|
||||
modulePaths = prependAll "${self}/system/";
|
||||
|
||||
inherit (import "${self}/system") desktop;
|
||||
in {
|
||||
flake.colmena = let
|
||||
mod = "${self}/system";
|
||||
inherit (import "${self}/system") desktop;
|
||||
in {
|
||||
flake.colmena = {
|
||||
meta = {
|
||||
nixpkgs = import inputs.nixpkgs {
|
||||
system = "x86_64-linux";
|
||||
|
@ -38,24 +42,26 @@ in {
|
|||
};
|
||||
imports =
|
||||
desktop
|
||||
++ [
|
||||
++ lib.flatten [
|
||||
./nixdesk
|
||||
|
||||
"${self}/secrets"
|
||||
"${self}/secrets/nixdesk"
|
||||
(rootPaths [
|
||||
"secrets"
|
||||
"secrets/nixdesk"
|
||||
])
|
||||
|
||||
#"${mod}/network/wifi.nix"
|
||||
(modulePaths [
|
||||
"services/syncthing.nix"
|
||||
"services/virt/waydroid.nix"
|
||||
"services/virt/virt-manager.nix"
|
||||
#"network/wifi.nix"
|
||||
#"services/ollama.nix"
|
||||
"desktop/x11/nosleep.nix"
|
||||
|
||||
"${mod}/services/syncthing.nix"
|
||||
#"${mod}/services/virt/podman.nix"
|
||||
"${mod}/services/virt/waydroid.nix"
|
||||
"${mod}/services/virt/virt-manager.nix"
|
||||
#"${mod}/services/ollama.nix"
|
||||
"${mod}/desktop/x11/nosleep.nix"
|
||||
|
||||
"${mod}/programs/gamemode.nix"
|
||||
"${mod}/programs/gamescope.nix"
|
||||
"${mod}/programs/steam.nix"
|
||||
"programs/gamemode.nix"
|
||||
"programs/gamescope.nix"
|
||||
"programs/steam.nix"
|
||||
])
|
||||
|
||||
{
|
||||
home-manager = {
|
||||
|
@ -70,34 +76,38 @@ in {
|
|||
targetUser = "xun";
|
||||
targetHost = "hopper.local";
|
||||
};
|
||||
imports = [
|
||||
imports = lib.flatten [
|
||||
./hopper
|
||||
|
||||
"${self}/secrets"
|
||||
"${self}/secrets/hopper"
|
||||
(rootPaths [
|
||||
"secrets"
|
||||
"secrets/hopper"
|
||||
])
|
||||
|
||||
"${mod}/core"
|
||||
(modulePaths [
|
||||
"core"
|
||||
|
||||
#"${mod}/programs"
|
||||
#"${mod}/programs/steam.nix"
|
||||
#"programs"
|
||||
#"programs/steam.nix"
|
||||
|
||||
#"${mod}/desktop"
|
||||
#"${mod}/desktop/awesome.nix"
|
||||
#"desktop"
|
||||
#"desktop/awesome.nix"
|
||||
|
||||
#"${mod}/hardware/opengl.nix"
|
||||
#"${mod}/hardware/steam-hardware.nix"
|
||||
#"${mod}/hardware/bluetooth.nix"
|
||||
#"${mod}/hardware/qmk.nix"
|
||||
#"hardware/graphics.nix"
|
||||
#"hardware/steam-hardware.nix"
|
||||
#"hardware/bluetooth.nix"
|
||||
#"hardware/qmk.nix"
|
||||
|
||||
"${mod}/network/avahi.nix"
|
||||
"${mod}/network/networkd.nix"
|
||||
"${mod}/network/tailscale.nix"
|
||||
"network/avahi.nix"
|
||||
"network/networkd.nix"
|
||||
"network/tailscale.nix"
|
||||
|
||||
#"${mod}/services"
|
||||
#"${mod}/services/pipewire.nix"
|
||||
"${mod}/services/syncthing.nix"
|
||||
#"${mod}/services/containers/server"
|
||||
"${mod}/services/containers/experimental"
|
||||
#"services"
|
||||
#"services/pipewire.nix"
|
||||
"services/syncthing.nix"
|
||||
#"services/containers/server"
|
||||
"services/containers/experimental"
|
||||
])
|
||||
|
||||
#{
|
||||
# home-manager = {
|
||||
|
@ -109,15 +119,15 @@ in {
|
|||
};
|
||||
liveiso = {
|
||||
deployment.targetHost = null;
|
||||
imports = [
|
||||
imports = lib.flatten [
|
||||
./liveiso
|
||||
|
||||
"${mod}/nix"
|
||||
"${mod}/core/security.nix"
|
||||
|
||||
"${mod}/services"
|
||||
|
||||
"${mod}/desktop"
|
||||
(modulePaths [
|
||||
"/nix"
|
||||
"/core/security.nix"
|
||||
"/services"
|
||||
"/desktop"
|
||||
])
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
|
@ -37,12 +37,12 @@
|
|||
${lib.getExe pkgs.gnuplot} -c ${pkgs.writeText "gnuplotcmds" ''
|
||||
set xdata time
|
||||
set timefmt '%Y%m%dT%H%M%S.000Z'
|
||||
set format x '%H:%M'
|
||||
set format x '%m/%d-%H:%M'
|
||||
set xlabel 'Time'
|
||||
set ylabel 'Trophies'
|
||||
set term svg
|
||||
plot "/dev/stdin" using 1:2 with linespoints notitle
|
||||
''} # 2>/dev/null
|
||||
plot "/dev/stdin" u 1:2 w lines notitle
|
||||
''}
|
||||
}
|
||||
|
||||
case ''${parameters:1} in
|
||||
|
@ -59,41 +59,23 @@
|
|||
;;
|
||||
brawler*)
|
||||
id=$(echo $parameters | ${lib.getExe pkgs.gawk} '{print $2}')
|
||||
brawler=$(echo $parameters | ${lib.getExe pkgs.gawk} '{print $3}')
|
||||
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)
|
||||
#reponse=$(${lib.getExe pkgs.jq} -r \
|
||||
# "sort_by(.battleTime)
|
||||
# | reverse
|
||||
# | map (select (.. | .tag? == \"#$id\" and .brawler.name == \"$brawler\")).[]
|
||||
# | .battleTime,
|
||||
# (.battle | (.teams[]?,.players) | select(.)[] | select(.tag == \"#$id\") | .brawler.trophies) + .battle.trophyChange" \
|
||||
# "/var/lib/brawlstats/$id-log.json" \
|
||||
# | paste - - \
|
||||
# | tosvg)
|
||||
#echo $response
|
||||
;;
|
||||
*)
|
||||
response="parameters: $parameters | firstparam: $(echo "$parameters" | ${lib.getExe pkgs.gawk} '{print $1}')"
|
||||
;;
|
||||
esac
|
||||
|
||||
#file="/var/lib/brawlstats/output.svg"
|
||||
echo -e "HTTP/1.1 200 OK\r\nContent-Length: $(echo "$response" | wc -c)\r\nContent-Type: text/html\r\n\r\n$response"
|
||||
#echo $endpoint
|
||||
#cat "$file"
|
||||
#while read -r LINE
|
||||
#do
|
||||
# echo "$LINE"
|
||||
# [ -z "$LINE" ] && break
|
||||
#done
|
||||
|
||||
''}";
|
||||
};
|
||||
};
|
||||
|
@ -119,7 +101,7 @@
|
|||
LoadCredential = "apitoken:${config.sops.secrets.brawlstars-api-key.path}";
|
||||
Environment = "TOKEN=%d/apitoken";
|
||||
|
||||
ExecStart = "${pkgs.writeShellScript "brawlstats.sh" ''
|
||||
ExecStart = pkgs.writers.writeBash "brawlstats.sh" ''
|
||||
TOKEN=$(cat $TOKEN)
|
||||
|
||||
cd "$STATE_DIRECTORY"
|
||||
|
@ -160,7 +142,7 @@
|
|||
# remove old backups
|
||||
find . -type f -name "$id-log-*.json" | sort | head -n -5 | xargs -r rm
|
||||
done
|
||||
''}";
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
{inputs, ...}: {
|
||||
imports = with inputs.hardware.nixosModules; [
|
||||
common-cpu-intel
|
||||
common-pc-hdd
|
||||
|
||||
./hardware.nix
|
||||
./brawlstats.nix
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
nixpkgs.hostPlatform.system = "x86_64-linux";
|
||||
|
||||
## nvidia gpu
|
||||
services.xserver.videoDrivers = ["nvidia"];
|
||||
#services.xserver.videoDrivers = ["nvidia"];
|
||||
|
||||
hardware.nvidia = {
|
||||
modesetting.enable = true;
|
||||
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||
};
|
||||
#hardware.nvidia = {
|
||||
# modesetting.enable = true;
|
||||
# package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||
#};
|
||||
|
||||
boot = {
|
||||
initrd = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue