Migrate to Snowfall (#1)
Reviewed-on: #1 Co-authored-by: Evan Reichard <evan@reichard.io> Co-committed-by: Evan Reichard <evan@reichard.io>
This commit was merged in pull request #1.
This commit is contained in:
52
modules/nixos/system/boot/default.nix
Normal file
52
modules/nixos/system/boot/default.nix
Normal file
@@ -0,0 +1,52 @@
|
||||
{ config, lib, namespace, ... }:
|
||||
let
|
||||
inherit (lib) mkIf mkDefault;
|
||||
|
||||
cfg = config.${namespace}.system.boot;
|
||||
in
|
||||
{
|
||||
options.${namespace}.system.boot = {
|
||||
enable = lib.mkEnableOption "Enable Boot";
|
||||
xenGuest = lib.mkEnableOption "Enable Xen Guest";
|
||||
showNotch = lib.mkEnableOption "Show macOS Notch";
|
||||
silentBoot = lib.mkEnableOption "Silent Boot";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
services.xe-guest-utilities.enable = mkIf cfg.xenGuest true;
|
||||
|
||||
boot = {
|
||||
kernelParams = lib.optionals cfg.silentBoot [
|
||||
"quiet"
|
||||
"loglevel=3"
|
||||
"udev.log_level=3"
|
||||
"rd.udev.log_level=3"
|
||||
"systemd.show_status=auto"
|
||||
"rd.systemd.show_status=auto"
|
||||
"vt.global_cursor_default=0"
|
||||
] ++ lib.optionals cfg.showNotch [
|
||||
"apple_dcp.show_notch=1"
|
||||
];
|
||||
|
||||
loader = {
|
||||
efi = {
|
||||
canTouchEfiVariables = false;
|
||||
};
|
||||
|
||||
systemd-boot = {
|
||||
enable = true;
|
||||
configurationLimit = 20;
|
||||
editor = false;
|
||||
};
|
||||
|
||||
timeout = mkDefault 1;
|
||||
};
|
||||
|
||||
initrd = mkIf cfg.xenGuest {
|
||||
kernelModules = [ "xen_netfront" "xen_blkfront" ];
|
||||
supportedFilesystems = [ "xenfs" ];
|
||||
};
|
||||
kernelModules = mkIf cfg.xenGuest [ "xen_netfront" "xen_blkfront" "xenfs" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
55
modules/nixos/system/disk/default.nix
Normal file
55
modules/nixos/system/disk/default.nix
Normal file
@@ -0,0 +1,55 @@
|
||||
{ config, lib, namespace, ... }:
|
||||
let
|
||||
inherit (lib.${namespace}) mkOpt;
|
||||
inherit (lib) mkIf types;
|
||||
|
||||
cfg = config.${namespace}.system.disk;
|
||||
in
|
||||
{
|
||||
options.${namespace}.system.disk = {
|
||||
enable = lib.mkEnableOption "Disko Configuration";
|
||||
diskPath = mkOpt types.str null "Device path for the main disk";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
disko.devices = {
|
||||
disk = {
|
||||
main = {
|
||||
type = "disk";
|
||||
device = cfg.diskPath;
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
boot = {
|
||||
size = "512M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [ "umask=0077" ];
|
||||
};
|
||||
};
|
||||
root = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
};
|
||||
};
|
||||
swap = {
|
||||
size = "32G";
|
||||
content = {
|
||||
type = "swap";
|
||||
discardPolicy = "both";
|
||||
resumeDevice = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
71
modules/nixos/system/networking/default.nix
Normal file
71
modules/nixos/system/networking/default.nix
Normal file
@@ -0,0 +1,71 @@
|
||||
{ config, lib, pkgs, namespace, ... }:
|
||||
let
|
||||
inherit (lib) types mkIf mkForce mkOption mkEnableOption;
|
||||
inherit (lib.${namespace}) mkBoolOpt enabled;
|
||||
|
||||
cfg = config.${namespace}.system.networking;
|
||||
in
|
||||
{
|
||||
options.${namespace}.system.networking = {
|
||||
enable = mkEnableOption "Enable Networking";
|
||||
enableIWD = mkEnableOption "Enable IWD";
|
||||
useDHCP = mkBoolOpt true "Use DHCP";
|
||||
useNetworkd = mkBoolOpt false "Use networkd";
|
||||
useStatic = mkOption {
|
||||
type = types.nullOr (types.submodule {
|
||||
options = {
|
||||
interface = mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Network interface name";
|
||||
example = "enp0s3";
|
||||
};
|
||||
address = mkOption {
|
||||
type = types.str;
|
||||
description = "Static IP address";
|
||||
example = "10.0.20.200";
|
||||
};
|
||||
defaultGateway = mkOption {
|
||||
type = types.str;
|
||||
description = "Default gateway IP";
|
||||
example = "10.0.20.254";
|
||||
};
|
||||
nameservers = mkOption {
|
||||
type = types.listOf 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 {
|
||||
environment.systemPackages = with pkgs; [
|
||||
mtr
|
||||
tcpdump
|
||||
traceroute
|
||||
];
|
||||
|
||||
reichard.user.extraGroups = [ "network" ];
|
||||
|
||||
networking = {
|
||||
firewall = enabled;
|
||||
useDHCP = mkForce (cfg.useDHCP && cfg.useStatic == null);
|
||||
useNetworkd = cfg.useNetworkd;
|
||||
} // (lib.optionalAttrs (cfg.enableIWD) {
|
||||
wireless.iwd = {
|
||||
enable = true;
|
||||
settings.General.EnableNetworkConfiguration = true;
|
||||
};
|
||||
}) // (lib.optionalAttrs (cfg.useStatic != null) {
|
||||
inherit (cfg.useStatic) defaultGateway nameservers;
|
||||
interfaces.${cfg.useStatic.interface}.ipv4.addresses = [{
|
||||
inherit (cfg.useStatic) address;
|
||||
prefixLength = 24;
|
||||
}];
|
||||
});
|
||||
};
|
||||
}
|
||||
27
modules/nixos/system/networking/networkmanager/default.nix
Normal file
27
modules/nixos/system/networking/networkmanager/default.nix
Normal file
@@ -0,0 +1,27 @@
|
||||
{ config, lib, namespace, ... }:
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
|
||||
cfg = config.${namespace}.system.networking;
|
||||
in
|
||||
{
|
||||
config = mkIf cfg.enable {
|
||||
reichard.user.extraGroups = [ "networkmanager" ];
|
||||
|
||||
networking.networkmanager = {
|
||||
enable = true;
|
||||
wifi.backend = mkIf cfg.enableIWD "iwd";
|
||||
|
||||
connectionConfig = {
|
||||
"connection.mdns" = "2";
|
||||
};
|
||||
|
||||
# unmanaged = [
|
||||
# "interface-name:br-*"
|
||||
# "interface-name:rndis*"
|
||||
# ]
|
||||
# ++ lib.optionals config.${namespace}.virtualisation.podman.enable [ "interface-name:docker*" ]
|
||||
# ++ lib.optionals config.${namespace}.virtualisation.kvm.enable [ "interface-name:virbr*" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user