refactor: move system modules into proper directories
This commit is contained in:
parent
16f28bf227
commit
1989535535
10 changed files with 80 additions and 105 deletions
|
@ -1,13 +1,8 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
hostname,
|
hostname,
|
||||||
pkgs,
|
|
||||||
type,
|
type,
|
||||||
modulesPath,
|
modulesPath,
|
||||||
inputs,
|
|
||||||
config,
|
|
||||||
specialArgs,
|
|
||||||
username,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
|
@ -15,13 +10,14 @@
|
||||||
# Common options for all machines.
|
# Common options for all machines.
|
||||||
[
|
[
|
||||||
(modulesPath + "/installer/scan/not-detected.nix")
|
(modulesPath + "/installer/scan/not-detected.nix")
|
||||||
./modules/bootloaders/systemd-boot.nix
|
./modules/boot.nix
|
||||||
|
./modules/networking.nix
|
||||||
|
./modules/nix.nix
|
||||||
./modules/programs/zsh.nix
|
./modules/programs/zsh.nix
|
||||||
./modules/hardware/networking.nix
|
|
||||||
./modules/security.nix
|
./modules/security.nix
|
||||||
./modules/users.nix
|
./modules/users.nix
|
||||||
]
|
]
|
||||||
# Options for desktops.
|
# Options for graphical systems.
|
||||||
(lib.optionals (type == "desktop") [
|
(lib.optionals (type == "desktop") [
|
||||||
./modules/hardware/audio.nix
|
./modules/hardware/audio.nix
|
||||||
./modules/hardware/bluetooth.nix
|
./modules/hardware/bluetooth.nix
|
||||||
|
@ -33,66 +29,9 @@
|
||||||
# Options for specific hostnames.
|
# Options for specific hostnames.
|
||||||
(lib.optionals (hostname == "nemesis") [
|
(lib.optionals (hostname == "nemesis") [
|
||||||
./hw-nemesis.nix
|
./hw-nemesis.nix
|
||||||
./modules/hardware/nvidia.nix
|
./modules/bootloaders/systemd-boot.nix
|
||||||
./modules/hardware/cpu_amd.nix
|
./modules/hardware/cpu_amd.nix
|
||||||
|
./modules/hardware/nvidia.nix
|
||||||
])
|
])
|
||||||
];
|
];
|
||||||
|
|
||||||
boot = {
|
|
||||||
loader = {
|
|
||||||
timeout = 5;
|
|
||||||
efi.canTouchEfiVariables = true;
|
|
||||||
};
|
|
||||||
kernelPackages = pkgs.linuxPackages_latest;
|
|
||||||
initrd.availableKernelModules = [
|
|
||||||
"nvme"
|
|
||||||
"xhci_pci"
|
|
||||||
"ahci"
|
|
||||||
"usbhid"
|
|
||||||
"usb_storage"
|
|
||||||
"sd_mod"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
home-manager = {
|
|
||||||
useGlobalPkgs = true;
|
|
||||||
useUserPackages = true;
|
|
||||||
extraSpecialArgs = specialArgs;
|
|
||||||
};
|
|
||||||
|
|
||||||
system.stateVersion = "24.11";
|
|
||||||
|
|
||||||
users.mutableUsers = false; # Always reset users on system activation
|
|
||||||
|
|
||||||
nixpkgs.config.allowUnfree = true;
|
|
||||||
nix = {
|
|
||||||
settings.experimental-features = [
|
|
||||||
"nix-command"
|
|
||||||
"flakes"
|
|
||||||
"pipe-operators"
|
|
||||||
];
|
|
||||||
|
|
||||||
# Add binary caches to avoid having to compile them
|
|
||||||
settings = {
|
|
||||||
substituters = [
|
|
||||||
"https://hyprland.cachix.org"
|
|
||||||
"https://cuda-maintainers.cachix.org"
|
|
||||||
"https://nix-community.cachix.org"
|
|
||||||
"https://nvf.cachix.org"
|
|
||||||
"https://yazi.cachix.org"
|
|
||||||
];
|
|
||||||
trusted-public-keys = [
|
|
||||||
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
|
|
||||||
"cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
|
|
||||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
|
||||||
"nvf.cachix.org-1:GMQWiUhZ6ux9D5CvFFMwnc2nFrUHTeGaXRlVBXo+naI="
|
|
||||||
"yazi.cachix.org-1:Dcdz63NZKfvUCbDGngQDAZq6kOroIrFoyO064uvLh8k="
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
time.timeZone = "Asia/Singapore";
|
|
||||||
|
|
||||||
i18n.defaultLocale = "en_SG.UTF-8";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
18
systems/modules/boot.nix
Normal file
18
systems/modules/boot.nix
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
boot = {
|
||||||
|
loader = {
|
||||||
|
timeout = 5;
|
||||||
|
efi.canTouchEfiVariables = true;
|
||||||
|
};
|
||||||
|
kernelPackages = pkgs.linuxPackages_latest;
|
||||||
|
initrd.availableKernelModules = [
|
||||||
|
"nvme"
|
||||||
|
"xhci_pci"
|
||||||
|
"ahci"
|
||||||
|
"usbhid"
|
||||||
|
"usb_storage"
|
||||||
|
"sd_mod"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
# Use the extlinux boot loader. (NixOS wants to enable GRUB by default)
|
|
||||||
boot.loader.grub.enable = false;
|
|
||||||
# Enables the generation of /boot/extlinux/extlinux.conf
|
|
||||||
boot.loader.generic-extlinux-compatible.enable = true;
|
|
||||||
}
|
|
|
@ -3,10 +3,17 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}: {
|
}:
|
||||||
|
{
|
||||||
# Accept the license by default; needed for some packages.
|
# Accept the license by default; needed for some packages.
|
||||||
nixpkgs.config.nvidia.acceptLicense = true;
|
nixpkgs.config.nvidia.acceptLicense = true;
|
||||||
services.xserver.videoDrivers = ["nvidia"];
|
nix.settings = {
|
||||||
|
substituters = [ "https://cuda-maintainers.cachix.org" ];
|
||||||
|
trusted-public-keys = [
|
||||||
|
"cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
|
||||||
|
];
|
||||||
|
};
|
||||||
|
services.xserver.videoDrivers = [ "nvidia" ];
|
||||||
environment.variables = {
|
environment.variables = {
|
||||||
GBM_BACKEND = "nvidia-drm";
|
GBM_BACKEND = "nvidia-drm";
|
||||||
LIBVA_DRIVER_NAME = "nvidia";
|
LIBVA_DRIVER_NAME = "nvidia";
|
||||||
|
@ -17,19 +24,23 @@
|
||||||
nvidia-container-toolkit.enable = true;
|
nvidia-container-toolkit.enable = true;
|
||||||
graphics = {
|
graphics = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = inputs.hyprland.inputs.nixpkgs.legacyPackages.${pkgs.stdenv.hostPlatform.system}.mesa.drivers;
|
package = inputs.hyprland.inputs.nixpkgs.legacyPackages.${pkgs.stdenv.hostPlatform.system}.mesa;
|
||||||
extraPackages = with pkgs; [
|
extraPackages = with pkgs; [
|
||||||
nvidia-vaapi-driver # hardware acceleration
|
nvidia-vaapi-driver # hardware acceleration
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
nvidia = {
|
nvidia = {
|
||||||
modesetting.enable = true;
|
modesetting.enable = true;
|
||||||
# powerManagement.enable = true;
|
|
||||||
open = false;
|
open = false;
|
||||||
nvidiaSettings = true;
|
nvidiaSettings = true;
|
||||||
nvidiaPersistenced = true;
|
nvidiaPersistenced = true;
|
||||||
package = config.boot.kernelPackages.nvidiaPackages.latest;
|
package = config.boot.kernelPackages.nvidiaPackages.latest;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
boot.initrd.availableKernelModules = ["nvidia" "nvidia_modeset" "nvidia_uvm" "nvidia_drm"];
|
boot.initrd.availableKernelModules = [
|
||||||
|
"nvidia"
|
||||||
|
"nvidia_modeset"
|
||||||
|
"nvidia_uvm"
|
||||||
|
"nvidia_drm"
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
28
systems/modules/nix.nix
Normal file
28
systems/modules/nix.nix
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
{
|
||||||
|
system.stateVersion = "24.11";
|
||||||
|
|
||||||
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
nix = {
|
||||||
|
settings = {
|
||||||
|
experimental-features = [
|
||||||
|
"nix-command"
|
||||||
|
"flakes"
|
||||||
|
"pipe-operators"
|
||||||
|
];
|
||||||
|
|
||||||
|
# Add binary caches to avoid having to compile them
|
||||||
|
substituters = [
|
||||||
|
"https://hyprland.cachix.org"
|
||||||
|
"https://nix-community.cachix.org"
|
||||||
|
"https://nvf.cachix.org"
|
||||||
|
"https://yazi.cachix.org"
|
||||||
|
];
|
||||||
|
trusted-public-keys = [
|
||||||
|
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
|
||||||
|
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||||
|
"nvf.cachix.org-1:GMQWiUhZ6ux9D5CvFFMwnc2nFrUHTeGaXRlVBXo+naI="
|
||||||
|
"yazi.cachix.org-1:Dcdz63NZKfvUCbDGngQDAZq6kOroIrFoyO064uvLh8k="
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,2 +0,0 @@
|
||||||
{
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
{ inputs, ... }:
|
|
||||||
{
|
|
||||||
sops = {
|
|
||||||
defaultSopsFile = ../../../secrets/secrets.yaml;
|
|
||||||
age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
|
||||||
secrets.password.neededForUsers = true;
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,5 +1,16 @@
|
||||||
{ config, ... }:
|
{ config, specialArgs, ... }:
|
||||||
{
|
{
|
||||||
|
home-manager = {
|
||||||
|
useGlobalPkgs = true;
|
||||||
|
useUserPackages = true;
|
||||||
|
extraSpecialArgs = specialArgs;
|
||||||
|
};
|
||||||
|
|
||||||
|
users.mutableUsers = false; # Always reset users on system activation
|
||||||
|
|
||||||
|
time.timeZone = "Asia/Singapore";
|
||||||
|
i18n.defaultLocale = "en_SG.UTF-8";
|
||||||
|
|
||||||
home-manager.users.rafiq.imports = [ ../../users/rafiq.nix ];
|
home-manager.users.rafiq.imports = [ ../../users/rafiq.nix ];
|
||||||
users.users.rafiq = {
|
users.users.rafiq = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
{ inputs, config, ... }:
|
|
||||||
{
|
|
||||||
home-manager.users.rafiq.imports = [ ../../../users/rafiq.nix ];
|
|
||||||
users.users.rafiq = {
|
|
||||||
isNormalUser = true;
|
|
||||||
description = "rafiq";
|
|
||||||
hashedPasswordFile = config.sops.secrets.password.path;
|
|
||||||
extraGroups = [
|
|
||||||
"networkmanager"
|
|
||||||
"wheel"
|
|
||||||
];
|
|
||||||
openssh.authorizedKeys.keys = [
|
|
||||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILdsZyY3gu8IGB8MzMnLdh+ClDxQQ2RYG9rkeetIKq8n"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue