First commit

This commit is contained in:
Nicole 2025-04-22 22:58:26 +02:00
commit 75a0f87f93
5 changed files with 584 additions and 0 deletions

355
etc/nixos/configuration.nix Normal file
View file

@ -0,0 +1,355 @@
{ config, pkgs, pkgs-unstable, lib, ... }:
#░█░█░█▀▀░█▀▀░█▀▄░░░█░█░█▀█░█▀▄░▀█▀░█▀█░█▀▄░█░░░█▀▀░█▀▀
#░█░█░▀▀█░█▀▀░█▀▄░░░▀▄▀░█▀█░█▀▄░░█░░█▀█░█▀▄░█░░░█▀▀░▀▀█
#░▀▀▀░▀▀▀░▀▀▀░▀░▀░░░░▀░░▀░▀░▀░▀░▀▀▀░▀░▀░▀▀░░▀▀▀░▀▀▀░▀▀▀
let
user = "nicole";
in
#░▀█▀░█▄█░█▀█░█▀█░█▀▄░▀█▀░█▀▀
#░░█░░█░█░█▀▀░█░█░█▀▄░░█░░▀▀█
#░▀▀▀░▀░▀░▀░░░▀▀▀░▀░▀░░▀░░▀▀▀
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./modules/virtualization.nix
./modules/nvidia.nix
];
#░█▀▄░█▀█░█▀█░▀█▀░█░░░█▀█░█▀█░█▀▄░█▀▀░█▀▄
#░█▀▄░█░█░█░█░░█░░█░░░█░█░█▀█░█░█░█▀▀░█▀▄
#░▀▀░░▀▀▀░▀▀▀░░▀░░▀▀▀░▀▀▀░▀░▀░▀▀░░▀▀▀░▀░▀
hardware.bluetooth.enable = true; # enables support for Bluetooth
hardware.bluetooth.powerOnBoot = true; # powers up the default Bluetooth controller on boot
services.blueman.enable = true;
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot = {
plymouth = {
enable = true;
};
# Enable "Silent Boot"
consoleLogLevel = 0;
initrd.verbose = false;
kernelParams = [
"quiet"
"splash"
"boot.shell_on_fail"
"loglevel=3"
"rd.systemd.show_status=false"
"rd.udev.log_level=0"
"udev.log_priority=3"
];
kernelPackages = pkgs.linuxPackages_latest;
loader.timeout = 0;
loader.systemd-boot.consoleMode = "max";
};
#░█▀█░█▀▀░▀█▀░█░█░█▀█░█▀▄░█░█
#░█░█░█▀▀░░█░░█▄█░█░█░█▀▄░█▀▄
#░▀░▀░▀▀▀░░▀░░▀░▀░▀▀▀░▀░▀░▀░▀
networking.hostName = "nixos";
networking.networkmanager.enable = true;
time.timeZone = "Europe/Rome";
services.printing.enable = true;
services.avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
#░█░░░█▀█░█▀▀░█▀█░█░░░█▀▀
#░█░░░█░█░█░░░█▀█░█░░░█▀▀
#░▀▀▀░▀▀▀░▀▀▀░▀░▀░▀▀▀░▀▀▀
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "it_IT.UTF-8";
LC_IDENTIFICATION = "it_IT.UTF-8";
LC_MEASUREMENT = "it_IT.UTF-8";
LC_MONETARY = "it_IT.UTF-8";
LC_NAME = "it_IT.UTF-8";
LC_NUMERIC = "it_IT.UTF-8";
LC_PAPER = "it_IT.UTF-8";
LC_TELEPHONE = "it_IT.UTF-8";
LC_TIME = "it_IT.UTF-8";
};
services.xserver.xkb = {
layout = "us";
variant = "intl";
};
console.keyMap = "us-acentos";
#░█░█░█▀▀░█▀▀░█▀▄
#░█░█░▀▀█░█▀▀░█▀▄
#░▀▀▀░▀▀▀░▀▀▀░▀░▀
users.users.nicole = {
isNormalUser = true;
description = "Nicole";
extraGroups = [ "networkmanager" "wheel" "libvrtd" "kvm" "qemu-libvirtd" ];
packages = with pkgs; [];
};
#░█░█░█▀█░█▀▀░█▀▄░█▀▀░█▀▀
#░█░█░█░█░█▀▀░█▀▄░█▀▀░█▀▀
#░▀▀▀░▀░▀░▀░░░▀░▀░▀▀▀░▀▀▀
nixpkgs.config.allowUnfree = true;
nixpkgs.config.cudaSupport = true;
nix.settings.experimental-features = [ "nix-command" "flakes" ];
#░█░░░█▀▄░░░█▀▀░▀█▀░█░█
#░█░░░█░█░░░█▀▀░░█░░▄▀▄
#░▀▀▀░▀▀░░░░▀░░░▀▀▀░▀░▀
programs.nix-ld.enable = true;
programs.nix-ld.libraries = with pkgs ; [
gcc-unwrapped
];
#░█▀▄░█▀▀░█▀▀░█░█░▀█▀░█▀█░█▀█
#░█░█░█▀▀░▀▀█░█▀▄░░█░░█░█░█▀▀
#░▀▀░░▀▀▀░▀▀▀░▀░▀░░▀░░▀▀▀░▀░░
# Enable SDDM & Hyprland
services.xserver.displayManager.gdm.enable = true;
services.gnome.gnome-keyring.enable = true;
services.desktopManager.cosmic.xwayland.enable = true;
programs.hyprland = {
enable = true;
withUWSM = true;
xwayland.enable = true;
};
environment.sessionVariables = {
WLR_NO_HARDWARE_CURSOR = "1";
NIXOS_OZONE_WL = "1";
CUDA_HOME = "${pkgs.cudaPackages.cudatoolkit}";
CUDA_MODULE_LOADING = "LAZY";
};
#░█░█░█▀▄░█▀▀
#░▄▀▄░█░█░█░█
#░▀░▀░▀▀░░▀▀▀
xdg.portal.enable = true;
xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
#░█▀▀░█▀█░█░█░█▀█░█▀▄
#░▀▀█░█░█░█░█░█░█░█░█
#░▀▀▀░▀▀▀░▀▀▀░▀░▀░▀▀░
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
};
#░█▀█░█▀█░█▀▀░█░█░█▀█░█▀▀░█▀▀░█▀▀
#░█▀▀░█▀█░█░░░█▀▄░█▀█░█░█░█▀▀░▀▀█
#░▀░░░▀░▀░▀▀▀░▀░▀░▀░▀░▀▀▀░▀▀▀░▀▀▀
environment.systemPackages = with pkgs; [
# TERM UTILS #
kitty
neovim
wget
git
fastfetch
htop
cowsay
starship
# FILES #
nemo-with-extensions
gvfs
nautilus
nautilus-python
sushi
fsearch
# SCREENSHOTS AND RECORDING #
grim
slurp
swappy
wl-clipboard
obs-studio
# HYPRLAND RELATED #
hyprpaper
pkgs-unstable.hyprlock
swaylock
hypridle
hyprpanel
hyprpolkitagent
waybar
wlogout
rofi-wayland
libnotify
ags
# OFFICE #
onlyoffice-desktopeditors
obsidian
siyuan
nextcloud-client
xournalpp
gnome-text-editor
gnome-calculator
# MEDIA #
ffmpeg
mpv
jellyfin-media-player
# INTERNET #
floorp
telegram-desktop
element-desktop
discord
mailspring
wasistlos
teams-for-linux
qbittorrent
# DEV #
vscode-fhs
nixd
nil
python312
python312Packages.pip
zed-editor
gnumake
cmake
ninja
python3
libgcc
gcc
# GAMING #
mangohud
lutris
protonup-qt
gdlauncher-carbon
# OTHERS #
home-manager
nwg-look
seahorse
playerctl
adw-gtk3
remmina
# UTILS #
monitorets
xdg-user-dirs
# CUDA #
cudaPackages.cudatoolkit
cudaPackages.cudnn
cudaPackages.cuda_cudart
# AUDIO #
helvum
];
# OLLAMA #
services.ollama = {
enable = true;
acceleration = "cuda";
package = pkgs-unstable.ollama;
environmentVariables = {
CUDA_VISIBLE_DEVICES = "0";
NVIDIA_VISIBLE_DEVICES = "all";
LD_LIBRARY_PATH = "${pkgs.cudaPackages.cudatoolkit}/lib:${pkgs.cudaPackages.cudatoolkit}/lib64";
};
};
# GTK DARK THEME #
programs.dconf = {
enable = true;
profiles.user.databases = [{
settings = with lib.gvariant; {
"org/gnome/desktop/interface" = {
color-scheme = "prefer-dark";
gtk-theme = "adw-gtk3-dark";
};
};
}];
};
nixpkgs.overlays = [
(final: prev:
{
ags = prev.ags.overrideAttrs (old: {
buildInputs = old.buildInputs ++ [ pkgs.libdbusmenu-gtk3 ];
});
})
];
# STEAM #
programs.steam.enable = true;
programs.steam.gamescopeSession.enable = true;
programs.gamemode.enable = true;
environment = {
sessionVariables = {
EDITOR = "nvim";
BROWSER = "firefox";
TERMINAL = "kitty";
LIBVIRT_DEFAULT_URI = "qemu:///system";
};
#etc."nvidia/nvidia-application-profiles-rc.d/50-limit-free-buffer-pool.json".source = ./50-limit-free-buffer-pool.json;
};
fonts.packages = with pkgs; [ nerd-fonts.jetbrains-mono ];
system.stateVersion = "24.11";
}

