basic gui setup for desktop

This commit is contained in:
bogale 2026-10-08 18:28:20 +09:00
commit d0c1518df6
10 changed files with 228 additions and 114 deletions

View file

@ -1,32 +1,16 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
time.timeZone = "Asia/Chita"; time.timeZone = "Asia/Chita";
system.stateVersion = "26.05"; system.stateVersion = "26.11";
imports = [ ./mods/pxeboot.nix ]; imports = [ ./mods/pxeboot.nix ];
i18n.defaultLocale = "ru_RU.UTF-8"; i18n.defaultLocale = "ru_RU.UTF-8";
swapDevices = [ { device = "/var/swapfile"; } ]; swapDevices = [ { device = "/var/swapfile"; } ];
users.users.root.hashedPasswordFile = "/secrets/user/root-pw"; users.users.root.hashedPasswordFile = "/secrets/user/root-pw";
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings.experimental-features = [ "nix-command" "flakes" ];
console = { environment.systemPackages = with pkgs; [ jq _7zz sbctl openssl ];
font = "cyr-sun16"; fileSystems = {
keyMap = "ruwin_alt_sh-UTF-8"; "/".options = [ "noatime" ];
}; "/boot".options = [ "noatime" ];
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;
};
}; };
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"d /root/backup" "d /root/backup"
@ -45,16 +29,26 @@
panicOnChecksumMismatch = true; panicOnChecksumMismatch = true;
}; };
}; };
networking = { services = {
firewall = { logind.settings.Login.HandleLidSwitch = "ignore";
allowedTCPPorts = [ 53 80 2049 ]; openssh = {
allowedUDPPorts = [ 53 67 69 547 ];
};
nat = {
enable = true; enable = true;
enableIPv6 = true; settings.PasswordAuthentication = false;
internalInterfaces = [ "enp1s0" ];
}; };
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 = { wg-quick.interfaces.awg0 = {
type = "amneziawg"; type = "amneziawg";
peers = [ { peers = [ {
@ -66,22 +60,7 @@
enable = true; enable = true;
ensureProfiles = { ensureProfiles = {
environmentFiles = [ "/secrets/wifi.env" ]; environmentFiles = [ "/secrets/wifi.env" ];
profiles = { profiles.wifi = {
ethernet = {
ipv6 = {
method = "manual";
addresses = "fc02::1/64";
};
ipv4 = {
method = "manual";
addresses = "10.2.0.1/16";
};
connection = {
id = "ethernet";
type = "802-3-ethernet";
};
};
wifi = {
wifi-security.key-mgmt = "sae"; wifi-security.key-mgmt = "sae";
ipv6 = { ipv6 = {
method = "manual"; method = "manual";
@ -99,5 +78,4 @@
}; };
}; };
}; };
};
} }

View file

@ -1,19 +1,12 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
imports = [ ../common.nix ./hardware.nix ]; imports = [ ../common.nix ./hardware.nix ];
users.users = { users.users.bogale = {
data = {
uid = 1256;
isNormalUser = true;
hashedPasswordFile = "/secrets/user/data-pw";
};
bogale = {
uid = 1551; uid = 1551;
isNormalUser = true; isNormalUser = true;
extraGroups = [ "wheel" ]; extraGroups = [ "wheel" ];
hashedPasswordFile = "/secrets/user/bogale-pw"; hashedPasswordFile = "/secrets/user/bogale-pw";
}; };
};
networking = { networking = {
hostName = "nixos-desktop"; hostName = "nixos-desktop";
wg-quick.interfaces.awg0 = { wg-quick.interfaces.awg0 = {
@ -27,4 +20,9 @@
wifi-security.psk = "$BOGALE_5_PSK"; wifi-security.psk = "$BOGALE_5_PSK";
}; };
}; };
programs.niri.enable = true;
services.pipewire = {
enable = true;
pulse.enable = true;
};
} }

24
desktop/hardware.nix Normal file
View file

@ -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" ];
};
};
}

View file

@ -23,7 +23,6 @@
useUserPackages = true; useUserPackages = true;
extraSpecialArgs = { inherit inputs; }; extraSpecialArgs = { inherit inputs; };
users = { users = {
data = ./home/data.nix;
root = ./home/root.nix; root = ./home/root.nix;
bogale = ./home/bogale.nix; bogale = ./home/bogale.nix;
}; };

View file

@ -1,8 +1,110 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
imports = [ ./common.nix ]; imports = [ ./common.nix ];
programs.alacritty.enable = true;
gtk = {
enable = true;
colorScheme = "dark";
};
home = { home = {
username = "bogale"; username = "bogale";
homeDirectory = "/home/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; }
}
*/

View file

@ -1,20 +1,23 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
home.stateVersion = "26.05";
services.ssh-agent.enable = true; services.ssh-agent.enable = true;
home.packages = with pkgs; [ ncdu yt-dlp ]; home = {
stateVersion = "26.11";
packages = with pkgs; [ ncdu yt-dlp ];
};
programs = { programs = {
home-manager.enable = true; home-manager.enable = true;
bash = {
enable = true;
shellAliases.la = "ls -lAtr";
historyControl = [ "ignoreboth" ];
};
ssh = { ssh = {
enable = true; enable = true;
enableDefaultConfig = false; enableDefaultConfig = false;
settings."*".SetEnv.TERM = "xterm-256color"; settings."*".SetEnv.TERM = "xterm-256color";
}; };
bash = {
enable = true;
shellAliases.la = "ls -lAtr";
historyControl = [ "ignoreboth" ];
sessionVariables.PROMPT_COMMAND = "history -a";
};
git = { git = {
enable = true; enable = true;
settings = { settings = {

View file

@ -1,8 +0,0 @@
{ config, pkgs, ... }:
{
imports = [ ./common.nix ];
home = {
username = "data";
homeDirectory = "/home/data";
};
}

View file

@ -2,7 +2,7 @@ gdisk $DISK
mkfs.fat -F 32 $ESPPART mkfs.fat -F 32 $ESPPART
cryptsetup luksFormat $ROOTPART cryptsetup luksFormat $ROOTPART
cryptsetup open $ROOTPART root cryptsetup open $ROOTPART root
mkfs.ext4 $ROOTPART mkfs.ext4 /dev/mapper/root
mount /dev/mapper/root /mnt mount /dev/mapper/root /mnt
mount $ESPPART --mkdir -o umask=077 /mnt/boot mount $ESPPART --mkdir -o umask=077 /mnt/boot
mkdir /mnt/var mkdir /mnt/var
@ -11,5 +11,5 @@ swapon /mnt/var/swapfile
nixos-generate-config --root /mnt --kernel latest --flake nixos-generate-config --root /mnt --kernel latest --flake
#copy backup #copy backup
nixos-install --no-root-passwd --no-channel-copy --flake "/mnt/etc/nixos#nixos" 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 systemd-cryptenroll --tpm2-device=auto --tpm2-pcrs=0+2+7 $ROOTPART

View file

@ -1,5 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
environment.systemPackages = [ pkgs.grub2_efi ];
virtualisation.oci-containers.containers.fedora-dracut = { virtualisation.oci-containers.containers.fedora-dracut = {
pull = "newer"; pull = "newer";
autoStart = false; autoStart = false;
@ -13,6 +14,14 @@
]; ];
}; };
services = { 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 = { nfs.server = {
enable = true; enable = true;
exports = let exports = let
@ -22,22 +31,29 @@
"/srv/nfs/fedora/root" = clients; "/srv/nfs/fedora/root" = clients;
}; };
}; };
dnsmasq = { };
networking = {
firewall = {
allowedTCPPorts = [ 53 2049 ];
allowedUDPPorts = [ 53 67 69 547 ];
};
nat = {
enable = true; enable = true;
settings = { enableIPv6 = true;
enable-ra = true; internalInterfaces = [ "enp1s0" ];
no-resolv = true; };
cache-size = 4096; networkmanager.ensureProfiles.profiles.ethernet = {
bogus-priv = true; ipv6 = {
enable-tftp = true; method = "manual";
interface = "enp1s0"; addresses = "fc02::1/64";
domain-needed = true; };
tftp-root = "/srv/tftp"; ipv4 = {
dhcp-boot = "grubx64.efi"; method = "manual";
server = [ "1.1.1.2" "2606:4700:4700::1112" addresses = "10.2.0.1/16";
"1.0.0.2" "2606:4700:4700::1002" ]; };
dhcp-range = [ "10.2.0.2,10.2.255.254,12h" connection = {
"fc02::2,fc02::ffff:ffff:ffff:ffff,12h" ]; id = "ethernet";
type = "802-3-ethernet";
}; };
}; };
}; };
@ -45,7 +61,9 @@
tmpfiles.rules = [ "d /srv/tftp" ]; tmpfiles.rules = [ "d /srv/tftp" ];
services.pxeboot = { services.pxeboot = {
before = [ "nfs-server.service" ]; before = [ "nfs-server.service" ];
after = [ "wg-quick-awg0.service" ];
requiredBy = [ "nfs-server.service" ]; requiredBy = [ "nfs-server.service" ];
requires = [ "wg-quick-awg0.service" ];
path = with pkgs; [ xz curl e2fsprogs grub2_efi util-linux ]; path = with pkgs; [ xz curl e2fsprogs grub2_efi util-linux ];
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
@ -77,6 +95,18 @@
url = "https://download.fedoraproject.org/pub/fedora/linux/releases/" + url = "https://download.fedoraproject.org/pub/fedora/linux/releases/" +
"44/Workstation/x86_64/iso/Fedora-Workstation-Live-44-1.7.x86_64.iso"; "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" '' grubCfg = pkgs.writeText "grub.cfg" ''
function load { function load {
set p=$cmdpath/boot/$1 set p=$cmdpath/boot/$1
@ -90,18 +120,6 @@
load fedora selinux=0 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 '' in ''
for distro in arch fedora; do for distro in arch fedora; do
case $distro in case $distro in

View file

@ -49,7 +49,7 @@
hostName = "nixos-server"; hostName = "nixos-server";
firewall = { firewall = {
allowedUDPPorts = [ 443 ]; allowedUDPPorts = [ 443 ];
allowedTCPPorts = [ 25 443 465 993 ]; allowedTCPPorts = [ 25 80 443 465 993 ];
}; };
wg-quick.interfaces.awg0 = { wg-quick.interfaces.awg0 = {
configFile = "/secrets/awg/1.conf"; configFile = "/secrets/awg/1.conf";