diff --git a/bootable/common.nix b/bootable/common.nix index 96281ef..ea11b34 100644 --- a/bootable/common.nix +++ b/bootable/common.nix @@ -1,8 +1,17 @@ -{ +{ pkgs, ... }: { boot = { initrd.systemd.tpm2.enable = false; loader.timeout = 0; }; + environment.systemPackages = with pkgs; [ + ddrescue + efibootmgr + hdparm + hwinfo + nvme-cli + smartmontools + ]; + hardware.enableAllHardware = true; imports = [ ../common.nix ]; services.getty.autologinUser = "root"; systemd.tpm2.enable = false; diff --git a/bootable/drive.nix b/bootable/drive.nix index 9594aee..01b955e 100644 --- a/bootable/drive.nix +++ b/bootable/drive.nix @@ -1,9 +1,8 @@ { fileSystems = { - "/".device = "/dev/disk/by-label/bootdrive-root"; - "/boot".device = "/dev/disk/by-label/bootdrive-esp"; + "/".device = "/dev/disk/by-label/ext-root"; + "/boot".device = "/dev/disk/by-label/ext-esp"; }; - hardware.enableAllHardware = true; imports = [ ../mods/fs.nix ./common.nix diff --git a/bootable/pxe.nix b/bootable/pxe.nix index 4f0cb80..11d0440 100644 --- a/bootable/pxe.nix +++ b/bootable/pxe.nix @@ -2,7 +2,10 @@ boot = { initrd = { availableKernelModules = [ "nfsv4" ]; - network.enable = true; + network = { + enable = true; + flushBeforeStage2 = true; + }; systemd.initrdBin = [ pkgs.nfs-utils ]; }; kernelParams = [ "ip=dhcp" ]; diff --git a/common.nix b/common.nix index 6a9ca5c..2d49b09 100644 --- a/common.nix +++ b/common.nix @@ -23,12 +23,16 @@ }; environment.systemPackages = with pkgs; [ _7zz + cryptsetup file + gptfdisk jq + pciutils python314 sbctl sops speedtest-go + usbutils ]; i18n.defaultLocale = "ru_RU.UTF-8"; imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; diff --git a/desktop/configuration.nix b/desktop/configuration.nix index 8807497..c3bba97 100644 --- a/desktop/configuration.nix +++ b/desktop/configuration.nix @@ -4,6 +4,8 @@ android-tools binutils binwalk + exfat + nixfmt-tree qemu qrencode ]; diff --git a/home/bogale.nix b/home/bogale.nix index f4f91ea..64861af 100644 --- a/home/bogale.nix +++ b/home/bogale.nix @@ -1,4 +1,5 @@ { config, pkgs, ... }: { + dconf.settings."org/gnome/desktop/interface".gtk-enable-primary-paste = true; gtk = { colorScheme = "dark"; enable = true; diff --git a/home/common.nix b/home/common.nix index 5d97a78..008d48f 100644 --- a/home/common.nix +++ b/home/common.nix @@ -38,7 +38,10 @@ ssh = { enable = true; enableDefaultConfig = false; - settings."*".SetEnv.TERM = "xterm-256color"; + settings."*" = { + SetEnv.TERM = "xterm-256color"; + StrictHostKeyChecking = "accept-new"; + }; }; }; services.ssh-agent.enable = true; diff --git a/mods/pxeboot.nix b/mods/pxeboot.nix index f55be9c..ba59533 100644 --- a/mods/pxeboot.nix +++ b/mods/pxeboot.nix @@ -103,11 +103,10 @@ (printf '{\n boot.initrd.availableKernelModules = [\n' cd ${config.boot.kernelPackages.kernel.modules}/lib/modules/*/kernel/drivers/net/ethernet find -type f | sed 's/^.*\/\([^.]*\).*$/ "\1"/' | sort - printf ' ];\n}') > /etc/nixos/pxeboot/ethernet.nix - nixos-install --flake "/etc/nixos#nixos-pxeboot" \ + printf ' ];\n}\n') > /etc/nixos/bootable/ethernet.nix + nixos-install --flake "/etc/nixos#nixos-bootpxe" \ --no-channel-copy --no-root-passwd --root /srv/pxe/nixos ''; - # delete --no-channel-copy later }; }; tmpfiles.rules = [ "d /srv/pxe/nixos/boot" ]; diff --git a/mods/vps-init.nix b/mods/vps-init.nix index ec35a06..98e3184 100644 --- a/mods/vps-init.nix +++ b/mods/vps-init.nix @@ -36,12 +36,12 @@ Unattended-Upgrade::Remove-Unused-Dependencies "true"; EOF export DEBIAN_FRONTEND=noninteractive + apt-get update apt-get install -y unattended-upgrades cat <<' EOF' > 20auto-upgrades APT::Periodic::Unattended-Upgrade "1"; APT::Periodic::Update-Package-Lists "1"; EOF - apt-get update apt-get dist-upgrade -y;; 1) cat <<' EOF' >> /etc/sysctl.conf diff --git a/server/configuration.nix b/server/configuration.nix index c2165ea..1608904 100644 --- a/server/configuration.nix +++ b/server/configuration.nix @@ -40,9 +40,12 @@ }; defaults.email = "letsencrypt@bogaledev.ru"; }; - services.openssh = { - enable = true; - settings.PasswordAuthentication = false; + services = { + logind.settings.Login.HandleLidSwitch = "ignore"; + openssh = { + enable = true; + settings.PasswordAuthentication = false; + }; }; sops = { secrets = { diff --git a/server/mods/system.nix b/server/mods/system.nix index 3b53459..0b8f1cd 100644 --- a/server/mods/system.nix +++ b/server/mods/system.nix @@ -20,6 +20,8 @@ services = { network-watchdog = { script = '' + exec {lock_fd}> /run/network.lock + ${pkgs.util-linux}/bin/flock -n $lock_fd || exit if [ ! -e /run/network.failures ] || [ ! -e /run/network.limit ] || \ ${pkgs.curl}/bin/curl --head --max-time 3 https://bogaledev.ru; then limit=3 @@ -29,9 +31,9 @@ failures=$((1+$(cat /run/network.failures))) fi if [ $failures -ge $limit ]; then - echo "<4>restarting network" + echo "<4>Restarting network" systemctl restart NetworkManager.service - sleep 1 + until ${pkgs.iputils}/bin/ping 10.1.0.1 -c 1 -W 1; do sleep 1; done systemctl restart wg-quick-awg0.service [ $limit -lt 360 ] && limit=$((2*$limit)) failures=0 @@ -39,10 +41,7 @@ echo $limit > /run/network.limit echo $failures > /run/network.failures ''; - serviceConfig = { - LogLevelMax = "warning"; - Type = "oneshot"; - }; + serviceConfig.Type = "oneshot"; }; tgbot-send = { script = ''