better config

This commit is contained in:
Wekuz 2025-11-22 22:30:21 +02:00
parent 51db5ee771
commit 87dc71ad94
Signed by: Wekuz
GPG key ID: 2E502F2AABD32DF9
5 changed files with 116 additions and 103 deletions

1
TODO
View file

@ -1,3 +1,4 @@
- nix.settings.experimental-features = [ "nix-command" "flakes" ];
- distributed build (https://nix.dev/tutorials/nixos/distributed-builds-setup)
- setup script (https://github.com/jakeb-grant/nix-configs/blob/main/setup.sh)
- swap

View file

@ -10,61 +10,11 @@
};
};
outputs = { self, nixpkgs, disko, ... }@inputs: {
outputs = { nixpkgs, disko, ... }: {
nixosConfigurations = {
opti = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./hosts/opti
disko.nixosModules.disko
{
disko.devices = {
disk = {
main = {
type = "disk";
device =
"/dev/disk/by-id/nvme-eui.00000000000000000c82d58020000000";
content = {
type = "gpt";
partitions = {
boot = {
size = "500M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
primary = {
size = "100%";
content = {
type = "btrfs";
extraArgs = [ "-f" ]; # Override existing partition
subvolumes = {
"/rootfs" = { mountpoint = "/"; };
"/home" = {
mountOptions = [ "compress=zstd" ];
mountpoint = "/home";
};
"/home/wekuz" = { };
"/nix" = {
mountOptions = [ "compress=zstd" "noatime" ];
mountpoint = "/nix";
};
};
mountpoint = "/partition-root";
};
};
};
};
};
};
};
}
];
modules = [ ./hosts/opti disko.nixosModules.disko ];
};
};
};

View file

@ -1,12 +1,22 @@
{ config, lib, pkgs, ... }:
{
imports = [ ./hardware-configuration.nix ];
imports = [ ./hardware-configuration.nix ./disko-config.nix ];
nix = {
package = pkgs.nixFlakes;
package = pkgs.nixVersions.stable;
optimise.automatic = true;
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 14d";
};
nix.settings.experimental-features = [ "nix-command" "flakes" ];
extraOptions = ''
experimental-features = nix-command flakes
min-free = 512000000
max-free = 2000000000
'';
};
@ -17,19 +27,52 @@
nixpkgs.hostPlatform = "x86_64-linux";
hardware.graphics = {
enable = true;
extraPackages = with pkgs; [ intel-media-driver vaapiIntel ];
};
time.timeZone = "Europe/Tallinn";
networking = {
hostName = "opti";
networkmanager.enable = true;
firewall.enable = false; # TODO: Configure firewall
useDHCP = true;
firewall.allowedTCPPorts = [ 22 ];
};
services.openssh.enable = true;
services.openssh = {
enable = true;
settings.PasswordAuthentication = false;
settings.PermitRootLogin = "no";
};
environment.systemPackages = with pkgs; [ git ];
virtualisation = {
docker = {
enable = true;
autoPrune = {
enable = true;
dates = "weekly";
};
};
};
environment.systemPackages = with pkgs; [
git
btop
ncdu
tmux
wget
ripgrep
smartmontools
lm_sensors
];
environment.variables.EDITOR = "nvim";
users.users.wekuz = {
isNormalUser = true;
extraGroups = [ "wheel" ];
extraGroups = [ "wheel" "networkmanager" "docker" ];
packages = with pkgs; [ ];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBs3aPxyJpVGytuVSO3va2WybKNFMR241o8DCJQbBEWV"

View file

@ -1,47 +1,50 @@
{
disko.devices = {
disk = {
main = {
type = "disk";
device =
"/dev/disk/by-id/nvme-eui.00000000000000000c82d58020000000";
content = {
type = "gpt";
partitions = {
boot = {
size = "500M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
primary = {
size = "100%";
content = {
type = "btrfs";
extraArgs = [ "-f" ]; # Override existing partition
subvolumes = {
"/rootfs" = { mountpoint = "/"; };
"/home" = {
mountOptions = [ "compress=zstd" ];
mountpoint = "/home";
};
"/home/wekuz" = { };
"/nix" = {
mountOptions = [ "compress=zstd" "noatime" ];
mountpoint = "/nix";
};
};
mountpoint = "/partition-root";
};
};
};
};
};
disko.devices = {
disk = {
main = {
type = "disk";
device = "/dev/disk/by-id/nvme-eui.00000000000000000c82d58020000000";
content = {
type = "gpt";
partitions = {
boot = {
size = "500M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
}
primary = {
size = "100%";
content = {
type = "btrfs";
extraArgs = [ "-f" ]; # Override existing partition
subvolumes = {
"/rootfs" = {
mountOptions = [ "compress=zstd" "noatime" ];
mountpoint = "/";
};
"/home" = {
mountOptions = [ "compress=zstd" "noatime" ];
mountpoint = "/home";
};
"/home/wekuz" = { };
"/nix" = {
mountOptions = [ "compress=zstd" "noatime" ];
mountpoint = "/nix";
};
# TODO: /log
};
mountpoint = "/part-root";
};
};
};
};
};
};
};
}

View file

@ -0,0 +1,16 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules =
[ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = true;
}