2024-09-09 11:41:10 +01:00
{
inputs ,
lib ,
pkgs ,
2024-10-07 14:19:27 +01:00
configVars ,
2024-09-09 11:41:10 +01:00
. . .
} : let
2024-05-30 21:20:39 +01:00
# Disko setup
fsType = " b t r f s " ; # one of ext4 or btrfs. Use btrfs if using impermanence
2024-05-31 22:18:40 +01:00
dev = " / d e v / n v m e 0 n 1 " ; # depends on target hardware
2024-05-30 21:20:39 +01:00
encrypted = true ; # currrently only applies to btrfs
2024-09-09 11:41:10 +01:00
btrfsMountDevice =
if encrypted
then " / d e v / m a p p e r / c r y p t e d "
else " / d e v / r o o t _ v g / r o o t " ;
2024-05-31 00:17:16 +01:00
user = " s a m " ;
2024-06-28 20:21:27 +01:00
impermanence = true ;
2024-10-07 14:19:27 +01:00
pieholeIp = configVars . networking . addresses . piehole . ip ;
gatewayIp = configVars . networking . addresses . gateway . ip ;
semitaIp = configVars . networking . addresses . semita . ip ;
2024-09-09 11:41:10 +01:00
in {
imports = [
# Create users for this host
../common/users / $ { user }
2024-05-30 21:20:39 +01:00
2024-09-09 11:41:10 +01:00
# Disk configuration
inputs . disko . nixosModules . disko
( import ../common/disks {
device = dev ;
impermanence = impermanence ;
fsType = fsType ;
encrypted = encrypted ;
} )
2024-05-30 21:20:39 +01:00
2024-09-09 11:41:10 +01:00
# Impermanence
( import ../common/disks/btrfs/impermanence.nix {
btrfsMountDevice = btrfsMountDevice ;
lib = lib ;
} )
2024-05-30 21:20:39 +01:00
2024-09-09 11:41:10 +01:00
# Import core options
./hardware-configuration.nix
../common/core
2024-05-30 21:20:39 +01:00
2024-09-09 11:41:10 +01:00
# Import optional options
../common/optional/persistence.nix
../common/optional/pipewire.nix
../common/optional/openssh.nix
../common/optional/dwm.nix
../common/optional/nfs-mounts/media.nix
../common/optional/nfs-mounts/homeshare.nix
../common/optional/printing.nix
2024-09-21 22:19:00 +01:00
../common/optional/docker
2024-10-06 17:26:39 +01:00
../common/optional/nixos-containers/nix-bitcoin.nix
../common/optional/nixos-containers/postgres.nix
2024-10-07 09:35:22 +01:00
../common/optional/nixos-containers/jellyfin.nix
2024-10-12 00:19:40 +01:00
../common/optional/nixos-containers/baseddata-worker.nix
../common/optional/nixos-containers/mongodb.nix
2024-09-09 11:41:10 +01:00
] ;
2024-05-30 21:20:39 +01:00
2024-10-04 17:53:32 +01:00
fileSystems . " / m e d i a / m a i n - s s d " = {
device = " / d e v / d i s k / b y - u u i d / b a 8 8 4 0 0 6 - e 8 1 3 - 4 b 6 7 - 9 f e 6 - 6 2 a e a 0 8 b 3 b 5 9 " ;
fsType = " e x t 4 " ;
} ;
2024-05-30 21:20:39 +01:00
boot = {
2024-09-09 11:41:10 +01:00
blacklistedKernelModules = [ " s n d _ h d a _ i n t e l " " s n d _ s o c _ s k l " ] ;
2024-06-01 16:39:14 +01:00
kernelPackages = pkgs . linuxPackagesFor pkgs . linux_latest ;
2024-05-30 21:20:39 +01:00
loader = {
systemd-boot . enable = true ;
efi . canTouchEfiVariables = true ;
timeout = 3 ;
} ;
} ;
2024-07-20 17:38:49 +01:00
services = {
xserver = {
dpi = 144 ;
upscaleDefaultCursor = true ;
} ;
} ;
environment . variables = {
2024-07-20 18:49:27 +01:00
GDK_SCALE = " 2 " ;
GDK_DPI_SCALE = " 0 . 6 " ;
2024-07-20 17:38:49 +01:00
_JAVA_OPTIONS = " - D s u n . j a v a 2 d . u i S c a l e = 1 . 8 " ;
QT_AUTO_SCREEN_SCALE_FACTOR = " 1 " ;
XCURSOR_SIZE = " 3 2 " ;
} ;
2024-06-01 16:39:14 +01:00
hardware . firmware = [
pkgs . sof-firmware
] ;
2024-10-07 09:35:22 +01:00
# Add hardware support for intel gpus as specified here: https://nixos.wiki/wiki/Jellyfin
2024-10-06 17:26:39 +01:00
nixpkgs . config . packageOverrides = pkgs : {
vaapiIntel = pkgs . vaapiIntel . override { enableHybridCodec = true ; } ;
} ;
hardware . opengl = {
enable = true ;
extraPackages = with pkgs ; [
intel-media-driver
intel-vaapi-driver
vaapiVdpau
libvdpau-va-gl
intel-compute-runtime
2024-10-07 09:35:22 +01:00
# only available on unstable
unstable . vpl-gpu-rt
2024-10-06 17:26:39 +01:00
intel-media-sdk
] ;
} ;
2024-05-30 21:20:39 +01:00
networking = {
hostName = " s e m i t a " ;
2024-10-07 14:19:27 +01:00
nameservers = [ " ${ pieholeIp } " " ${ gatewayIp } " " 8 . 8 . 8 . 8 " ] ;
defaultGateway = " ${ gatewayIp } " ;
2024-10-05 16:42:16 +01:00
useDHCP = false ;
bridges = {
br0 = {
interfaces = [ " e t h 0 " ] ;
} ;
} ;
interfaces . br0 = {
2024-10-03 14:55:42 +01:00
ipv4 . addresses = [
{
2024-10-07 14:19:27 +01:00
" a d d r e s s " = " ${ semitaIp } " ;
2024-10-05 16:42:16 +01:00
" p r e f i x L e n g t h " = 24 ;
2024-10-03 14:55:42 +01:00
}
] ;
} ;
2024-05-30 21:20:39 +01:00
} ;
2024-10-10 01:36:50 +01:00
# Using non-Nix Python Packages with Binaries on NixOS https://github.com/mcdonc/.nixconfig/blob/e7885ad18b7980f221e59a21c91b8eb02795b541/videos/pydev/script.rst
programs . nix-ld . enable = true ;
programs . nix-ld . libraries = with pkgs ; [
zlib # numpy
libgcc # sqlalchemy
# that's where the shared libs go, you can find which one you need using
# nix-locate --top-level libstdc++.so.6 (replace this with your lib)
# ^ this requires `nix-index` pkg
] ;
environment . variables = {
NIX_LD_LIBRARY_PATH = " / r u n / c u r r e n t - s y s t e m / s w / s h a r e / n i x - l d / l i b " ;
NIX_LD = " / r u n / c u r r e n t - s y s t e m / s w / s h a r e / n i x - l d / l i b / l d . s o " ;
LD_LIBRARY_PATH = lib . mkForce " $ N I X _ L D _ L I B R A R Y _ P A T H " ;
} ;
2024-05-30 21:20:39 +01:00
services . libinput . enable = true ;
}