new nixos dotfile layout

Signed-off-by: Michał Czyż <mike@c2yz.com>
This commit is contained in:
2024-11-04 13:21:48 +01:00
parent cbfbe20592
commit 720c05f9b0
119 changed files with 3895 additions and 4549 deletions

8
hosts/modules/adb.nix Normal file
View File

@@ -0,0 +1,8 @@
{ pkgs, ... }:
{
programs.adb.enable = true;
environment.systemPackages = [
pkgs.android-tools
pkgs.universal-android-debloater
];
}

View File

@@ -0,0 +1,8 @@
{ pkgs, ... }:
{
services.ananicy = {
enable = true;
package = pkgs.ananicy-cpp;
rulesProvider = pkgs.ananicy-rules-cachyos;
};
}

View File

@@ -0,0 +1,8 @@
{
services.blueman.enable = false;
hardware.bluetooth = {
enable = true;
powerOnBoot = false;
};
}

24
hosts/modules/boot.nix Normal file
View File

@@ -0,0 +1,24 @@
{ pkgs, hostname, inputs, ... }:
{
imports = if hostname == "zion" then [ inputs.chaotic.nixosModules.default ] else [ ];
boot = {
tmp.cleanOnBoot = true;
loader = {
timeout = 1;
efi.canTouchEfiVariables = true;
systemd-boot = {
enable = true;
configurationLimit = 10;
};
};
kernelPackages =
if hostname == "zion" then pkgs.linuxPackages #linuxPackages_zen #linuxPackages #linuxPackages_latest #linuxPackages_xanmod_latest
else if hostname == "thor" then pkgs.linuxPackages
else if hostname == "server" then pkgs.linuxPackages
else pkgs.linuxPackages_zen;
};
}

View File

@@ -0,0 +1,66 @@
{ hostname, inputs, ... }:
{
time.timeZone = "Europe/Warsaw";
i18n.defaultLocale = "en_US.UTF-8";
hardware.graphics = {
enable = true;
enable32Bit = true;
};
services = {
logind = {
lidSwitch = "ignore";
lidSwitchExternalPower = if hostname == "server" then "ignore" else "suspend-then-hibernate";
};
};
system = {
stateVersion = "24.05";
switch = {
enable = false;
enableNg = true;
};
};
nixpkgs = { config = { allowUnfree = true; }; };
documentation = {
enable = false;
doc.enable = false;
man.enable = false;
dev.enable = false;
info.enable = false;
nixos.enable = false;
};
nix = {
daemonCPUSchedPolicy = "batch";
channel.enable = false;
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
optimise = {
automatic = true;
dates = [ "daily" ];
};
settings = {
auto-optimise-store = true;
experimental-features = [ "nix-command" "flakes" ];
substituters = [
"https://cache.nixos.org"
"https://hyprland.cachix.org"
"https://nix-community.cachix.org"
"https://cuda-maintainers.cachix.org"
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
];
};
};
}

6
hosts/modules/fstrim.nix Normal file
View File

@@ -0,0 +1,6 @@
{
services.fstrim = {
enable = true;
interval = "daily";
};
}

28
hosts/modules/gaming.nix Executable file
View File

@@ -0,0 +1,28 @@
{ pkgs, username, ... }:
{
users.users.${username}.packages = with pkgs; [ heroic ];
hardware.steam-hardware.enable = true;
programs = {
steam = {
enable = true;
gamescopeSession.enable = true;
extraCompatPackages = with pkgs; [ proton-ge-bin ];
};
gamemode = {
enable = false;
enableRenice = false;
settings = { };
};
gamescope = {
enable = false;
args = [
"-w 1920 -h 1080"
"-F nis"
"f"
];
};
};
}

32
hosts/modules/greetd.nix Normal file
View File

@@ -0,0 +1,32 @@
{ pkgs, ... }:
{
services.greetd = {
enable = true;
settings = {
default_session = {
command = "${pkgs.greetd.tuigreet}/bin/tuigreet --remember --asterisks --container-padding 2 --time --time-format '%I:%M %p | %a %h | %F' --cmd Hyprland";
user = "greeter";
};
};
};
# this is a life saver.
# literally no documentation about this anywhere.
# might be good to write about this...
# https://www.reddit.com/r/NixOS/comments/u0cdpi/tuigreet_with_xmonad_how/
systemd = {
# To prevent getting stuck at shutdown
extraConfig = "DefaultTimeoutStopSec=10s";
services.greetd.serviceConfig = {
Type = "idle";
StandardInput = "tty";
StandardOutput = "tty";
StandardError = "journal"; # Without this errors will spam on screen
# Without these bootlogs will spam on screen
TTYReset = true;
TTYVHangup = true;
TTYVTDisallocate = true;
};
};
}

