Initial flake-based system config

This commit is contained in:
MichaelFisher1997
2025-05-10 16:33:30 +01:00
parent 3c37d9f335
commit 13f11fda47
12 changed files with 17 additions and 1 deletions

View File

@@ -0,0 +1,222 @@
# 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).
{ pkgs, lib, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./packages.nix
./mnt.nix
./docker.nix
./hyprland.nix
./networking.nix
./gpu.nix
./sunshine.nix
#./i3.nix
];
# Bootloader.
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/nvme0n1";
boot.loader.grub.useOSProber = true;
boot.initrd.kernelModules = [ "amdgpu" ];
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.kernelParams = [
"cgroup_enable=cpuset,cpu,cpuacct,blkio,devices,freezer,net_cls,perf_event,net_prio,hugetlb,pids"
];
boot.supportedFilesystems = [ "ntfs" ];
services.zfs.autoScrub.enable = true;
services.zfs.trim.enable = true;
# boot.supportedFilesystems = [ "zfs" ];
# boot.zfs.forceImportRoot = false;
# networking.hostId = "a44f5fde";
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Enable networking
networking.networkmanager.enable = true;
nixpkgs.config.allowBroken = true;
# Set your time zone.
time.timeZone = "Europe/London";
# Select internationalisation properties.
i18n.defaultLocale = "en_GB.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_GB.UTF-8";
LC_IDENTIFICATION = "en_GB.UTF-8";
LC_MEASUREMENT = "en_GB.UTF-8";
LC_MONETARY = "en_GB.UTF-8";
LC_NAME = "en_GB.UTF-8";
LC_NUMERIC = "en_GB.UTF-8";
LC_PAPER = "en_GB.UTF-8";
LC_TELEPHONE = "en_GB.UTF-8";
LC_TIME = "en_GB.UTF-8";
};
services = {
# Enable X11 and configure Wayland support
xserver = {
enable = true;
xkb.layout = "gb";
xkb.variant = "";
videoDrivers = ["amdgpu"];
# Enable GDM as the display manager
displayManager.gdm.enable = true;
# Desktop Managers Configuration
desktopManager = {
gnome.enable = true; # GNOME
plasma6.enable = true; # Use plasma5 for KDE6 as well
};
# Window Managers Configuration
windowManager = {
i3 = {
enable = true;
package = pkgs.i3-gaps; # Optional: use i3-gaps for gaps support
extraPackages = with pkgs; [
i3lock
rofi
lxappearance
];
};
# Note: No need to enable Hyprland here, as it's done in hyprland.nix
};
};
};
# XDG Portals Configuration for Wayland
xdg.portal = {
enable = true;
extraPortals = [
pkgs.xdg-desktop-portal-hyprland
];
};
# Configure console keymap
console.keyMap = "uk";
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable sound with pipewire.
hardware.pulseaudio.enable = false;
#sound.enable = true;
services.flatpak.enable = true;
services.blueman.enable = true;
security.rtkit.enable = true;
services.gvfs.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.micqdf = {
isNormalUser = true;
description = "micqdf";
extraGroups = [ "networkmanager" "wheel" "docker"];
};
# environment.systemPackages = [
# pkgs.home-manager
# ];
# Install programs config
programs.java.enable = true;
programs.sway.enable = true;
programs.fish.enable = true;
users.defaultUserShell = pkgs.fish;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
#nixpkgs.overlays = [
# (import ./godot4-overlay.nix)
#];
#hardware.opengl.driSupport = true; # This is already enabled by default
hardware.bluetooth.enable = true; # enables support for Bluetooth
hardware.bluetooth.powerOnBoot = true; # powers up the default Bluetooth controller on boot
hardware.bluetooth.settings = {
General = {
Enable = "Source,Sink,Media,Socket";
};
};
#cosmic
#hardware.system76.enableAll = true;
#services.desktopManager.cosmic.enable = true;
#services.displayManager.cosmic-greeter.enable = true;
hardware.opengl = {
enable = true;
driSupport = true;
#driSupport32Bit = true;
extraPackages = with pkgs; [
vulkan-loader
vulkan-validation-layers
vulkan-extension-layer
intel-media-driver # LIBVA_DRIVER_NAME=iHD
intel-vaapi-driver # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium)
libvdpau-va-gl
vaapiVdpau
mesa.drivers
];
};
programs.steam.enable = true;
programs.steam.gamescopeSession.enable = true;
programs.gamemode.enable = true;
programs.ssh.askPassword = lib.mkForce "/nix/store/qjl45ra2yaqn88h6s9f7b79zpja9dy8b-seahorse-43.0/libexec/seahorse/ssh-askpass";
# # List services that you want to enable:
# environment.sessionVariables = {
# STEAM_EXTRA_COMPAT_TOOLS_PATHS = "/home/micqdf/.steam/root/compatibilitytools.d";
# hyprshot = "/home/micqdf/flakes/hyprshot/Hyprshot";
# };
#
security.polkit.enable = true;
# Enable the OpenSSH daemon.
services.openssh.enable = true;
services.tumbler.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# 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.11"; # Did you read the comment?
system.autoUpgrade.enable = true;
system.autoUpgrade.allowReboot = false;
}

