Config overhaul

This commit is contained in:
2025-05-29 23:48:27 -06:00
parent ab2d207bf3
commit 0e47cae395
13 changed files with 220 additions and 150 deletions

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# My NixOS Config
Use `nix:help` to list all commands

View File

@ -1,162 +1,29 @@
# 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, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Use latest kernel.
boot.kernelPackages = pkgs.linuxPackages_latest;
networking.hostName = "lavitz"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# 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/Edmonton";
# Select internationalisation properties.
i18n.defaultLocale = "en_CA.UTF-8";
# Enable the X11 windowing system.
services.xserver.enable = true;
# Enable the GNOME Desktop Environment.
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
# Configure keymap in X11
services.xserver.xkb = {
layout = "us";
variant = "";
};
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable sound with pipewire.
services.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
# 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.atridad = {
isNormalUser = true;
description = "Atridad";
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [
# thunderbird
];
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
environment.shellAliases = {
rebuild = "sudo nixos-rebuild switch";
confedit = "sudo nano ~/Developer/nix/configuration.nix";
confcpy="sudo rm -rf /etc/nixos/configuration.nix && sudo cp ~/Developer/nix/configuration.nix /etc/nixos/configuration.nix && cd ~/Developer/nix && git add -A && git commit -m \"$(date -u +%s)\" && git push";
};
# Sleep
systemd.sleep.extraConfig = ''
AllowSuspend=no
AllowHibernation=no
AllowHybridSleep=no
AllowSuspendThenHibernate=no
'';
# Packages:
environment.systemPackages = with pkgs; [
pkgs.vivaldi
pkgs.zed-editor
pkgs.discord
pkgs.bitwarden-desktop
pkgs.signal-desktop-bin
pkgs.ghostty
pkgs.spotify
pkgs.git
pkgs.git
pkgs.go
pkgs.nodejs_24
pkgs.zig
pkgs.python3Full
pkgs.openssh
gnomeExtensions.appindicator
pkgs.vlc
imports = [
# Include the results of the hardware scan
./hardware-configuration.nix
# Import modular configuration files
./modules/boot.nix
./modules/networking.nix
./modules/locale.nix
./modules/desktop.nix
./modules/audio.nix
./modules/users.nix
./modules/packages.nix
./modules/programs.nix
./modules/hardware.nix
./modules/services.nix
./modules/aliases.nix
];
# Programs
# Steam
programs.steam = {
enable = true;
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers
};
# Enable OpenGL
hardware.graphics = {
enable = true;
};
# Load nvidia driver for Xorg and Wayland
services.xserver.videoDrivers = ["nvidia"];
hardware.nvidia = {
modesetting.enable = true;
powerManagement.enable = true;
powerManagement.finegrained = false;
gsp.enable = true;
open = true;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.beta;
};
# Enable the OpenSSH daemon.
services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# 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
# on your system were taken. It's 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 = "25.05"; # Did you read the comment?
}

29
modules/aliases.nix Normal file
View File

@ -0,0 +1,29 @@
{ config, pkgs, ... }:
{
environment.shellAliases = {
# Help command - shows all available nix commands
"nix:help" = "echo '\n🔧 NixOS Configuration Commands:\n\n📋 Basic Operations:\n nix:rebuild - Rebuild and switch to new configuration\n nix:conf:edit - Edit the main configuration file\n nix:conf:sync - Sync local config to /etc/nixos/ without rebuild\n\n📝 Module Editing:\n nix:edit:boot - Edit boot configuration\n nix:edit:net - Edit networking configuration\n nix:edit:desktop - Edit desktop configuration\n nix:edit:audio - Edit audio configuration\n nix:edit:users - Edit user configuration\n nix:edit:pkgs - Edit packages configuration\n nix:edit:programs - Edit programs configuration\n nix:edit:hardware - Edit hardware configuration\n nix:edit:services - Edit services configuration\n nix:edit:aliases - Edit aliases configuration\n\n🔄 Git Operations:\n nix:conf:push - Copy config to /etc/nixos/, commit changes, and push to remote\n nix:conf:pull - Pull latest changes from remote and sync to /etc/nixos/\n\n💡 Use nix:help to see this list anytime!\n'";
# Basic operations
"nix:rebuild" = "sudo nixos-rebuild switch";
"nix:conf:edit" = "sudo nano ~/Developer/nix/configuration.nix";
"nix:conf:sync" = "sudo rm -rf /etc/nixos/configuration.nix && sudo cp ~/Developer/nix/configuration.nix /etc/nixos/configuration.nix && sudo rm -rf /etc/nixos/modules && sudo cp -r ~/Developer/nix/modules /etc/nixos/";
# Module editing shortcuts
"nix:edit:boot" = "sudo nano ~/Developer/nix/modules/boot.nix";
"nix:edit:net" = "sudo nano ~/Developer/nix/modules/networking.nix";
"nix:edit:desktop" = "sudo nano ~/Developer/nix/modules/desktop.nix";
"nix:edit:audio" = "sudo nano ~/Developer/nix/modules/audio.nix";
"nix:edit:users" = "sudo nano ~/Developer/nix/modules/users.nix";
"nix:edit:pkgs" = "sudo nano ~/Developer/nix/modules/packages.nix";
"nix:edit:programs" = "sudo nano ~/Developer/nix/modules/programs.nix";
"nix:edit:hardware" = "sudo nano ~/Developer/nix/modules/hardware.nix";
"nix:edit:services" = "sudo nano ~/Developer/nix/modules/services.nix";
"nix:edit:aliases" = "sudo nano ~/Developer/nix/modules/aliases.nix";
# Git operations
"nix:conf:push" = "sudo rm -rf /etc/nixos/configuration.nix && sudo cp ~/Developer/nix/configuration.nix /etc/nixos/configuration.nix && sudo rm -rf /etc/nixos/modules && sudo cp -r ~/Developer/nix/modules /etc/nixos/ && cd ~/Developer/nix && git add -A && git commit -m \"$(date -u +%s)\" && git push";
"nix:conf:pull" = "cd ~/Developer/nix && git pull && sudo rm -rf /etc/nixos/configuration.nix && sudo cp ~/Developer/nix/configuration.nix /etc/nixos/configuration.nix && sudo rm -rf /etc/nixos/modules && sudo cp -r ~/Developer/nix/modules /etc/nixos/";
};
}

