basic gui setup for desktop
This commit is contained in:
parent
4dd5416eb6
commit
d0c1518df6
10 changed files with 228 additions and 114 deletions
70
common.nix
70
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,22 +60,7 @@
|
|||
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";
|
||||
};
|
||||
};
|
||||
wifi = {
|
||||
profiles.wifi = {
|
||||
wifi-security.key-mgmt = "sae";
|
||||
ipv6 = {
|
||||
method = "manual";
|
||||
|
|
@ -99,5 +78,4 @@
|
|||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,12 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
imports = [ ../common.nix ./hardware.nix ];
|
||||
users.users = {
|
||||
data = {
|
||||
uid = 1256;
|
||||
isNormalUser = true;
|
||||
hashedPasswordFile = "/secrets/user/data-pw";
|
||||
};
|
||||
bogale = {
|
||||
users.users.bogale = {
|
||||
uid = 1551;
|
||||
isNormalUser = true;
|
||||
extraGroups = [ "wheel" ];
|
||||
hashedPasswordFile = "/secrets/user/bogale-pw";
|
||||
};
|
||||
};
|
||||
networking = {
|
||||
hostName = "nixos-desktop";
|
||||
wg-quick.interfaces.awg0 = {
|
||||
|
|
@ -27,4 +20,9 @@
|
|||
wifi-security.psk = "$BOGALE_5_PSK";
|
||||
};
|
||||
};
|
||||
programs.niri.enable = true;
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
pulse.enable = true;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
24
desktop/hardware.nix
Normal file
24
desktop/hardware.nix
Normal 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" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -23,7 +23,6 @@
|
|||
useUserPackages = true;
|
||||
extraSpecialArgs = { inherit inputs; };
|
||||
users = {
|
||||
data = ./home/data.nix;
|
||||
root = ./home/root.nix;
|
||||
bogale = ./home/bogale.nix;
|
||||
};
|
||||
|
|
|
|||
102
home/bogale.nix
102
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; }
|
||||
|
||||
}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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 = {
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
imports = [ ./common.nix ];
|
||||
home = {
|
||||
username = "data";
|
||||
homeDirectory = "/home/data";
|
||||
};
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue