niksos/hosts/niks/configuration.nix

233 lines
6.7 KiB
Nix

{
config,
pkgs,
inputs,
...
}:
let
swayConfig = pkgs.writeText "greetd-sway-config" ''
# https://github.com/swaywm/sway/issues/5732#issuecomment-1583336383
exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP
exec hash dbus-update-activation-environment 2>/dev/null && \
dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP
exec "${pkgs.greetd.regreet}/bin/regreet; swaymsg exit"
bindsym Mod4+shift+e exec swaynag \
-t warning \
-m 'What do you want to do?' \
-b 'Poweroff' 'systemctl poweroff' \
-b 'Reboot' 'systemctl reboot'
'';
in
{
nixpkgs.config.allowUnfree = true;
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.kernelPackages = pkgs.linuxPackages_xanmod_latest;
boot.initrd.kernelModules = [ "amdgpu" ];
boot.kernelParams = [
"video=eDP-1:2560x1440@165"
"video=HDMI-A-1:2560x1440@144"
];
networking.networkmanager.enable = true;
time.timeZone = "Europe/Warsaw";
nix.settings = {
experimental-features = [
"flakes"
"nix-command"
];
substituters = [
"https://hyprland.cachix.org"
"https://neovim-nightly.cachix.org"
"https://nix-gaming.cachix.org"
];
trusted-public-keys = [
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
"neovim-nightly.cachix.org-1:feIoInHRevVEplgdZvQDjhp11kYASYCE2NGY9hNrwxY="
"nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4="
];
keep-outputs = true;
keep-derivations = true;
};
programs.zsh.enable = true;
programs.hyprland = {
enable = true;
xwayland = {
enable = true;
hidpi = true;
};
nvidiaPatches = false;
};
# https://github.com/NixOS/nixpkgs/issues/158025
security.pam.services.swaylock = {};
programs.regreet = {
enable = true;
settings = {
#GTK = {
# application_prefer_dark_theme = true;
# cursor_theme_name = "Bibata-Modern-Classic";
# font_name = "JetBrains Mono 16";
# icon_theme_name = "Papirus-Dark";
# theme_name = "Catppuccin-Mocha-Standard-Green-dark";
#};
env = {
GTK_USE_PORTAL = "0";
};
};
};
fonts.fonts = with pkgs; [
material-design-icons
(nerdfonts.override { fonts = [ "JetBrainsMono" ]; })
];
users.users.jacek = {
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" ];
shell = pkgs.zsh;
};
environment = {
shells = with pkgs; [zsh];
pathsToLink = [ "/share/zsh" ];
enableAllTerminfo = true;
sessionVariables = {
TERM = "foot";
EDITOR = "nvim";
GTK_IM_MODULE = "fcitx";
QT_IM_MODULE = "fcitx";
XMODIFIERS = "@im=fcitx";
LIBSEAT_BACKEND = "logind";
QT_QPA_PLATFORMTHEME = "qt5ct";
XDG_CURRENT_DESKTOP = "Hyprland";
XDG_SESSION_TYPE = "wayland";
XDG_SESSION_DESKTOP = "Hyprland";
QT_QPA_PLATFORM = "wayland";
MOZ_ENABLE_WAYLAND = "1";
MOZ_DRM_DEVICE = "/dev/dri/card0";
SDL_VIDEODRIVER = "wayland";
_JAVA_AWT_WM_NONEREPARENTING = "1";
CLUTTER_BACKEND = "wayland";
GDK_BACKEND = "wayland";
XCURSOR_THEME = "Bibata-Modern-Classic";
XCURSOR_SIZE = "24";
SYSTEMD_TIMEDATED_NTP_SERVICES = "chronyd.service:systemd-timesyncd.service";
XDG_DATA_HOME = "\$HOME/.local/share";
XDG_CONFIG_HOME = "\$HOME/.config";
XDG_STATE_HOME = "\$HOME/.local/state";
XDG_CACHE_HOME = "\$HOME/.cache";
HISTFILE = "\${XDG_STATE_HOME}/bash/history";
CARGO_HOME = "\${XDG_DATA_HOME}/cargo";
GTK2_RC_FILES = "\${XDG_CONFIG_HOME}/gtk-2.0/gtkrc";
};
etc = let
json = pkgs.formats.json {};
in {
"greetd/environments".text = ''
Hyprland
zsh
shutdown now
'';
"pipewire/pipewire.conf.d/92-low-latency.conf".text = ''
context.properties = {
default.clock.rate = 48000
default.clock.quantum = 1024
default.clock.min-quantum = 1024
default.clock.max-quantum = 1024
}
'';
"pipewire/pipewire-pulse.d/92-low-latency.conf".source = json.generate "92-low-latency.conf" {
context.modules = [
{
name = "libpipewire-module-protocol-pulse";
args = {
pulse.min.req = "512/48000";
pulse.default.req = "512/48000";
pulse.max.req = "512/48000";
pulse.min.quantum = "512/48000";
pulse.max.quantum = "512/48000";
};
}
];
stream.properties = {
node.latency = "512/48000";
resample.quality = 1;
};
};
};
};
services = {
pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
greetd = {
enable = true;
settings = {
default_session = {
command = "${pkgs.sway}/bin/sway --config ${swayConfig}";
user = "greeter";
};
};
};
blueman.enable = true;
mullvad-vpn.enable = true;
pcscd.enable = true;
udev.packages = [ pkgs.yubikey-personalization ];
udisks2.enable = true;
};
programs.gnupg.agent = {
enable = true;
pinentryFlavor = "qt";
enableSSHSupport = true;
};
security.rtkit.enable = true;
hardware = {
opentabletdriver = {
enable = true;
daemon.enable = true;
};
bluetooth.enable = true;
opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
};
swapDevices = [ {
device = "/var/lib/swapfile";
size = 16*1024;
} ];
system.stateVersion = "23.11";
}