refectored some stuff

This commit is contained in:
Victor Ișan 2026-02-08 19:09:03 +01:00
parent d0bb91ec08
commit 2af15b79fb
12 changed files with 245 additions and 189 deletions

View File

@ -1,34 +0,0 @@
{ mainDisk, ... }:
{
disk.main = {
device = mainDisk;
type = "disk";
content = {
type = "gpt";
partitions = {
MBR = {
size = "1M";
type = "EF02";
};
root = {
size = "100%";
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"@root" = { mountpoint = "/"; };
"@nix" = { mountpoint = "/nix"; };
"@var" = { mountpoint = "/var"; };
"@docker" = { mountpoint = "/var/lib/docker"; };
"@home" = { mountpoint = "/home"; };
"@snapshots" = { mountpoint = "/.snapshots"; };
};
};
};
};
};
};
}

View File

@ -0,0 +1,36 @@
{ ... }:
{
disko.devices = {
disk.main = {
device = "/dev/sda";
type = "disk";
content = {
type = "gpt";
partitions = {
MBR = {
size = "1M";
type = "EF02";
};
root = {
size = "100%";
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"@root" = { mountpoint = "/"; };
"@nix" = { mountpoint = "/nix"; };
"@var" = { mountpoint = "/var"; };
"@docker" = { mountpoint = "/var/lib/docker"; };
"@home" = { mountpoint = "/home"; };
"@snapshots" = { mountpoint = "/.snapshots"; };
};
};
};
};
};
};
};
}

92
disko/palantir/lvm.nix Normal file
View File

@ -0,0 +1,92 @@
{...}:
let
disks = [
"/dev/disk/by-id/ata-WDC_WDS120G2G0A-00JH30_184377804456"
"/dev/disk/by-id/ata-KINGSTON_SA400S37120G_50026B7783176055"
];
in
{
disko.devices = {
disk = {
ssd0 = {
type = "disk";
device = builtins.elemAt disks 0;
content = {
type = "gpt";
partitions = {
bios_grub = {
size = "2M";
type = "EF02";
};
pv = {
size = "100%";
content = {
type = "lvm_pv";
vg = "mainpool";
};
};
};
};
};
ssd1 = {
type = "disk";
device = builtins.elemAt disks 1;
content = {
type = "gpt";
partitions = {
pv = {
size = "100%";
content = {
type = "lvm_pv";
vg = "mainpool";
};
};
};
};
};
};
lvm_vg = {
mainpool = {
type = "lvm_vg";
lvs = {
root = {
size = "30G";
lvm_type = "raid0";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
mountOptions = [ "noatime" ];
};
};
nix = {
size = "50G";
lvm_type = "raid0";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/nix";
mountOptions = [ "noatime" ];
};
};
games = {
size = "100%FREE";
lvm_type = "raid0";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/games";
mountOptions = [ "noatime" ];
};
};
};
};
};
};
}

View File

@ -0,0 +1,38 @@
{ ... }:
{
disko.devices = {
disk.main = {
device = "/dev/sda";
type = "disk";
content = {
type = "gpt";
partitions = {
ESP = {
name = "ESP";
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
root = {
name = "root";
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
};
}

View File

@ -1,36 +0,0 @@
{ mainDisk, ... }:
{
disk.main = {
device = mainDisk;
type = "disk";
content = {
type = "gpt";
partitions = {
ESP = {
name = "ESP";
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
root = {
name = "root";
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
}

View File

@ -14,7 +14,6 @@
# options
system = "x86_64-linux";
release = "25.11";
mainDisk = "/dev/sda";
myUser = "victor";
# helper
@ -23,7 +22,7 @@
nixosConfigurations = {
isengard = lib.nixosSystem {
inherit system;
specialArgs = { inherit release mainDisk myUser disko; };
specialArgs = { inherit release myUser disko; };
modules = [
./hosts/isengard.nix
./modules/base.nix
@ -33,17 +32,14 @@
};
palantir = lib.nixosSystem {
inherit system;
specialArgs = { inherit release mainDisk myUser disko; };
specialArgs = { inherit release myUser disko; };
modules = [
./hosts/palantir.nix
./modules/base.nix
./modules/plasma.nix
./modules/gaming.nix
home-manager.nixosModules.home-manager
./modules/home.nix
]
++ lib.optional (builtins.pathExists ./hardware-configuration.nix) ./hardware-configuration.nix;
];
};
};
};

View File

@ -1,14 +1,13 @@
{ config, pkgs, myUser, release, disko, mainDisk, ... }:
{ config, pkgs, myUser, release, disko, ... }:
{
networking.hostName = "isengard";
imports = [
disko.nixosModules.disko
disko.nixosModules.disko ../disko/isengard/btrfs-legacy.nix
../modules/docker.nix
];
disko.devices = import ../disko/btrfs-legacy.nix {
inherit mainDisk;
};
boot.loader = {
grub.enable = true;
};

View File

@ -1,21 +1,40 @@
{ config, pkgs, myUser, release, disko, mainDisk, ... }:
{ config, pkgs, myUser, release, disko, ... }:
{
networking.hostName = "palantir";
# Imports
imports = [
disko.nixosModules.disko
disko.nixosModules.disko ../disko/palantir/lvm.nix
../modules/nvidia.nix
../modules/plasma.nix
../modules/gaming.nix
];
disko.devices = import ../disko/simple-efi-gpt.nix {
inherit mainDisk;
};
# Disks
boot.initrd.services.lvm.enable = true;
boot.loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
# Networking
networking.hostName = "palantir";
networking.useDHCP = true;
time.timeZone = "Europe/Vienna";
# SSH
users.users.${myUser}.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOiNyGO4RAxSdxvn2ZIBZ2Ze4iVVMrBNmu/V9JO70PoT victor@battleship"
];
users.users.root.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOiNyGO4RAxSdxvn2ZIBZ2Ze4iVVMrBNmu/V9JO70PoT victor@battleship"
];
services.openssh = {
enable = true;
settings.PasswordAuthentication = false;
};
# User
users.users.${myUser} = {
isNormalUser = true;
extraGroups = [
@ -25,30 +44,26 @@
"input"
];
shell = pkgs.zsh;
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOiNyGO4RAxSdxvn2ZIBZ2Ze4iVVMrBNmu/V9JO70PoT victor@battleship"
];
};
## Autologin
services = {
getty.autologinUser = myUser;
displayManager.autoLogin = {
enable = true;
user = myUser;
};
};
users.users.root.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOiNyGO4RAxSdxvn2ZIBZ2Ze4iVVMrBNmu/V9JO70PoT victor@battleship"
];
networking.useDHCP = true;
services.openssh = {
enable = true;
settings.PasswordAuthentication = false;
};
fileSystems."/games" = {
device = "/dev/disk/by-uuid/90bea801-2b8a-40db-8862-ccc55f2b2262";
fsType = "ext4";
options = [
"nofail" # Prevent system from failing if this drive doesn't mount
];
};
# Mounts
#fileSystems."/games" = {
# device = "/dev/disk/by-uuid/90bea801-2b8a-40db-8862-ccc55f2b2262";
# fsType = "ext4";
# options = [
# "nofail" # Prevent system from failing if this drive doesn't mount
# ];
#};
# Release
system.stateVersion = release;
}

View File

@ -1,36 +1,20 @@
{ config, pkgs, mainDisk, lib, ... }:
{ config, pkgs, lib, ... }:
let
cfg = config.my.allowUnfree;
in
{
options = {
my.allowUnfree.names = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [];
description = "Package names allowed by allowUnfreePredicate";
};
nix.settings = {
experimental-features = [ "nix-command" "flakes" ];
auto-optimise-store = true;
};
config = {
nix.settings = {
experimental-features = [ "nix-command" "flakes" ];
auto-optimise-store = true;
};
programs.zsh.enable = true;
environment.systemPackages = with pkgs; [
git
curl
htop
tmux
killall
neovim
pciutils
progress
];
nixpkgs.config.allowUnfreePredicate =
pkg: builtins.elem (lib.getName pkg) cfg.names;
};
programs.zsh.enable = true;
environment.systemPackages = with pkgs; [
git
curl
htop
tmux
killall
neovim
progress
];
}

View File

@ -1,42 +1,7 @@
{ config, pkgs, myUser, release, lib, ... }:
{
my.allowUnfree.names = lib.mkAfter [
"steam"
"steam-unwrapped"
"cuda-merged"
"cuda_cuobjdump"
"cuda_gdb"
"cuda_nvcc"
"cuda_nvdisasm"
"cuda_nvprune"
"cuda_cccl"
"cuda_cudart"
"cuda_cupti"
"cuda_cuxxfilt"
"cuda_nvml_dev"
"cuda_nvrtc"
"cuda_nvtx"
"cuda_profiler_api"
"cuda_sanitizer_api"
"libcublas"
"libcufft"
"libcurand"
"libcusolver"
"libnvjitlink"
"libcusparse"
"libnpp"
"cudnn"
];
nixpkgs.config.cudaSupport = true;
services = {
getty.autologinUser = "victor";
displayManager.autoLogin = {
enable = true;
user = "victor";
};
sunshine = {
enable = true;
autoStart = true;

13
modules/nvidia.nix Normal file
View File

@ -0,0 +1,13 @@
{ config, lib, ... }:
{
nixpkgs.config.allowUnfree = true; # Cuz nvidia drivers and stuff
nixpkgs.config.cudaSupport = true;
hardware.graphics.enable = true;
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia = {
modesetting.enable = true;
open = false;
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
}

View File

@ -1,4 +1,4 @@
{ config, pkgs, lib, ... }:
{ config, pkgs, ... }:
{
services = {
@ -16,18 +16,6 @@
environment.systemPackages = with pkgs; [
librewolf
pciutils
];
# Nvidia
my.allowUnfree.names = lib.mkAfter [
"nvidia-x11"
"nvidia-settings"
];
hardware.graphics.enable = true;
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia = {
modesetting.enable = true;
open = false;
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
}