Compare commits
2 Commits
c2ea64512c
...
8f4e907bce
Author | SHA1 | Date | |
---|---|---|---|
8f4e907bce | |||
a1a5ee1f8f |
@ -1,4 +1,4 @@
|
|||||||
{ config, lib, pkgs, namespace, host, ... }:
|
{ config, lib, pkgs, inputs, namespace, host, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib) types mkIf;
|
inherit (lib) types mkIf;
|
||||||
inherit (lib.${namespace}) mkBoolOpt mkOpt;
|
inherit (lib.${namespace}) mkBoolOpt mkOpt;
|
||||||
@ -14,6 +14,14 @@ in
|
|||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
nix =
|
nix =
|
||||||
let
|
let
|
||||||
|
mappedRegistry = lib.pipe inputs [
|
||||||
|
(lib.filterAttrs (_: lib.isType "flake"))
|
||||||
|
(lib.mapAttrs (_: flake: { inherit flake; }))
|
||||||
|
(x: x // {
|
||||||
|
nixpkgs.flake = if pkgs.stdenv.hostPlatform.isLinux then inputs.nixpkgs else inputs.nixpkgs-unstable;
|
||||||
|
})
|
||||||
|
(x: if pkgs.stdenv.hostPlatform.isDarwin then lib.removeAttrs x [ "nixpkgs-unstable" ] else x)
|
||||||
|
];
|
||||||
users = [
|
users = [
|
||||||
"root"
|
"root"
|
||||||
"@wheel"
|
"@wheel"
|
||||||
@ -48,6 +56,9 @@ in
|
|||||||
|
|
||||||
optimise.automatic = true;
|
optimise.automatic = true;
|
||||||
|
|
||||||
|
# Pin the registry to avoid downloading and evaluating a new nixpkgs version everytime
|
||||||
|
registry = mappedRegistry;
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
allowed-users = users;
|
allowed-users = users;
|
||||||
auto-optimise-store = pkgs.stdenv.hostPlatform.isLinux;
|
auto-optimise-store = pkgs.stdenv.hostPlatform.isLinux;
|
||||||
|
@ -22,5 +22,6 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
networking.hostName = lib.mkForce "";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,35 @@ in
|
|||||||
enableIWD = mkEnableOption "Enable IWD";
|
enableIWD = mkEnableOption "Enable IWD";
|
||||||
useDHCP = mkBoolOpt true "Use DHCP";
|
useDHCP = mkBoolOpt true "Use DHCP";
|
||||||
useNetworkd = mkBoolOpt false "Use networkd";
|
useNetworkd = mkBoolOpt false "Use networkd";
|
||||||
|
useStatic = lib.mkOption {
|
||||||
|
type = lib.types.submodule {
|
||||||
|
options = {
|
||||||
|
interface = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Network interface name";
|
||||||
|
example = "enp0s3";
|
||||||
|
};
|
||||||
|
address = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Static IP address";
|
||||||
|
example = "10.0.20.200";
|
||||||
|
};
|
||||||
|
defaultGateway = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Default gateway IP";
|
||||||
|
example = "10.0.20.254";
|
||||||
|
};
|
||||||
|
nameservers = lib.mkOption {
|
||||||
|
type = lib.types.listOf lib.types.str;
|
||||||
|
description = "List of DNS servers";
|
||||||
|
example = [ "10.0.20.254" "8.8.8.8" ];
|
||||||
|
default = [ "8.8.8.8" "8.8.4.4" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
default = null;
|
||||||
|
description = "Static Network Configuration";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
@ -24,24 +53,19 @@ in
|
|||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
firewall = enabled;
|
firewall = enabled;
|
||||||
useDHCP = mkDefault cfg.useDHCP;
|
useDHCP = mkIf (cfg.useStatic == null) (mkDefault cfg.useDHCP);
|
||||||
useNetworkd = cfg.useNetworkd;
|
useNetworkd = cfg.useNetworkd;
|
||||||
} // (lib.optionalAttrs cfg.enableIWD) {
|
} // (lib.optionalAttrs (cfg.enableIWD) {
|
||||||
wireless.iwd = {
|
wireless.iwd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings.General.EnableNetworkConfiguration = true;
|
settings.General.EnableNetworkConfiguration = true;
|
||||||
};
|
};
|
||||||
};
|
}) // (lib.optionalAttrs (cfg.useStatic != null) {
|
||||||
|
inherit (cfg.useStatic) defaultGateway nameservers;
|
||||||
# TODO - Network Configuration
|
interfaces.${cfg.useStatic.interface}.ipv4.addresses = [{
|
||||||
# (lib.mkIf (config.network != null) {
|
inherit (cfg.useStatic) address;
|
||||||
# networking = {
|
prefixLength = 24;
|
||||||
# inherit (config.network) defaultGateway nameservers;
|
}];
|
||||||
# interfaces.${config.network.interface}.ipv4.addresses = [{
|
});
|
||||||
# inherit (config.network) address;
|
|
||||||
# prefixLength = 24;
|
|
||||||
# }];
|
|
||||||
# };
|
|
||||||
# })
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -11,9 +11,7 @@ in
|
|||||||
extraGroups = mkOpt (listOf str) [ ] "Groups for the user to be assigned.";
|
extraGroups = mkOpt (listOf str) [ ] "Groups for the user to be assigned.";
|
||||||
extraOptions = mkOpt attrs { } "Extra options passed to <option>users.users.<name></option>.";
|
extraOptions = mkOpt attrs { } "Extra options passed to <option>users.users.<name></option>.";
|
||||||
fullName = mkOpt str "Evan Reichard" "The full name of the user.";
|
fullName = mkOpt str "Evan Reichard" "The full name of the user.";
|
||||||
initialPassword =
|
initialPassword = mkOpt str "changeMe2025!" "The initial password to use when the user is first created.";
|
||||||
mkOpt str "password"
|
|
||||||
"The initial password to use when the user is first created.";
|
|
||||||
name = mkOpt str "evanreichard" "The name to use for the user account.";
|
name = mkOpt str "evanreichard" "The name to use for the user account.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@ sops:
|
|||||||
SC91WFNocEN2K1NFK2dBUHYwZTQrVFkKKb3AlaRX96vJwEmxNNAThTlO9ZwtD1tv
|
SC91WFNocEN2K1NFK2dBUHYwZTQrVFkKKb3AlaRX96vJwEmxNNAThTlO9ZwtD1tv
|
||||||
c6aBELEbmJFdHOcIJITzmS3YOssDOgTL2TbcSFu8mdAQYsRvxC96HA==
|
c6aBELEbmJFdHOcIJITzmS3YOssDOgTL2TbcSFu8mdAQYsRvxC96HA==
|
||||||
-----END AGE ENCRYPTED FILE-----
|
-----END AGE ENCRYPTED FILE-----
|
||||||
lastmodified: "2025-04-05T02:29:22Z"
|
lastmodified: "2025-04-09T00:53:28Z"
|
||||||
mac: ENC[AES256_GCM,data:2rI+pEYmQIPmtcnDTuyroAbfIvLIZKvsyAMEbQM2y9xYXhLyK8Vt7IzmdHy//hQRBSWdBV7/HfCMWJcg9i1B/P9fXrKx+OxaIb654SkthWhkORq32Sr1Gee3Yj195MffIUrEZ4rVauCeprzdEXqN6oTVXjHvnqV2/VXuTkkbztE=,iv:gCgo+8uLH6H9R3OQvzf2K9SgXb3tXG7Lvu6lxL0P2xo=,tag:ev+vMOn6UAfKexfyUnMP5Q==,type:str]
|
mac: ENC[AES256_GCM,data:NKv91i8Ms4TfbU0t9td4QoGD+9d9KYGQ9Mu1QlFdCc4AjMfRCcUCrvb9SVMF5JbYa8oZAH4Qp9FEJ5fFmgoTNrewspLUMpyjUYRgARYQWiHYhZjE/uTNhFo2FxXYLWsAlQjEJ8abbwUyr2y6NsK2tcQcOBDIWUssb4XqajNcylE=,iv:gvwQZB20JR4bKfMMR6sYjTnf3CNiOjcd8T30s2drKwY=,tag:mF9etyVyPVw5YblI8VdtTw==,type:str]
|
||||||
pgp: []
|
pgp: []
|
||||||
unencrypted_suffix: _unencrypted
|
unencrypted_suffix: _unencrypted
|
||||||
version: 3.9.4
|
version: 3.9.4
|
||||||
|
@ -15,7 +15,16 @@ in
|
|||||||
enable = true;
|
enable = true;
|
||||||
diskPath = "/dev/xvda";
|
diskPath = "/dev/xvda";
|
||||||
};
|
};
|
||||||
networking = enabled; # TODO - Network Config
|
networking = {
|
||||||
|
enable = true;
|
||||||
|
useDHCP = false;
|
||||||
|
useStatic = {
|
||||||
|
interface = "enX0";
|
||||||
|
address = "10.0.50.130";
|
||||||
|
defaultGateway = "10.0.50.254";
|
||||||
|
nameservers = [ "10.0.50.254" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user