45
etc/nixos/flake.nix Normal file
View file

@ -0,0 +1,45 @@
{
description = "My Flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
hyprpanel.url = "github:Jas-SinghFSU/HyprPanel";
};
outputs = { self, nixpkgs, nixpkgs-unstable, ... } @inputs:
let
system = "x86_64-linux"; # change to whatever your system should be.
pkgs-unstable = import nixpkgs-unstable { system = "x86_64-linux"; config.allowUnfree = true; };
pkgs = import nixpkgs {
inherit system;
overlays = [
inputs.hyprpanel.overlay
(final: prev: {
unstable = nixpkgs-unstable.legacyPackages.${prev.system};
})
];
};
in
{
# Define NixOS configuration
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
inherit system;
inherit inputs;
inherit pkgs-unstable;
};
modules = [
./configuration.nix
{nixpkgs.overlays = [inputs.hyprpanel.overlay];}
];
};
packages.x86_64-linux.hello = nixpkgs.legacyPackages.x86_64-linux.hello;
packages.x86_64-linux.default = self.packages.x86_64-linux.hello;
};
}

View file

@ -0,0 +1,33 @@
{
"rules": [
{
"pattern": {
"feature": "procname",
"matches": ".Hyprland-wrapped"
},
"profile": "No VidMem Reuse"
},
{
"pattern": {
"feature": "procname",
"matches": "electron"
},
"profile": "No VidMem Reuse"
},
{
"pattern": {
"feature": "procname",
"matches": ".librewolf-wrapped"
},
"profile": "No VidMem Reuse"
},
{
"pattern": {
"feature": "procname",
"matches": "librewolf"
},
"profile": "No VidMem Reuse"
}
]
}

