refactor flake.nix and osConfig organization

This commit is contained in:
2025-02-09 03:02:57 +01:00
parent b61d654f08
commit a2037ffb56
19 changed files with 76 additions and 149 deletions

81
osConfigs/global.nix Normal file
View File

@ -0,0 +1,81 @@
# **************************************************************************** #
# #
# ::: :::::::: #
# configuration.nix :+: :+: :+: #
# +:+ +:+ +:+ #
# By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2025/02/09 01:43:46 by tomoron #+# #+# #
# Updated: 2025/02/09 01:50:15 by tomoron ### ########.fr #
# #
# **************************************************************************** #
{ config, lib, inputs, pkgs, flakeName, ... }:
{
imports = [
./hardware-configuration.nix
./modules/yubikey.nix
];
nix.settings.experimental-features = ["nix-command" "flakes"];
nixpkgs.config.allowUnfree = true;
boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
boot.loader = {
systemd-boot.enable = true;
systemd-boot.memtest86.enable = true;
efi.canTouchEfiVariables = true;
timeout = 1;
};
networking.networkmanager.enable = lib.mkDefault true;
time.timeZone = "Europe/Paris";
services.xserver.enable = true;
services.xserver.displayManager.startx.enable = true;
services.pipewire = {
enable = true;
pulse.enable = true;
};
users.users.tom = {
isNormalUser = true;
extraGroups = [ "wheel" "docker" "libvirtd"];
initialPassword = "password";
};
virtualisation.docker.enable = true;
virtualisation.docker.enableOnBoot = lib.mkDefault false;
environment.systemPackages = with pkgs; [
home-manager
killall
vim
pciutils
pigz
htop
gnumake
git
neofetch
ntfs3g
clang
ninja
gdb
valgrind
wget
cmake
usbutils
man-pages
stress
ffmpeg
];
system.stateVersion = "24.05";
environment.etc.nixosFlakeName.text = "${flakeName}";
programs.hyprland.enable = true;
}

View File

@ -0,0 +1 @@
/etc/nixos/hardware-configuration.nix

View File

@ -0,0 +1,35 @@
{ config, lib, inputs, pkgs, ... }:
{
imports = [
../modules/game.nix
../modules/nvidia.nix
../modules/vboxHost.nix
];
environment.systemPackages = with pkgs; [
cudatoolkit
lm_sensors
];
networking.hostName = "nixos-fixe";
hardware.cpu.intel.updateMicrocode = true;
boot.kernelModules = [ "kvm-intel" "nvidia" ];
hardware.graphics.extraPackages = with pkgs; [libGL linuxPackages.nvidia_x11.out];
hardware.nvidia = {
open = true;
prime.nvidiaBusId = "PCI:1:0:0";
prime.intelBusId = "PCI:0:2:0";
prime.sync.enable = true;
modesetting.enable = true;
};
services.openssh.enable = true;
}

View File

@ -0,0 +1,65 @@
{ config, lib, inputs, pkgs, ... }:
{
imports = [
../modules/game.nix
../modules/nvidia.nix
../modules/vboxHost.nix
];
boot.kernelParams = [ "kvm.enable_virt_at_load=0" ];
# systemd.tmpfiles.rules = [
# "f /dev/shm/looking-glass 0660 tom libvirtd -"
# ];
# virtualisation.libvirtd.qemu.vhostUserPackages = with pkgs; [ virtiofsd ];
networking.hostName = "patate-douce";
networking.wireless.enable = true;
networking.networkmanager.enable = false;
environment.systemPackages = with pkgs; [
acpi
tlp
looking-glass-client
fprintd
];
hardware.nvidia.prime.offload = {
enable = true;
enableOffloadCmd = true;
};
services.libinput.enable = true;
services.libinput.touchpad.clickMethod = "clickfinger";
services.libinput.touchpad.tapping = false;
hardware.bluetooth.enable = true;
#power management
powerManagement.enable = true;
# powerManagement.powertop.enable = true;
powerManagement.cpuFreqGovernor = "powersave";
services.auto-cpufreq.enable = true;
services.auto-cpufreq.settings = {
battery = {
governor = "powersave";
turbo = "never";
};
charger = {
governor = "performance";
turbo = "auto";
};
};
services.upower.enable = true;
services.udev.packages = [ pkgs.yubikey-personalization ];
# boot.plymouth = {
# enable = true;
# theme = "ycontre-glow";
# themePackages = [
# inputs.plymouth-theme-ycontre-glow.defaultPackage.x86_64-linux
# ];
# };
}

View File

@ -0,0 +1,81 @@
{ config, lib, inputs, pkgs, ... }:
{
imports = [
../modules/game.nix
../modules/vboxHost.nix
../modules/nvidia.nix
];
boot.kernelPackages = pkgs.linuxPackages;
boot.extraModulePackages = [ config.boot.kernelPackages.gasket ];
networking.hostName = "server";
services.openssh.enable = true;
services.xserver.videoDrivers = [ "nvidia" ];
boot.extraModprobeConfig = ''
options amdgpu virtual_display=1
'';
environment.systemPackages = with pkgs; [
zfs
nvidia-docker
libnvidia-container
screen
];
boot.supportedFilesystems = [ "zfs" ];
networking.firewall.allowedTCPPorts = [
80 443 #http server
5000 #frigate
8083 137 138 139 445 548 3702 5357 #prob some samba shit
];
networking.firewall.allowedUDPPorts = [
80 443 #http server
5000 #frigate
8083 137 138 139 445 548 3702 5357 #prob some samba shit
];
networking.firewall.allowedUDPPortRanges = [
{from = 47950; to = 49000;}
];
networking.firewall.allowedTCPPortRanges = [
{from = 47950; to = 49000;}
];
networking = {
interfaces.eth0.ipv4.addresses = [ {
address = "192.168.1.24";
prefixLength = 24;
} ];
defaultGateway = "192.168.1.254";
nameservers = ["8.8.8.8" "8.8.4.4" "1.1.1.1"];
hostId = "68290da7";
};
virtualisation.docker = {
liveRestore = false;
enableOnBoot = true;
# daemon.settings = {
# runtimes.nvidia.path = "${pkgs.nvidia-docker}/bin/nvidia-container-runtime";
# exec-opts = ["native.cgroupdriver=cgroupfs"];
# };
};
services.fail2ban.enable = true;
services.fail2ban.bantime = "2h";
hardware.nvidia-container-toolkit.enable = true;
hardware.nvidia = {
open = true;
# prime.nvidiaBusId = "PCI:1:0:0";
# prime.amdgpuBusId = "PCI:13:0:0";
# prime.sync.enable = true;
# modesetting.enable = true;
};
}

6
osConfigs/hosts/vbox.nix Normal file
View File

@ -0,0 +1,6 @@
{ config, lib, inputs, pkgs, ... }:
{
virtualisation.virtualbox.guest.enable = true;
}

View File

@ -0,0 +1,10 @@
{ config, lib, inputs, pkgs, ... }:
{
programs.steam.enable=true;
programs.steam.protontricks.enable=true;
# environment.systemPackages = with pkgs; [ qemu quickemu];
# programs.virt-manager.enable = true;
# virtualisation.libvirtd.enable = true;
}

View File

@ -0,0 +1,11 @@
{ config, lib, inputs, pkgs, ... }:
{
hardware.graphics = {
enable = true;
enable32Bit = true;
};
services.xserver.videoDrivers = ["nvidia"];
}

View File

@ -0,0 +1,6 @@
{ config, lib, inputs, pkgs, ... }:
{
virtualisation.virtualbox.host.enable = true;
users.users.tom.extraGroups = [ "vboxusers" ];
}

View File

@ -0,0 +1,14 @@
{ config, lib, inputs, pkgs, ... }:
{
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
security.pam.yubico = {
enable = true;
id = "30536547";
mode = "challenge-response";
};
}