Fix Wi-Fi flakes
This commit is contained in:
parent
e013bcfdba
commit
6d98d85642
|
@ -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
|
|
@ -2,6 +2,9 @@
|
|||
#! nix-shell -i bash
|
||||
#! nix-shell -p bash nix-output-monitor
|
||||
|
||||
echo FIXME Not flakes ready
|
||||
exit 1
|
||||
|
||||
set -euo pipefail
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
#! nix-shell -i bash
|
||||
#! nix-shell -p bash nix-output-monitor
|
||||
|
||||
echo FIXME Not flakes ready
|
||||
exit 1
|
||||
|
||||
set -euo pipefail
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ in
|
|||
type = "luks";
|
||||
name = "boot";
|
||||
extraFormatArgs = [ "--type luks1" ];
|
||||
passwordFile = "FIXME";
|
||||
passwordFile = passwordFile;
|
||||
settings = {
|
||||
# keyFile = "/etc/keys/boot";
|
||||
};
|
||||
|
@ -94,7 +94,7 @@ in
|
|||
content = {
|
||||
type = "luks";
|
||||
name = "razmo";
|
||||
passwordFile = "FIXME";
|
||||
passwordFile = passwordFile;
|
||||
settings = {
|
||||
# keyFile = "/etc/keys/razmo";
|
||||
};
|
||||
|
@ -129,7 +129,7 @@ in
|
|||
content = {
|
||||
type = "luks";
|
||||
name = "rapswap";
|
||||
passwordFile = "FIXME";
|
||||
passwordFile = passwordFile;
|
||||
settings = {
|
||||
# keyFile = "/etc/keys/rapswap";
|
||||
allowDiscards = true;
|
||||
|
@ -147,7 +147,7 @@ in
|
|||
type = "luks";
|
||||
name = "rapido";
|
||||
initrdUnlock = true;
|
||||
passwordFile = "FIXME";
|
||||
passwordFile = passwordFile;
|
||||
settings = {
|
||||
# keyFile = "/etc/keys/rapido";
|
||||
allowDiscards = true;
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
{
|
||||
nixpkgs.overlays = sharedOverlays;
|
||||
home-manager.sharedModules = [ self.homeManagerModules.dotfiles ];
|
||||
system.nixos.tags = [ "flakes" ];
|
||||
}
|
||||
];
|
||||
};
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
#! nix-shell -i bash
|
||||
#! nix-shell -p bash nixos-install-tools
|
||||
|
||||
echo FIXME Not flakes ready
|
||||
exit 1
|
||||
|
||||
set -euo pipefail
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
./desktop.nix
|
||||
./gaming
|
||||
./geoffrey.nix
|
||||
# ./wireless.nix
|
||||
# FIXME networks.json is git-ignored, so flakes will not use it
|
||||
./wireless.nix
|
||||
];
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
# wireless support via wpa_supplicant
|
||||
networking.wireless = {
|
||||
enable = true;
|
||||
networks = builtins.fromJSON (builtins.readFile ./wireless/networks.json); # If this file doesn't exist, run ./wireless/import.py
|
||||
extraConfig = ''
|
||||
country=NL
|
||||
'';
|
||||
|
|
4
os/wireless/.gitignore
vendored
4
os/wireless/.gitignore
vendored
|
@ -1,2 +1,2 @@
|
|||
networks.json
|
||||
networks.env
|
||||
wireless_networks.json
|
||||
wireless_networks.env
|
||||
|
|
|
@ -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";
|
||||
# sha256 = "sha256:1la36n2f31j9s03v847ig6ny9lr875q3g7smnq33dcsmf2i5gd92";
|
||||
# }
|
||||
# TODO Very ugly, can probably do better
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
|
@ -157,10 +158,14 @@ for path in list_networks():
|
|||
for suffix in suffixes:
|
||||
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)
|
||||
|
||||
with open("networks.env", "w") as fd:
|
||||
with open("wireless_networks.env", "w") as fd:
|
||||
if SEPARATE_PASSWORDS:
|
||||
for k, v in Password.vars().items():
|
||||
print(f"{k}={v}", file=fd)
|
||||
|
||||
print("Now, execute:")
|
||||
print("sudo mv -f wireless_networks.* /etc/keys")
|
||||
print("sudo nixos-rebuild switch")
|
||||
|
|
Loading…
Reference in a new issue