zaphyra's git: nixfiles

zaphyra's nixfiles

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
38 
39 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
51 
52 
53 
54 
55 
56 
57 
58 
59 
{
  povSelf,
  inputs,
  pkgs,
  lib,
  config,
  hostConfig,
  ...
}:
let
  inherit (lib) types;
  cfg = lib.getAttrFromPath povSelf config;

in
{

  options = {
    enable = {
      type = types.bool;
      default = false;
    };
    username.type = types.str;
    envFile.type = types.path;
  };

  config = lib.mkIf cfg.enable {
    sops.secrets."environments/networkManagerProfiles/zaphyraHome" = {
      sopsFile = inputs.self.sopsSecrets.common;
    };

    networking.networkmanager.ensureProfiles = {
      environmentFiles = [ config.sops.secrets."environments/networkManagerProfiles/zaphyraHome".path ];
      profiles."zaphyraHome" = {
        connection = {
          id = "zaphyraHome";
          type = "wifi";
          uuid = "2eb10476-ea80-4059-afdc-8d2ce844236b";
        };
        ipv4 = {
          method = "auto";
        };
        ipv6 = {
          addr-gen-mode = "default";
          method = "auto";
        };
        proxy = { };
        wifi = {
          mode = "infrastructure";
          ssid = "$ZAPHYRA_HOME_SSID";
        };
        wifi-security = {
          key-mgmt = "sae";
          psk = "$ZAPHYRA_HOME_PASS";
        };
      };
    };
  };

}