tweak: module structure

This commit is contained in:
serenity-F 2026-10-04 21:14:44 +10:00
parent d9717532aa
commit 3f34b819ed
No known key found for this signature in database
10 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,130 @@
{ self, inputs, ... }:
{
# defines the hades specific configuration
flake.nixosConfigurations.hades =
inputs.nixpkgs.lib.nixosSystem
{
# modules that comprise the host specific configuration
modules = with self.nixosModules; [
# user modules
serenity # user module declaration
# shared system modules
core # shared configuration options
user-parts # user variables
# host-specific modules
hades-configuration # host specific configuration options below
hades-hardware # hardware configuration options for host
zfs-support # zfs support module for hades specific zpool
# feature modules
virtualisation # virtual machines
network-proxy # basic dns crypt proxy
media-server # remote mediashare configuration
kde-connect # phone <-> desktop connectivity
terminal # most terminal programs
terminal-emulator # terminal program for desktops
desktop # most desktop programs
music # music consumption
music-production # music creation
gaming # gaming modules, steam, osu, etc.
multimedia # image and video programs
virtual-reality # configuration for vr setup
];
};
# host module declaration
flake.nixosModules.hades-configuration =
{
config,
pkgs,
lib,
...
}:
{
# set hostname
networking.hostName = "hades";
# bootloader settings
boot = {
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
timeout = lib.mkDefault 5;
};
initrd.systemd.enable = true;
};
# cpu settings
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
# gpu monitoring and control
services.lact = {
enable = true;
};
# gpu firmware - https://nixos.wiki/wiki/AMD_GPU
boot = {
# gpu drivers during boot and pre boot
initrd.kernelModules = [ "amdgpu" ];
# exposes gpu drivers to system
kernelModules = [
"amdgpu"
"kvm-amd"
];
};
hardware = {
# amd discrete graphics support
graphics.enable = true;
amdgpu = {
# fixes early video issues
initrd.enable = true;
# amd sanctioned overclocking
overdrive = {
enable = true;
#ppfeaturemask = "0xfffd7fff"; # default
ppfeaturemask = "0xffffffff"; # all overdrive features
};
};
};
# fstrim for ssd
services.fstrim.enable = true;
# corsair mouse software
hardware.ckb-next.enable = true;
# enable printing support
services.printing.enable = true;
# other packages for hades hardware and peripherals
environment.systemPackages = with pkgs; [
# hades performance and hardware
s-tui # stress testing
undervolt # cpu tweaking
# hades peripherals
#input-remapper # razer keypad
#razergenie # razer keypad
#openrazer-daemon # razer keypad
#openrgb-with-all-plugins # for various rgb devices
android-cli # adb for vr headset
android-tools # adb for vr headset
];
};
}

View file

@ -0,0 +1,67 @@
{ ... }:
{
# hardware module declaration
flake.nixosModules.hades-hardware =
{
config,
pkgs,
lib,
modulesPath,
...
}:
{
# important
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
# kernel modules to include
boot.initrd.availableKernelModules = [
"ehci_pci"
"xhci_pci"
"ahci"
"nvme"
"usbhid"
"usb_storage"
"sd_mod"
];
# generic kernel module options
boot = {
initrd.kernelModules = [ ];
kernelModules = [ "kvm-amd" ];
extraModulePackages = [ ];
};
# boot partition
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/2C83-7F40";
fsType = "vfat";
options = [
"fmask=0077"
"dmask=0077"
];
};
# root device configuration
boot.initrd.luks.devices."luks-35440a88-293e-455b-a018-ee1086b07321".device =
"/dev/disk/by-uuid/35440a88-293e-455b-a018-ee1086b07321";
fileSystems."/" = {
device = "/dev/mapper/luks-35440a88-293e-455b-a018-ee1086b07321";
fsType = "ext4";
};
# swap device configuration
boot.initrd.luks.devices."luks-55f7d546-fac9-4ea0-a21e-4c50ecc0d67d".device =
"/dev/disk/by-uuid/55f7d546-fac9-4ea0-a21e-4c50ecc0d67d";
swapDevices = [
{
device = "/dev/mapper/luks-55f7d546-fac9-4ea0-a21e-4c50ecc0d67d";
}
];
};
}

View file

@ -0,0 +1,58 @@
{ inputs, ... }:
{
flake.nixosModules.zfs-support =
{
config,
lib,
pkgs,
...
}:
let
# matches kernel to latest with zfs support
# Black magic wizardry from https://wiki.nixos.org/wiki/ZFS
zfsCompatibleKernelPackages = lib.filterAttrs (
name: kernelPackages:
(builtins.match "linux_[0-9]+_[0-9]+" name) != null
&& (builtins.tryEval kernelPackages).success
&& (!kernelPackages.${config.boot.zfs.package.kernelModuleAttribute}.meta.broken)
) pkgs.linuxKernel.packages;
latestKernelPackage = lib.last (
lib.sort (a: b: (lib.versionOlder a.kernel.version b.kernel.version)) (
builtins.attrValues zfsCompatibleKernelPackages
)
);
in
{
imports = [ inputs.home-manager.nixosModules.home-manager ];
boot = {
# sets system to use latest zfs compatible kernel
kernelPackages = lib.mkForce latestKernelPackage;
# adds zfs support at boot
supportedFilesystems = [ "zfs" ];
# zfs boot settings
zfs = {
forceImportRoot = false;
# imports hades specific zpool
extraPools = [ "orcus" ];
};
};
# adds zfs to system packages
environment.systemPackages = with pkgs; [ zfs ];
# is this needed? - YES nixos yelled at me about it
networking.hostId = "603b0c8b";
# data integrity service
services.zfs.autoScrub.enable = true;
};
}

View file

@ -0,0 +1,59 @@
{ self, inputs, ... }:
{
# defines the installer specific configuration
# use the following command to build a bootable iso
# with the declared system configuration
# `$ nix run nixpkgs#nixos-generators -- --format iso --flake .#usb -o result`
flake.nixosConfigurations.usb = inputs.nixpkgs.lib.nixosSystem {
# modules that comprise the installer specific configuration
modules = with self.nixosModules; [
# user modules
serenity # user module declaration
# shared system modules
core # shared core system modules
user-parts # basic user library
# host-specific modules
usb-configuration # defined below
# feature modules
terminal # full featured terminal supermodule
network-proxy # basic dnscrypt proxy
];
};
# host module declaration
flake.nixosModules.usb-configuration =
{ pkgs, lib, ... }:
{
# set hostname
networking.hostName = "serenity-os";
# bootloader settings
boot = {
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
timeout = lib.mkDefault 5;
};
initrd.systemd.enable = true;
};
# extra supported filesystems at boot
boot.supportedFilesystems = [
"ntfs"
];
};
}