infrastructure/nixos/hosts/thalassa/null/configuration.nix

252 lines
6.6 KiB
Nix
Raw Normal View History

2022-08-20 11:34:41 +02:00
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
2022-08-24 18:17:29 +02:00
{ config, pkgs, lib, inputs, ... }:
2022-08-20 12:16:29 +02:00
let
nvidia-offload = pkgs.writeShellScriptBin "nvidia-offload" ''
export __NV_PRIME_RENDER_OFFLOAD=1
export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export __VK_LAYER_NV_optimus=NVIDIA_only
2022-08-24 23:44:40 +02:00
export LIBVA_DRIVER_NAME=nvidia
export GBM_BACKEND=nvidia-drm
2022-08-20 12:16:29 +02:00
exec "$@"
'';
2022-08-24 23:44:40 +02:00
run-hyprland = pkgs.writeShellScriptBin "run-hyprland" ''
export _JAVA_AWT_WM_NONREPARENTING=1
2022-09-07 13:57:45 +02:00
export XCURSOR_SIZE=32
2022-08-24 23:44:40 +02:00
export CLUTTER_BACKEND=wayland
export XDG_SESSION_TYPE=wayland
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
export MOZ_ENABLE_WAYLAND=1
export WLR_NO_HARDWARE_CURSORS=1
export WLR_BACKEND=vulkan
export QT_QPA_PLATFORM=wayland
export GDK_BACKEND=wayland
2022-09-07 13:57:45 +02:00
export SDL_VIDEODRIVER=wayland
2022-08-24 23:44:40 +02:00
exec Hyprland
'';
2022-11-06 13:04:41 +01:00
in {
2022-09-29 18:56:03 +02:00
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
2022-10-08 21:38:55 +02:00
./rescue-boot.nix
2022-09-29 18:56:03 +02:00
./networking.nix
];
2022-08-20 11:34:41 +02:00
2022-08-20 12:55:59 +02:00
# home-manager
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.victor = import ./home;
2022-09-29 18:56:03 +02:00
home-manager.extraSpecialArgs = { inherit inputs; };
2022-08-24 18:17:29 +02:00
2022-08-30 22:38:00 +02:00
security.pam.services.swaylock = { };
security.sudo.wheelNeedsPassword = true;
2022-08-24 18:17:29 +02:00
fonts = {
fonts = with pkgs; [
material-design-icons
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
dejavu_fonts
2022-09-29 18:56:03 +02:00
(nerdfonts.override {
fonts =
[ "DejaVuSansMono" "Ubuntu" "DroidSansMono" "NerdFontsSymbolsOnly" ];
})
2022-08-24 18:17:29 +02:00
];
enableDefaultFonts = false;
fontconfig = {
defaultFonts = {
monospace = [ "DejaVuSansMono Nerd Font" "Noto Color Emoji" ];
2022-09-29 18:56:03 +02:00
sansSerif =
[ "DejaVu Sans" "DejaVuSansMono Nerd Font" "Noto Color Emoji" ];
serif =
[ "DejaVu Serif" "DejaVuSansMono Nerd Font" "Noto Color Emoji" ];
2022-08-24 18:17:29 +02:00
emoji = [ "Noto Color Emoji" ];
};
};
};
2022-08-20 12:55:59 +02:00
2022-08-20 11:34:41 +02:00
# Bootloader.
2022-09-28 12:20:54 +02:00
# boot.initrd.systemd.enable = true; # Experimental
2022-09-28 14:43:39 +02:00
boot = {
2022-09-29 18:56:03 +02:00
kernelPackages = pkgs.linuxPackages_latest;
2022-09-28 14:43:39 +02:00
loader.systemd-boot.editor = false;
loader.systemd-boot.enable = true;
2022-10-08 21:38:55 +02:00
# loader.systemd-boot.configurationLimit = 6;
2022-09-28 14:43:39 +02:00
loader.efi.canTouchEfiVariables = true;
loader.efi.efiSysMountPoint = "/boot/efi";
2022-11-04 14:25:13 +01:00
2022-11-06 13:04:41 +01:00
kernel.sysctl = { "fs.inotify.max_user_watches" = 524288; };
2022-09-28 14:43:39 +02:00
};
2022-08-20 11:34:41 +02:00
2022-09-21 09:51:08 +02:00
services.gnome.gnome-keyring.enable = true;
2022-09-29 18:56:03 +02:00
2022-08-20 12:55:59 +02:00
fileSystems."/".options = [ "compress=zstd" ];
2022-10-08 16:34:25 +02:00
fileSystems."/home".options = [ "compress=zstd" ];
2022-10-08 21:38:55 +02:00
fileSystems."/nix".options = [ "compress=zstd" "noatime" ];
2022-10-08 16:34:25 +02:00
2022-08-23 22:31:19 +02:00
# Filesystem dedup
2022-10-31 10:41:17 +01:00
# services.beesd.filesystems = {
2022-10-26 16:05:03 +02:00
# root = {
# spec = "LABEL=nixos";
# hashTableSizeMB = 256;
# verbosity = "crit";
# extraOptions = [ "--loadavg-target" "2.0" ];
# };
2022-10-31 10:41:17 +01:00
# };
2022-08-23 22:31:19 +02:00
2022-08-20 11:34:41 +02:00
# Select internationalisation properties.
i18n.defaultLocale = "en_GB.utf8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "nl_NL.UTF-8";
LC_IDENTIFICATION = "nl_NL.UTF-8";
LC_MEASUREMENT = "nl_NL.UTF-8";
LC_MONETARY = "nl_NL.UTF-8";
LC_NAME = "nl_NL.UTF-8";
LC_NUMERIC = "nl_NL.UTF-8";
LC_PAPER = "nl_NL.UTF-8";
LC_TELEPHONE = "nl_NL.UTF-8";
LC_TIME = "en_DK.UTF-8";
2022-08-20 11:34:41 +02:00
};
2022-09-29 18:56:03 +02:00
i18n.supportedLocales =
[ "en_GB.UTF-8/UTF-8" "nl_NL.UTF-8/UTF-8" "en_DK.UTF-8/UTF-8" ];
2022-09-28 14:43:39 +02:00
xdg.portal = {
2022-09-29 18:56:03 +02:00
enable = true;
wlr.enable = true;
2022-08-24 18:17:29 +02:00
};
2022-09-29 18:56:03 +02:00
services.udisks2.enable = true;
2022-09-09 19:02:32 +02:00
services.dbus.enable = true;
2022-08-24 18:17:29 +02:00
# Hyprland
programs.hyprland = {
enable = true;
package = null; # Managed by home manager
};
2022-08-20 11:34:41 +02:00
2022-08-24 23:44:40 +02:00
environment.loginShellInit = ''
2022-09-07 13:57:45 +02:00
if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then
2022-08-24 23:44:40 +02:00
${run-hyprland}/bin/run-hyprland
fi
'';
2022-08-20 11:34:41 +02:00
services.xserver = {
2022-09-07 13:57:45 +02:00
enable = false;
2022-08-20 11:34:41 +02:00
layout = "us";
xkbVariant = "altgr-intl";
2022-08-20 12:16:29 +02:00
xkbOptions = "caps:swapescape";
videoDrivers = [ "nvidia" ];
};
2022-09-28 14:43:39 +02:00
hardware.nvidia.prime = {
offload.enable = true;
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
2022-08-20 12:16:29 +02:00
};
2022-08-24 23:44:40 +02:00
hardware.opengl = {
enable = true;
extraPackages = with pkgs; [
vaapiVdpau
intel-media-driver # LIBVA_DRIVER_NAME=iHD
vaapiIntel # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium)
libvdpau-va-gl
];
};
2022-08-20 11:34:41 +02:00
2022-09-21 09:51:08 +02:00
hardware.bluetooth.enable = true;
services.blueman.enable = true;
2022-08-21 10:22:41 +02:00
virtualisation.podman.enable = true;
2022-09-21 09:51:08 +02:00
hardware.saleae-logic.enable = true;
2022-09-23 17:06:57 +02:00
2022-08-20 11:34:41 +02:00
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable sound with pipewire.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
environment.systemPackages = with pkgs; [
2022-08-20 12:16:29 +02:00
pciutils
nvidia-offload
2022-08-24 23:44:40 +02:00
run-hyprland
2022-08-20 15:49:40 +02:00
wireguard-tools
2022-08-24 18:17:29 +02:00
slurp
2022-08-24 23:44:40 +02:00
gdb
2022-08-30 22:38:00 +02:00
2022-09-05 14:52:11 +02:00
swaylock-effects # Has to be installed globally so that pam module works
2022-08-20 11:34:41 +02:00
];
2022-08-20 13:54:45 +02:00
programs.steam = {
enable = true;
remotePlay.openFirewall = true;
dedicatedServer.openFirewall = true;
};
2022-08-20 12:55:59 +02:00
services.fstrim.enable = true;
2022-08-23 22:31:19 +02:00
nix.extraOptions = ''
keep-outputs = true
keep-derivations = true
'';
2022-09-05 14:52:11 +02:00
# Enables logging in with my Solokey
security.pam.u2f = {
enable = true;
debug = false;
cue = true;
control = "sufficient";
2022-09-29 18:56:03 +02:00
authFile =
"/etc/u2f-mappings"; # use `pamu2fcfg` from `pkgs.pam_u2f` to generate this config
2022-09-05 14:52:11 +02:00
};
2022-09-23 17:06:57 +02:00
programs.ssh.startAgent = true;
2022-09-28 14:43:39 +02:00
# don't shutdown when power button is short-pressed
2022-09-23 17:06:57 +02:00
services.logind.extraConfig = ''
HandlePowerKey=suspend
'';
2022-09-29 18:56:03 +02:00
services.udev.packages = with pkgs; [
2022-09-28 14:43:39 +02:00
android-udev-rules
logitech-udev-rules
2022-09-29 18:56:03 +02:00
qmk-udev-rules
2022-09-28 14:43:39 +02:00
wooting-udev-rules
];
2022-09-13 14:43:23 +02:00
2022-08-20 11:34:41 +02:00
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "22.05"; # Did you read the comment?
}