{ config, pkgs, lib, ... }: { imports = [ ]; security = { rtkit.enable = true; doas.enable = true; doas.wheelNeedsPassword = false; sudo.wheelNeedsPassword = false; }; boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; boot.kernelParams = [ "nohibernate" "nmi_watchdog=0" "systemd.watchdog-device/dev/watchdog" "console=tty1" ]; boot.initrd.supportedFilesystems = [ "zfs" ]; boot.supportedFilesystems = [ "zfs" ]; boot.zfs.enableUnstable = true; # GRUB bootloader boot.loader.efi.canTouchEfiVariables = true; boot.loader.grub = { enable = true; efiSupport = true; configurationLimit = 10; device = "nodev"; useOSProber = true; copyKernels = true; extraEntries = '' # os-prober cannot detect QubesOS # We don't want to set any complex parameters here, # So load the qubes grub instead. menuentry "Qubes" { search --set=root --fs-uuid d34d5041-8c08-445b-8ff5-4057b4b302ea configfile ($root)/grub2/grub.cfg } menuentry "Reboot" { reboot } menuentry "Shutdown" { halt } ''; }; boot.initrd.postDeviceCommands = lib.mkAfter '' zfs rollback -r rpool/local/root@blank ''; hardware.enableRedistributableFirmware = true; networking.hostName = "alpha"; networking.hostId = "641a7b10"; networking.networkmanager.enable = true; networking.useDHCP = false; networking.firewall.enable = true; i18n.defaultLocale = "en_US.UTF-8"; console.keyMap = "us"; console.colors = [ "151515" "cf6a4c" "99ad6a" "dfa358" "8197bf" "b3a3ff" "8fbfdc" "cbc0ab" "333333" "d98870" "adbd88" "e5b579" "9aaccc" "c2b5ff" "a5cce3" "d5cdbc" ]; time.timeZone = "Asia/Seoul"; environment.systemPackages = with pkgs; [ gcc git gnumake solaar ]; services.zfs.trim.enable = true; services.zfs.autoScrub.enable = true; services.zfs.autoScrub.pools = [ "rpool" ]; services.openssh.enable = true; services.openssh.settings.PasswordAuthentication = false; services.openssh.hostKeys = [ { path = "/persist/ssh/ssh_host_ed25519_key"; type = "ed25519"; } { path = "/persist/ssh/ssh_host_rsa_key"; type = "rsa"; bits = 4096; } ]; sops.secrets.borg-alpha-rolling-pass = { }; services.borgbackup.jobs.alpha-rolling = { paths = [ "/persist" "/home" ]; exclude = [ # Rust build files "**/target" ]; prune.keep = { within = "1d"; # Keep all archives from the last day daily = 7; weekly = 4; monthly = 3; }; repo = "20963@hk-s020.rsync.net:rolling/alpha"; encryption.mode = "repokey-blake2"; encryption.passCommand = "cat ${config.sops.secrets.borg-alpha-rolling-pass.path}"; environment.BORG_RSH = "ssh -i /persist/ssh/ssh_host_ed25519_key"; # use borg 1.0+ on rsync.net environment.BORG_REMOTE_PATH="/usr/local/bin/borg1/borg1"; extraCreateArgs = "--verbose --stats --checkpoint-interval 600"; compression = "auto,zstd"; startAt = "*-*-* 03:00:00"; persistentTimer = true; }; services.openssh.knownHosts."hk-s020.rsync.net".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILcPl9x9JfRFwsn09NnDw/xBZbAN80ZQck+h6AqlVqPH"; sound.enable = false; services.pipewire = { enable = true; alsa.enable = true; alsa.support32Bit = true; pulse.enable = true; }; hardware.bluetooth.enable = true; hardware.logitech.wireless.enable = true; services.udev.extraRules = '' # Logitech receiver for superlight, causes premature wakeup from suspend ACTION=="add", SUBSYSTEM=="usb", DRIVERS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c547", ATTR{power/wakeup}="disabled" ''; services.printing.enable = true; services.printing.drivers = [ pkgs.gutenprint pkgs.samsung-unified-linux-driver pkgs.brgenml1lpr pkgs.brgenml1cupswrapper ]; nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "samsung-UnifiedLinuxDriver" "brgenml1lpr" ]; services.pcscd.enable = true; programs.dconf.enable = true; services.gnome.gnome-keyring.enable = true; services.greetd = { enable = true; vt = 2; settings.default_session.command = "${pkgs.greetd.tuigreet}/bin/tuigreet -t -c sway"; }; services.journald.extraConfig = lib.mkForce ""; systemd.extraConfig = "RebootWatchdogSec=5"; fonts = { fontDir.enable = true; packages = with pkgs; [ cozette dina-font envypn-font nanum sarasa-gothic siji jetbrains-mono tamzen twemoji-color-font emacs-all-the-icons-fonts (nerdfonts.override { fonts = [ "Iosevka" "JetBrainsMono" ]; }) ]; fontconfig = { enable = true; defaultFonts = { serif = [ "Sarasa Gothic C" "Sarasa Gothic J" "Sarasa Gothic K" ]; sansSerif = [ "Sarasa Gothic C" "Sarasa Gothic J" "Sarasa Gothic K" ]; monospace = [ "Dina" "Terminus" "Iosevka Nerd Font" "JetBrainsMono Nerd Font" ]; emoji = [ "Siji" "Twitter Color Emoji" ]; }; }; }; programs = { sway.enable = true; sway.extraPackages = lib.mkForce [ ]; zsh.enable = true; zsh.enableCompletion = false; }; hardware.opengl.enable = true; hardware.opengl.driSupport = true; hardware.opengl.driSupport32Bit = true; hardware.opengl.extraPackages = with pkgs; [ vaapiVdpau libvdpau-va-gl ]; xdg.portal = { enable = true; extraPortals = with pkgs; [ xdg-desktop-portal-gtk xdg-desktop-portal-wlr ]; }; sops.defaultSopsFile = ./secrets/secrets.yaml; sops.secrets.root-password.neededForUsers = true; sops.secrets.sefidel-password.neededForUsers = true; users.mutableUsers = false; fileSystems."/persist".neededForBoot = true; users.users = { root.passwordFile = config.sops.secrets.root-password.path; sefidel = { isNormalUser = true; shell = pkgs.zsh; passwordFile = config.sops.secrets.sefidel-password.path; extraGroups = [ "wheel" "audio" "networkmanager" ]; }; }; # This value determines the NixOS release with which your system is to be # compatible, in order to avoid breaking some software such as database # servers. You should change this only after NixOS release notes say you # should. system.stateVersion = "22.05"; # Did you read the comment? }