28
hosts/hypr-nix/docker.nix Normal file
View File

@@ -0,0 +1,28 @@
{ ... }:
{
# Enable Docker program itself
virtualisation.docker.enable = true;
# Create a socket to lazy-load Docker
systemd.sockets.docker = {
wantedBy = [ "sockets.target" ];
listenStreams = [ "/run/docker.sock" ];
socketConfig = {
SocketMode = "0660";
SocketUser = "root";
SocketGroup = "docker";
};
};
# Override the Docker service to disable autostart
systemd.services.docker = {
enable = false;
wants = [ "docker.socket" ];
after = [ "docker.socket" ];
serviceConfig = {
ExecStartPre = "-/usr/bin/rm -f /run/docker.sock";
};
};
}

10
hosts/hypr-nix/gpu.nix Normal file
View File

@@ -0,0 +1,10 @@
{ pkgs, ... }:
{
hardware.opengl.extraPackages = with pkgs; [
rocmPackages.clr.icd
];
environment.systemPackages = [
pkgs.rocmPackages.rpp
];
}

View File

@@ -0,0 +1,35 @@
# 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 = [ "xhci_pci" "ahci" "nvme" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/2ccf7538-1328-4793-a455-d62e09c1f057";
fsType = "ext4";
};
swapDevices = [ ];
# 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.docker0.useDHCP = lib.mkDefault true;
# networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true;
# networking.interfaces.tailscale0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp9s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View File

@@ -0,0 +1,48 @@
{ pkgs, ... }:
{
programs.hyprland = {
enable = true;
# package = inputs.hyprland.packages.${pkgs.system}.hyprland;
xwayland.enable = true;
};
environment.systemPackages = with pkgs; [
waypaper
wl-clipboard
blueman
rofi-wayland
waybar
polybar
wttrbar
hackgen-nf-font
playerctl
swaybg
swww
nwg-look
dunst
udiskie
hyprshot
hyprland-protocols
xfce.thunar-volman
xfce.thunar-dropbox-plugin
xfce.thunar-archive-plugin
xfce.tumbler
pavucontrol
wlr-randr
libcanberra-gtk3
pamixer
grim
discocss
themechanger
catppuccin-kvantum
dolphin
nwg-drawer
hyprpaper
];
programs.thunar.enable = true;
programs.thunar.plugins = with pkgs.xfce; [
thunar-archive-plugin
thunar-volman
];
}

22
hosts/hypr-nix/i3.nix Normal file
View File

@@ -0,0 +1,22 @@
#this might be redundent
{config, pkgs, callPackage, ... }:
{
services.xserver = {
enable = true;
desktopManager = {
xterm.enable = false;
};
windowManager.i3 = {
enable = true;
extraPackages = with pkgs; [
dmenu #application launcher most people use
i3status # gives you the default i3 status bar
i3lock #default i3 screen locker
i3blocks #if you are planning on using i3blocks over i3status
picom
];
};
};
}

30
hosts/hypr-nix/mnt.nix Normal file
View File

@@ -0,0 +1,30 @@
{... }:
{
services.rpcbind.enable = true; # needed for NFS
systemd.mounts = [{
type = "nfs";
what = "10.27.27.239:/BigNAS";
where = "/mnt/BigNAS";
mountConfig = {
Options = "noatime,nofail,x-systemd.device-timeout=5s";
};
}];
systemd.automounts = [{
wantedBy = [ "multi-user.target" ];
automountConfig = {
TimeoutIdleSec = "600";
};
where = "/mnt/BigNAS";
}];
fileSystems."/mnt/NVME" = {
device = "/dev/disk/by-uuid/15b96913-a018-4ecc-950c-b8cf74b93315";
fsType = "btrfs";
options = [ "compress=zstd" "nofail" "x-systemd.device-timeout=5s" ];
};
fileSystems."/mnt/ssd2" = {
device = "/dev/disk/by-uuid/bc0d1423-5682-4150-906f-b1a154a316ea";
fsType = "btrfs";
};
}

