From d0c1518df6bcd40ac0c3c65faa7d5cfaa136891c Mon Sep 17 00:00:00 2001 From: bogale Date: Thu, 8 Oct 2026 18:28:20 +0900 Subject: [PATCH 1/5] basic gui setup for desktop --- common.nix | 92 +++++++++++++--------------------- desktop/configuration.nix | 22 ++++---- desktop/hardware.nix | 24 +++++++++ flake.nix | 1 - home/bogale.nix | 102 ++++++++++++++++++++++++++++++++++++++ home/common.nix | 17 ++++--- home/data.nix | 8 --- install.sh | 4 +- mods/pxeboot.nix | 72 +++++++++++++++++---------- server/configuration.nix | 2 +- 10 files changed, 229 insertions(+), 115 deletions(-) create mode 100644 desktop/hardware.nix delete mode 100644 home/data.nix diff --git a/common.nix b/common.nix index 48e228f..9c64bde 100644 --- a/common.nix +++ b/common.nix @@ -1,32 +1,16 @@ { config, lib, pkgs, ... }: { time.timeZone = "Asia/Chita"; - system.stateVersion = "26.05"; + system.stateVersion = "26.11"; imports = [ ./mods/pxeboot.nix ]; i18n.defaultLocale = "ru_RU.UTF-8"; swapDevices = [ { device = "/var/swapfile"; } ]; users.users.root.hashedPasswordFile = "/secrets/user/root-pw"; nix.settings.experimental-features = [ "nix-command" "flakes" ]; - console = { - font = "cyr-sun16"; - keyMap = "ruwin_alt_sh-UTF-8"; - }; - environment.systemPackages = with pkgs; [ - jq _7zz sbctl - openssl grub2_efi - ]; - fileSystems = let - noatime.options = [ "noatime" ]; - in { - "/" = noatime; - "/boot" = noatime; - }; - services = { - logind.settings.Login.HandleLidSwitch = "ignore"; - openssh = { - enable = true; - settings.PasswordAuthentication = false; - }; + environment.systemPackages = with pkgs; [ jq _7zz sbctl openssl ]; + fileSystems = { + "/".options = [ "noatime" ]; + "/boot".options = [ "noatime" ]; }; systemd.tmpfiles.rules = [ "d /root/backup" @@ -45,16 +29,26 @@ panicOnChecksumMismatch = true; }; }; - networking = { - firewall = { - allowedTCPPorts = [ 53 80 2049 ]; - allowedUDPPorts = [ 53 67 69 547 ]; - }; - nat = { + services = { + logind.settings.Login.HandleLidSwitch = "ignore"; + openssh = { enable = true; - enableIPv6 = true; - internalInterfaces = [ "enp1s0" ]; + settings.PasswordAuthentication = false; }; + dnsmasq = { + enable = true; + settings = { + enable-ra = true; + no-resolv = true; + cache-size = 4096; + bogus-priv = true; + domain-needed = true; + server = [ "1.1.1.2" "2606:4700:4700::1112" + "1.0.0.2" "2606:4700:4700::1002" ]; + }; + }; + }; + networking = { wg-quick.interfaces.awg0 = { type = "amneziawg"; peers = [ { @@ -66,35 +60,19 @@ enable = true; ensureProfiles = { environmentFiles = [ "/secrets/wifi.env" ]; - profiles = { - ethernet = { - ipv6 = { - method = "manual"; - addresses = "fc02::1/64"; - }; - ipv4 = { - method = "manual"; - addresses = "10.2.0.1/16"; - }; - connection = { - id = "ethernet"; - type = "802-3-ethernet"; - }; + profiles.wifi = { + wifi-security.key-mgmt = "sae"; + ipv6 = { + method = "manual"; + gateway = "fc01::1"; }; - wifi = { - wifi-security.key-mgmt = "sae"; - ipv6 = { - method = "manual"; - gateway = "fc01::1"; - }; - ipv4 = { - method = "manual"; - gateway = "10.1.0.1"; - }; - connection = { - id = "wifi"; - type = "802-11-wireless"; - }; + ipv4 = { + method = "manual"; + gateway = "10.1.0.1"; + }; + connection = { + id = "wifi"; + type = "802-11-wireless"; }; }; }; diff --git a/desktop/configuration.nix b/desktop/configuration.nix index 5865f22..420047e 100644 --- a/desktop/configuration.nix +++ b/desktop/configuration.nix @@ -1,18 +1,11 @@ { config, lib, pkgs, ... }: { imports = [ ../common.nix ./hardware.nix ]; - users.users = { - data = { - uid = 1256; - isNormalUser = true; - hashedPasswordFile = "/secrets/user/data-pw"; - }; - bogale = { - uid = 1551; - isNormalUser = true; - extraGroups = [ "wheel" ]; - hashedPasswordFile = "/secrets/user/bogale-pw"; - }; + users.users.bogale = { + uid = 1551; + isNormalUser = true; + extraGroups = [ "wheel" ]; + hashedPasswordFile = "/secrets/user/bogale-pw"; }; networking = { hostName = "nixos-desktop"; @@ -27,4 +20,9 @@ wifi-security.psk = "$BOGALE_5_PSK"; }; }; + programs.niri.enable = true; + services.pipewire = { + enable = true; + pulse.enable = true; + }; } diff --git a/desktop/hardware.nix b/desktop/hardware.nix new file mode 100644 index 0000000..7af382a --- /dev/null +++ b/desktop/hardware.nix @@ -0,0 +1,24 @@ +{ config, lib, pkgs, modulesPath, ... }: +{ + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + boot = { + kernelModules = [ "kvm-amd" ]; + initrd = { + luks.devices.root.device = "/dev/disk/by-uuid/70ac6613-2e6c-4817-a0ce-43a97efb8bab"; + availableKernelModules = [ "nvme" "xhci_pci" "usb_storage" "sd_mod" "rtsx_usb_sdmmc" ]; + }; + }; + fileSystems = { + "/" = { + fsType = "ext4"; + device = "/dev/mapper/root"; + }; + "/boot" = { + fsType = "vfat"; + device = "/dev/disk/by-uuid/2610-A769"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + }; +} diff --git a/flake.nix b/flake.nix index f376312..4ee6436 100644 --- a/flake.nix +++ b/flake.nix @@ -23,7 +23,6 @@ useUserPackages = true; extraSpecialArgs = { inherit inputs; }; users = { - data = ./home/data.nix; root = ./home/root.nix; bogale = ./home/bogale.nix; }; diff --git a/home/bogale.nix b/home/bogale.nix index 70ec97a..7831ffb 100644 --- a/home/bogale.nix +++ b/home/bogale.nix @@ -1,8 +1,110 @@ { config, pkgs, ... }: { imports = [ ./common.nix ]; + programs.alacritty.enable = true; + gtk = { + enable = true; + colorScheme = "dark"; + }; home = { username = "bogale"; homeDirectory = "/home/bogale"; + packages = with pkgs; [ bibata-cursors brave-origin ]; + #pointerCursor = { + #enable = true; + #gtk.enable = true; + #x11.enable = true; + #name = "Vanilla-DMZ"; + #package = pkgs.vanilla-dmz; + #}; + }; + wayland.windowManager.niri = { + enable = true; + settings = { + gestures.hot-corners.off = {}; + binds."Mod+T".spawn = "alacritty"; + hotkey-overlay.skip-at-startup = {}; + screenshot-path = "~/Multimedia/Screenshots/%Y-%m-%d_%H-%M-%S.png"; + cursor = { + xcursor-size = 24; + xcursor-theme = "Bibata-Modern-Amber"; + }; + layout = { + center-focused-column = "always"; + default-column-width.proportion = 0.8; + }; + window-rule = { + open-floating = false; + clip-to-geometry = true; + geometry-corner-radius = 20; + }; + input = { + touchpad = { + dwt = {}; + tap = {}; + natural-scroll = {}; + }; + keyboard = { + numlock = {}; + xkb = { + layout = "us,ru"; + options = "grp:alt_shift_toggle"; + }; + }; + }; + binds = { + "Print".screenshot = {}; + "Mod+Q".close-window = {}; + "Mod+F".maximize-column = {}; + "Mod+O".toggle-overview = {}; + "Mod+H".focus-column-left = {}; + "Mod+L".focus-column-right = {}; + "Alt+Print".screenshot-window = {}; + "Ctrl+Print".screenshot-screen = {}; + "Mod+Shift+H".move-column-left = {}; + "Mod+Shift+F".fullscreen-window = {}; + "Mod+Shift+L".move-column-right = {}; + "Mod+Shift+P".power-off-monitors = {}; + "Mod+K".focus-window-or-workspace-up = {}; + "Mod+J".focus-window-or-workspace-down = {}; + "Mod+Shift+K".move-window-up-or-to-workspace-up = {}; + "Mod+Shift+J".move-window-down-or-to-workspace-down = {}; + }; + }; }; } +/* + spawn-at-startup "noctalia" + spawn-at-startup "gammastep" "-b" "0.8:0.5" "-l" "52:113.5" "-P" "-t" "6000:3000" + environment.QT_QPA_PLATFORMTHEME "qt6ct" + } + + binds { + Mod+D { spawn-sh "noctalia msg panel-toggle launcher"; } + Mod+E { spawn-sh "noctalia msg panel-toggle session"; } + Mod+S { spawn-sh "noctalia msg panel-toggle control-center"; } + Mod+Shift+S { spawn-sh "noctalia msg settings-open"; } + + XF86AudioRaiseVolume { spawn-sh "noctalia msg volume-up"; } + XF86AudioLowerVolume { spawn-sh "noctalia msg volume-down"; } + XF86AudioMute { spawn-sh "noctalia msg volume-mute"; } + Shift+XF86AudioRaiseVolume { spawn-sh "noctalia msg mic-volume-up"; } + Shift+XF86AudioLowerVolume { spawn-sh "noctalia msg mic-volume-down"; } + Shift+XF86AudioMute { spawn-sh "noctalia msg mic-mute"; } + XF86MonBrightnessUp { spawn-sh "noctalia msg brightness-up"; } + XF86MonBrightnessDown { spawn-sh "noctalia msg brightness-down"; } + + + + Mod+Ctrl+H { focus-monitor-left; } + Mod+Ctrl+J { focus-monitor-down; } + Mod+Ctrl+K { focus-monitor-up; } + Mod+Ctrl+L { focus-monitor-right; } + + Mod+Ctrl+Shift+H { move-column-to-monitor-left; } + Mod+Ctrl+Shift+J { move-column-to-monitor-down; } + Mod+Ctrl+Shift+K { move-column-to-monitor-up; } + Mod+Ctrl+Shift+L { move-column-to-monitor-right; } + + } +*/ diff --git a/home/common.nix b/home/common.nix index f4b2813..36d3ede 100644 --- a/home/common.nix +++ b/home/common.nix @@ -1,20 +1,23 @@ { config, pkgs, ... }: { - home.stateVersion = "26.05"; services.ssh-agent.enable = true; - home.packages = with pkgs; [ ncdu yt-dlp ]; + home = { + stateVersion = "26.11"; + packages = with pkgs; [ ncdu yt-dlp ]; + }; programs = { home-manager.enable = true; - bash = { - enable = true; - shellAliases.la = "ls -lAtr"; - historyControl = [ "ignoreboth" ]; - }; ssh = { enable = true; enableDefaultConfig = false; settings."*".SetEnv.TERM = "xterm-256color"; }; + bash = { + enable = true; + shellAliases.la = "ls -lAtr"; + historyControl = [ "ignoreboth" ]; + sessionVariables.PROMPT_COMMAND = "history -a"; + }; git = { enable = true; settings = { diff --git a/home/data.nix b/home/data.nix deleted file mode 100644 index 2c64968..0000000 --- a/home/data.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ config, pkgs, ... }: -{ - imports = [ ./common.nix ]; - home = { - username = "data"; - homeDirectory = "/home/data"; - }; -} diff --git a/install.sh b/install.sh index c105463..f826f8d 100644 --- a/install.sh +++ b/install.sh @@ -2,7 +2,7 @@ gdisk $DISK mkfs.fat -F 32 $ESPPART cryptsetup luksFormat $ROOTPART cryptsetup open $ROOTPART root -mkfs.ext4 $ROOTPART +mkfs.ext4 /dev/mapper/root mount /dev/mapper/root /mnt mount $ESPPART --mkdir -o umask=077 /mnt/boot mkdir /mnt/var @@ -11,5 +11,5 @@ swapon /mnt/var/swapfile nixos-generate-config --root /mnt --kernel latest --flake #copy backup nixos-install --no-root-passwd --no-channel-copy --flake "/mnt/etc/nixos#nixos" -sbctl enroll-keys --yes-this-might-brick-my-machine +sbctl enroll-keys --yolo systemd-cryptenroll --tpm2-device=auto --tpm2-pcrs=0+2+7 $ROOTPART diff --git a/mods/pxeboot.nix b/mods/pxeboot.nix index 308f140..a506f55 100644 --- a/mods/pxeboot.nix +++ b/mods/pxeboot.nix @@ -1,5 +1,6 @@ { config, lib, pkgs, ... }: { + environment.systemPackages = [ pkgs.grub2_efi ]; virtualisation.oci-containers.containers.fedora-dracut = { pull = "newer"; autoStart = false; @@ -13,6 +14,14 @@ ]; }; services = { + dnsmasq.settings = { + enable-tftp = true; + interface = "enp1s0"; + tftp-root = "/srv/tftp"; + dhcp-boot = "grubx64.efi"; + dhcp-range = [ "10.2.0.2,10.2.255.254,12h" + "fc02::2,fc02::ffff:ffff:ffff:ffff,12h" ]; + }; nfs.server = { enable = true; exports = let @@ -22,22 +31,29 @@ "/srv/nfs/fedora/root" = clients; }; }; - dnsmasq = { + }; + networking = { + firewall = { + allowedTCPPorts = [ 53 2049 ]; + allowedUDPPorts = [ 53 67 69 547 ]; + }; + nat = { enable = true; - settings = { - enable-ra = true; - no-resolv = true; - cache-size = 4096; - bogus-priv = true; - enable-tftp = true; - interface = "enp1s0"; - domain-needed = true; - tftp-root = "/srv/tftp"; - dhcp-boot = "grubx64.efi"; - server = [ "1.1.1.2" "2606:4700:4700::1112" - "1.0.0.2" "2606:4700:4700::1002" ]; - dhcp-range = [ "10.2.0.2,10.2.255.254,12h" - "fc02::2,fc02::ffff:ffff:ffff:ffff,12h" ]; + enableIPv6 = true; + internalInterfaces = [ "enp1s0" ]; + }; + networkmanager.ensureProfiles.profiles.ethernet = { + ipv6 = { + method = "manual"; + addresses = "fc02::1/64"; + }; + ipv4 = { + method = "manual"; + addresses = "10.2.0.1/16"; + }; + connection = { + id = "ethernet"; + type = "802-3-ethernet"; }; }; }; @@ -45,7 +61,9 @@ tmpfiles.rules = [ "d /srv/tftp" ]; services.pxeboot = { before = [ "nfs-server.service" ]; + after = [ "wg-quick-awg0.service" ]; requiredBy = [ "nfs-server.service" ]; + requires = [ "wg-quick-awg0.service" ]; path = with pkgs; [ xz curl e2fsprogs grub2_efi util-linux ]; serviceConfig = { Type = "oneshot"; @@ -77,6 +95,18 @@ url = "https://download.fedoraproject.org/pub/fedora/linux/releases/" + "44/Workstation/x86_64/iso/Fedora-Workstation-Live-44-1.7.x86_64.iso"; }; + entryScript = pkgs.writeShellScript "entry.sh" '' + set -e + dnf install -y nfs-utils dracut-network + cd /data/workdir + for target in $(ls .. | grep -v workdir); do + mkdir $target + modsDir=../$target/usr/lib/modules/* + cp $modsDir/vmlinuz $target + dracut -Nm "network-manager nfs" --zstd -k $modsDir \ + --kver $(basename $modsDir) $target/initramfs + done + ''; grubCfg = pkgs.writeText "grub.cfg" '' function load { set p=$cmdpath/boot/$1 @@ -90,18 +120,6 @@ load fedora selinux=0 } ''; - entryScript = pkgs.writeShellScript "entry.sh" '' - set -e - dnf install -y nfs-utils dracut-network - cd /data/workdir - for target in $(ls .. | grep -v workdir); do - mkdir $target - modsDir=../$target/usr/lib/modules/* - cp $modsDir/vmlinuz $target - dracut -Nm "network-manager nfs" --zstd -k $modsDir \ - --kver $(basename $modsDir) $target/initramfs - done - ''; in '' for distro in arch fedora; do case $distro in diff --git a/server/configuration.nix b/server/configuration.nix index bc2308c..c109ae8 100644 --- a/server/configuration.nix +++ b/server/configuration.nix @@ -49,7 +49,7 @@ hostName = "nixos-server"; firewall = { allowedUDPPorts = [ 443 ]; - allowedTCPPorts = [ 25 443 465 993 ]; + allowedTCPPorts = [ 25 80 443 465 993 ]; }; wg-quick.interfaces.awg0 = { configFile = "/secrets/awg/1.conf"; From 0073ec63bb4ab4f9c394783eaea039e402a1379f Mon Sep 17 00:00:00 2001 From: bogale Date: Thu, 8 Oct 2026 21:22:11 +0900 Subject: [PATCH 2/5] niri configured, noctalia installed --- common.nix | 26 ++++-------- desktop/configuration.nix | 26 ++++++++++-- home/bogale.nix | 86 +++++++++++++++++++-------------------- home/common.nix | 4 +- mods/pxeboot.nix | 21 ++++------ server/configuration.nix | 29 ++++++------- server/mods/mail.nix | 35 +++++++--------- server/mods/system.nix | 6 +-- server/mods/web.nix | 4 +- 9 files changed, 115 insertions(+), 122 deletions(-) diff --git a/common.nix b/common.nix index 9c64bde..79ebd8e 100644 --- a/common.nix +++ b/common.nix @@ -29,23 +29,15 @@ panicOnChecksumMismatch = true; }; }; - services = { - logind.settings.Login.HandleLidSwitch = "ignore"; - openssh = { - enable = true; - settings.PasswordAuthentication = false; - }; - dnsmasq = { - enable = true; - settings = { - enable-ra = true; - no-resolv = true; - cache-size = 4096; - bogus-priv = true; - domain-needed = true; - server = [ "1.1.1.2" "2606:4700:4700::1112" - "1.0.0.2" "2606:4700:4700::1002" ]; - }; + services.dnsmasq = { + enable = true; + settings = { + enable-ra = true; + no-resolv = true; + bogus-priv = true; + cache-size = 4096; + domain-needed = true; + server = [ "1.1.1.2" "1.0.0.2" "2606:4700:4700::1112" "2606:4700:4700::1002" ]; }; }; networking = { diff --git a/desktop/configuration.nix b/desktop/configuration.nix index 420047e..92a31d3 100644 --- a/desktop/configuration.nix +++ b/desktop/configuration.nix @@ -1,5 +1,7 @@ { config, lib, pkgs, ... }: { + programs.niri.enable = true; + hardware.bluetooth.enable = true; imports = [ ../common.nix ./hardware.nix ]; users.users.bogale = { uid = 1551; @@ -20,9 +22,25 @@ wifi-security.psk = "$BOGALE_5_PSK"; }; }; - programs.niri.enable = true; - services.pipewire = { - enable = true; - pulse.enable = true; + services = { + tuned.enable = true; + displayManager.noctalia-greeter.enable = true; + pipewire = { + enable = true; + pulse.enable = true; + }; + upower = { + enable = true; + percentageCritical = 10; + criticalPowerAction = "Suspend"; + allowRiskyCriticalPowerAction = true; + }; + greetd = { + enable = true; + settings.default_session = { + user = "greeter"; + command = "${pkgs.noctalia-greeter}/bin/noctalia-greeter-session -- --session niri --user bogale"; + }; + }; }; } diff --git a/home/bogale.nix b/home/bogale.nix index 7831ffb..43d5225 100644 --- a/home/bogale.nix +++ b/home/bogale.nix @@ -1,7 +1,6 @@ { config, pkgs, ... }: { imports = [ ./common.nix ]; - programs.alacritty.enable = true; gtk = { enable = true; colorScheme = "dark"; @@ -10,13 +9,27 @@ username = "bogale"; homeDirectory = "/home/bogale"; packages = with pkgs; [ bibata-cursors brave-origin ]; - #pointerCursor = { - #enable = true; - #gtk.enable = true; - #x11.enable = true; - #name = "Vanilla-DMZ"; - #package = pkgs.vanilla-dmz; - #}; + }; + programs = { + alacritty.enable = true; + noctalia = { + enable = true; + systemd.enable = true; + #launch_apps_as_systemd_services + }; + }; + services.gammastep = { + enable = true; + latitude = 52.0; + longitude = 113.5; + temperature = { + day = 6000; + night = 3000; + }; + settings.general = { + brightness-day = 0.9; + brightness-night = 0.6; + }; }; wayland.windowManager.niri = { enable = true; @@ -36,7 +49,7 @@ window-rule = { open-floating = false; clip-to-geometry = true; - geometry-corner-radius = 20; + geometry-corner-radius = 24; }; input = { touchpad = { @@ -60,51 +73,36 @@ "Mod+H".focus-column-left = {}; "Mod+L".focus-column-right = {}; "Alt+Print".screenshot-window = {}; + "Mod+Ctrl+K".focus-monitor-up = {}; "Ctrl+Print".screenshot-screen = {}; "Mod+Shift+H".move-column-left = {}; + "Mod+Ctrl+H".focus-monitor-left = {}; + "Mod+Ctrl+J".focus-monitor-down = {}; "Mod+Shift+F".fullscreen-window = {}; "Mod+Shift+L".move-column-right = {}; + "Mod+Ctrl+L".focus-monitor-right = {}; "Mod+Shift+P".power-off-monitors = {}; "Mod+K".focus-window-or-workspace-up = {}; "Mod+J".focus-window-or-workspace-down = {}; + "Mod+Ctrl+Shift+K".move-column-to-monitor-up = {}; + "Mod+Ctrl+Shift+H".move-column-to-monitor-left = {}; + "Mod+Ctrl+Shift+J".move-column-to-monitor-down = {}; + "Mod+Ctrl+Shift+L".move-column-to-monitor-right = {}; "Mod+Shift+K".move-window-up-or-to-workspace-up = {}; + "Mod+Shift+S".spawn-sh = "noctalia msg settings-open"; + "XF86AudioMute".spawn-sh = "noctalia msg volume-mute"; + "Mod+E".spawn-sh = "noctalia msg panel-toggle session"; + "Mod+D".spawn-sh = "noctalia msg panel-toggle launcher"; "Mod+Shift+J".move-window-down-or-to-workspace-down = {}; + "Shift+XF86AudioMute".spawn-sh = "noctalia msg mic-mute"; + "XF86AudioRaiseVolume".spawn-sh = "noctalia msg volume-up"; + "XF86AudioLowerVolume".spawn-sh = "noctalia msg volume-down"; + "Mod+S".spawn-sh = "noctalia msg panel-toggle control-center"; + "XF86MonBrightnessUp".spawn-sh = "noctalia msg brightness-up"; + "XF86MonBrightnessDown".spawn-sh = "noctalia msg brightness-down"; + "Shift+XF86AudioRaiseVolume".spawn-sh = "noctalia msg mic-volume-up"; + "Shift+XF86AudioLowerVolume".spawn-sh = "noctalia msg mic-volume-down"; }; }; }; } -/* - spawn-at-startup "noctalia" - spawn-at-startup "gammastep" "-b" "0.8:0.5" "-l" "52:113.5" "-P" "-t" "6000:3000" - environment.QT_QPA_PLATFORMTHEME "qt6ct" - } - - binds { - Mod+D { spawn-sh "noctalia msg panel-toggle launcher"; } - Mod+E { spawn-sh "noctalia msg panel-toggle session"; } - Mod+S { spawn-sh "noctalia msg panel-toggle control-center"; } - Mod+Shift+S { spawn-sh "noctalia msg settings-open"; } - - XF86AudioRaiseVolume { spawn-sh "noctalia msg volume-up"; } - XF86AudioLowerVolume { spawn-sh "noctalia msg volume-down"; } - XF86AudioMute { spawn-sh "noctalia msg volume-mute"; } - Shift+XF86AudioRaiseVolume { spawn-sh "noctalia msg mic-volume-up"; } - Shift+XF86AudioLowerVolume { spawn-sh "noctalia msg mic-volume-down"; } - Shift+XF86AudioMute { spawn-sh "noctalia msg mic-mute"; } - XF86MonBrightnessUp { spawn-sh "noctalia msg brightness-up"; } - XF86MonBrightnessDown { spawn-sh "noctalia msg brightness-down"; } - - - - Mod+Ctrl+H { focus-monitor-left; } - Mod+Ctrl+J { focus-monitor-down; } - Mod+Ctrl+K { focus-monitor-up; } - Mod+Ctrl+L { focus-monitor-right; } - - Mod+Ctrl+Shift+H { move-column-to-monitor-left; } - Mod+Ctrl+Shift+J { move-column-to-monitor-down; } - Mod+Ctrl+Shift+K { move-column-to-monitor-up; } - Mod+Ctrl+Shift+L { move-column-to-monitor-right; } - - } -*/ diff --git a/home/common.nix b/home/common.nix index 36d3ede..ed39198 100644 --- a/home/common.nix +++ b/home/common.nix @@ -43,8 +43,8 @@ tmux = { enable = true; clock24 = true; - keyMode = "vi"; escapeTime = 0; + keyMode = "vi"; terminal = "screen-256color"; extraConfig = '' unbind C-b @@ -55,8 +55,8 @@ bind j select-pane -D bind k select-pane -U bind l select-pane -R - bind u split-window -h bind i split-window -v + bind u split-window -h set -s set-clipboard external set-option -g focus-events on set-option -a terminal-features "xterm-256color:RGB" diff --git a/mods/pxeboot.nix b/mods/pxeboot.nix index a506f55..c2d3488 100644 --- a/mods/pxeboot.nix +++ b/mods/pxeboot.nix @@ -19,8 +19,7 @@ interface = "enp1s0"; tftp-root = "/srv/tftp"; dhcp-boot = "grubx64.efi"; - dhcp-range = [ "10.2.0.2,10.2.255.254,12h" - "fc02::2,fc02::ffff:ffff:ffff:ffff,12h" ]; + dhcp-range = [ "10.2.0.2,10.2.255.254,12h" "fc02::2,fc02::ffff:ffff:ffff:ffff,12h" ]; }; nfs.server = { enable = true; @@ -92,8 +91,7 @@ fedoraIso = { rootfs = "LiveOS/squashfs.img"; hash = "1620295f6a00c27c3208f0c00b8ece4eab1ec69b9002152d97488bf26a426ddf"; - url = "https://download.fedoraproject.org/pub/fedora/linux/releases/" + - "44/Workstation/x86_64/iso/Fedora-Workstation-Live-44-1.7.x86_64.iso"; + url = "https://download.fedoraproject.org/pub/fedora/linux/releases/44/Workstation/x86_64/iso/Fedora-Workstation-Live-44-1.7.x86_64.iso"; }; entryScript = pkgs.writeShellScript "entry.sh" '' set -e @@ -103,15 +101,14 @@ mkdir $target modsDir=../$target/usr/lib/modules/* cp $modsDir/vmlinuz $target - dracut -Nm "network-manager nfs" --zstd -k $modsDir \ - --kver $(basename $modsDir) $target/initramfs + dracut -Nm "network-manager nfs" --zstd -k $modsDir --kver $(basename $modsDir) $target/initramfs done ''; grubCfg = pkgs.writeText "grub.cfg" '' function load { - set p=$cmdpath/boot/$1 - linux $p/vmlinuz $2 rw ip=dhcp root=nfs4:$net_default_server:/srv/nfs/$1/root - initrd $p/initramfs + set path=$cmdpath/boot/$1 + linux $path/vmlinuz $2 rw ip=dhcp root=nfs4:$net_default_server:/srv/nfs/$1/root + initrd $path/initramfs } menuentry Arch { load arch @@ -140,8 +137,7 @@ mkdir -p loop root work lower upper mountpoint -q loop || mount $distro.iso loop mountpoint -q lower || mount loop/$rootfs lower - mountpoint -q root || mount -t overlay overlay root -o \ - workdir=work,nfs_export=on,lowerdir=lower,upperdir=upper + mountpoint -q root || mount -t overlay overlay root -o workdir=work,nfs_export=on,lowerdir=lower,upperdir=upper if [ ! -e upper/etc/resolv.conf ]; then cd root/etc rm -f resolv.conf @@ -151,8 +147,7 @@ done cd /srv/tftp if [ ! -e grubx64.efi ]; then - grub-mkstandalone -O x86_64-efi --compress=xz -o \ - grubx64.efi --modules=efinet /boot/grub/grub.cfg=${grubCfg} + grub-mkstandalone -O x86_64-efi --compress=xz -o grubx64.efi --modules=efinet /boot/grub/grub.cfg=${grubCfg} fi if [ ! -e boot ]; then workdir=/var/lib/podman-dracut diff --git a/server/configuration.nix b/server/configuration.nix index c109ae8..3cbc2f3 100644 --- a/server/configuration.nix +++ b/server/configuration.nix @@ -1,8 +1,20 @@ { config, lib, pkgs, ... }: { boot.kernelParams = [ "consoleblank=60" ]; - imports = [ ../common.nix ./hardware.nix - ./mods/web.nix ./mods/mail.nix ./mods/system.nix ]; + imports = [ ../common.nix ./hardware.nix ./mods/web.nix ./mods/mail.nix ./mods/system.nix ]; + services.openssh = { + enable = true; + settings.PasswordAuthentication = false; + }; + systemd.tmpfiles.rules = [ + "d /root/backup/server" + "L /root/backup/server/http - - - - /srv/http" + "L /root/backup/server/acme - - - - /var/lib/acme" + "L /root/backup/server/mail - - - - /var/spool/mail" + "L /root/backup/server/forgejo - - - - /var/lib/forgejo/dump" + "L /root/backup/server/vaultwarden - - - - /var/lib/vaultwarden" + "L /root/backup/server/postgresql - - - - /var/backup/postgresql" + ]; security.acme = { acceptTerms = true; defaults.email = "letsencrypt@bogaledev.ru"; @@ -14,15 +26,6 @@ reloadServices = [ "nginx.service" "dovecot.service" "postfix.service" ]; }; }; - systemd.tmpfiles.rules = [ - "d /root/backup/server" - "L /root/backup/server/http - - - - /srv/http" - "L /root/backup/server/acme - - - - /var/lib/acme" - "L /root/backup/server/mail - - - - /var/spool/mail" - "L /root/backup/server/forgejo - - - - /var/lib/forgejo/dump" - "L /root/backup/server/vaultwarden - - - - /var/lib/vaultwarden" - "L /root/backup/server/postgresql - - - - /var/backup/postgresql" - ]; users = { groups = { php.gid = 1568; @@ -30,6 +33,7 @@ }; users = { nginx.extraGroups = [ "php" "acme" ]; + root.openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+wc+3rahpNa+OMS9gaWgMQIxXIKHy4Beku5LBDt+Ow" ]; php = { uid = 1568; group = "php"; @@ -40,9 +44,6 @@ group = "vmail"; isSystemUser = true; }; - root.openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+wc+3rahpNa+OMS9gaWgMQIxXIKHy4Beku5LBDt+Ow" - ]; }; }; networking = { diff --git a/server/mods/mail.nix b/server/mods/mail.nix index 1b9e8a8..6bc8a4f 100644 --- a/server/mods/mail.nix +++ b/server/mods/mail.nix @@ -2,9 +2,7 @@ let postfixDir = "/var/spool/postfix"; in { - systemd.tmpfiles.rules = [ - "d ${postfixDir} 0700 postfix postfix" - ]; + systemd.tmpfiles.rules = [ "d ${postfixDir} 0700 postfix postfix" ]; services = let sslCertDir = config.security.acme.certs."bogaledev.ru".directory; in { @@ -44,37 +42,32 @@ in { smtp_sasl_tls_security_options = "noanonymous"; virtual_transport = "lmtp:unix:${postfixDir}/lmtp"; smtp_sasl_password_maps = "hash:/etc/postfix/smtp_passwd"; - smtpd_tls_chain_files = [ - "${sslCertDir}/key.pem" - "${sslCertDir}/fullchain.pem" - ]; + smtpd_tls_chain_files = [ "${sslCertDir}/key.pem" "${sslCertDir}/fullchain.pem" ]; }; }; dovecot2 = { enable = true; - settings = { + settings = let + postfix-mode = { + mode = "0600"; + user = "postfix"; + group = "postfix"; + }; + in { ssl = "required"; mail_gid = "vmail"; mail_uid = "vmail"; mail_driver = "maildir"; - protocols = [ "imap" "lmtp" ]; auth_mechanisms = [ "plain" ]; - dovecot_config_version = "2.4.5"; - dovecot_storage_version = "2.4.5"; + protocols = [ "imap" "lmtp" ]; + #dovecot_config_version = "2.4.5"; + #dovecot_storage_version = "2.4.5"; mail_path = "/var/spool/mail/vmail"; ssl_server_key_file = "${sslCertDir}/key.pem"; ssl_server_cert_file = "${sslCertDir}/fullchain.pem"; "passdb passwd-file".passwd_file_path = "/secrets/dovecot-pw"; - "service auth"."unix_listener ${postfixDir}/auth" = { - mode = "0600"; - user = "postfix"; - group = "postfix"; - }; - "service lmtp"."unix_listener ${postfixDir}/lmtp" = { - mode = "0600"; - user = "postfix"; - group = "postfix"; - }; + "service auth"."unix_listener ${postfixDir}/auth" = postfix-mode; + "service lmtp"."unix_listener ${postfixDir}/lmtp" = postfix-mode; "namespace inbox" = let mailbox = name: { auto = "subscribe"; diff --git a/server/mods/system.nix b/server/mods/system.nix index 2695b23..9b78ca9 100644 --- a/server/mods/system.nix +++ b/server/mods/system.nix @@ -50,8 +50,7 @@ for msg in "''${MESSAGES[@]}"; do TEXT="''${msg#*:}" CHAT_ID="''${msg%%:*}" - ${pkgs.curl}/bin/curl -X POST "https://api.telegram.org/$BOT/sendMessage" \ - -d "chat_id=$CHAT_ID" -d "text=$TEXT" 2> /dev/null | ${pkgs.jq}/bin/jq + ${pkgs.curl}/bin/curl -X POST "https://api.telegram.org/$BOT/sendMessage" -d "chat_id=$CHAT_ID" -d "text=$TEXT" 2> /dev/null | ${pkgs.jq}/bin/jq sleep 1 done ''; @@ -62,8 +61,7 @@ LogLevelMax = "warning"; }; script = '' - if [ ! -e /run/network.failures ] || [ ! -e /run/network.limit ] || \ - ${pkgs.curl}/bin/curl --head --max-time 3 https://www.google.com; then + if [ ! -e /run/network.failures ] || [ ! -e /run/network.limit ] || ${pkgs.curl}/bin/curl --head --max-time 3 https://www.google.com; then limit=3 failures=0 else diff --git a/server/mods/web.nix b/server/mods/web.nix index f23d552..f28b9ef 100644 --- a/server/mods/web.nix +++ b/server/mods/web.nix @@ -29,8 +29,8 @@ }; vaultwarden = { enable = true; - dbBackend = "postgresql"; configurePostgres = true; + dbBackend = "postgresql"; package = pkgs.vaultwarden-postgresql; environmentFile = "/secrets/vw-token.env"; config = { @@ -86,10 +86,8 @@ localNetworks = '' allow fc00::/64; allow fc01::/96; - allow fc02::/64; allow 10.0.0.0/16; allow 10.1.0.0/24; - allow 10.2.0.0/16; deny all; ''; in { From 530c67601a4c84f003d0d18e60a34a1128705c6e Mon Sep 17 00:00:00 2001 From: bogale Date: Sat, 10 Oct 2026 16:34:47 +0900 Subject: [PATCH 3/5] configured noctalia --- common.nix | 2 +- desktop/configuration.nix | 13 ++- flake.lock | 12 +-- home/bogale.nix | 84 +---------------- home/common.nix | 4 +- home/mods/niri.kdl | 74 +++++++++++++++ home/mods/noctalia.toml | 190 ++++++++++++++++++++++++++++++++++++++ home/root.nix | 5 + server/configuration.nix | 36 ++++---- server/mods/system.nix | 4 +- 10 files changed, 312 insertions(+), 112 deletions(-) create mode 100644 home/mods/niri.kdl create mode 100644 home/mods/noctalia.toml diff --git a/common.nix b/common.nix index 79ebd8e..f3fd890 100644 --- a/common.nix +++ b/common.nix @@ -7,7 +7,7 @@ swapDevices = [ { device = "/var/swapfile"; } ]; users.users.root.hashedPasswordFile = "/secrets/user/root-pw"; nix.settings.experimental-features = [ "nix-command" "flakes" ]; - environment.systemPackages = with pkgs; [ jq _7zz sbctl openssl ]; + environment.systemPackages = with pkgs; [ jq _7zz sbctl openssl python314 ]; fileSystems = { "/".options = [ "noatime" ]; "/boot".options = [ "noatime" ]; diff --git a/desktop/configuration.nix b/desktop/configuration.nix index 92a31d3..a2622fa 100644 --- a/desktop/configuration.nix +++ b/desktop/configuration.nix @@ -11,9 +11,10 @@ }; networking = { hostName = "nixos-desktop"; + firewall.allowedTCPPorts = [ 8000 ]; wg-quick.interfaces.awg0 = { configFile = "/secrets/awg/2.conf"; - address = [ "fc00::3/128" "10.0.0.3/32" ]; + address = [ "10.0.0.3/32" "fc00::3/128" ]; }; networkmanager.ensureProfiles.profiles.wifi = { wifi.ssid = "bogale_5"; @@ -24,7 +25,6 @@ }; services = { tuned.enable = true; - displayManager.noctalia-greeter.enable = true; pipewire = { enable = true; pulse.enable = true; @@ -42,5 +42,14 @@ command = "${pkgs.noctalia-greeter}/bin/noctalia-greeter-session -- --session niri --user bogale"; }; }; + displayManager.noctalia-greeter = { + enable = true; + settings.cursor.size = 24; + passwordlessSyncUsers = [ "bogale" ]; + cursorTheme = { + name = "Bibata-Modern-Amber"; + package = pkgs.bibata-cursors; + }; + }; }; } diff --git a/flake.lock b/flake.lock index 8dae76d..f46c202 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1789618856, - "narHash": "sha256-OSqj7eOijvCZfN7owFWRxLWRhej5lZI+Kt82q3INLvc=", + "lastModified": 1791600313, + "narHash": "sha256-/2gb2WTztITD/JU1XUCg63vDsIfJGLr0LDsjSCTTJc8=", "owner": "nix-community", "repo": "home-manager", - "rev": "afa6821c70560bb19d1a8c577bff398f7f239869", + "rev": "427c74a88a93cc9f856c8bb99bf6b4a5187a6b33", "type": "github" }, "original": { @@ -22,11 +22,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1789546076, - "narHash": "sha256-zVxLZiSnmaaPLwnhj7pwmqe3axBg/C6nG5JZsJMh2g4=", + "lastModified": 1791456040, + "narHash": "sha256-H83yz/do+hjOO0uujHyH8RgtIQP2v7Mw+cLwcZK/xKc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b1b875982b17dabde9b4a37f3e229e74913e6db3", + "rev": "e7439b6b14ad3cc35d05608ebca9bce01a25f5f8", "type": "github" }, "original": { diff --git a/home/bogale.nix b/home/bogale.nix index 43d5225..6e520cc 100644 --- a/home/bogale.nix +++ b/home/bogale.nix @@ -1,21 +1,19 @@ { config, pkgs, ... }: { imports = [ ./common.nix ]; - gtk = { - enable = true; - colorScheme = "dark"; - }; + wayland.windowManager.niri.enable = true; + xdg.configFile."niri/config.kdl".source = ./mods/niri.kdl; home = { username = "bogale"; homeDirectory = "/home/bogale"; - packages = with pkgs; [ bibata-cursors brave-origin ]; + packages = with pkgs; [ bluez brave-origin libqalculate bibata-cursors ]; }; programs = { alacritty.enable = true; noctalia = { enable = true; systemd.enable = true; - #launch_apps_as_systemd_services + settings = ./mods/noctalia.toml; }; }; services.gammastep = { @@ -31,78 +29,4 @@ brightness-night = 0.6; }; }; - wayland.windowManager.niri = { - enable = true; - settings = { - gestures.hot-corners.off = {}; - binds."Mod+T".spawn = "alacritty"; - hotkey-overlay.skip-at-startup = {}; - screenshot-path = "~/Multimedia/Screenshots/%Y-%m-%d_%H-%M-%S.png"; - cursor = { - xcursor-size = 24; - xcursor-theme = "Bibata-Modern-Amber"; - }; - layout = { - center-focused-column = "always"; - default-column-width.proportion = 0.8; - }; - window-rule = { - open-floating = false; - clip-to-geometry = true; - geometry-corner-radius = 24; - }; - input = { - touchpad = { - dwt = {}; - tap = {}; - natural-scroll = {}; - }; - keyboard = { - numlock = {}; - xkb = { - layout = "us,ru"; - options = "grp:alt_shift_toggle"; - }; - }; - }; - binds = { - "Print".screenshot = {}; - "Mod+Q".close-window = {}; - "Mod+F".maximize-column = {}; - "Mod+O".toggle-overview = {}; - "Mod+H".focus-column-left = {}; - "Mod+L".focus-column-right = {}; - "Alt+Print".screenshot-window = {}; - "Mod+Ctrl+K".focus-monitor-up = {}; - "Ctrl+Print".screenshot-screen = {}; - "Mod+Shift+H".move-column-left = {}; - "Mod+Ctrl+H".focus-monitor-left = {}; - "Mod+Ctrl+J".focus-monitor-down = {}; - "Mod+Shift+F".fullscreen-window = {}; - "Mod+Shift+L".move-column-right = {}; - "Mod+Ctrl+L".focus-monitor-right = {}; - "Mod+Shift+P".power-off-monitors = {}; - "Mod+K".focus-window-or-workspace-up = {}; - "Mod+J".focus-window-or-workspace-down = {}; - "Mod+Ctrl+Shift+K".move-column-to-monitor-up = {}; - "Mod+Ctrl+Shift+H".move-column-to-monitor-left = {}; - "Mod+Ctrl+Shift+J".move-column-to-monitor-down = {}; - "Mod+Ctrl+Shift+L".move-column-to-monitor-right = {}; - "Mod+Shift+K".move-window-up-or-to-workspace-up = {}; - "Mod+Shift+S".spawn-sh = "noctalia msg settings-open"; - "XF86AudioMute".spawn-sh = "noctalia msg volume-mute"; - "Mod+E".spawn-sh = "noctalia msg panel-toggle session"; - "Mod+D".spawn-sh = "noctalia msg panel-toggle launcher"; - "Mod+Shift+J".move-window-down-or-to-workspace-down = {}; - "Shift+XF86AudioMute".spawn-sh = "noctalia msg mic-mute"; - "XF86AudioRaiseVolume".spawn-sh = "noctalia msg volume-up"; - "XF86AudioLowerVolume".spawn-sh = "noctalia msg volume-down"; - "Mod+S".spawn-sh = "noctalia msg panel-toggle control-center"; - "XF86MonBrightnessUp".spawn-sh = "noctalia msg brightness-up"; - "XF86MonBrightnessDown".spawn-sh = "noctalia msg brightness-down"; - "Shift+XF86AudioRaiseVolume".spawn-sh = "noctalia msg mic-volume-up"; - "Shift+XF86AudioLowerVolume".spawn-sh = "noctalia msg mic-volume-down"; - }; - }; - }; } diff --git a/home/common.nix b/home/common.nix index ed39198..f138fc8 100644 --- a/home/common.nix +++ b/home/common.nix @@ -32,10 +32,10 @@ enable = true; defaultEditor = true; extraConfig = '' + set number + set expandtab set tabstop=4 set shiftwidth=4 - set expandtab - set number set relativenumber autocmd FileType nix set tabstop=2 shiftwidth=2 ''; diff --git a/home/mods/niri.kdl b/home/mods/niri.kdl new file mode 100644 index 0000000..e6ea619 --- /dev/null +++ b/home/mods/niri.kdl @@ -0,0 +1,74 @@ +include "./noctalia.kdl"; +gestures { hot-corners { off; }; }; +hotkey-overlay { skip-at-startup; }; +screenshot-path "~/Multimedia/Screenshots/%Y-%m-%d_%H-%M-%S.png"; +cursor { + xcursor-size 24; + xcursor-theme "Bibata-Modern-Amber"; +}; +layout { + center-focused-column "always"; + default-column-width { proportion 0.8; }; +}; +window-rule { + open-floating false; + clip-to-geometry true; + geometry-corner-radius 24; +}; +input { + touchpad { + dwt; + tap; + natural-scroll; + }; + keyboard { + numlock; + xkb { + layout "us,ru"; + options "grp:alt_shift_toggle"; + }; + }; +}; +binds { + Mod+T { spawn "alacritty"; }; + Mod+D { spawn-sh "noctalia msg panel-toggle launcher"; }; + Mod+E { spawn-sh "noctalia msg panel-toggle session"; }; + Mod+S { spawn-sh "noctalia msg panel-toggle control-center"; }; + Mod+Shift+S { spawn-sh "noctalia msg settings-open"; }; + + Mod+H { focus-column-left; }; + Mod+J { focus-window-or-workspace-down; }; + Mod+K { focus-window-or-workspace-up; }; + Mod+L { focus-column-right; }; + Mod+Shift+H { move-column-left; }; + Mod+Shift+J { move-window-down-or-to-workspace-down; }; + Mod+Shift+K { move-window-up-or-to-workspace-up; }; + Mod+Shift+L { move-column-right; }; + + Mod+Ctrl+H { focus-monitor-left; }; + Mod+Ctrl+J { focus-monitor-down; }; + Mod+Ctrl+K { focus-monitor-up; }; + Mod+Ctrl+L { focus-monitor-right; }; + Mod+Ctrl+Shift+H { move-column-to-monitor-left; }; + Mod+Ctrl+Shift+J { move-column-to-monitor-down; }; + Mod+Ctrl+Shift+K { move-column-to-monitor-up; }; + Mod+Ctrl+Shift+L { move-column-to-monitor-right; }; + + XF86MonBrightnessUp { spawn-sh "noctalia msg brightness-up"; }; + XF86MonBrightnessDown { spawn-sh "noctalia msg brightness-down"; }; + XF86AudioRaiseVolume { spawn-sh "noctalia msg volume-up"; }; + XF86AudioLowerVolume { spawn-sh "noctalia msg volume-down"; }; + XF86AudioMute { spawn-sh "noctalia msg volume-mute"; }; + Shift+XF86AudioRaiseVolume { spawn-sh "noctalia msg mic-volume-up"; }; + Shift+XF86AudioLowerVolume { spawn-sh "noctalia msg mic-volume-down"; }; + Shift+XF86AudioMute { spawn-sh "noctalia msg mic-mute"; }; + + Mod+O { toggle-overview; }; + Mod+Q { close-window; }; + Mod+F { maximize-column; }; + Mod+Shift+F { fullscreen-window; }; + Mod+Shift+P { power-off-monitors; }; + Print { screenshot; }; + Alt+Print { screenshot-window; }; + Ctrl+Print { screenshot-screen; }; +}; diff --git a/home/mods/noctalia.toml b/home/mods/noctalia.toml new file mode 100644 index 0000000..e0e74a3 --- /dev/null +++ b/home/mods/noctalia.toml @@ -0,0 +1,190 @@ +[bar] +order = [ "default" ] + + [bar.default] + center = [ "workspaces" ] + end = [ "tray", "notifications", "battery", "keyboard_layout" ] + margin_ends = 0 + start = [ "date", "clock", "sysmon" ] + widget_spacing = 12 + + [bar.default.dead_zone.actions] + right = "none" + +[control_center] +hidden_tabs = [ "media", "audio", "monitor", "notifications" ] + + [[control_center.shortcuts]] + type = "wifi" + + [[control_center.shortcuts]] + type = "bluetooth" + + [[control_center.shortcuts]] + type = "caffeine" + + [[control_center.shortcuts]] + type = "notification" + + [[control_center.shortcuts]] + type = "power_profile" + +[desktop_widgets] +enabled = false +schema_version = 2 +widget_order = [] + + [desktop_widgets.grid] + cell_size = 16 + major_interval = 4 + visible = true + + [desktop_widgets.widget] + +[idle] +behavior_order = [ "screen-off", "lock", "lock-and-suspend" ] + + [idle.behavior.lock] + action = "lock" + enabled = true + timeout = 600.0 + + [idle.behavior.lock-and-suspend] + action = "lock_and_suspend" + enabled = true + timeout = 900.0 + + [idle.behavior.screen-off] + action = "screen_off" + enabled = true + timeout = 300.0 + +[location] +address = "Chita" + +[lockscreen] +fingerprint = false + +[lockscreen_widgets] +enabled = false +schema_version = 2 +widget_order = [ "lockscreen-login-box@eDP-1" ] + + [lockscreen_widgets.grid] + cell_size = 16 + major_interval = 4 + visible = true + + [lockscreen_widgets.widget."lockscreen-login-box@eDP-1"] + box_height = 196.0 + box_width = 810.0 + cx = 960.0 + cy = 898.0 + output = "eDP-1" + placement_height = 1080.0 + placement_width = 1920.0 + rotation = 0.0 + type = "login_box" + + [lockscreen_widgets.widget."lockscreen-login-box@eDP-1".settings] + background_color = "surface_variant" + background_opacity = 0.88 + background_radius = 12.0 + center_password_text = false + input_opacity = 1.0 + input_radius = 6.0 + layout = "regular" + show_caps_lock = true + show_keyboard_layout = true + show_login_button = true + show_media = true + show_session_buttons = true + show_unlock_hint = true + show_weather = true + +[notification] +history_retention_hours = 8 +layer = "overlay" + +[osd.kinds] +bluetooth = false +caffeine = false +dnd = false +keyboard_backlight = false +keyboard_layout = false +media = false +nightlight = false +power_profile = false +wifi = false + +[shell] +clipboard_enabled = false +launch_apps_as_systemd_services = true +screen_time_enabled = true + + [shell.greeter_sync] + auto_sync = true + + [shell.screen_corners] + enabled = true + + [[shell.session.actions]] + action = "lock" + countdown_seconds = 0.0 + enabled = true + shortcut = "1" + variant = "default" + + [[shell.session.actions]] + action = "lock_and_suspend" + countdown_seconds = 0.0 + enabled = true + shortcut = "2" + variant = "default" + + [[shell.session.actions]] + action = "command" + command = "systemctl hibernate" + countdown_seconds = 0.0 + enabled = true + glyph = "hibernate" + label = "Гибернация" + shortcut = "3" + variant = "default" + + [[shell.session.actions]] + action = "reboot" + countdown_seconds = 0.0 + enabled = true + shortcut = "4" + variant = "default" + + [[shell.session.actions]] + action = "shutdown" + countdown_seconds = 0.0 + enabled = true + shortcut = "5" + variant = "default" + +[theme] +builtin = "Tokyo-Night" + + [theme.templates] + builtin_ids = [ "alacritty", "gtk3", "gtk4", "kcolorscheme", "niri", "qt" ] + enable_community_templates = false + +[wallpaper] +directory = "/home/bogale/Multimedia/Wallpapers" +transition_on_startup = true + + [wallpaper.default] + path = "/home/bogale/Multimedia/Wallpapers/main.jpg" + + [wallpaper.last] + path = "/home/bogale/Multimedia/Wallpapers/main.jpg" + + [wallpaper.monitors.eDP-1] + path = "/home/bogale/Multimedia/Wallpapers/main.jpg" + +[weather] +refresh_minutes = 10 diff --git a/home/root.nix b/home/root.nix index 76e6ac2..cab8b6f 100644 --- a/home/root.nix +++ b/home/root.nix @@ -5,4 +5,9 @@ username = "root"; homeDirectory = "/root"; }; + programs.bash.initExtra = '' + session() { + systemd-run -tGM $1@ --user --wait $SHELL + } + ''; } diff --git a/server/configuration.nix b/server/configuration.nix index 3cbc2f3..692aa35 100644 --- a/server/configuration.nix +++ b/server/configuration.nix @@ -26,6 +26,23 @@ reloadServices = [ "nginx.service" "dovecot.service" "postfix.service" ]; }; }; + networking = { + hostName = "nixos-server"; + firewall = { + allowedUDPPorts = [ 443 ]; + allowedTCPPorts = [ 25 80 443 465 993 ]; + }; + wg-quick.interfaces.awg0 = { + configFile = "/secrets/awg/1.conf"; + address = [ "10.0.0.2/32" "fc00::2/128" ]; + }; + networkmanager.ensureProfiles.profiles.wifi = { + wifi.ssid = "bogale_2.4"; + ipv6.addresses = "fc01::2/64"; + ipv4.addresses = "10.1.0.2/16"; + wifi-security.psk = "$BOGALE_2_4_PSK"; + }; + }; users = { groups = { php.gid = 1568; @@ -33,7 +50,7 @@ }; users = { nginx.extraGroups = [ "php" "acme" ]; - root.openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+wc+3rahpNa+OMS9gaWgMQIxXIKHy4Beku5LBDt+Ow" ]; + root.openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPTb4c1ISQSV34GN27GgaJ08jpiRM3Wul/iSWjQ6emTq" ]; php = { uid = 1568; group = "php"; @@ -46,21 +63,4 @@ }; }; }; - networking = { - hostName = "nixos-server"; - firewall = { - allowedUDPPorts = [ 443 ]; - allowedTCPPorts = [ 25 80 443 465 993 ]; - }; - wg-quick.interfaces.awg0 = { - configFile = "/secrets/awg/1.conf"; - address = [ "fc00::2/128" "10.0.0.2/32" ]; - }; - networkmanager.ensureProfiles.profiles.wifi = { - wifi.ssid = "bogale_2.4"; - ipv6.addresses = "fc01::2/64"; - ipv4.addresses = "10.1.0.2/16"; - wifi-security.psk = "$BOGALE_2_4_PSK"; - }; - }; } diff --git a/server/mods/system.nix b/server/mods/system.nix index 9b78ca9..0e0ecda 100644 --- a/server/mods/system.nix +++ b/server/mods/system.nix @@ -6,9 +6,7 @@ exporters.node.enable = true; scrapeConfigs = [ { job_name = "node"; - static_configs = [ { targets = [ - "localhost:${toString config.services.prometheus.exporters.node.port}" - ]; } ]; + static_configs = [ { targets = [ "localhost:${toString config.services.prometheus.exporters.node.port}" ]; } ]; } ]; }; grafana = { From 6fc02cb1e192c2b1e569743dcfe626ce4b76415c Mon Sep 17 00:00:00 2001 From: bogale Date: Sun, 11 Oct 2026 20:14:58 +0900 Subject: [PATCH 4/5] llama.cpp installed, games in progress --- common.nix | 2 +- desktop/configuration.nix | 3 +++ desktop/hardware.nix | 1 + home/bogale.nix | 24 +++++++++++++++++++----- home/common.nix | 1 - home/mods/niri.kdl | 7 ++++++- home/mods/noctalia.toml | 2 +- home/root.nix | 13 ++++++++----- mods/pxeboot.nix | 4 ++-- 9 files changed, 41 insertions(+), 16 deletions(-) diff --git a/common.nix b/common.nix index f3fd890..679aea4 100644 --- a/common.nix +++ b/common.nix @@ -7,7 +7,7 @@ swapDevices = [ { device = "/var/swapfile"; } ]; users.users.root.hashedPasswordFile = "/secrets/user/root-pw"; nix.settings.experimental-features = [ "nix-command" "flakes" ]; - environment.systemPackages = with pkgs; [ jq _7zz sbctl openssl python314 ]; + environment.systemPackages = with pkgs; [ jq _7zz sbctl openssl python314 speedtest-go ]; fileSystems = { "/".options = [ "noatime" ]; "/boot".options = [ "noatime" ]; diff --git a/desktop/configuration.nix b/desktop/configuration.nix index a2622fa..93326ae 100644 --- a/desktop/configuration.nix +++ b/desktop/configuration.nix @@ -1,8 +1,10 @@ { config, lib, pkgs, ... }: { programs.niri.enable = true; + security.apparmor.enable = true; hardware.bluetooth.enable = true; imports = [ ../common.nix ./hardware.nix ]; + boot.kernelParams = [ "hibernate.compressor=lz4" ]; users.users.bogale = { uid = 1551; isNormalUser = true; @@ -25,6 +27,7 @@ }; services = { tuned.enable = true; + flatpak.enable = true; pipewire = { enable = true; pulse.enable = true; diff --git a/desktop/hardware.nix b/desktop/hardware.nix index 7af382a..9111d1a 100644 --- a/desktop/hardware.nix +++ b/desktop/hardware.nix @@ -5,6 +5,7 @@ hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; boot = { kernelModules = [ "kvm-amd" ]; + kernelParams = [ "ttm.pages_limit=3014656" ]; initrd = { luks.devices.root.device = "/dev/disk/by-uuid/70ac6613-2e6c-4817-a0ce-43a97efb8bab"; availableKernelModules = [ "nvme" "xhci_pci" "usb_storage" "sd_mod" "rtsx_usb_sdmmc" ]; diff --git a/home/bogale.nix b/home/bogale.nix index 6e520cc..c4f4db9 100644 --- a/home/bogale.nix +++ b/home/bogale.nix @@ -3,13 +3,10 @@ imports = [ ./common.nix ]; wayland.windowManager.niri.enable = true; xdg.configFile."niri/config.kdl".source = ./mods/niri.kdl; - home = { - username = "bogale"; - homeDirectory = "/home/bogale"; - packages = with pkgs; [ bluez brave-origin libqalculate bibata-cursors ]; - }; programs = { + mpv.enable = true; alacritty.enable = true; + bash.sessionVariables.TTS_MODEL = "ggml-org/Qwen3-TTS-12Hz-1.7B-Base-GGUF"; noctalia = { enable = true; systemd.enable = true; @@ -29,4 +26,21 @@ brightness-night = 0.6; }; }; + home = { + username = "bogale"; + homeDirectory = "/home/bogale"; + packages = with pkgs; [ + bluez + heroic + qbittorrent + thunderbird + brave-origin + libqalculate + bibata-cursors + ffmpeg-headless + llama-cpp-vulkan + telegram-desktop + nvtopPackages.amd + ]; + }; } diff --git a/home/common.nix b/home/common.nix index f138fc8..446c2ac 100644 --- a/home/common.nix +++ b/home/common.nix @@ -6,7 +6,6 @@ packages = with pkgs; [ ncdu yt-dlp ]; }; programs = { - home-manager.enable = true; ssh = { enable = true; enableDefaultConfig = false; diff --git a/home/mods/niri.kdl b/home/mods/niri.kdl index e6ea619..99fee03 100644 --- a/home/mods/niri.kdl +++ b/home/mods/niri.kdl @@ -1,7 +1,12 @@ include "./noctalia.kdl"; gestures { hot-corners { off; }; }; hotkey-overlay { skip-at-startup; }; +environment { QT_QPA_PLATFORMTHEME "qt6ct"; }; screenshot-path "~/Multimedia/Screenshots/%Y-%m-%d_%H-%M-%S.png"; +window-rule { + match app-id="mpv"; + open-fullscreen true; +}; cursor { xcursor-size 24; xcursor-theme "Bibata-Modern-Amber"; @@ -13,7 +18,7 @@ layout { window-rule { open-floating false; clip-to-geometry true; - geometry-corner-radius 24; + geometry-corner-radius 8; }; input { touchpad { diff --git a/home/mods/noctalia.toml b/home/mods/noctalia.toml index e0e74a3..bd085eb 100644 --- a/home/mods/noctalia.toml +++ b/home/mods/noctalia.toml @@ -3,7 +3,7 @@ order = [ "default" ] [bar.default] center = [ "workspaces" ] - end = [ "tray", "notifications", "battery", "keyboard_layout" ] + end = [ "tray", "keyboard_layout", "battery", "notifications" ] margin_ends = 0 start = [ "date", "clock", "sysmon" ] widget_spacing = 12 diff --git a/home/root.nix b/home/root.nix index cab8b6f..8b18d7e 100644 --- a/home/root.nix +++ b/home/root.nix @@ -5,9 +5,12 @@ username = "root"; homeDirectory = "/root"; }; - programs.bash.initExtra = '' - session() { - systemd-run -tGM $1@ --user --wait $SHELL - } - ''; + programs.bash = { + shellAliases.dd = "dd bs=1M conv=fsync status=progress"; + initExtra = '' + user-session() { + systemd-run -tGM $1@ --user --wait $SHELL + } + ''; + }; } diff --git a/mods/pxeboot.nix b/mods/pxeboot.nix index c2d3488..c1639d7 100644 --- a/mods/pxeboot.nix +++ b/mods/pxeboot.nix @@ -60,13 +60,12 @@ tmpfiles.rules = [ "d /srv/tftp" ]; services.pxeboot = { before = [ "nfs-server.service" ]; - after = [ "wg-quick-awg0.service" ]; requiredBy = [ "nfs-server.service" ]; - requires = [ "wg-quick-awg0.service" ]; path = with pkgs; [ xz curl e2fsprogs grub2_efi util-linux ]; serviceConfig = { Type = "oneshot"; RemainAfterExit = true; + TimeoutStartSec = "infinity"; ExecStop = pkgs.writeShellScript "stop.sh" '' set -e for distro in arch fedora; do @@ -130,6 +129,7 @@ mkdir -p /srv/nfs/$distro cd /srv/nfs/$distro if [ ! -e $distro.iso ]; then + until curl --head --max-time 3 https://www.google.com; do sleep 5; done curl -C - "$url" -Lo $distro.iso.tmp mv $distro.iso{.tmp,} sha256sum $distro.iso | grep $hash From 1fdf900886631c5a502609e4f72db48b92adfffb Mon Sep 17 00:00:00 2001 From: bogale Date: Mon, 12 Oct 2026 14:53:03 +0900 Subject: [PATCH 5/5] configured graphical environment --- desktop/configuration.nix | 2 -- home/bogale.nix | 27 ++++++++++++++++++++++++--- home/common.nix | 22 ---------------------- home/mods/niri.kdl | 1 - home/mods/noctalia.toml | 3 ++- home/root.nix | 38 +++++++++++++++++++++++++++++++------- 6 files changed, 57 insertions(+), 36 deletions(-) diff --git a/desktop/configuration.nix b/desktop/configuration.nix index 93326ae..f827d65 100644 --- a/desktop/configuration.nix +++ b/desktop/configuration.nix @@ -1,7 +1,6 @@ { config, lib, pkgs, ... }: { programs.niri.enable = true; - security.apparmor.enable = true; hardware.bluetooth.enable = true; imports = [ ../common.nix ./hardware.nix ]; boot.kernelParams = [ "hibernate.compressor=lz4" ]; @@ -27,7 +26,6 @@ }; services = { tuned.enable = true; - flatpak.enable = true; pipewire = { enable = true; pulse.enable = true; diff --git a/home/bogale.nix b/home/bogale.nix index c4f4db9..12717e6 100644 --- a/home/bogale.nix +++ b/home/bogale.nix @@ -3,15 +3,25 @@ imports = [ ./common.nix ]; wayland.windowManager.niri.enable = true; xdg.configFile."niri/config.kdl".source = ./mods/niri.kdl; + systemd.user.sessionVariables.QT_QPA_PLATFORMTHEME = "gtk3"; + gtk = { + enable = true; + colorScheme = "dark"; + }; programs = { - mpv.enable = true; - alacritty.enable = true; - bash.sessionVariables.TTS_MODEL = "ggml-org/Qwen3-TTS-12Hz-1.7B-Base-GGUF"; noctalia = { enable = true; systemd.enable = true; settings = ./mods/noctalia.toml; }; + bash = { + sessionVariables.TTS_MODEL = "ggml-org/Qwen3-TTS-12Hz-1.7B-Base-GGUF"; + initExtra = '' + session() { + sudo machinectl shell root@ + } + ''; + }; }; services.gammastep = { enable = true; @@ -29,9 +39,20 @@ home = { username = "bogale"; homeDirectory = "/home/bogale"; + pointerCursor = { + size = 24; + enable = true; + gtk.enable = true; + x11.enable = true; + name = "Bibata-Modern-Amber"; + package = pkgs.bibata-cursors; + }; packages = with pkgs; [ + mpv bluez heroic + alacritty + libreoffice qbittorrent thunderbird brave-origin diff --git a/home/common.nix b/home/common.nix index 446c2ac..f11dfe2 100644 --- a/home/common.nix +++ b/home/common.nix @@ -39,27 +39,5 @@ autocmd FileType nix set tabstop=2 shiftwidth=2 ''; }; - tmux = { - enable = true; - clock24 = true; - escapeTime = 0; - keyMode = "vi"; - terminal = "screen-256color"; - extraConfig = '' - unbind C-b - set -g mouse on - set -g prefix M-f - bind f send-prefix - bind h select-pane -L - bind j select-pane -D - bind k select-pane -U - bind l select-pane -R - bind i split-window -v - bind u split-window -h - set -s set-clipboard external - set-option -g focus-events on - set-option -a terminal-features "xterm-256color:RGB" - ''; - }; }; } diff --git a/home/mods/niri.kdl b/home/mods/niri.kdl index 99fee03..69c1470 100644 --- a/home/mods/niri.kdl +++ b/home/mods/niri.kdl @@ -1,7 +1,6 @@ include "./noctalia.kdl"; gestures { hot-corners { off; }; }; hotkey-overlay { skip-at-startup; }; -environment { QT_QPA_PLATFORMTHEME "qt6ct"; }; screenshot-path "~/Multimedia/Screenshots/%Y-%m-%d_%H-%M-%S.png"; window-rule { match app-id="mpv"; diff --git a/home/mods/noctalia.toml b/home/mods/noctalia.toml index bd085eb..cf0ab5e 100644 --- a/home/mods/noctalia.toml +++ b/home/mods/noctalia.toml @@ -3,6 +3,7 @@ order = [ "default" ] [bar.default] center = [ "workspaces" ] + enabled = true end = [ "tray", "keyboard_layout", "battery", "notifications" ] margin_ends = 0 start = [ "date", "clock", "sysmon" ] @@ -170,7 +171,7 @@ screen_time_enabled = true builtin = "Tokyo-Night" [theme.templates] - builtin_ids = [ "alacritty", "gtk3", "gtk4", "kcolorscheme", "niri", "qt" ] + builtin_ids = [ "alacritty", "gtk3", "gtk4", "niri" ] enable_community_templates = false [wallpaper] diff --git a/home/root.nix b/home/root.nix index 8b18d7e..6529440 100644 --- a/home/root.nix +++ b/home/root.nix @@ -5,12 +5,36 @@ username = "root"; homeDirectory = "/root"; }; - programs.bash = { - shellAliases.dd = "dd bs=1M conv=fsync status=progress"; - initExtra = '' - user-session() { - systemd-run -tGM $1@ --user --wait $SHELL - } - ''; + programs = { + bash = { + shellAliases.dd = "dd bs=1M conv=fsync status=progress"; + initExtra = '' + session() { + systemd-run -tGM bogale@ --user --wait $SHELL + } + ''; + }; + tmux = { + enable = true; + clock24 = true; + escapeTime = 0; + keyMode = "vi"; + terminal = "screen-256color"; + extraConfig = '' + unbind C-b + set -g mouse on + set -g prefix M-f + bind f send-prefix + bind h select-pane -L + bind j select-pane -D + bind k select-pane -U + bind l select-pane -R + bind i split-window -v + bind u split-window -h + set -s set-clipboard external + set-option -g focus-events on + set-option -a terminal-features "xterm-256color:RGB" + ''; + }; }; }