Compare commits

...

6 Commits

Author SHA1 Message Date
Sam f7e23e39c7 MODIFY: Add deploy_key into sops hosts 2024-07-20 16:14:09 +01:00
Sam 86f27abb2f MODIFY: Firmware configuration for citadel to enable wifi 2024-07-20 16:13:24 +01:00
Sam fa060dba70 Added sam to networkmanager group 2024-07-20 16:12:49 +01:00
Sam f411adbf20 FIX: Renamed sb-battery 2024-07-20 16:12:10 +01:00
Sam 5e0230dcdd Added dmenu-wifi to dwm 2024-07-20 16:11:42 +01:00
Sam 1049ecbd76 Update flake.lock 2024-07-20 16:10:53 +01:00
7 changed files with 71 additions and 11 deletions

View File

@ -380,11 +380,11 @@
"nix-secrets": {
"flake": false,
"locked": {
"lastModified": 1721482736,
"narHash": "sha256-jrR4tQeESMJ/vSDSDjw6N8t1137TiRFsXq8CsG05sLE=",
"lastModified": 1721484039,
"narHash": "sha256-NIAfRofVQrYEE/XVbp3nmW1JYCxfv8gbuCEYySnZN18=",
"ref": "refs/heads/master",
"rev": "cfdb75ffef8f3e91fe95823086fabf4743e5e65b",
"revCount": 155,
"rev": "ad7a2afbe9c767101006c992b6031337f49c3777",
"revCount": 157,
"type": "git",
"url": "ssh://git@git.bitlab21.com/sam/nix-secrets.git"
},
@ -502,11 +502,11 @@
},
"nur": {
"locked": {
"lastModified": 1721472350,
"narHash": "sha256-XFGmZB6GhnYsTOFouj60lc40OkZxpdk6mL2nTT0fIkU=",
"lastModified": 1721483124,
"narHash": "sha256-pWsDpSZ/8necd7nvjV9P+EAARWaYgvn8tIDfUo6kJ/c=",
"owner": "nix-community",
"repo": "NUR",
"rev": "b4365ef44d92f9f6bd6ad3e54117d1719ebd2c57",
"rev": "a4c5fbcd97777ae321523253b042b13de0941a25",
"type": "github"
},
"original": {

View File

@ -28,6 +28,7 @@
./scripts/get-focused-monitor.nix
./scripts/git-commit-ai.nix
./scripts/aichat-wrapper.nix
./scripts/dmenu-wifi.nix
];
home.packages = [

View File

@ -0,0 +1,51 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
(writeShellScriptBin "dmenu-wifi" ''
nmcli dev wifi rescan
ssid_list=$(nmcli -f in-use,bssid,ssid,mode,chan,freq,rate,signal,bars,security dev wifi)
available_connections=$(echo "$ssid_list" | sed '/--.*Infra/d')
connection=$( echo "$available_connections" | dmenu -l 20)
bssid=$(echo "$connection" | sed 's/^.\s*//;s/\s\s.*$//')
ssid=$(echo "$connection" | sed 's/^.\s*[0-9;A-Z;:]*\s\s//;s/\s*Infra\s*[0-9].*$//')
[[ "$connection" = "" ]] && notify-send -t 5000 "Wifi Connect" "Cancelled" && exit 0
[[ $( echo "$connection" | grep "IN-USE" -o) = "IN-USE" ]] && notify-send -t 5000 "Wifi Connect" "Please select valid network" && exit 0
[[ -n "$(echo "$connection" | grep '\*')" ]] && notify-send -t 5000 "Wifi Connect" "Already Connected to: $(echo "$ssid")" && exit 0
notify-send -t 5000 "Network Manager" "Attempting to connect to $ssid..."
nmcli connection modify "$ssid" 802-11-wireless.bssid "$bssid"
nmcli device wifi connect "$bssid"
return_code=$?
if [ $return_code == 4 ];
then
notify-send -t 5000 "Wifi Connect" "Please enter password for '$ssid'..."
prompt="Enter Password for '$ssid'"
pwd=$(echo "" | dmenu -p "$prompt")
nmcli device wifi connect "$bssid" password "$pwd"
return_code=$?
fi
case "$return_code" in
0) notify-send -t 5000 "Wifi Connect" "Successfully connected to: $ssid!"
pkill -RTMIN+12 dwmblocks
exit 0
;;
3) notify-send -t 5000 "Wifi Connect" "Connection to $ssid failed. Timeout expired?"
pkill -RTMIN+12 dwmblocks
exit 1
;;
4)
notify-send -t 5000 "Wifi Connect" "Connection to $ssid failed. Possibly wrong password?"
nmcli connection delete id "$ssid"
pkill -RTMIN+12 dwmblocks
exit 1
;;
*) notify-send -t 5000 "Wifi Connect" "Connection to $ssid failed. Error code $?"
echo "Failed. Exiting"
pkill -RTMIN+12 dwmblocks
exit 1
esac
'')
];
}

View File

@ -1,7 +1,7 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
(writeShellScriptBin "sb-cpu-pct" ''
(writeShellScriptBin "sb-battery" ''
BAT=/sys/class/power_supply/BAT0/capacity
# Exit script if no battery detected

View File

@ -37,6 +37,7 @@ in
boot = {
blacklistedKernelModules = [ "snd_hda_intel" "snd_soc_skl" ];
kernelModules = [ "iwlwifi" ];
kernelPackages = pkgs.linuxPackagesFor pkgs.linux_latest;
loader = {
systemd-boot.enable = true;
@ -45,9 +46,12 @@ in
};
};
hardware.firmware = [
hardware = {
enableRedistributableFirmware = true;
firmware = [
pkgs.sof-firmware
];
};
networking = {
hostName = "citadel";

View File

@ -21,6 +21,9 @@ in
};
secrets = {
"passwords/root".neededForUsers = true;
"ssh_keys/deploy_key/id_ed25519" = {
path = "/etc/ssh/deploy_key-ssh-ed25519";
};
};
};
}

View File

@ -16,6 +16,7 @@ in
extraGroups = [
"wheel"
"networkmanager"
];
};