Flake for my NixOS devices
at musnix 68 lines 1.6 kB view raw
1{...}: { 2 config, 3 lib, 4 pkgs, 5 ... 6}: { 7 options.cow.network = { 8 enable = lib.mkEnableOption "custom network setup using some nicer defaults"; 9 wireless = lib.mkEnableOption "wireless networking with IWD"; 10 bluetooth = lib.mkEnableOption "bluetooth networking"; 11 }; 12 13 config = lib.mkIf config.cow.network.enable { 14 hardware.bluetooth = lib.mkIf config.cow.network.bluetooth { 15 enable = true; 16 settings = { 17 General = { 18 Experimental = true; 19 }; 20 }; 21 }; 22 23 environment.systemPackages = with pkgs; 24 (lib.optionals config.cow.network.bluetooth [ 25 bluetui 26 ]) 27 ++ (lib.optionals config.cow.network.wireless [impala]); 28 29 cow.imperm.keepCache = 30 (lib.optional config.cow.network.bluetooth "/var/lib/bluetooth") 31 ++ (lib.optional config.cow.network.wireless "/var/lib/iwd"); 32 33 networking = { 34 wireless.iwd.enable = config.cow.network.wireless; 35 useNetworkd = true; 36 useDHCP = true; 37 }; 38 39 systemd.network = { 40 enable = lib.mkDefault true; 41 wait-online = { 42 enable = lib.mkDefault false; 43 }; 44 }; 45 46 services = lib.mkDefault { 47 resolved = { 48 enable = true; 49 llmnr = "false"; 50 fallbackDns = [ 51 "2606:4700:4700::1111" 52 "2606:4700:4700::1001" 53 "1.1.1.1" 54 "1.0.0.1" 55 ]; 56 }; 57 timesyncd.servers = map (x: "time-${x}-g.nist.gov") [ 58 "a" 59 "b" 60 "c" 61 "d" 62 "e" 63 "f" 64 "g" 65 ]; 66 }; 67 }; 68}