refactor!: restructure and document configuration

This commit is contained in:
Alexandre Cavalheiro S. Tiago da Silva 2025-03-06 05:30:47 -03:00
parent 4a02e072a7
commit f87f9995be
Signed by: wizardlink
GPG key ID: A5767B54367CFBDF
126 changed files with 957 additions and 590 deletions

70
shared/nixos/common.nix Normal file
View file

@ -0,0 +1,70 @@
{ pkgs, nixpkgs, ... }:
{
# Enable experimental features
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
# Optimize storage
nix.optimise.automatic = true;
nix.settings.auto-optimise-store = true;
# Pin the nix registry
nix.registry = {
nixpkgs.flake = nixpkgs;
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# Enable nh, a bundle of CLI utilities for NixOS
programs.nh = {
enable = true;
# Enable automatic garbage collection.
clean.enable = true;
clean.dates = "daily";
clean.extraArgs = "--keep-since 4d --keep 3";
flake = "/home/wizardlink/.system";
};
# Enable flatpak to all users.
services.flatpak.enable = true;
environment.systemPackages = with pkgs; [
## Tools
# Utilities
bat
duf
fuseiso
lm_sensors
p7zip
tree
unrar
unzip
wget
zip
# File managing
sshfs
yazi
# Networking
gping
nmap
# Processes
(btop.override {
# AMD GPU support
rocmSupport = true;
})
killall
# Filter
fzf
ripgrep
];
}

12
shared/nixos/default.nix Normal file
View file

@ -0,0 +1,12 @@
{ ... }:
{
imports = [
./common.nix
./desktop.nix
./gaming.nix
./hardware.nix
./system.nix
./virtualization.nix
];
}

109
shared/nixos/desktop.nix Normal file
View file

@ -0,0 +1,109 @@
{
pkgs,
...
}:
{
# Enable SDDM.
services.displayManager.sddm = {
enable = true;
wayland.enable = true;
theme = "catppuccin-frappe";
package = pkgs.kdePackages.sddm;
};
# Enable XDG Desktop Portals.
xdg.portal = {
enable = true;
config = {
common = {
default = [ "wlr" ];
};
};
};
# Needed for home-manager
environment.pathsToLink = [
"/share/xdg-desktop-portal"
"/share/applications"
];
# Enable OpenGL.
hardware.graphics = {
enable = true;
enable32Bit = true;
extraPackages = with pkgs; [
rocmPackages.clr.icd # OpenGL hwa
];
};
# Set the default fonts for the system.
fonts.fontconfig = {
defaultFonts = {
serif = [ "IBM Plex Serif" ];
sansSerif = [ "IBM Plex Sans" ];
monospace = [ "IBM Plex Mono" ];
};
};
# Enable Thunar and it's dependencies
programs.thunar = {
enable = true;
plugins = with pkgs.xfce; [ thunar-archive-plugin ];
};
programs.xfconf.enable = true; # For configuring
services.gvfs.enable = true; # For mounting drives, trash, etc.
services.tumbler.enable = true; # Thumbnail support
# Enable KDEConnect
programs.kdeconnect = {
enable = true;
package = pkgs.kdePackages.kdeconnect-kde;
};
# Enable the Fcitx5 IME
i18n.inputMethod = {
enable = true;
type = "fcitx5";
fcitx5 = {
addons = with pkgs; [
fcitx5-mozc
fcitx5-gtk
fcitx5-catppuccin
];
quickPhrase = {
proud = "<()>";
};
waylandFrontend = true;
};
};
environment.sessionVariables = {
# Set env for Fcitx5
QMODIFIERS = "@im=fcitx5";
};
environment.systemPackages = with pkgs; [
wl-clipboard
xclip
zoxide
(catppuccin-sddm.override # So SDDM finds the theme files.
{
flavor = "frappe";
font = "IBM Plex Sans";
fontSize = "11";
background = "${../../assets/sddm/Background.jpg}";
loginBackground = true;
}
)
## Libraries
libsForQt5.qt5.qtgraphicaleffects
libsForQt5.qt5.qtquickcontrols2
];
}

28
shared/nixos/gaming.nix Normal file
View file

@ -0,0 +1,28 @@
{ pkgs, ... }:
{
# Enable Steam.
programs.steam = {
enable = true;
remotePlay.openFirewall = true;
localNetworkGameTransfers.openFirewall = true;
# ^ Enables so we can transfer games to other computers in the network.
# Add Proton-GE to 'compatibilitytools.d'.
extraCompatPackages = with pkgs; [ proton-ge-bin ];
};
# Enable and configure gamemode.
programs.gamemode = {
enable = true;
enableRenice = true;
settings = {
gpu = {
apply_gpu_optimisations = "accept-responsibility";
gpu_device = 1;
amd_performance_level = "auto";
};
};
};
}

18
shared/nixos/hardware.nix Normal file
View file

@ -0,0 +1,18 @@
{ ... }:
{
# Add AMD drivers
boot.initrd.kernelModules = [
"amdgpu"
];
# Enable Bluetooth
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
};
services.blueman.enable = true;
# Enable fstrim for better ssd lifespan
services.fstrim.enable = true;
}

84
shared/nixos/system.nix Normal file
View file

@ -0,0 +1,84 @@
{ pkgs, config, ... }:
{
# Kernel
boot.kernelPackages = pkgs.linuxPackages_zen;
boot.initrd.kernelModules = [
"v4l2loopback"
"zenergy"
];
boot.extraModulePackages = [
config.boot.kernelPackages.v4l2loopback
config.boot.kernelPackages.zenergy # Allows fetching power draw information on AMD CPUs
];
# Configure v4l2loopback
boot.extraModprobeConfig = ''
options v4l2loopback devices=1 video_nr=1 card_label="Virtual camera" exclusive_caps=1
'';
# Bootloader.
boot.loader = {
systemd-boot = {
enable = true;
configurationLimit = 10;
};
efi.canTouchEfiVariables = true;
};
# Enables zram.
zramSwap.enable = true;
# Enable networking
networking.networkmanager.enable = true;
# Enable sound with pipewire.
services.pulseaudio.enable = false;
services.pipewire = {
enable = true;
audio.enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
# Enable fish system-wide to integrate with nixpkgs.
programs.fish.enable = true;
# Set fish as the default shell for all users.
users.defaultUserShell = pkgs.fish;
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable the OpenSSH daemon.
services.openssh = {
enable = true;
settings = {
PasswordAuthentication = false;
PermitRootLogin = "no";
StreamLocalBindUnlink = "yes";
};
};
# Enable GPG.
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
# Enable polkit,
security.polkit.enable = true;
# install an agent to interface with it,
environment.systemPackages = with pkgs; [ polkit_gnome ];
# And enable GNOME keyring for registering keys.
services.gnome.gnome-keyring.enable = true;
}

View file

@ -0,0 +1,18 @@
{ pkgs, ... }:
{
# Enable Docker.
virtualisation.docker.enable = true;
# Enable virt-manager
programs.virt-manager.enable = true;
# Enable virtd and spice USB redirection
virtualisation.spiceUSBRedirection.enable = true;
virtualisation.libvirtd.enable = true;
environment.systemPackages = with pkgs; [
docker-compose
quickemu
];
}