19
modules/audio.nix Normal file
View File

@ -0,0 +1,19 @@
{ config, pkgs, ... }:
{
# Enable sound with pipewire
services.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
}

10
modules/boot.nix Normal file
View File

@ -0,0 +1,10 @@
{ config, pkgs, ... }:
{
# Bootloader
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Use latest kernel
boot.kernelPackages = pkgs.linuxPackages_latest;
}

22
modules/desktop.nix Normal file
View File

@ -0,0 +1,22 @@
{ config, pkgs, ... }:
{
# Enable the X11 windowing system
services.xserver.enable = true;
# Enable the GNOME Desktop Environment
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
# Configure keymap in X11
services.xserver.xkb = {
layout = "us";
variant = "";
};
# Enable CUPS to print documents
services.printing.enable = true;
# Enable touchpad support (enabled default in most desktopManager)
# services.xserver.libinput.enable = true;
}

21
modules/hardware.nix Normal file
View File

@ -0,0 +1,21 @@
{ config, pkgs, ... }:
{
# Enable OpenGL
hardware.graphics = {
enable = true;
};
# Load nvidia driver for Xorg and Wayland
services.xserver.videoDrivers = ["nvidia"];
hardware.nvidia = {
modesetting.enable = true;
powerManagement.enable = true;
powerManagement.finegrained = false;
gsp.enable = true;
open = true;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.beta;
};
}

9
modules/locale.nix Normal file
View File

@ -0,0 +1,9 @@
{ config, pkgs, ... }:
{
# Time zone
time.timeZone = "America/Edmonton";
# Internationalization properties
i18n.defaultLocale = "en_CA.UTF-8";
}

20
modules/networking.nix Normal file
View File

@ -0,0 +1,20 @@
{ config, pkgs, ... }:
{
# Networking configuration
networking.hostName = "lavitz"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# 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;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
}

32
modules/packages.nix Normal file
View File

@ -0,0 +1,32 @@
{ config, pkgs, ... }:
{
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# System packages
environment.systemPackages = with pkgs; [
# Browsers and communication
vivaldi
discord
signal-desktop-bin
# Development tools
zed-editor
git
go
nodejs_24
zig
python3Full
openssh
# Desktop applications
bitwarden-desktop
ghostty
spotify
vlc
# GNOME extensions
gnomeExtensions.appindicator
];
}

11
modules/programs.nix Normal file
View File

@ -0,0 +1,11 @@
{ config, pkgs, ... }:
{
# Steam
programs.steam = {
enable = true;
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers
};
}

14
modules/services.nix Normal file
View File

@ -0,0 +1,14 @@
{ config, pkgs, ... }:
{
# Enable the OpenSSH daemon
services.openssh.enable = true;
# Sleep configuration
systemd.sleep.extraConfig = ''
AllowSuspend=no
AllowHibernation=no
AllowHybridSleep=no
AllowSuspendThenHibernate=no
'';
}

13
modules/users.nix Normal file
View File

@ -0,0 +1,13 @@
{ config, pkgs, ... }:
{
# Define a user account. Don't forget to set a password with 'passwd'.
users.users.atridad = {
isNormalUser = true;
description = "Atridad";
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [
# thunderbird
];
};
}