niksos/hosts/niks/configuration.nix

533 lines
18 KiB
Nix
Raw Normal View History

2023-07-06 20:03:25 +02:00
{
2023-07-13 12:49:20 +02:00
config,
2023-10-13 23:11:29 +02:00
config',
2023-07-13 12:49:20 +02:00
pkgs,
2023-09-08 16:10:15 +02:00
lib,
2023-07-13 12:49:20 +02:00
inputs,
...
2023-07-30 23:52:15 +02:00
}: {
2023-08-11 00:00:19 +02:00
nixpkgs = {
config = {
permittedInsecurePackages = [
"python-2.7.18.6"
2023-11-25 17:12:09 +01:00
"electron-24.8.6"
"electron-25.9.0"
];
allowUnfree = true;
};
2023-08-11 00:00:19 +02:00
overlays = [
inputs.nur.overlay
inputs.neovim-nightly-overlay.overlay
];
};
2023-07-13 12:49:20 +02:00
2023-08-11 00:00:19 +02:00
boot = {
loader = {
2023-09-08 16:10:15 +02:00
systemd-boot = {
enable = true;
memtest86.enable = true;
};
2023-08-11 00:00:19 +02:00
efi.canTouchEfiVariables = true;
};
2023-10-03 19:22:24 +02:00
kernelPackages = pkgs.linuxPackages_zen;
2023-10-13 23:11:29 +02:00
extraModulePackages = with config.boot.kernelPackages; [ ddcci-driver ];
kernelModules = [ "ddcci" ];
2023-08-11 00:00:19 +02:00
initrd.kernelModules = [ "amdgpu" ];
kernelParams = [
"video=eDP-1:2560x1440@165"
"video=HDMI-A-1:2560x1440@144"
];
};
2023-07-13 12:49:20 +02:00
2023-09-08 16:10:15 +02:00
documentation = {
enable = true;
dev.enable = true;
doc.enable = true;
info.enable = true;
man = {
enable = true;
generateCaches = true;
man-db.enable = false;
mandoc.enable = true;
};
nixos = {
includeAllModules = true;
};
};
networking = {
2023-09-09 00:05:59 +02:00
hostName = config'.hostname;
2023-11-25 17:12:09 +01:00
networkmanager = {
enable = true;
dns = "systemd-resolved";
};
firewall.checkReversePath = "loose";
};
2023-07-13 12:49:20 +02:00
2023-11-25 17:12:09 +01:00
services.resolved.enable = true;
2023-09-08 16:10:15 +02:00
# don't wait for network to boot faster
# https://old.reddit.com/r/NixOS/comments/vdz86j/how_to_remove_boot_dependency_on_network_for_a
systemd = {
targets.network-online.wantedBy = lib.mkForce []; # default is [ "multi-user.target" ]
services.NetworkManager-wait-online.wantedBy = lib.mkForce []; # default is [ "network-online.target" ]
};
2023-07-13 12:49:20 +02:00
2023-09-08 16:10:15 +02:00
systemd.oomd = {
enable = true;
enableUserServices = true;
2023-07-13 12:49:20 +02:00
};
2023-07-06 20:03:25 +02:00
2023-09-08 16:10:15 +02:00
time.timeZone = "Europe/Warsaw";
nix = {
settings = {
experimental-features = [
"flakes"
"nix-command"
];
substituters = [
"https://nix-gaming.cachix.org"
"https://nix-community.cachix.org"
"https://nixpkgs-wayland.cachix.org"
2023-10-03 19:22:24 +02:00
"https://viperml.cachix.org"
2023-09-08 16:10:15 +02:00
];
trusted-public-keys = [
"nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
2023-10-03 19:22:24 +02:00
"viperml.cachix.org-1:qZhKBMTfmcLL+OG6fj/hzsMEedgKvZVFRRAhq7j8Vh8="
2023-09-08 16:10:15 +02:00
];
keep-outputs = true;
keep-derivations = true;
};
};
2023-07-06 20:03:25 +02:00
2023-09-08 16:10:15 +02:00
virtualisation = {
libvirtd = {
enable = true;
onBoot = "ignore";
qemu = {
ovmf.enable = true;
runAsRoot = false;
swtpm.enable = true;
};
};
};
networking.firewall.trustedInterfaces = [ "virbr0" ];
programs.dconf.enable = true;
security.sudo.package = pkgs.sudo.override { withInsults = true; };
2023-10-03 19:22:24 +02:00
security.polkit.enable = true;
fonts.packages = with pkgs; [
2023-07-13 12:49:20 +02:00
material-design-icons
2023-09-08 16:10:15 +02:00
(nerdfonts.override { fonts = [
"JetBrainsMono"
]; })
2023-08-15 18:59:11 +02:00
noto-fonts
2023-08-11 23:52:31 +02:00
noto-fonts-cjk-sans
noto-fonts-cjk-serif
2023-08-15 17:57:50 +02:00
noto-fonts-emoji
2023-07-06 20:03:25 +02:00
];
2023-09-09 00:05:59 +02:00
users.users.${config'.username} = {
2023-07-13 12:49:20 +02:00
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" "libvirtd" ];
2023-07-13 12:49:20 +02:00
shell = pkgs.zsh;
};
2023-07-06 20:03:25 +02:00
2023-09-08 16:10:15 +02:00
programs.zsh.enable = true;
2023-07-13 12:49:20 +02:00
environment = {
2023-09-08 16:10:15 +02:00
shells = [ pkgs.zsh ];
2023-07-13 12:49:20 +02:00
pathsToLink = [ "/share/zsh" ];
enableAllTerminfo = true;
sessionVariables = {
TERM = "foot";
2023-08-06 23:04:14 +02:00
EDITOR = "${pkgs.neovim}/bin/nvim";
2023-07-13 12:49:20 +02:00
GTK_IM_MODULE = "fcitx";
QT_IM_MODULE = "fcitx";
XMODIFIERS = "@im=fcitx";
LIBSEAT_BACKEND = "logind";
QT_QPA_PLATFORMTHEME = "qt5ct";
2023-08-11 20:04:01 +02:00
GOPATH = "\$HOME/.local/share/go";
2023-07-13 12:49:20 +02:00
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";
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";
2023-08-11 20:04:01 +02:00
CHROME_EXECUTABLE = "${pkgs.ungoogled-chromium}/bin/chromium";
2023-10-03 19:22:24 +02:00
2023-11-25 17:12:09 +01:00
#NIXOS_OZONE_WL = "1";
#WLR_DRM_DEVICES = "/dev/dri/card0:/dev/dri/card1";
#DRI_PRIME = "1";
2024-01-20 01:29:12 +01:00
AMD_VULKAN_ICD = "radv";
2023-07-13 12:49:20 +02:00
};
2023-09-08 16:10:15 +02:00
systemPackages = with pkgs; [
man-pages
man-pages-posix
];
};
2023-07-13 12:49:20 +02:00
services = {
2023-07-20 00:06:31 +02:00
blueman.enable = true;
2023-12-21 13:48:06 +01:00
mullvad-vpn = {
enable = true;
package = pkgs.mullvad-vpn;
};
2023-07-23 20:12:12 +02:00
pcscd.enable = true;
udev.packages = [ pkgs.yubikey-personalization ];
udisks2.enable = true;
2023-09-08 16:10:15 +02:00
dbus.enable = true;
2023-10-13 21:04:24 +02:00
fwupd = {
enable = true;
};
# db
mysql = {
enable = true;
package = pkgs.mariadb;
2023-12-21 13:48:22 +01:00
};
postgresql = {
enable = true;
2023-10-13 21:04:24 +02:00
ensureUsers = [{
name = "jacek";
2023-12-21 13:48:22 +01:00
ensureClauses.superuser = true;
2023-10-13 21:04:24 +02:00
}];
};
2023-07-23 20:12:12 +02:00
};
programs.gnupg.agent = {
enable = true;
pinentryFlavor = "qt";
enableSSHSupport = true;
2023-07-20 00:06:31 +02:00
};
hardware = {
2023-07-20 15:51:48 +02:00
opentabletdriver = {
enable = true;
daemon.enable = true;
};
2023-12-21 13:48:32 +01:00
bluetooth = {
enable = true;
input.General.ClassicBondedOnly = true;
};
2023-07-20 21:03:58 +02:00
opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
2023-11-25 17:12:09 +01:00
extraPackages = with pkgs; [
2024-01-20 01:29:12 +01:00
mesa
2023-11-25 17:12:09 +01:00
amdvlk
2024-01-20 01:29:12 +01:00
libdrm
libva
vaapiVdpau
libvdpau-va-gl
2023-11-25 17:12:09 +01:00
];
extraPackages32 = with pkgs; [
2024-01-20 01:29:12 +01:00
driversi686Linux.mesa
2023-11-25 17:12:09 +01:00
driversi686Linux.amdvlk
2024-01-20 01:29:12 +01:00
driversi686Linux.vaapiVdpau
driversi686Linux.libvdpau-va-gl
2023-11-25 17:12:09 +01:00
];
2023-07-20 21:03:58 +02:00
};
2023-10-13 21:04:24 +02:00
cpu.amd.updateMicrocode = true;
2023-07-07 20:13:49 +02:00
};
2023-07-13 12:49:20 +02:00
2023-09-08 16:10:15 +02:00
services.btrfs = {
autoScrub = {
2023-07-23 20:12:29 +02:00
enable = true;
2023-09-08 16:10:15 +02:00
interval = "weekly";
2023-07-23 20:12:29 +02:00
};
};
2023-09-08 16:10:15 +02:00
services.psd = {
enable = true;
resyncTimer = "30m";
};
2023-07-22 00:16:19 +02:00
services.journald = {
extraConfig = ''
SystemMaxUse=100M
'';
};
2023-10-13 21:04:24 +02:00
services.udev = {
extraRules = let
inherit (inputs.hyprland.packages.${pkgs.system}) hyprland;
power_supply = pkgs.writeShellScript "on_power_supply" ''
${pkgs.asusctl}/bin/asusctl profile -P Performance
#${pkgs.supergfxctl}/bin/supergfxctl -m Hybrid
${config.boot.kernelPackages.cpupower}/bin/cpupower frequency-set -g performance
${hyprland}/bin/hyprctl keyword decoration:blur:enabled true
${hyprland}/bin/hyprctl keyword animations:enabled true
'';
battery = pkgs.writeShellScript "on_battery" ''
${pkgs.asusctl}/bin/asusctl profile -P Quiet
#${pkgs.supergfxctl}/bin/supergfxctl -m Integrated
${config.boot.kernelPackages.cpupower}/bin/cpupower frequency-set -g powersave
${hyprland}/bin/hyprctl keyword decoration:blur:enabled false
${hyprland}/bin/hyprctl keyword animations:enabled false
'';
in ''
2023-10-14 19:17:48 +02:00
SUBSYSTEM=="power_supply",ENV{POWER_SUPPLY_ONLINE}=="1",RUN+="${power_supply}"
SUBSYSTEM=="power_supply",ENV{POWER_SUPPLY_ONLINE}=="0",RUN+="${battery}"
2023-10-13 21:04:24 +02:00
'';
};
systemd.services = {
"suspend@" = {
description = "Unit suspend actions";
before = [ "sleep.target" ];
serviceConfig = {
User = "%I";
Type = "forking";
};
environment = {
DISPLAY = ":0";
};
preStart = "${pkgs.mpc-cli}/bin/mpc pause";
script = "${inputs.nixpkgs-wayland.packages.${pkgs.system}.swaylock-effects}/bin/swaylock";
postStart = "${pkgs.coreutils-full}/bin/sleep 1";
wantedBy = [ "sleep.target" ];
};
#"resume@" = {
#
#};
};
# this makes usb devices autosuspend
#powerManagement.powertop.enable = true;
programs.kdeconnect.enable = true;
2023-11-25 17:12:09 +01:00
programs.noisetorch.enable = true;
2023-10-13 21:04:24 +02:00
myOptions = {
programs = {
git = {
enable = true;
userName = "jacekpoz";
userEmail = "jacekpoz@cock.li";
signingKey = "0EEE6B0C9A8CC06820E59C3894E812A8B12AAE3C";
editor = "${pkgs.neovim-nightly}/bin/nvim";
defaultBranch = "master";
};
starship.enable = true;
2023-11-25 17:12:09 +01:00
zsh = {
enable = true;
extraAliases = {
#u = "nh os switch \"/home/jacek/niksos\" -H niks -- --use-remote-sudo --max-jobs 3 --cores 4";
#us = "NIX_SSHOPTS='-t' nh os switch \"/home/jacek/niksos\" -H chmura -- --use-remote-sudo --target-host chmura --max-jobs 3 --cores 4";
u = "nixos-rebuild switch --flake \"/home/jacek/niksos#niks\" -L --use-remote-sudo --max-jobs 3 --cores 4";
us = "NIX_SSHOPTS='-t' nixos-rebuild switch --flake \"/home/jacek/niksos#chmura\" -L --use-remote-sudo --target-host chmura --max-jobs 3 --cores 4";
2023-11-25 17:12:09 +01:00
};
profiling = false;
};
2023-10-13 21:04:24 +02:00
anyrun.enable = true;
armcord.enable = true;
2024-01-20 01:27:49 +01:00
vesktop.enable = true;
2023-10-13 21:04:24 +02:00
btop.enable = true;
firefox = {
enable = true;
defaultSearchEngine = "NotASearx";
2023-10-13 21:04:24 +02:00
searchEngines = {
"NotASearx" = {
url = "https://search.notashelf.dev/search?q={searchTerms}";
faviconUrl = "https://search.notashelf.dev/favicon.ico";
aliases = [ "!sx" ];
2023-10-13 21:04:24 +02:00
};
"NixOS Packages" = {
url = "https://search.nixos.org/packages?channel=unstable&query={searchTerms}";
faviconPath = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
aliases = [ "!np" ];
2023-10-13 21:04:24 +02:00
};
"NixOS Options" = {
url = "https://search.nixos.org/options?channel=unstable&query={searchTerms}";
faviconPath = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
aliases = [ "!no" ];
2023-10-13 21:04:24 +02:00
};
"NixOS Wiki" = {
url = "https://nixos.wiki/index.php?search={searchTerms}";
faviconPath = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
aliases = [ "!nw" ];
2023-10-13 21:04:24 +02:00
};
"Home Manger Option Search" = {
url = "https://mipmip.github.io/home-manager-option-search?query={searchTerms}";
faviconPath = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
aliases = [ "!hm" ];
2023-10-13 21:04:24 +02:00
};
"Arch Wiki" = {
url = "https://wiki.archlinux.org/index.php?search={searchTerms}";
faviconUrl = "https://archlinux.org/favicon.ico";
aliases = [ "!aw" ];
2023-10-13 21:04:24 +02:00
};
"Gentoo Wiki" = {
url = "https://wiki.gentoo.org/index.php?search={searchTerms}";
faviconUrl = "https://www.gentoo.org/favicon.ico";
aliases = [ "!gw" ];
2023-10-13 21:04:24 +02:00
};
"Debian Wiki" = {
url = "https://wiki.debian.org/FrontPage?action=fullsearch&value={searchTerms}";
faviconUrl = "https://www.debian.org/favicon.ico";
aliases = [ "!dw" ];
2023-10-13 21:04:24 +02:00
};
};
};
foot.enable = true;
mpv.enable = true;
neovim.enable = true;
swaylock.enable = true;
waybar.enable = true;
zathura.enable = true;
2023-11-25 17:12:09 +01:00
hyprland = {
enable = true;
startupSound = ./mathis.m4a;
};
2023-10-14 19:18:01 +02:00
helix.enable = true;
2023-11-25 17:12:09 +01:00
newsboat.enable = true;
2023-10-13 21:04:24 +02:00
};
themes = {
cursor = {
enable = true;
package = pkgs.bibata-cursors;
name = "Bibata-Modern-Classic";
size = 24;
};
gtk = {
enable = true;
package = pkgs.catppuccin-gtk;
name = "Catppuccin-Mocha-Standard-Green-Dark";
variant = "mocha";
accentColour = "green";
iconTheme = {
name = "Papirus-Dark";
package = pkgs.catppuccin-papirus-folders;
};
};
qt = {
enable = true;
package = pkgs.catppuccin-kde;
name = "Catppuccin-Mocha-Dark";
variant = "mocha";
accentColour = "green";
};
};
services = {
asusd.enable = true;
dunst.enable = true;
mpd.enable = true;
greetd = {
enable = true;
greeter = "gtkgreet";
launchOptions = [
"Hyprland"
"sway"
"zsh"
"reboot"
"shutdown now"
];
};
ssh = {
daemon.enable = false;
agent = {
enable = true;
hostAliases = {
"github" = {
hostName = "github.com";
identityFile = "${config.home-manager.users.${config'.username}.home.homeDirectory}/.ssh/githubkey";
};
"git.dupa.edu.pl" = {
hostName = "git.dupa.edu.pl";
identityFile = "${config.home-manager.users.${config'.username}.home.homeDirectory}/.ssh/gitdupaedupl";
};
"codeberg" = {
hostName = "codeberg.org";
identityFile = "${config.home-manager.users.${config'.username}.home.homeDirectory}/.ssh/codeberg";
};
"gitlab" = {
hostName = "gitlab.com";
identityFile = "${config.home-manager.users.${config'.username}.home.homeDirectory}/.ssh/gitlab";
};
"aur" = {
hostName = "aur.archlinux.org";
user = "aur";
identityFile = "${config.home-manager.users.${config'.username}.home.homeDirectory}/.ssh/aur";
};
2023-11-25 17:12:09 +01:00
"jacekpoz" = {
hostName = "git.jacekpoz.pl";
user = "forgejo";
identityFile = "${config.home-manager.users.${config'.username}.home.homeDirectory}/.ssh/jacekpoz";
};
2023-10-13 21:04:24 +02:00
"chmura" = {
2024-01-20 01:28:28 +01:00
hostName = "192.168.15.2";
2023-10-13 21:04:24 +02:00
user = "chmura";
identityFile = "${config.home-manager.users.${config'.username}.home.homeDirectory}/.ssh/chmura";
};
2023-11-25 17:12:09 +01:00
"chmura2" = {
hostName = "jacekpoz.pl";
user = "chmura";
identityFile = "${config.home-manager.users.${config'.username}.home.homeDirectory}/.ssh/chmura";
};
2023-10-13 21:04:24 +02:00
"malina" = {
2024-01-20 01:28:28 +01:00
hostName = "192.168.15.3";
2023-10-13 21:04:24 +02:00
user = "malina";
identityFile = "${config.home-manager.users.${config'.username}.home.homeDirectory}/.ssh/malina";
};
2023-11-25 17:12:09 +01:00
"outfoxxed" = {
hostName = "git.outfoxxed.me";
identityFile = "${config.home-manager.users.${config'.username}.home.homeDirectory}/.ssh/outfoxxed";
};
2023-10-13 21:04:24 +02:00
};
};
};
pipewire.enable = true;
2023-10-13 21:04:24 +02:00
};
};
2023-07-13 15:11:17 +02:00
system.stateVersion = "23.11";
2023-07-06 20:03:25 +02:00
}