Fix Wi-Fi flakes

This commit is contained in:
Geoffrey Frogeye 2024-01-06 19:10:47 +01:00
parent e013bcfdba
commit 6d98d85642
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
11 changed files with 25 additions and 19 deletions

View file

@ -1,8 +0,0 @@
#!/usr/bin/env bash
# TODO Flakes
nix-channel --add https://nixos.org/channels/nixos-23.11 nixpkgs
nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.11.tar.gz home-manager
nix-channel --add https://github.com/NixOS/nixos-hardware/archive/8772491ed75f150f02552c60694e1beff9f46013.tar.gz nixos-hardware
nix-channel --update

View file

@ -2,6 +2,9 @@
#! nix-shell -i bash #! nix-shell -i bash
#! nix-shell -p bash nix-output-monitor #! nix-shell -p bash nix-output-monitor
echo FIXME Not flakes ready
exit 1
set -euo pipefail set -euo pipefail
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

View file

@ -2,6 +2,9 @@
#! nix-shell -i bash #! nix-shell -i bash
#! nix-shell -p bash nix-output-monitor #! nix-shell -p bash nix-output-monitor
echo FIXME Not flakes ready
exit 1
set -euo pipefail set -euo pipefail
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

View file

@ -73,7 +73,7 @@ in
type = "luks"; type = "luks";
name = "boot"; name = "boot";
extraFormatArgs = [ "--type luks1" ]; extraFormatArgs = [ "--type luks1" ];
passwordFile = "FIXME"; passwordFile = passwordFile;
settings = { settings = {
# keyFile = "/etc/keys/boot"; # keyFile = "/etc/keys/boot";
}; };
@ -94,7 +94,7 @@ in
content = { content = {
type = "luks"; type = "luks";
name = "razmo"; name = "razmo";
passwordFile = "FIXME"; passwordFile = passwordFile;
settings = { settings = {
# keyFile = "/etc/keys/razmo"; # keyFile = "/etc/keys/razmo";
}; };
@ -129,7 +129,7 @@ in
content = { content = {
type = "luks"; type = "luks";
name = "rapswap"; name = "rapswap";
passwordFile = "FIXME"; passwordFile = passwordFile;
settings = { settings = {
# keyFile = "/etc/keys/rapswap"; # keyFile = "/etc/keys/rapswap";
allowDiscards = true; allowDiscards = true;
@ -147,7 +147,7 @@ in
type = "luks"; type = "luks";
name = "rapido"; name = "rapido";
initrdUnlock = true; initrdUnlock = true;
passwordFile = "FIXME"; passwordFile = passwordFile;
settings = { settings = {
# keyFile = "/etc/keys/rapido"; # keyFile = "/etc/keys/rapido";
allowDiscards = true; allowDiscards = true;

View file

@ -42,6 +42,7 @@
{ {
nixpkgs.overlays = sharedOverlays; nixpkgs.overlays = sharedOverlays;
home-manager.sharedModules = [ self.homeManagerModules.dotfiles ]; home-manager.sharedModules = [ self.homeManagerModules.dotfiles ];
system.nixos.tags = [ "flakes" ];
} }
]; ];
}; };

View file

@ -2,6 +2,9 @@
#! nix-shell -i bash #! nix-shell -i bash
#! nix-shell -p bash nixos-install-tools #! nix-shell -p bash nixos-install-tools
echo FIXME Not flakes ready
exit 1
set -euo pipefail set -euo pipefail
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

View file

@ -8,7 +8,6 @@
./desktop.nix ./desktop.nix
./gaming ./gaming
./geoffrey.nix ./geoffrey.nix
# ./wireless.nix ./wireless.nix
# FIXME networks.json is git-ignored, so flakes will not use it
]; ];
} }

View file

@ -3,7 +3,6 @@
# wireless support via wpa_supplicant # wireless support via wpa_supplicant
networking.wireless = { networking.wireless = {
enable = true; enable = true;
networks = builtins.fromJSON (builtins.readFile ./wireless/networks.json); # If this file doesn't exist, run ./wireless/import.py
extraConfig = '' extraConfig = ''
country=NL country=NL
''; '';

View file

@ -1,2 +1,2 @@
networks.json wireless_networks.json
networks.env wireless_networks.env

View file

@ -11,6 +11,7 @@ Exports Wi-Fi networks configuration stored in pass into a format readable by Ni
# url = "https://letsencrypt.org/certs/isrgrootx1.pem"; # url = "https://letsencrypt.org/certs/isrgrootx1.pem";
# sha256 = "sha256:1la36n2f31j9s03v847ig6ny9lr875q3g7smnq33dcsmf2i5gd92"; # sha256 = "sha256:1la36n2f31j9s03v847ig6ny9lr875q3g7smnq33dcsmf2i5gd92";
# } # }
# TODO Very ugly, can probably do better
import hashlib import hashlib
import json import json
@ -157,10 +158,14 @@ for path in list_networks():
for suffix in suffixes: for suffix in suffixes:
networks[ssid + suffix] = network networks[ssid + suffix] = network
with open("networks.json", "w") as fd: with open("wireless_networks.json", "w") as fd:
json.dump(networks, fd, indent=4) json.dump(networks, fd, indent=4)
with open("networks.env", "w") as fd: with open("wireless_networks.env", "w") as fd:
if SEPARATE_PASSWORDS: if SEPARATE_PASSWORDS:
for k, v in Password.vars().items(): for k, v in Password.vars().items():
print(f"{k}={v}", file=fd) print(f"{k}={v}", file=fd)
print("Now, execute:")
print("sudo mv -f wireless_networks.* /etc/keys")
print("sudo nixos-rebuild switch")

1
result Symbolic link
View file

@ -0,0 +1 @@
/nix/store/gw0sb3b287fqdrwszimkffypb14w7yvv-nixos-system-curacao-flakes-23.11.20240103.b0b2c54