Modularize '/etc/configuration.nix'

This commit is contained in:
2025-05-30 20:28:48 +02:00
parent f948a51a63
commit 931244ee90
9 changed files with 84 additions and 109 deletions

12
modules/audio.nix Normal file
View File

@@ -0,0 +1,12 @@
{ ... }:
{
services.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
}

7
modules/bootloader.nix Normal file
View File

@@ -0,0 +1,7 @@
{ ... }:
{
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/vda";
boot.loader.grub.useOSProber = true;
}

View File

@@ -0,0 +1,33 @@
# 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 + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/7d406784-bf6b-420e-a956-134f719c8206";
fsType = "ext4";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/4cbaffdb-0ca2-4735-87d0-eefe994f0e18"; }
];
# 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.enp1s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}

6
modules/localization.nix Normal file
View File

@@ -0,0 +1,6 @@
{ ... }:
{
time.timeZone = "Europe/Brussels";
i18n.defaultLocale = "en_US.UTF-8";
}

19
modules/networking.nix Normal file
View File

@@ -0,0 +1,19 @@
{ ... }:
{
networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
}

5
modules/printing.nix Normal file
View File

@@ -0,0 +1,5 @@
{ ... }:
{
services.printing.enable = true;
}

12
modules/users.nix Normal file
View File

@@ -0,0 +1,12 @@
{ pkgs, ... }:
{
users.users.h = {
isNormalUser = true;
description = "h";
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [
# thunderbird
];
};
}

11
modules/x.nix Normal file
View File

@@ -0,0 +1,11 @@
{ ... }:
{
services.xserver = {
enable = true;
displayManager.gdm.enable = true;
desktopManager.gnome.enable = true;
xkb.layout = "us";
xkb.variant = "";
};
}