refactor: massively overhaul home manager module system

This commit is contained in:
Youwen Wu 2024-12-25 19:47:59 -08:00
parent b2270408fc
commit a506d2aed4
Signed by: youwen
GPG key ID: 865658ED1FE61EC3
64 changed files with 5201 additions and 64 deletions

View file

@ -0,0 +1,232 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{
config,
inputs,
pkgs,
lib,
...
}:
{
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
];
# Bootloader.
boot = {
plymouth = {
enable = true;
# theme = "rings";
# themePackages = with pkgs; [
# # By default we would install all themes
# (adi1090x-plymouth-themes.override {
# selected_themes = [ "rings" ];
# })
# ];
font = "${config.stylix.fonts.monospace.package}/share/fonts/truetype/NerdFonts/CaskaydiaCove/CaskaydiaCoveNerdFontMono-Regular.ttf";
};
# Enable "Silent Boot"
consoleLogLevel = 3;
initrd.verbose = false;
kernelParams = [
"quiet"
"splash"
"boot.shell_on_fail"
"rd.systemd.show_status=false"
"rd.udev.log_level=3"
"udev.log_priority=3"
# "display=HDMI-A-1:2560x1440@144D"
];
# Hide the OS choice for bootloaders.
# It's still possible to open the bootloader list by pressing any key
# It will just not appear on screen unless a key is pressed
loader = {
efi.canTouchEfiVariables = true;
# timeout = 15;
# Lanzaboote currently replaces the systemd-boot module.
# This setting is usually set to true in configuration.nix
# generated at installation time. So we force it to false
# for now.
# timeout = 0;
systemd-boot = {
enable = true;
consoleMode = "auto";
};
};
initrd.systemd.enable = true;
};
services.ucodenix = {
enable = true;
cpuModelId = "00A50F00";
};
# boot.lanzaboote = {
# enable = false;
# pkiBundle = "/etc/secureboot";
# };
# services.keyd = {
# enable = true;
# keyboards = {
# default = {
# ids = [ "*" ];
# settings = {
# main = {
# capslock = "esc";
# leftalt = "leftcontrol";
# leftcontrol = "leftalt";
# };
# };
# };
# };
# };
boot.initrd.luks.devices."luks-52d1be6d-b32f-41e0-a6d7-2ff52599fe7c".device =
"/dev/disk/by-uuid/52d1be6d-b32f-41e0-a6d7-2ff52599fe7c";
services.tlp.enable = true;
powerManagement = {
powerDownCommands = "pidof hyprlock || ${pkgs.hyprlock}/bin/hyprlock";
cpuFreqGovernor = "performance";
};
networking.hostName = "adrastea"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# select kernel
boot.kernelPackages = pkgs.linuxPackages_zen;
# 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;
# Set your time zone.
time.timeZone = "America/Los_Angeles";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
systemd.services = {
NetworkManager-wait-online.enable = false;
};
# Enable the X11 windowing system.
# You can disable this if you're only using the Wayland session.
services.xserver.enable = false;
programs.nix-ld = {
enable = true;
libraries = with pkgs; [
icu
xorg.libXtst
xorg.libXi
];
};
hardware.nvidia = {
modesetting.enable = true;
powerManagement.enable = true;
powerManagement.finegrained = false;
nvidiaSettings = true;
open = true;
# prime = {
# amdgpuBusId = "PCI:4:0:0";
# nvidiaBusId = "PCI:1:0:0";
# # offload = {
# # enable = true;
# # enableOffloadCmd = true;
# # };
# sync.enable = true;
# };
};
hardware.graphics.enable = true;
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.beta;
services.xserver.videoDrivers = [ "nvidia" ];
# services.desktopManager.plasma6.enable = true;
# Configure keymap in X11
services.xserver = {
xkb.layout = "us";
xkb.variant = "";
};
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users.users.youwen = {
isNormalUser = true;
description = "Youwen Wu";
extraGroups = [ "networkmanager" ];
};
nix.settings = {
trusted-users = [
"root"
"youwen"
];
};
services.udev.extraRules = ''
KERNEL=="cpu_dma_latency", GROUP="realtime"
'';
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
wget
git
curl
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
programs.dconf.enable = true;
programs.hyprland.enable = true;
programs.zsh.enable = false;
programs.fish.enable = true;
users.users.youwen.shell = pkgs.fish;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.05"; # Did you read the comment?
}

View file

@ -0,0 +1,50 @@
{
inputs,
...
}:
{
imports =
[
./configuration.nix
../../modules/linux/gaming
../../modules/linux/audio
../../modules/linux/networking
../../modules/linux/fonts
../../modules/linux/greeter
../../modules/linux/core
../../modules/linux/desktop-portal
../../modules/linux/audio-prod
../../modules/linux/wine
../../modules/linux/stylix
../../modules/linux/distrobox
../../modules/linux/flatpak
../../overlays
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.backupFileExtension = "backup";
home-manager.extraSpecialArgs = {
inherit inputs;
};
home-manager.users.youwen = {
imports =
[
./home-manager-extras
../../users/youwen/linux/laptop
../../users/youwen/linux/packages/x86_64
../../users/youwen/linux/programs
../../users/youwen/common
../../users/youwen/linux/spicetify
(import ../../users/youwen/common/fastfetch { })
]
++ (with inputs; [
nix-index-database.hmModules.nix-index
]);
};
}
]
++ (with inputs; [
home-manager.nixosModules.home-manager
ucode.nixosModules.default
]);
}

View file

@ -0,0 +1,54 @@
# 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 = [
"nvme"
"xhci_pci"
"usbhid"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" = {
device = "/dev/disk/by-uuid/01983a52-5693-4cda-ad2e-5a406776bfb9";
fsType = "ext4";
};
boot.initrd.luks.devices."luks-f169a679-d70b-4dff-a344-7131f3303813".device =
"/dev/disk/by-uuid/f169a679-d70b-4dff-a344-7131f3303813";
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/3FCB-9D60";
fsType = "vfat";
options = [
"fmask=0022"
"dmask=0022"
];
};
swapDevices = [ { device = "/dev/disk/by-uuid/f28d0752-feab-4591-899e-e5deac3712d0"; } ];
# 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.enp4s0f3u2.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -0,0 +1,20 @@
{ pkgs, lib, ... }:
{
wayland.windowManager.hyprland.settings.monitor = pkgs.lib.mkForce [
# "eDP-1,2560x1440@165,0x0,1.6"
"eDP-1, disable"
"HDMI-A-1,2560x1440@144,0x0,1.0"
];
wayland.windowManager.hyprland.settings.cursor.no_hardware_cursors = true;
# since we are using this as a "desktop" of sorts, we have no need to save
# power by using optimus. poor performance on external display, so we add
# this line to force hyprland to use the nvidia GPU only for rendering. can
# be removed if only using internal display
wayland.windowManager.hyprland.settings.env = [
"AQ_DRM_DEVICES,/dev/dri/card1:/dev/dri/card0"
];
programs.waybar.settings.mainBar.output = "HDMI-A-1";
programs.hyprlock.settings.background.monitor = lib.mkForce "HDMI-A-1";
}