restructure system.nix into multiple files
This commit is contained in:
parent
f61859eedc
commit
ab6245fe26
18
system/boot.nix
Normal file
18
system/boot.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{pkgs, ...}: {
|
||||
boot = {
|
||||
loader = {
|
||||
grub = {
|
||||
enable = true;
|
||||
devices = [ "nodev" ];
|
||||
efiSupport = true;
|
||||
useOSProber = true;
|
||||
};
|
||||
# systemd-boot.enable = true;
|
||||
efi.canTouchEfiVariables = true;
|
||||
# timeout = 0;
|
||||
};
|
||||
|
||||
# kernelModules = [];
|
||||
kernelPackages = pkgs.linuxPackages_zen;
|
||||
};
|
||||
}
|
||||
|
|
@ -1,6 +1,13 @@
|
|||
{inputs, lib, pkgs, config, ...}: {
|
||||
{pkgs, ...}: {
|
||||
imports = [
|
||||
../options.nix
|
||||
./boot.nix
|
||||
./fonts.nix
|
||||
./hardware.nix
|
||||
./networking.nix
|
||||
./power.nix
|
||||
./qemu.nix
|
||||
./virtualisation.nix
|
||||
./wireless.nix
|
||||
];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
|
|
@ -34,25 +41,7 @@
|
|||
};
|
||||
};
|
||||
|
||||
boot = {
|
||||
loader = {
|
||||
systemd-boot.enable = true;
|
||||
efi.canTouchEfiVariables = true;
|
||||
# timeout = 0;
|
||||
};
|
||||
|
||||
# kernelModules = [];
|
||||
kernelPackages = pkgs.linuxPackages_zen;
|
||||
};
|
||||
|
||||
hardware = {
|
||||
enableAllFirmware = true;
|
||||
amdgpu.initrd.enable = true;
|
||||
graphics = {
|
||||
enable = true;
|
||||
enable32Bit = true;
|
||||
};
|
||||
};
|
||||
time.hardwareClockInLocalTime = true;
|
||||
|
||||
security = {
|
||||
polkit.enable = true;
|
||||
|
|
@ -60,80 +49,6 @@
|
|||
sudo.wheelNeedsPassword = false; # Allow sudo without password
|
||||
};
|
||||
|
||||
fonts = {
|
||||
enableDefaultPackages = true;
|
||||
packages = with pkgs; [
|
||||
noto-fonts
|
||||
noto-fonts-cjk-sans
|
||||
noto-fonts-emoji
|
||||
liberation_ttf
|
||||
roboto
|
||||
roboto-mono
|
||||
twitter-color-emoji
|
||||
nerd-fonts.fira-code
|
||||
nerd-fonts.fira-mono
|
||||
unicode-emoji
|
||||
fira-sans
|
||||
font-awesome
|
||||
fira-mono
|
||||
fira-code
|
||||
material-icons
|
||||
source-sans
|
||||
source-code-pro
|
||||
pkgs.nur.repos.redpz.sf-mono
|
||||
|
||||
inputs.apple-fonts.packages.${pkgs.system}.sf-pro-nerd
|
||||
inputs.apple-fonts.packages.${pkgs.system}.sf-mono-nerd
|
||||
inputs.apple-fonts.packages.${pkgs.system}.sf-compact-nerd
|
||||
inputs.apple-fonts.packages.${pkgs.system}.ny-nerd
|
||||
|
||||
];
|
||||
fontconfig = {
|
||||
defaultFonts = {
|
||||
monospace = ["SF Mono" "Fira Mono" "Noto Mono"];
|
||||
serif = ["Noto Serif"];
|
||||
sansSerif = ["SF Pro Text" "Noto Sans" "Roboto"];
|
||||
emoji = ["Twitter Color Emoji" "Noto Emoji"];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
virtualisation = lib.mkIf config.enableVirtualisation {
|
||||
libvirtd = {
|
||||
enable = true;
|
||||
qemu = {
|
||||
package = pkgs.qemu_kvm;
|
||||
runAsRoot = true;
|
||||
swtpm.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
networking = {
|
||||
nameservers = [ "9.9.9.9#dns.quad9.net" "1.1.1.1#one.one.one.one" ];
|
||||
# networkmanager.wifi.backend = "iwd";
|
||||
# networkmanager.enable = true;
|
||||
|
||||
wireless.iwd = {
|
||||
enable = true;
|
||||
settings = {
|
||||
Settings ={
|
||||
AutoConnect = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
firewall = {
|
||||
enable = true;
|
||||
# ssh: 22 TCP
|
||||
# cups: 631 TCP
|
||||
# syncthing:
|
||||
# 22000 TCP and/or UDP for sync traffic
|
||||
# 21027/UDP for discovery
|
||||
allowedTCPPorts = [ 22 22000 631 ];
|
||||
allowedUDPPorts = [ 22000 21027 ];
|
||||
};
|
||||
};
|
||||
|
||||
time.timeZone = "Europe/Amsterdam";
|
||||
i18n.defaultLocale = "en_GB.UTF-8";
|
||||
|
||||
|
|
@ -143,55 +58,8 @@
|
|||
};
|
||||
|
||||
services = {
|
||||
qemuGuest.enable = config.vmGuest;
|
||||
spice-vdagentd.enable = config.vmGuest;
|
||||
|
||||
dbus.implementation = "broker";
|
||||
|
||||
connman = {
|
||||
enable = true;
|
||||
wifi.backend = "iwd"; # Use iwd for Wi-Fi management.
|
||||
extraFlags = [ "--nodnsproxy" ];
|
||||
};
|
||||
|
||||
resolved = {
|
||||
enable = true;
|
||||
dnssec = "true";
|
||||
domains = ["~."];
|
||||
fallbackDns = [ "9.9.9.9#dns.quad9.net" "149.112.112.112#dns.quad9.net" "1.1.1.1#one.one.one.one" "1.0.0.1#one.one.one.one" ];
|
||||
dnsovertls = "true";
|
||||
};
|
||||
|
||||
thermald.enable = config.useThermald;
|
||||
|
||||
tlp = lib.mkIf (config.has_battery) {
|
||||
enable = true;
|
||||
settings = {
|
||||
START_CHARGE_THRESH_BAT0 = 50;
|
||||
STOP_CHARGE_THRESH_BAT0 = 85;
|
||||
};
|
||||
} // config.tlpConfig or {};
|
||||
|
||||
auto-cpufreq = lib.mkIf (config.has_battery) {
|
||||
enable = true;
|
||||
settings = {
|
||||
battery = {
|
||||
governor = "powersave"; # Set the CPU governor to powersave.
|
||||
energy_performance_preference = "power";
|
||||
turbo = "never";
|
||||
|
||||
# enable_thresholds = true;
|
||||
# start_threshold = 50;
|
||||
# stop_threshold = 90;
|
||||
};
|
||||
|
||||
charger = {
|
||||
governor = "performance"; # Set the CPU governor to performance when charging.
|
||||
turbo = "auto";
|
||||
};
|
||||
};
|
||||
} // config.cpufreqConfig or {};
|
||||
|
||||
pipewire = {
|
||||
enable = true;
|
||||
pulse.enable = true;
|
||||
|
|
|
|||
40
system/fonts.nix
Normal file
40
system/fonts.nix
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{inputs, pkgs, ...}: {
|
||||
fonts = {
|
||||
enableDefaultPackages = true;
|
||||
packages = with pkgs; [
|
||||
noto-fonts
|
||||
noto-fonts-cjk-sans
|
||||
noto-fonts-emoji
|
||||
liberation_ttf
|
||||
roboto
|
||||
roboto-mono
|
||||
twitter-color-emoji
|
||||
nerd-fonts.fira-code
|
||||
nerd-fonts.fira-mono
|
||||
unicode-emoji
|
||||
fira-sans
|
||||
font-awesome
|
||||
fira-mono
|
||||
fira-code
|
||||
material-icons
|
||||
source-sans
|
||||
source-code-pro
|
||||
pkgs.nur.repos.redpz.sf-mono
|
||||
|
||||
inputs.apple-fonts.packages.${pkgs.system}.sf-pro-nerd
|
||||
inputs.apple-fonts.packages.${pkgs.system}.sf-mono-nerd
|
||||
inputs.apple-fonts.packages.${pkgs.system}.sf-compact-nerd
|
||||
inputs.apple-fonts.packages.${pkgs.system}.ny-nerd
|
||||
|
||||
];
|
||||
fontconfig = {
|
||||
defaultFonts = {
|
||||
monospace = ["SF Mono" "Fira Mono" "Noto Mono"];
|
||||
serif = ["Noto Serif"];
|
||||
sansSerif = ["SF Pro Text" "Noto Sans" "Roboto"];
|
||||
emoji = ["Twitter Color Emoji" "Noto Emoji"];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
10
system/hardware.nix
Normal file
10
system/hardware.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{...}: {
|
||||
hardware = {
|
||||
enableAllFirmware = true;
|
||||
amdgpu.initrd.enable = true;
|
||||
graphics = {
|
||||
enable = true;
|
||||
enable32Bit = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
26
system/networking.nix
Normal file
26
system/networking.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{...}: {
|
||||
networking = {
|
||||
nameservers = [ "9.9.9.9#dns.quad9.net" "1.1.1.1#one.one.one.one" ];
|
||||
# networkmanager.wifi.backend = "iwd";
|
||||
# networkmanager.enable = true;
|
||||
|
||||
firewall = {
|
||||
enable = true;
|
||||
# ssh: 22 TCP
|
||||
# cups: 631 TCP
|
||||
# syncthing:
|
||||
# 22000 TCP and/or UDP for sync traffic
|
||||
# 21027/UDP for discovery
|
||||
allowedTCPPorts = [ 22 22000 631 ];
|
||||
allowedUDPPorts = [ 22000 21027 ];
|
||||
};
|
||||
};
|
||||
|
||||
services.resolved = {
|
||||
enable = true;
|
||||
dnssec = "true";
|
||||
domains = ["~."];
|
||||
fallbackDns = [ "9.9.9.9#dns.quad9.net" "149.112.112.112#dns.quad9.net" "1.1.1.1#one.one.one.one" "1.0.0.1#one.one.one.one" ];
|
||||
dnsovertls = "true";
|
||||
};
|
||||
}
|
||||
37
system/power.nix
Normal file
37
system/power.nix
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{lib, config, ...}: {
|
||||
imports = [
|
||||
../options.nix
|
||||
];
|
||||
|
||||
services = {
|
||||
thermald.enable = config.useThermald;
|
||||
|
||||
tlp = lib.mkIf (config.has_battery) {
|
||||
enable = true;
|
||||
settings = {
|
||||
START_CHARGE_THRESH_BAT0 = 50;
|
||||
STOP_CHARGE_THRESH_BAT0 = 85;
|
||||
};
|
||||
} // config.tlpConfig or {};
|
||||
|
||||
auto-cpufreq = lib.mkIf (config.has_battery) {
|
||||
enable = true;
|
||||
settings = {
|
||||
battery = {
|
||||
governor = "powersave"; # Set the CPU governor to powersave.
|
||||
energy_performance_preference = "power";
|
||||
turbo = "never";
|
||||
|
||||
# enable_thresholds = true;
|
||||
# start_threshold = 50;
|
||||
# stop_threshold = 90;
|
||||
};
|
||||
|
||||
charger = {
|
||||
governor = "performance"; # Set the CPU governor to performance when charging.
|
||||
turbo = "auto";
|
||||
};
|
||||
};
|
||||
} // config.cpufreqConfig or {};
|
||||
};
|
||||
}
|
||||
10
system/qemu.nix
Normal file
10
system/qemu.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{config, ...}: {
|
||||
imports = [
|
||||
../options.nix
|
||||
];
|
||||
|
||||
services = {
|
||||
qemuGuest.enable = config.vmGuest;
|
||||
spice-vdagentd.enable = config.vmGuest;
|
||||
};
|
||||
}
|
||||
16
system/virtualisation.nix
Normal file
16
system/virtualisation.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{lib, pkgs, config, ...}: {
|
||||
imports = [
|
||||
../options.nix
|
||||
];
|
||||
|
||||
virtualisation = lib.mkIf config.enableVirtualisation {
|
||||
libvirtd = {
|
||||
enable = true;
|
||||
qemu = {
|
||||
package = pkgs.qemu_kvm;
|
||||
runAsRoot = true;
|
||||
swtpm.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
15
system/wireless.nix
Normal file
15
system/wireless.nix
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{...}: {
|
||||
networking.wireless.iwd = {
|
||||
enable = true;
|
||||
settings = {
|
||||
Settings ={
|
||||
AutoConnect = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
services.connman = {
|
||||
enable = true;
|
||||
wifi.backend = "iwd"; # Use iwd for Wi-Fi management.
|
||||
extraFlags = [ "--nodnsproxy" ];
|
||||
};
|
||||
}
|
||||
Loading…
Reference in a new issue