network: rework wpa supplicant

This commit is contained in:
Rouven Seifert 2024-08-22 11:39:42 +02:00
parent f8561e3246
commit 076a7cacfe
4 changed files with 90 additions and 85 deletions

View file

@ -20,7 +20,6 @@
"soft-reboot.target" "soft-reboot.target"
"systemd-soft-reboot.service" "systemd-soft-reboot.service"
]; ];
# Use the systemd-boot EFI boot loader. # Use the systemd-boot EFI boot loader.
boot = { boot = {
kernelModules = [ "v4l2loopback" ]; kernelModules = [ "v4l2loopback" ];
@ -107,7 +106,7 @@
services = { services = {
# envfs.enable = true; #usr/bin fixes envfs.enable = true; #usr/bin fixes
blueman.enable = true; # bluetooth blueman.enable = true; # bluetooth
devmon.enable = true; # automount stuff devmon.enable = true; # automount stuff
upower.enable = true; upower.enable = true;

View file

@ -36,7 +36,7 @@
"2620:fe::9" "2620:fe::9"
]; ];
# allow downgrade since fritzbox at home doesn't support it (yet?) # allow downgrade since fritzbox at home doesn't support it (yet?)
dnssec = "allow-downgrade"; # dnssec = "allow-downgrade";
}; };
networking = { networking = {
nftables.enable = true; nftables.enable = true;

View file

@ -1,4 +1,4 @@
{ config, pkgs, ... }: { config, pkgs, lib, ... }:
{ {
age.secrets = { age.secrets = {
tud.file = ../../../../secrets/thinkpad/tud.age; tud.file = ../../../../secrets/thinkpad/tud.age;
@ -8,15 +8,12 @@
}; };
}; };
networking = { networking = {
supplicant = rec { supplicant = {
enp0s31f6 = { "LAN" = {
userControlled.enable = true; userControlled.enable = true;
driver = "wired"; driver = "wired";
configFile.path = config.age.secrets.dyport-auth.path; configFile.path = config.age.secrets.dyport-auth.path;
}; };
# ugly way to add more interfaces
# "enp0s13f0u2u1" = enp0s31f6;
# "enp0s13f0u3u1" = enp0s31f6;
}; };
wireless.networks = { wireless.networks = {
eduroam = { eduroam = {
@ -143,5 +140,9 @@
LockPersonality = true; LockPersonality = true;
}; };
}; };
# fix systemd dependencies for supplicant services
"supplicant-lan@" = {
wantedBy = lib.mkForce [ ];
};
}; };
} }

View file

@ -1,4 +1,19 @@
{ pkgs, config, lib, ... }: { pkgs, config, lib, ... }:
let
switch = pkgs.writeShellScript "switch.sh" ''
OUT_PATH=/tmp/nixos-rebuild-nom-$(date +%s)
${lib.getExe pkgs.nix-output-monitor} build /etc/nixos\#nixosConfigurations.${config.networking.hostName}.config.system.build.toplevel -o $OUT_PATH
${pkgs.nix}/bin/nix-env -p /nix/var/nix/profiles/system --set $OUT_PATH
$OUT_PATH/bin/switch-to-configuration switch
unlink $OUT_PATH
'';
garbage = pkgs.writeShellScript "garbage.sh" ''
nix-collect-garbage -d
echo Cleaning up boot entries...
/run/current-system/bin/switch-to-configuration boot
echo Done
'';
in
{ {
programs.command-not-found.enable = false; programs.command-not-found.enable = false;
programs.nix-index-database.comma.enable = true; programs.nix-index-database.comma.enable = true;
@ -15,7 +30,8 @@
programs.fzf = { programs.fzf = {
keybindings = true; keybindings = true;
}; };
programs.zsh = { programs.zsh =
{
enable = true; enable = true;
shellAliases = { shellAliases = {
rm = "trash"; rm = "trash";
@ -24,8 +40,9 @@
ll = "ls -la"; ll = "ls -la";
la = "ls -a"; la = "ls -a";
less = "bat"; less = "bat";
run0 = "run0 --setenv=PATH=$PATH --setenv=LOCALE_ARCHIVE=$LOCALE_ARCHIVE";
update = "cd /etc/nixos && nix flake update"; update = "cd /etc/nixos && nix flake update";
msh = "f() {mosh $1 zsh};f"; switch = "run0 ${switch}";
}; };
histSize = 100000; histSize = 100000;
histFile = "~/.local/share/zsh/history"; histFile = "~/.local/share/zsh/history";
@ -66,21 +83,9 @@
prompt_segment blue $CURRENT_FG '%c' prompt_segment blue $CURRENT_FG '%c'
} }
switch() {
sudo true # ask the password so we can leave during the (sometimes quite long) build process
OUT_PATH=/tmp/nixos-rebuild-nom-$(date +%s)
${lib.getExe pkgs.nix-output-monitor} build /etc/nixos\#nixosConfigurations.${config.networking.hostName}.config.system.build.toplevel -o $OUT_PATH
sudo ${pkgs.nix}/bin/nix-env -p /nix/var/nix/profiles/system --set $OUT_PATH
sudo $OUT_PATH/bin/switch-to-configuration switch
unlink $OUT_PATH
}
garbage() { garbage() {
${pkgs.home-manager}/bin/home-manager expire-generations "-0 days" ${pkgs.home-manager}/bin/home-manager expire-generations "-0 days"
sudo nix-collect-garbage -d run0 --setenv=PATH=$PATH --setenv=LOCALE_ARCHIVE=$LOCALE_ARCHIVE ${garbage}
echo Cleaning up boot entries...
sudo /run/current-system/bin/switch-to-configuration boot
echo Done
} }
sysdiff() { sysdiff() {