From 9b0825293508a6eacdd7e3b00ab4470354a5934c Mon Sep 17 00:00:00 2001 From: Alexander Bantyev Date: Fri, 22 Jan 2021 20:44:23 +0300 Subject: [PATCH] Move server stuff to T420-Laptop --- machines/AMD-Workstation/default.nix | 10 +------ machines/T420-Laptop/default.nix | 18 +++++++++-- .../T420-Laptop/hardware-configuration.nix | 30 +++++++++++-------- modules/boot.nix | 18 ++++++----- modules/devices.nix | 1 + 5 files changed, 46 insertions(+), 31 deletions(-) diff --git a/machines/AMD-Workstation/default.nix b/machines/AMD-Workstation/default.nix index 4024d74..8920a4b 100644 --- a/machines/AMD-Workstation/default.nix +++ b/machines/AMD-Workstation/default.nix @@ -1,15 +1,7 @@ { inputs, ... }: { - imports = with inputs.self.nixosModules; [ + imports = [ ./hardware-configuration.nix inputs.self.nixosProfiles.desktop - gitea - jitsi - mailserver - matrix-synapse - minidlna - nextcloud - nginx - vsftpd ]; deviceSpecific.devInfo = { cpu = { diff --git a/machines/T420-Laptop/default.nix b/machines/T420-Laptop/default.nix index cc9c11c..0c9965b 100644 --- a/machines/T420-Laptop/default.nix +++ b/machines/T420-Laptop/default.nix @@ -1,7 +1,21 @@ { inputs, ... }: { - imports = [ ./hardware-configuration.nix inputs.self.nixosProfiles.desktop ]; + imports = with inputs.self.nixosModules; [ + ./hardware-configuration.nix + inputs.self.nixosProfiles.desktop + gitea + jitsi + mailserver + matrix-synapse + minidlna + nextcloud + nginx + vsftpd + ]; + + security.sudo.wheelNeedsPassword = false; + deviceSpecific.devInfo = { - legacy = false; + legacy = true; cpu = { vendor = "intel"; clock = 2500; diff --git a/machines/T420-Laptop/hardware-configuration.nix b/machines/T420-Laptop/hardware-configuration.nix index fb559c1..64f28e4 100644 --- a/machines/T420-Laptop/hardware-configuration.nix +++ b/machines/T420-Laptop/hardware-configuration.nix @@ -1,29 +1,33 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, inputs, ... }: +{ config, lib, pkgs, modulesPath, ... }: { - imports = - [ "${inputs.nixpkgs}/nixos/modules/installer/scan/not-detected.nix" ]; + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ]; + boot.initrd.availableKernelModules = + [ "ehci_pci" "ahci" "uas" "sd_mod" "sdhci_pci" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "/dev/disk/by-uuid/29edff1b-4457-4d0c-9dfc-2cf5b6afcb46"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/29edff1b-4457-4d0c-9dfc-2cf5b6afcb46"; + fsType = "ext4"; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/4976-D10F"; - fsType = "vfat"; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/4976-D10F"; + fsType = "vfat"; + }; + + fileSystems."/var" = { + device = "/dev/disk/by-uuid/ad3f31e2-e6d1-43a0-a1ef-7f493fd3a9e2"; + fsType = "ext4"; + }; swapDevices = [ ]; - nix.maxJobs = lib.mkDefault 4; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; } diff --git a/modules/boot.nix b/modules/boot.nix index 36682c1..81e9213 100644 --- a/modules/boot.nix +++ b/modules/boot.nix @@ -1,13 +1,17 @@ { lib, pkgs, config, ... }: { boot = { - loader.timeout = 1; - - loader.systemd-boot.enable = lib.mkIf (pkgs.system == "x86_64-linux") true; - - loader.grub.enable = false; - + loader = { + timeout = 1; + } // (if config.deviceSpecific.devInfo.legacy or false then { # Non-UEFI config + grub.enable = true; + grub.version = 2; + grub.useOSProber = true; + grub.device = "/dev/sda"; + } else { # UEFI config + systemd-boot.enable = true; + }); kernelParams = [ "quiet" "scsi_mod.use_blk_mq=1" "modeset" "nofb" ] - ++ lib.optional (pkgs.system == "x86_64-linux") [ + ++ lib.optionals (pkgs.system == "x86_64-linux") [ "rd.systemd.show_status=auto" "rd.udev.log_priority=3" "pti=off" diff --git a/modules/devices.nix b/modules/devices.nix index 1dc8eda..8d095b7 100644 --- a/modules/devices.nix +++ b/modules/devices.nix @@ -22,6 +22,7 @@ with types; { size = mkOption { type = int; }; }; ram = mkOption { type = int; }; + legacy = mkOption { type = bool; default = false; }; bigScreen = mkOption { type = bool; default = true;