View File

@@ -0,0 +1,4 @@
{
programs.dconf.enable = true;
services.gvfs.enable = true;
}

6
hosts/modules/kde.nix Normal file
View File

@@ -0,0 +1,6 @@
{
services.desktopManager = {
plasma6.enable = true;
enableQt5Integration = false;
};
}

View File

@@ -0,0 +1,14 @@
{ lib, pkgs, inputs, ... }:
{
imports = [ inputs.lanzaboote.nixosModules.lanzaboote ];
environment.systemPackages = [ pkgs.sbctl ];
boot = {
loader.systemd-boot.enable = lib.mkForce false;
lanzaboote = {
enable = true;
pkiBundle = "/etc/secureboot";
};
};
}

20
hosts/modules/network.nix Normal file
View File

@@ -0,0 +1,20 @@
{ hostname, ... }:
{
boot.initrd.systemd.network.wait-online.enable = false;
systemd.services.NetworkManager-wait-online.enable = false;
networking = {
hostName = "${hostname}";
firewall.enable = true;
wireless = {
enable = false;
iwd.enable = false;
};
networkmanager = {
enable = true;
wifi.backend = "wpa_supplicant";
};
};
}

12
hosts/modules/nh.nix Normal file
View File

@@ -0,0 +1,12 @@
{ username, ... }:
{
programs.nh = {
enable = true;
flake = "/home/${username}/.files";
clean = {
enable = true;
dates = "weekly";
extraArgs = "--keep-since 3d --keep 3";
};
};
}

56
hosts/modules/nvidia.nix Executable file
View File

@@ -0,0 +1,56 @@
{ config, ... }:
{
nixpkgs.config.nvidia.acceptLicense = true;
services.xserver.videoDrivers = [ "nvidia" ];
hardware = {
graphics = {
enable = true;
enable32Bit = true;
};
nvidia = {
package = config.boot.kernelPackages.nvidiaPackages.beta;
open = false;
nvidiaSettings = true;
modesetting.enable = true;
# dynamicBoost.enable = true;
powerManagement = {
enable = false;
finegrained = false;
};
# prime = {
# amdgpuBusId = "PCI:05:00:0";
# nvidiaBusId = "PCI:01:00:0";
# #sync.enable = true;
# offload = {
# enable = true;
# enableOffloadCmd = true;
# };
# };
};
};
# specialisation = {
# Battery.configuration = {
# system.nixos.tags = [ "Battery" ];
# boot.extraModprobeConfig = ''blacklist nouveau options nouveau modeset=0'';
# boot.blacklistedKernelModules = [ "nouveau" "nvidia" "nvidia_drm" "nvidia_modeset" ];
# 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"
# '';
# };
# };
}

14
hosts/modules/ollama.nix Normal file
View File

@@ -0,0 +1,14 @@
{
nixpkgs.config.cudaSupport = true;
services.ollama = {
enable = true;
acceleration = "cuda";
};
services.open-webui = {
enable = false;
host = "0.0.0.0";
openFirewall = true;
};
}

View File

@@ -0,0 +1,30 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
vim
ntfs3g
dosfstools
nix-output-monitor
nvd
];
fonts.packages = with pkgs; [
nerdfonts
noto-fonts
noto-fonts-cjk-sans
noto-fonts-emoji
font-awesome
source-han-sans
source-han-sans-japanese
source-han-serif-japanese
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
programs.mtr.enable = true;
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
}

View File

@@ -0,0 +1,23 @@
{
services.pipewire = {
enable = true;
jack.enable = true;
pulse.enable = true;
alsa = {
enable = true;
support32Bit = true;
};
wireplumber.extraConfig = {
"10-disable-camera" = {
"wireplumber.profiles" = {
main = {
"monitor.libcamera" = "disabled";
};
};
};
};
};
}

28
hosts/modules/qtile.nix Executable file
View File