View file

@ -0,0 +1,43 @@
{ config, pkgs, lib, ... }:
{
boot = {
kernelParams = [
"nvidia-drm.fbdev=1"
"nvidia.NVreg_UsePageAttributeTable=1"
"nvidia_modeset.disable_vrr_memclk_switch=1"
"nvidia.NVreg_TemporaryFilePath=/var/tmp"
];
blacklistedKernelModules = ["nouveau"];
};
services.xserver.videoDrivers = ["nvidia"];
hardware = {
nvidia = {
open = true;
gsp.enable = config.hardware.nvidia.open;
powerManagement.enable = true;
nvidiaSettings = false;
# package = config.boot.kernelPackages.nvidiaPackages.stable;
package = config.boot.kernelPackages.nvidiaPackages.mkDriver {
version = "575.51.02";
sha256_64bit = "sha256-XZ0N8ISmoAC8p28DrGHk/YN1rJsInJ2dZNL8O+Tuaa0=";
openSha256 = "sha256-NQg+QDm9Gt+5bapbUO96UFsPnz1hG1dtEwT/g/vKHkw=";
useSettings = false;
usePersistenced = false;
};
videoAcceleration = true;
};
};
environment = {
sessionVariables = {
"__EGL_VENDOR_LIBRARY_FILENAMES" = "${config.hardware.nvidia.package}/share/glvnd/egl_vendor.d/10_nvidia.json";
"CUDA_CACHE_PATH" = "/home/nicole/.cache/nv";
};
etc."nvidia/nvidia-application-profiles-rc.d/50-limit-free-buffer-pool.json".source = ./50-limit-free-buffer-pool.json;
};
}

