better config
This commit is contained in:
parent
51db5ee771
commit
87dc71ad94
5 changed files with 116 additions and 103 deletions
1
TODO
1
TODO
|
|
@ -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
|
||||
|
|
|
|||
54
flake.nix
54
flake.nix
|
|
@ -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 ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@
|
|||
disk = {
|
||||
main = {
|
||||
type = "disk";
|
||||
device =
|
||||
"/dev/disk/by-id/nvme-eui.00000000000000000c82d58020000000";
|
||||
device = "/dev/disk/by-id/nvme-eui.00000000000000000c82d58020000000";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
|
|
@ -24,9 +23,12 @@
|
|||
type = "btrfs";
|
||||
extraArgs = [ "-f" ]; # Override existing partition
|
||||
subvolumes = {
|
||||
"/rootfs" = { mountpoint = "/"; };
|
||||
"/rootfs" = {
|
||||
mountOptions = [ "compress=zstd" "noatime" ];
|
||||
mountpoint = "/";
|
||||
};
|
||||
"/home" = {
|
||||
mountOptions = [ "compress=zstd" ];
|
||||
mountOptions = [ "compress=zstd" "noatime" ];
|
||||
mountpoint = "/home";
|
||||
};
|
||||
"/home/wekuz" = { };
|
||||
|
|
@ -34,9 +36,10 @@
|
|||
mountOptions = [ "compress=zstd" "noatime" ];
|
||||
mountpoint = "/nix";
|
||||
};
|
||||
# TODO: /log
|
||||
};
|
||||
|
||||
mountpoint = "/partition-root";
|
||||
mountpoint = "/part-root";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
@ -44,4 +47,4 @@
|
|||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
16
hosts/opti/hardware-configuration.nix
Normal file
16
hosts/opti/hardware-configuration.nix
Normal 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;
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue