fully modularised 'services' and 'networking' subsections of 'configuration.nix'
This commit is contained in:
parent
6d8cfb8738
commit
cbc37a7226
10 changed files with 88 additions and 275 deletions
|
|
@ -1,103 +0,0 @@
|
||||||
{ inputs, outputs, config, pkgs, lib, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports =
|
|
||||||
[
|
|
||||||
# Include the results of the hardware scan.
|
|
||||||
"${builtins.fetchTarball "https://github.com/nix-community/disko/archive/master.tar.gz"}/module.nix"
|
|
||||||
./disko-config.nix
|
|
||||||
./hardware-configuration.nix
|
|
||||||
../../configuration.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
# Enable swap on luks
|
|
||||||
boot = {
|
|
||||||
loader = {
|
|
||||||
systemd-boot = {
|
|
||||||
enable = true;
|
|
||||||
configurationLimit = 10;
|
|
||||||
};
|
|
||||||
efi = {
|
|
||||||
canTouchEfiVariables = true;
|
|
||||||
# efiSysMountPoint = "/boot/efi";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
initrd = {
|
|
||||||
systemd.enable = true;
|
|
||||||
secrets = {
|
|
||||||
# "crypto_keyfile.bin" = null;
|
|
||||||
};
|
|
||||||
luks = {
|
|
||||||
# devices."luks-DISK_UUID" = {
|
|
||||||
# device = "/dev/disk/by-uuid/DISK_UUID";
|
|
||||||
# keyfile = "/crypto_keyfile.bin";
|
|
||||||
# };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
services.fstrim.enable = true;
|
|
||||||
|
|
||||||
powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
|
|
||||||
|
|
||||||
hardware = {
|
|
||||||
|
|
||||||
cpu.intel.updateMicrocode = true;
|
|
||||||
enableAllFirmware = false;
|
|
||||||
bluetooth.enable = false;
|
|
||||||
|
|
||||||
opengl = {
|
|
||||||
enable = true;
|
|
||||||
extraPackages = with pkgs; [
|
|
||||||
intel-compute-runtime
|
|
||||||
intel-media-driver
|
|
||||||
vaapiIntel
|
|
||||||
vaapiVdpau
|
|
||||||
libvdpau-va-gl
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
nix = {
|
|
||||||
# settings = {
|
|
||||||
# };
|
|
||||||
gc = {
|
|
||||||
automatic = true;
|
|
||||||
dates = "daily";
|
|
||||||
options = "--delete-older-than 7d";
|
|
||||||
persistent = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
networking = {
|
|
||||||
hostName = "hades"; # Define your hostname
|
|
||||||
};
|
|
||||||
|
|
||||||
services = {
|
|
||||||
|
|
||||||
syncthing = {
|
|
||||||
enable = false;
|
|
||||||
dataDir = "/home/serenity/";
|
|
||||||
configDir = "/home/serenity/.config/syncthing";
|
|
||||||
user = "serenity";
|
|
||||||
settings = {
|
|
||||||
|
|
||||||
devices = {
|
|
||||||
# hades.id = "$DEVICE_ID";
|
|
||||||
# hecate.id = "$DEVICE_ID";
|
|
||||||
# proserpina.id = "$DEVICE_ID";
|
|
||||||
};
|
|
||||||
|
|
||||||
folders = {
|
|
||||||
# "$FOLDER_ID" = {
|
|
||||||
# path = "/home/serenity/Documents/Notes";
|
|
||||||
# devices = [ "hecate" "hades" ];
|
|
||||||
# };
|
|
||||||
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
||||||
{
|
|
||||||
disko.devices = {
|
|
||||||
disk = {
|
|
||||||
sda = {
|
|
||||||
type = "disk";
|
|
||||||
device = "/dev/sda";
|
|
||||||
content = {
|
|
||||||
type = "gpt";
|
|
||||||
partitions = {
|
|
||||||
ESP = {
|
|
||||||
size = "512M";
|
|
||||||
type = "EF00";
|
|
||||||
content = {
|
|
||||||
type = "filesystem";
|
|
||||||
format = "vfat";
|
|
||||||
mountpoint = "/boot";
|
|
||||||
mountOptions = [
|
|
||||||
"defaults"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
luks = {
|
|
||||||
size = "100%";
|
|
||||||
content = {
|
|
||||||
type = "luks";
|
|
||||||
name = "pomegranate";
|
|
||||||
# disable settings.keyFile if you want to use interactive password entry
|
|
||||||
#passwordFile = "/tmp/secret.key"; # Interactive
|
|
||||||
settings = {
|
|
||||||
allowDiscards = true;
|
|
||||||
#keyFile = "/tmp/secret.key";
|
|
||||||
};
|
|
||||||
# additionalKeyFiles = [ "/tmp/additionalSecret.key" ];
|
|
||||||
content = {
|
|
||||||
type = "btrfs";
|
|
||||||
extraArgs = [ "-f" ];
|
|
||||||
subvolumes = {
|
|
||||||
"/root" = {
|
|
||||||
mountpoint = "/";
|
|
||||||
mountOptions = [ "compress=zstd" "noatime" ];
|
|
||||||
};
|
|
||||||
"/home" = {
|
|
||||||
mountpoint = "/home";
|
|
||||||
mountOptions = [ "compress=zstd" "noatime" ];
|
|
||||||
};
|
|
||||||
"/nix" = {
|
|
||||||
mountpoint = "/nix";
|
|
||||||
mountOptions = [ "compress=zstd" "noatime" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
|
||||||
# and may be overwritten by future invocations. Please make changes
|
|
||||||
# to /etc/nixos/configuration.nix instead.
|
|
||||||
{ config, lib, pkgs, modulesPath, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports =
|
|
||||||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" ];
|
|
||||||
boot.initrd.kernelModules = [ ];
|
|
||||||
boot.kernelModules = [ "kvm-intel" ];
|
|
||||||
boot.extraModulePackages = [ ];
|
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
|
||||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
|
||||||
# still possible to use this option, but it's recommended to use it in conjunction
|
|
||||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
|
||||||
networking.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.wlp58s0.useDHCP = lib.mkDefault true;
|
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
|
||||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
|
||||||
}
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
"${builtins.fetchTarball "https://github.com/nix-community/disko/archive/master.tar.gz"}/module.nix"
|
"${builtins.fetchTarball "https://github.com/nix-community/disko/archive/master.tar.gz"}/module.nix"
|
||||||
./disko-config.nix
|
./disko-config.nix
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
|
./network-configuration.nix
|
||||||
../../modules
|
../../modules
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -69,34 +70,4 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
networking = {
|
|
||||||
hostName = "proserpina"; # Define your hostname
|
|
||||||
};
|
|
||||||
|
|
||||||
services = {
|
|
||||||
|
|
||||||
syncthing = {
|
|
||||||
enable = false;
|
|
||||||
dataDir = "/home/serenity/";
|
|
||||||
configDir = "/home/serenity/.config/syncthing";
|
|
||||||
user = "serenity";
|
|
||||||
settings = {
|
|
||||||
|
|
||||||
devices = {
|
|
||||||
# hades.id = "$DEVICE_ID";
|
|
||||||
# hecate.id = "$DEVICE_ID";
|
|
||||||
# proserpina.id = "$DEVICE_ID";
|
|
||||||
};
|
|
||||||
|
|
||||||
folders = {
|
|
||||||
# "$FOLDER_ID" = {
|
|
||||||
# path = "/home/serenity/Documents/Notes";
|
|
||||||
# devices = [ "hecate" "hades" ];
|
|
||||||
# };
|
|
||||||
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,8 @@
|
||||||
imports =
|
imports =
|
||||||
[
|
[
|
||||||
(modulesPath + "/installer/scan/not-detected.nix")
|
(modulesPath + "/installer/scan/not-detected.nix")
|
||||||
./disko-config.sh
|
# ./disko-config.sh
|
||||||
|
./disko-config.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" ];
|
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" ];
|
||||||
|
|
|
||||||
69
hosts/proserpina/network-configuration.nix
Normal file
69
hosts/proserpina/network-configuration.nix
Normal file
|
|
@ -0,0 +1,69 @@
|
||||||
|
{ pkgs, lib, config, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
# ./file.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
networking = {
|
||||||
|
hostname = "proserpina";
|
||||||
|
wireless.enable = false;
|
||||||
|
networkmanager = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# networking.proxy = {
|
||||||
|
# default = "https://user:password@proxy:port/";
|
||||||
|
# noProxy = "127.0.0.1, localhost, internal.comain";
|
||||||
|
# };
|
||||||
|
|
||||||
|
networking.firewall = {
|
||||||
|
enable = false;
|
||||||
|
# checkReversePath = "loose";
|
||||||
|
# allowedTCPPorts = [ 22000 21027 25565 ];
|
||||||
|
# allowedUDPPorts = [ 22000 21027 41641 51820 ];
|
||||||
|
# allowedTCPPortRanges = [
|
||||||
|
# { from = 9999; to = 9999; } # KDE COnnect
|
||||||
|
# { from = 9999; to = 9999; } # Nicotine+
|
||||||
|
# ];
|
||||||
|
# allowedUDPPortRanges = [
|
||||||
|
# { from = 9999; to = 9999; } # KDE COnnect
|
||||||
|
# ];
|
||||||
|
# interfaces."DEVICENAME".allowedTCPPorts = [ 22999 ]
|
||||||
|
};
|
||||||
|
|
||||||
|
services.syncthing = {
|
||||||
|
enable = false;
|
||||||
|
dataDir = "/home/serenity/";
|
||||||
|
configDir = "/home/serenity/.config/syncthing";
|
||||||
|
user = "serenity";
|
||||||
|
settings.devices = {
|
||||||
|
|
||||||
|
# hades.id = "DEVICE_ID";
|
||||||
|
# proserpina.id = "DEVICE_ID";
|
||||||
|
# hecate.id = "DEVICE_ID";
|
||||||
|
|
||||||
|
};
|
||||||
|
settings.folders = {
|
||||||
|
|
||||||
|
# "FOLDER_ID" = {
|
||||||
|
# path = "/home/serenity/Documents/Notes";
|
||||||
|
# devices = [ "hecate" "hades" "proserpina" ];
|
||||||
|
# };
|
||||||
|
|
||||||
|
# "FOLDER_ID" = {
|
||||||
|
# path = "/home/serenity/Documents/Notes";
|
||||||
|
# devices = [ "hecate" "hades" "proserpina" ];
|
||||||
|
# };
|
||||||
|
|
||||||
|
# "FOLDER_ID" = {
|
||||||
|
# path = "/home/serenity/Documents/Notes";
|
||||||
|
# devices = [ "hecate" "hades" "proserpina" ];
|
||||||
|
# };
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -2,41 +2,17 @@
|
||||||
{
|
{
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
|
|
||||||
|
./display.nix
|
||||||
|
./services.nix
|
||||||
|
./packages
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
security = {
|
security = {
|
||||||
sudo.execWheelOnly = true;
|
sudo.execWheelOnly = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Enable networking
|
|
||||||
networking = {
|
|
||||||
wireless.enable = false;
|
|
||||||
networkmanager = {
|
|
||||||
enable = true;
|
|
||||||
# insertNameServers = [
|
|
||||||
# "10.7.0.1"
|
|
||||||
# ];
|
|
||||||
};
|
|
||||||
proxy = {
|
|
||||||
# default = "https://user:password@proxy:port/";
|
|
||||||
# noProxy = "127.0.0.1, localhost,internal.domain";
|
|
||||||
};
|
|
||||||
firewall = {
|
|
||||||
enable = false;
|
|
||||||
# allowedTCPPorts = [ 22000 21027 25565 ];
|
|
||||||
# allowedUDPPorts = [ 41641 22000 21027 51820 ];
|
|
||||||
# allowedTCPPortRanges = [
|
|
||||||
# { from = 1714; to = 1764; } # KDE Connect
|
|
||||||
# { from = 2234; to = 2239; } # Nicotine+
|
|
||||||
# ];
|
|
||||||
# allowedUDPPortRanges = [
|
|
||||||
# { from = 1714; to = 1764; } # KDE Connect
|
|
||||||
# ];
|
|
||||||
# checkReversePath = "loose";
|
|
||||||
# interfaces."tun0".allowedTCPPorts = [ 28996 ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# Set your time zone.
|
# Set your time zone.
|
||||||
time.timeZone = "Australia/Brisbane";
|
time.timeZone = "Australia/Brisbane";
|
||||||
|
|
||||||
|
|
@ -46,8 +22,6 @@
|
||||||
# Enable X11
|
# Enable X11
|
||||||
services.xserver = {
|
services.xserver = {
|
||||||
enable = true;
|
enable = true;
|
||||||
# displayManager.gdm.enable = true;
|
|
||||||
# desktopManager.gnome.enable = true;
|
|
||||||
layout = "us";
|
layout = "us";
|
||||||
xkbVariant = "";
|
xkbVariant = "";
|
||||||
};
|
};
|
||||||
|
|
@ -147,10 +121,10 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
# Disable these cuz they cause problems. see: https://github.com/NixOS/nixpkgs/issues/180175
|
# Disable these cuz they cause problems. see: https://github.com/NixOS/nixpkgs/issues/180175
|
||||||
systemd.services = {
|
# systemd.services = {
|
||||||
NetworkManager-wait-online.enable = lib.mkForce false;
|
# NetworkManager-wait-online.enable = lib.mkForce false;
|
||||||
systemd-networkd-wait-online.enable = lib.mkForce false;
|
# systemd-networkd-wait-online.enable = lib.mkForce false;
|
||||||
};
|
# };
|
||||||
|
|
||||||
# This value determines the NixOS release from which the default
|
# This value determines the NixOS release from which the default
|
||||||
# settings for stateful data, like file locations and database versions
|
# settings for stateful data, like file locations and database versions
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
|
|
||||||
imports = [
|
|
||||||
./configuration.nix
|
|
||||||
./services
|
|
||||||
./packages
|
|
||||||
./network
|
|
||||||
];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
{ config, lib, pkgs, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
import = [
|
|
||||||
#
|
|
||||||
];
|
|
||||||
|
|
||||||
# INSERT NETWORKING CONFIG HERE
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
{
|
{
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
# file.nix
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -27,5 +26,12 @@
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
systemd.services = {
|
||||||
|
networkManager-wait-online.enable = lib.mkForce false;
|
||||||
|
systemd-networkd-wait-online.enable = lib.mkForce false;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
system.stateVersion = "23.11";
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue