Initial commit

This commit is contained in:
Veneficium 2024-06-11 23:59:03 +02:00
commit 69d741b98b
29 changed files with 718 additions and 0 deletions

42
nixosModules/default.nix Normal file
View file

@ -0,0 +1,42 @@
#todo declare options to more easily activate the right modules then use those to import the correct modules in the hosts configs
{ lib, ... }: {
imports =
[
./fedfer.nix
./drivers/samsung-printer.nix
./drivers/ipod.nix
./drivers/gpu/opengl.nix
./drivers/gpu/amd.nix
./drivers/gpu/nvidia.nix
./drivers/gpu/disableNvidia.nix
./services/locale.nix #todo turn into config module?
./services/gnome.nix
./services/pipewire.nix
./services/printing.nix
./programs/docker.nix
./programs/tailscale.nix
];
settings = {
programs.docker.enable = lib.mkDefault false;
programs.tailscale.enable = lib.mkDefault false;
drivers = {
printer.M2020.enable = lib.mkDefault false;
ipod.enable = lib.mkDefault false;
gpu = {
opengl.enable = lib.mkDefault true;
nvidia.enable = lib.mkDefault false;
nvidia.forceDisable = lib.mkDefault true;
amd.enable = lib.mkDefault false;
};
};
services.printing.enable = lib.mkDefault false;
services.audio.enable = lib.mkDefault false;
gnome.enable = lib.mkDefault false;
};
}

View file

@ -0,0 +1,11 @@
{ lib, config, ... }: {
options = {
settings.drivers.gpu.amd.enable = lib.mkEnableOption "enable AMD gpu drivers";
};
config = lib.mkIf config.settings.drivers.gpu.amd.enable {
boot.initrd.kernelModules = [ "amdgpu" ];
services.xserver.videoDrivers = [ "amdgpu" ];
};
}

View file

@ -0,0 +1,24 @@
{ lib, config, ... }: {
options = {
settings.drivers.gpu.nvidia.forceDisable = lib.mkEnableOption "force disable all nvidia drivers";
};
config = lib.mkIf config.settings.drivers.gpu.nvidia.forceDisable {
boot.extraModprobeConfig = ''
blacklist nouveau
options nouveau modeset=0
'';
services.udev.extraRules = ''
# Remove NVIDIA USB xHCI Host Controller devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c0330", ATTR{power/control}="auto", ATTR{remove}="1"
# Remove NVIDIA USB Type-C UCSI devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c8000", ATTR{power/control}="auto", ATTR{remove}="1"
# Remove NVIDIA Audio devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x040300", ATTR{power/control}="auto", ATTR{remove}="1"
# Remove NVIDIA VGA/3D controller devices
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x03[0-9]*", ATTR{power/control}="auto", ATTR{remove}="1"
'';
boot.blacklistedKernelModules = [ "nouveau" "nvidia" "nvidia_drm" "nvidia_modeset" ];
};
}

View file

@ -0,0 +1,25 @@
{ lib, config, ... }: {
options = {
settings.drivers.gpu.nvidia.enable = lib.mkEnableOption "Enable Nvidia proprietary drivers";
settings.drivers.gpu.nvidia.offload = lib.mkEnableOption "Enable prime offloading";
settings.drivers.gpu.nvidia.sync = lib.mkEnableOption "Enable prime sync";
};
config = lib.mkIf config.settings.drivers.gpu.nvidia.enable {
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia = {
modesetting.enable = true;
prime = {
nvidiaBusId = "pci:1:0:0";
amdgpuBusId = "pci:5:0:0";
};
prime.offload = lib.mkIf config.settings.drivers.gpu.nvidia.offload {
enable = true;
enableOffloadCmd = true;
};
prime.sync.enable = lib.mkIf config.settings.drivers.gpu.nvidia.sync true;
nvidiaSettings = true;
};
};
}

View file

@ -0,0 +1,13 @@
{ config, lib, ... }: {
options = {
settings.drivers.gpu.opengl.enable = lib.mkEnableOption "enable OpenGL hardware support";
};
config = lib.mkIf config.settings.drivers.gpu.opengl.enable {
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
};
}

View file

@ -0,0 +1,15 @@
{ lib, config, pkgs, ... }: {
options = {
settings.drivers.ipod.enable = lib.mkEnableOption "Enable necessary software for ipod communication";
};
config = lib.mkIf config.settings.drivers.ipod.enable {
services.usbmuxd.enable = true;
environment.systemPackages = with pkgs; [
libimobiledevice
];
};
}

View file

@ -0,0 +1,10 @@
{ lib, config, pkgs, ... }: {
#use driver compatible with samsung M2020 printer
options = {
settings.drivers.printer.M2020.enable = lib.mkEnableOption "use the appropriate driver for the samsung M2020 printer";
};
config = lib.mkIf config.settings.drivers.printer.M2020.enable {
services.printing.drivers = [ pkgs.samsung-unified-linux-driver_1_00_37 ];
};
}

9
nixosModules/fedfer.nix Normal file
View file

@ -0,0 +1,9 @@
#need to move stuff to home-manager
{ pkgs, ... }: {
users.users.fedfer = {
isNormalUser = true;
description = "FedFer";
extraGroups = [ "networkmanager" "wheel" ];
shell = pkgs.zsh;
};
}

View file

@ -0,0 +1,10 @@
{ lib, config, ... }: {
#todo look further into virt options
options = {
settings.programs.docker.enable = lib.mkEnableOption "enables docker";
};
config = lib.mkIf config.settings.programs.docker.enable {
virtualisation.docker.enable = true;
};
}

View file

@ -0,0 +1,9 @@
{ config, lib, ... }: {
options = {
settings.programs.tailscale.enable = lib.mkEnableOption "enable tailscale";
};
config = lib.mkIf config.settings.programs.tailscale.enable {
services.tailscale.enable = true;
};
}

View file

@ -0,0 +1,26 @@
{ config, lib, pkgs, ... }: {
options = {
settings.gnome.enable = lib.mkEnableOption "enable gnome de";
};
#todo make this more configurable
config = lib.mkIf config.settings.gnome.enable {
services.xserver = {
enable = true;
displayManager.gdm.enable = true;
desktopManager.gnome.enable = true;
};
environment.systemPackages = [ pkgs.gnome.gnome-tweaks ];
#enable browser connector for installing extensions
services.gnome.gnome-browser-connector.enable = true;
# Gnome enables pulse by default smh
# make sure to have PIPEWIRE enabled!
hardware.pulseaudio.enable = false;
# remove various bloat
environment.gnome.excludePackages = with pkgs.gnome; [ epiphany gnome-contacts gnome-maps gnome-music gnome-weather totem yelp pkgs.gnome-tour ];
};
}

View file

@ -0,0 +1,24 @@
{ ... }: {
time.timeZone = "Europe/Rome";
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";
};
console.keyMap = "it";
services.xserver.xkb = {
layout = "it";
variant = "";
};
}

View file

@ -0,0 +1,20 @@
{ config, lib, ... }: {
options = {
settings.services.audio.enable = lib.mkEnableOption "enable sound through pipewire and its compat layers";
};
config = lib.mkIf config.settings.services.audio.enable {
sound.enable = true;
#enable RealtimeKit for realtime audio ( req by PulseAudio )
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
};
};
}

View file

@ -0,0 +1,19 @@
{ config, lib, ... }: {
options = {
settings.services.printing.enable = lib.mkEnableOption "enable printing";
};
config = lib.mkIf config.settings.services.printing.enable {
services = {
printing = {
enable = true;
};
#todo make this also configurable maybe a seperate module?
avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
};
};
}