@@ -0,0 +1,28 @@
# Enable Qtile
{ pkgs, ... }:
{
# --------------------------------------
# Enable QTILE
# --------------------------------------
services.xserver.windowManager.qtile = {
enable = true;
configFile = /home/nel/dotfiles/qtile/config.py;
extraPackages = python3Packages: with python3Packages; [ qtile-extras ];
};
# --------------------------------------
# Necessary things
# --------------------------------------
environment.sessionVariables = {
NIXOS_OZONE_WL = "1";
};
xdg.portal = {
enable = true;
config.common.default = "*";
extraPortals = with pkgs; [
xdg-desktop-portal-wlr
xdg-desktop-portal-gtk
];
};
}

View File

@@ -0,0 +1,7 @@
{
security = {
sudo.enable = true;
rtkit.enable = true;
polkit.enable = true;
};
}

13
hosts/modules/ssh.nix Normal file
View File

@@ -0,0 +1,13 @@
{
networking.firewall.allowedTCPPorts = [ 22 ];
services.openssh = {
enable = true;
ports = [ 22 ];
settings = {
PasswordAuthentication = true;
UseDns = true;
};
};
}

10
hosts/modules/thunar.nix Normal file
View File

@@ -0,0 +1,10 @@
{ pkgs, ... }:
{
programs.thunar = {
enable = true;
plugins = with pkgs.xfce; [
thunar-archive-plugin
thunar-volman
];
};
}

50
hosts/modules/tlp.nix Normal file
View File

@@ -0,0 +1,50 @@
{ config, hostname, ... }:
{
boot = {
kernelModules = [ "acpi_call" ];
extraModulePackages = with config.boot.kernelPackages; [ acpi_call ];
};
services.tlp = {
enable = true;
settings = {
TLP_DEFAULT_MODE =
if hostname == "laptop"
then "BAT"
else "AC";
TLP_PERSISTENT_DEFAULT =
if hostname == "laptop"
then 0
else 1;
CPU_BOOST_ON_AC = 1;
CPU_BOOST_ON_BAT = 0;
CPU_HWP_DYN_BOOST_ON_AC = 1;
CPU_HWP_DYN_BOOST_ON_BAT = 0;
CPU_SCALING_GOVERNOR_ON_AC = "performance";
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
CPU_ENERGY_PERF_POLICY_ON_BAT = "balance_power";
RADEON_DPM_PERF_LEVEL_ON_AC = "auto";
RADEON_DPM_PERF_LEVEL_ON_BAT = "low";
RADEON_DPM_STATE_ON_AC = "performance";
RADEON_DPM_STATE_ON_BAT = "battery";
RADEON_POWER_PROFILE_ON_AC = "default";
RADEON_POWER_PROFILE_ON_BAT = "low";
PLATFORM_PROFILE_ON_AC = "performance";
PLATFORM_PROFILE_ON_BAT = "low-power";
START_CHARGE_THRESH_BAT0 = 40;
STOP_CHARGE_THRESH_BAT0 = 60;
WOL_DISABLE = "Y";
USB_AUTOSUSPEND = 1;
};
};
}

26
hosts/modules/users.nix Normal file
View File

@@ -0,0 +1,26 @@
{ inputs, username, hostname, ... }:
{
imports = [ inputs.home-manager.nixosModules.home-manager ];
users.users.${username} = {
isNormalUser = true;
description = "${username}";
extraGroups = [ "networkmanager" "wheel" ];
};
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = { inherit inputs username hostname; };
users.${username} = {
imports = [ ../../home/home.nix ];
programs.home-manager.enable = true;
home = {
stateVersion = "24.05";
username = "${username}";
homeDirectory = "/home/${username}";
};
};
};
}

31
hosts/modules/vm.nix Normal file
View File

@@ -0,0 +1,31 @@
{ pkgs, username, ... }:
{
users.users.${username}.extraGroups = [ "libvirtd" ];
boot.kernel.sysctl = { "vm.max_map_count" = 2147483642; };
# Install necessary packages
environment.systemPackages = with pkgs; [
virt-manager
virt-viewer
spice
spice-gtk
spice-protocol
win-virtio
win-spice
adwaita-icon-theme
];
services.spice-vdagentd.enable = true;
virtualisation = {
spiceUSBRedirection.enable = true;
libvirtd = {
enable = true;
qemu = {
swtpm.enable = true;
ovmf.enable = true;
ovmf.packages = [ pkgs.OVMFFull.fd ];
};
};
};
}

View File

@@ -0,0 +1,9 @@
{ pkgs, ... }:
{
services.xserver = {
enable = true;
xkb.layout = "fr";
xkb.variant = "";
excludePackages = [ pkgs.xterm ];
};
}