refactor: move system specific modules into system/modules

This commit is contained in:
Mohammad Rafiq 2025-03-01 06:05:53 +08:00
parent abfacba0aa
commit fa79ebae52
5 changed files with 12 additions and 12 deletions

View file

@ -1,40 +0,0 @@
# Contains common configration for all machines
{
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Set your time zone.
time.timeZone = "Asia/Singapore";
# Select internationalisation properties.
i18n.defaultLocale = "en_SG.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_SG.UTF-8";
LC_IDENTIFICATION = "en_SG.UTF-8";
LC_MEASUREMENT = "en_SG.UTF-8";
LC_MONETARY = "en_SG.UTF-8";
LC_NAME = "en_SG.UTF-8";
LC_NUMERIC = "en_SG.UTF-8";
LC_PAPER = "en_SG.UTF-8";
LC_TELEPHONE = "en_SG.UTF-8";
LC_TIME = "en_SG.UTF-8";
};
# Configure keymap in X11
services.xserver.xkb = {
layout = "us";
variant = "";
};
# Define a user account. Don't forget to set a password with passwd.
users.users.rafiq = {
isNormalUser = true;
description = "rafiq";
extraGroups = [ "networkmanager" "wheel" ];
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
}

View file

@ -1,39 +0,0 @@
#
# Common networking settings for all machines.
# Anything system-specific should not be here.
#
{
networking = {
# Enable networkManager
# TODO: Look into the networkManager options.
networkmanager.enable = true;
# Configures a simple stateful firewall.
# By default, it doesn't allow any incoming connections.
firewall = {
enable = true;
allowedTCPPorts = [
22 # SSH
];
allowedUDPPorts = [];
};
};
# Add binary caches to avoid having to compile them
nix.settings = {
substituters = [
"https://hyprland.cachix.org"
"https://cuda-maintainers.cachix.org"
"https://nix-community.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="
];
};
# TODO: look into openssh and tailscale settings.
services.openssh.enable = true;
services.tailscale.enable = true;
}

View file

@ -1,38 +0,0 @@
{ pkgs, config, inputs, ... }:
let
hyprland-pkgs = inputs.hyprland.inputs.nixpkgs.legacyPackages.${pkgs.stdenv.hostPlatform.system};
in
{
hardware = {
graphics = {
enable = true;
package = hyprland-pkgs.mesa.drivers;
extraPackages = with pkgs; [
nvidia-vaapi-driver
ocl-icd
cudaPackages.cudatoolkit
];
};
nvidia = {
open = true;
package = config.boot.kernelPackages.nvidiaPackages.latest;
};
};
services.xserver = {
enable = true;
videoDrivers = [ "nvidia" ];
};
environment.variables = {
NIXOS_OZONE_WL = "1"; # Hint to electron apps to use Wayland
LIBVA_DRIVER_NAME = "nvidia";
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
NVD_BACKEND = "direct"; # Set VAAPI driver backend
};
environment.systemPackages = with pkgs; [
clinfo
pciutils
];
}

View file

@ -1,32 +0,0 @@
{ inputs, pkgs, ... }:
{
# Define the Universal Wayland Session Manager.
# This will start our compositor.
# TODO: Eventually move this to a common desktop module.
programs.uwsm = {
enable = true;
waylandCompositors.hyprland = {
prettyName = "Hyprland";
comment = "Hyprland compositor managed by UWSM";
binPath = "/run/current-system/sw/bin/Hyprland";
};
};
programs.hyprland = {
enable = true;
# Use the packages that we have defined as inputs in our flake.
package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
portalPackage = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland;
# Enable sustemd integration
systemd.setPath.enable = true;
withUWSM = true;
# Enable compatibility with X11 apps
xwayland.enable = true;
};
services.hypridle.enable = true;
# Run a script that launches Hyprland through UWSM on login.
services.hyprland-tty-launch.enable = true;
}