View file

@ -0,0 +1,108 @@
#░█░█░▀█▀░█▀▄░▀█▀░█░█░█▀█░█░░░▀█▀░▀▀█░█▀█░▀█▀░▀█▀░█▀█░█▀█
#░▀▄▀░░█░░█▀▄░░█░░█░█░█▀█░█░░░░█░░▄▀░░█▀█░░█░░░█░░█░█░█░█
#░░▀░░▀▀▀░▀░▀░░▀░░▀▀▀░▀░▀░▀▀▀░▀▀▀░▀▀▀░▀░▀░░▀░░▀▀▀░▀▀▀░▀░▀
{ config, pkgs, lib, ... }:
let
# VFIO ids for passthrough
vfioIds = [ "1002:13c0" "1002:1640" ];
# Username
user = "nicole";
in
{
boot = {
# Enable IOMMU
kernelParams = lib.mkAfter [
"amd_iommu=on" # Change to intel_iommu=on if you're using an Intel CPU
"iommu=pt"
];
# Add the required VFIO kernel modules
kernelModules = [
"vfio-pci"
"vfio"
"vfio_iommu_type1"
"vfio_virqfd"
"kvm"
"kvmfr"
"allow_unsafe_interrupts=1"
];
# Add the GPU video and audio to VFIO binding
extraModprobeConfig = ''options vfio-pci ids=${builtins.concatStringsSep "," vfioIds}
options kvmfr static_size_mb=64
'';
# Enable the KVMFR kernel package
extraModulePackages = [ config.boot.kernelPackages.kvmfr ];
};
# Enable Virt-Manager
programs.virt-manager.enable = true;
# Add user to the "libvirtd" group for permission to manage VMs
users.groups.libvirtd.members = ["${user}"];
# Add a udev rule to set permissions for KVMFR (Kernel Frame Relay) device
services.udev.extraRules = ''
SUBSYSTEM=="kvmfr", OWNER="${user}", GROUP="kvm", MODE="0660"
'';
# Enable the libvirtd (virtualization) service
virtualisation.libvirtd = {
enable = true;
# Configure QEMU
qemu = {
package = pkgs.qemu_kvm;
runAsRoot = true;
swtpm.enable = true;
# Configure OVMF (UEFI firmware for virtual machines)
ovmf = {
enable = true;
packages = [(pkgs.OVMF.override {
secureBoot = false; # Disable Secure Boot for the VM firmware
tpmSupport = true; # Enable TPM support
}).fd];
};
};
};
# Add additional QEMU configuration to explicitly define device ACLs
virtualisation.libvirtd.qemu.verbatimConfig = ''
cgroup_device_acl = [
"/dev/null", "/dev/full", "/dev/zero",
"/dev/random", "/dev/urandom",
"/dev/ptmx", "/dev/kvm",
"/dev/kvmfr0"
]
'';
# Define systemd temporary file rules to create a shared memory file for Looking Glass
systemd.tmpfiles.rules = [
"f /dev/shm/looking-glass 0660 ${user} qemu-libvirtd -"
"L+ /var/lib/qemu/firmware - - - - ${pkgs.qemu}/share/qemu/firmware"
];
# Packages
environment.systemPackages = lib.mkAfter (with pkgs; [
spice spice-gtk
spice-protocol
win-virtio
win-spice
looking-glass-client
linuxKernel.packages.linux_zen.kvmfr
qemu
(writeShellScriptBin "qemu-system-x86_64-uefi" ''
qemu-system-x86_64 \
-bios ${pkgs.OVMF.fd}/FV/OVMF.fd \
"$@"
'')
]);
}