View File

@@ -0,0 +1,21 @@
{ lib, ... }:
{
networking = {
hostName = "hypr-nix";
useDHCP = lib.mkDefault true;
interfaces = {
enp0s31f6.useDHCP = true;
};
};
networking.firewall = {
enable = true;
allowedTCPPorts = [ 47984 47989 47990 48010 ];
allowedUDPPortRanges = [
{ from = 47998; to = 48000; }
{ from = 8000; to = 8010; }
];
};
services.tailscale.enable = true;
systemd.services.NetworkManager-wait-online.enable = false;
}

219
hosts/hypr-nix/packages.nix Normal file
View File

@@ -0,0 +1,219 @@
{ config, pkgs, ... }:
let
unstable = import
(builtins.fetchTarball "channel:nixos-unstable")
{ config = config.nixpkgs.config; };
in
{
environment.systemPackages = with pkgs; [
# Text Editors
vim
libsForQt5.kate
sublime
lunarvim
vscode
#unstable.zed-editor
# Development Tools
openjdk
clang-tools
gcc
cmake
glew
glfw
libGL
SDL2
unstable.sdl3
SDL2_image
vulkan-loader
vulkan-tools
vulkan-headers
wayland-protocols
golangci-lint
golangci-lint-langserver
python3
php
php83Packages.composer
libsForQt5.kdenlive
exercism
betterdiscord-installer
unstable.go
unstable.bun
air
tailwindcss
google-cloud-sdk-gce
kubo
hashcat
# Version Control
git
git-lfs
nix-prefetch-git
# Terminals
kitty
alacritty
# Shell Utilities
fish
zsh
curl
wget
tree
fd
fzf
bat
thefuck
tmux
zellij
lolcat
lsd
tldr
# File Management
ranger
_7zz
unrar
zip
unzip
gzip
gvfs
btrfs-progs
nfs-utils
ntfs3g
# System Utilities
htop
vault
btop
amdgpu_top
parted
gparted
xorg.xprop
xorg.xkill
calc
maim
xclip
xdotool
networkmanager_dmenu
virt-manager
networkmanagerapplet
polybarFull
picom
arandr
nitrogen
pywal
ldmtool
smartmontools
gptfdisk
# Window Managers
i3
eww
vesktop
unstable.hyprsunset
unstable.hyprshot
# Web Browsers
brave
google-chrome
firefox
falkon
tor-browser
# Communication
discord
webcord
slack
#telegram-desktop
# Media
vlc
simplescreenrecorder
obs-studio
davinci-resolve-studio
audacity
haruna
# Gaming
mangohud
protonup
protontricks
lutris
bottles
wine
wine64
# Fonts
noto-fonts-color-emoji
twemoji-color-font
catppuccin-kvantum
themechanger
# Backup and Recovery
pika-backup
megasync
# Networking
ngrok
ipmitool
tailscale
remmina
ddev
# Containers and Virtualization
docker
docker-compose
kubectl
terraform
minikube
# Security
onlyoffice-bin
rcon
rconc
monero-gui
# Graphics
spice
spice-gtk
spice-vdagent
# Themes and Customization
kdePackages.qt6ct
catppuccin-kvantum
# Multimedia Tools
svt-av1
rav1e
libaom
unstable.sunshine
# Miscellaneous
fastfetch
betterdiscord-installer
unstable.ghostty
guacamole-client
rpi-imager
kdePackages.filelight
light
#games
flightgear
minetest
openttd
endless-sky
cataclysm-dda
xonotic
superTux
superTuxKart
airshipper
mindustry-wayland
speed_dreams
simutrans_binaries
modrinth-app
minecraft
nsnake
];
}

View File

@@ -0,0 +1,17 @@
{ ... }:
{
services.sunshine = {
enable = true;
autoStart = true;
capSysAdmin = true;
openFirewall = true;
};
#security.wrappers.sunshine = {
# owner = "root";
# group = "root";
# capabilities = "cap_sys_admin+p";
# source = "${pkgs.sunshine}/bin/sunshine";
# };
}