From b0461e98a7b004984608c25a8805c5e477cf6686 Mon Sep 17 00:00:00 2001 From: victor Date: Mon, 26 Sep 2022 17:17:27 +0200 Subject: [PATCH] laptop stuff --- nixos/common/services/flood.nix | 2 +- nixos/common/services/vmagent.nix | 8 ---- nixos/hosts/thalassa/null/configuration.nix | 43 +----------------- nixos/hosts/thalassa/null/home/default.nix | 5 +-- .../null/home/eww/scripts/do-not-disturb.sh | 2 +- .../thalassa/null/home/eww/scripts/volume.sh | 2 +- .../thalassa/null/home/eww/scripts/wifi.sh | 9 +--- .../null/home/eww/scripts/workspaces.sh | 6 ++- nixos/hosts/thalassa/null/home/hyprland.nix | 5 +++ nixos/hosts/thalassa/null/networking.nix | 45 +++++++++++++++++++ 10 files changed, 62 insertions(+), 65 deletions(-) create mode 100644 nixos/hosts/thalassa/null/networking.nix diff --git a/nixos/common/services/flood.nix b/nixos/common/services/flood.nix index cd698d8..9db0553 100644 --- a/nixos/common/services/flood.nix +++ b/nixos/common/services/flood.nix @@ -142,7 +142,7 @@ in { toString cfg.port } ${ if cfg.ssl then "--ssl" else "" - } --auth ${cfg.authMode} --rtsocket ${cfg.rpcSocket} --allowedpath ${cfg.downloadDir}"; + } --auth ${cfg.authMode} --rtsocket ${cfg.rpcSocket} --allowedpath ${cfg.downloadDir}"; }; }; diff --git a/nixos/common/services/vmagent.nix b/nixos/common/services/vmagent.nix index 31c2723..559b7a1 100644 --- a/nixos/common/services/vmagent.nix +++ b/nixos/common/services/vmagent.nix @@ -53,14 +53,6 @@ in type = lib.types.submodule { freeformType = settingsFormat.type; }; - # example = '' - # global: - # scrape_interval: 5s - # scrape_configs: - # - job_name: 'apache' - # static_configs: - # - targets: ['apache-exporter:9117'] - # ''; description = '' Config for prometheus style metrics ''; diff --git a/nixos/hosts/thalassa/null/configuration.nix b/nixos/hosts/thalassa/null/configuration.nix index 62127ec..c53902e 100644 --- a/nixos/hosts/thalassa/null/configuration.nix +++ b/nixos/hosts/thalassa/null/configuration.nix @@ -36,6 +36,7 @@ in [ # Include the results of the hardware scan. ./hardware-configuration.nix + ./networking.nix ]; # home-manager @@ -79,33 +80,8 @@ in boot.loader.efi.efiSysMountPoint = "/boot/efi"; boot.kernelPackages = pkgs.linuxPackages_latest; - # networking.wireless.iwd.enable = false; services.gnome.gnome-keyring.enable = true; - - # Enable networking - networking.networkmanager.enable = false; - networking.wireless = { - enable = true; - environmentFile = "/var/lib/secrets/wireless.env"; - userControlled.enable = true; - networks = { - eduroam = { - auth = '' - proto=RSN - key_mgmt=WPA-EAP - eap=PEAP - identity="vroest@tudelft.nl" - password=hash:@EDUROAM_PASSWORD_HASH@ - domain_suffix_match="radius.tudelft.nl" - anonymous_identity="anonymous@tudelft.nl" - phase1="peaplabel=0" - phase2="auth=MSCHAPV2" - ca_cert="/etc/ssl/certs/ca-bundle.crt" - ''; - }; - }; - }; - + fileSystems."/".options = [ "compress=zstd" ]; # Filesystem dedup services.beesd.filesystems = { @@ -231,21 +207,6 @@ in services.fstrim.enable = true; - # Allow reverse path for wireguard - networking.firewall = { - # if packets are still dropped, they will show up in dmesg - logReversePathDrops = true; - # wireguard trips rpfilter up - extraCommands = '' - ip46tables -t raw -I nixos-fw-rpfilter -p udp -m udp --sport 51820 -j RETURN - ip46tables -t raw -I nixos-fw-rpfilter -p udp -m udp --dport 51820 -j RETURN - ''; - extraStopCommands = '' - ip46tables -t raw -D nixos-fw-rpfilter -p udp -m udp --sport 51820 -j RETURN || true - ip46tables -t raw -D nixos-fw-rpfilter -p udp -m udp --dport 51820 -j RETURN || true - ''; - }; - nix.extraOptions = '' keep-outputs = true keep-derivations = true diff --git a/nixos/hosts/thalassa/null/home/default.nix b/nixos/hosts/thalassa/null/home/default.nix index 4e370db..3895c62 100644 --- a/nixos/hosts/thalassa/null/home/default.nix +++ b/nixos/hosts/thalassa/null/home/default.nix @@ -75,7 +75,6 @@ programs.mako = { enable = true; - # makoctl mode -a do-not-disturb will hide all notifications, makoctl mode -r do-not-disturb will show them again. extraConfig = '' [mode=do-not-disturb] invisible=1 @@ -92,9 +91,6 @@ programs.firefox = { enable = true; package = pkgs.firefox-devedition-bin; - # profiles.dev-edition-default = { - # isDefault = true; - # }; }; programs.vscode = { @@ -104,6 +100,7 @@ catppuccin.catppuccin-vsc codezombiech.gitignore editorconfig.editorconfig + foxundermoon.shell-format james-yu.latex-workshop jnoortheen.nix-ide matklad.rust-analyzer diff --git a/nixos/hosts/thalassa/null/home/eww/scripts/do-not-disturb.sh b/nixos/hosts/thalassa/null/home/eww/scripts/do-not-disturb.sh index 4926c07..fe35e03 100755 --- a/nixos/hosts/thalassa/null/home/eww/scripts/do-not-disturb.sh +++ b/nixos/hosts/thalassa/null/home/eww/scripts/do-not-disturb.sh @@ -1,7 +1,7 @@ #!/usr/bin/env nix-shell #! nix-shell -p jq -i bash -if makoctl mode | grep -Fxq "do-not-disturb"; then +if makoctl mode | rg -q "do-not-disturb"; then eww update dnd="" makoctl mode -r do-not-disturb > /dev/null else diff --git a/nixos/hosts/thalassa/null/home/eww/scripts/volume.sh b/nixos/hosts/thalassa/null/home/eww/scripts/volume.sh index 1f94e31..f274661 100755 --- a/nixos/hosts/thalassa/null/home/eww/scripts/volume.sh +++ b/nixos/hosts/thalassa/null/home/eww/scripts/volume.sh @@ -2,7 +2,7 @@ per="$(pamixer --get-volume)" -if pamixer --get-mute | grep -q true; then +if pamixer --get-mute | rg -q true; then icon="婢" elif [ "$per" -gt 66 ]; then icon="墳" # high diff --git a/nixos/hosts/thalassa/null/home/eww/scripts/wifi.sh b/nixos/hosts/thalassa/null/home/eww/scripts/wifi.sh index fa2e537..e3601ad 100755 --- a/nixos/hosts/thalassa/null/home/eww/scripts/wifi.sh +++ b/nixos/hosts/thalassa/null/home/eww/scripts/wifi.sh @@ -1,13 +1,8 @@ #!/bin/sh -if nmcli g | rg -q "\bconnected\b"; then +if wpa_cli status | rg -q "wpa_state=COMPLETED"; then icon="直" - ssid=$(nmcli -t -f name connection show --active | sed -z 's/\n/,/g;s/,$/\n/') - if echo $ssid | rg -q "Wired"; then - status="Connected via cable" - else - status="Connected to ${ssid}" - fi + status="Connected" else icon="睊" status="offline" diff --git a/nixos/hosts/thalassa/null/home/eww/scripts/workspaces.sh b/nixos/hosts/thalassa/null/home/eww/scripts/workspaces.sh index c8eedd4..23cc922 100755 --- a/nixos/hosts/thalassa/null/home/eww/scripts/workspaces.sh +++ b/nixos/hosts/thalassa/null/home/eww/scripts/workspaces.sh @@ -1,8 +1,10 @@ #!/bin/sh workspaces() { -./scripts/workspaces.lua + ./scripts/workspaces.lua } + workspaces + tail -f /tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/hyprland.log | grep --line-buffered "Changed to workspace" | while read -r; do -workspaces + workspaces done diff --git a/nixos/hosts/thalassa/null/home/hyprland.nix b/nixos/hosts/thalassa/null/home/hyprland.nix index da7d468..9e4aeca 100644 --- a/nixos/hosts/thalassa/null/home/hyprland.nix +++ b/nixos/hosts/thalassa/null/home/hyprland.nix @@ -68,6 +68,9 @@ bind=SUPER,S,togglefloating, bind=SUPER,P,pseudo, + bindm=SUPER,mouse:272,movewindow + bindm=SUPER,mouse:273,resizewindow + bind=SUPER,left,movefocus,l bind=SUPER,right,movefocus,r bind=SUPER,up,movefocus,u @@ -114,6 +117,8 @@ bind=SUPER,g,togglegroup bind=SUPER,tab,changegroupactive + bind=SUPER,m,fullscreen,1 + bind=SUPERSHIFT,m,fullscreen,0 bind=,XF86MonBrightnessUp,exec,brightnessctl -q s +5% bind=,XF86MonBrightnessDown,exec,brightnessctl -q s 5%- diff --git a/nixos/hosts/thalassa/null/networking.nix b/nixos/hosts/thalassa/null/networking.nix new file mode 100644 index 0000000..1bab92a --- /dev/null +++ b/nixos/hosts/thalassa/null/networking.nix @@ -0,0 +1,45 @@ +{ ... }@a: +{ + networking = { + networkmanager.enable = false; + wireless = { + enable = true; + environmentFile = "/var/lib/secrets/wireless.env"; + userControlled.enable = true; + networks = { + eduroam = { + auth = '' + proto=RSN + key_mgmt=WPA-EAP + eap=PEAP + identity="vroest@tudelft.nl" + password=hash:@EDUROAM_PASSWORD_HASH@ + domain_suffix_match="radius.tudelft.nl" + anonymous_identity="anonymous@tudelft.nl" + phase1="peaplabel=0" + phase2="auth=MSCHAPV2" + ca_cert="/etc/ssl/certs/ca-bundle.crt" + ''; + }; + "Pikachu 5G" = { + psk = "@PIKACHU_PASSWORD@"; + }; + }; + }; + + # Allow reverse path for wireguard + # firewall = { + # # if packets are still dropped, they will show up in dmesg + # logReversePathDrops = true; + # # wireguard trips rpfilter up + # extraCommands = '' + # ip46tables -t raw -I nixos-fw-rpfilter -p udp -m udp --sport 51820 -j RETURN + # ip46tables -t raw -I nixos-fw-rpfilter -p udp -m udp --dport 51820 -j RETURN + # ''; + # extraStopCommands = '' + # ip46tables -t raw -D nixos-fw-rpfilter -p udp -m udp --sport 51820 -j RETURN || true + # ip46tables -t raw -D nixos-fw-rpfilter -p udp -m udp --dport 51820 -j RETURN || true + # ''; + # }; + }; +}