From afc01e37bd8261119197fe60c01497fca4aa49b6 Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Tue, 6 Feb 2024 16:48:22 +0100 Subject: [PATCH] add host yodaGaming --- hive.nix | 24 +++++++++ hosts/yodaGaming/configuration.nix | 55 +++++++++++++++++++++ hosts/yodaGaming/hardware-configuration.nix | 40 +++++++++++++++ modules/ssh-fde-unlock.nix | 4 +- modules/ssh-server.nix | 2 +- 5 files changed, 123 insertions(+), 2 deletions(-) create mode 100644 hosts/yodaGaming/configuration.nix create mode 100644 hosts/yodaGaming/hardware-configuration.nix diff --git a/hive.nix b/hive.nix index 6d633fa..bba7f05 100644 --- a/hive.nix +++ b/hive.nix @@ -42,6 +42,17 @@ in }; }; + yodaGaming = { name, nodes, ... }: { + # Import the per-host configuration file. + imports = [ ./hosts/${name}/configuration.nix ]; + + deployment = { + # Local deployment. + allowLocalDeployment = true; + targetHost = null; + }; + }; + # # SSH DEPLOYMENT # @@ -59,6 +70,19 @@ in }; }; + remoteGaming = { name, nodes, ... }: { + # Import the per-host configuration file. + imports = [ ./hosts/yodaGaming/configuration.nix ]; + + deployment = { + # SSH deployment. + targetHost = "192.168.178.38"; + targetPort = 22; + + tags = []; + }; + }; + yodaYoga = { name, nodes, ... }: { # Import the per-host configuration file. imports = [ ./hosts/${name}/configuration.nix ]; diff --git a/hosts/yodaGaming/configuration.nix b/hosts/yodaGaming/configuration.nix new file mode 100644 index 0000000..87a7df0 --- /dev/null +++ b/hosts/yodaGaming/configuration.nix @@ -0,0 +1,55 @@ +{ config, pkgs, ... }: +{ + imports = + [ + ./hardware-configuration.nix + ../../modules/home-manager.nix + ../../modules/nur-and-unstable.nix + ../../modules/base.nix + ../../modules/power-management.nix + ../../modules/ntfs.nix + ../../modules/ssh-fde-unlock.nix + ../../modules/zsh.nix + ../../modules/ssh-client.nix + ../../modules/ssh-server.nix + + ../../modules/btrfs-scrub.nix + ../../modules/btrfs-mount-options.nix + + #../../modules/gpu-amd.nix + ../../modules/gnome-base.nix + ../../modules/gnome-config.nix + ../../modules/gnome-extensions.nix + ../../modules/fwupd-gnome.nix + ../../modules/gnome-wallpaper.nix + + #../../modules/gnome-terminal.nix + ../../modules/blackbox.nix + + ../../modules/programs.nix + ../../modules/signal-desktop.nix + #../../modules/games.nix + ]; + + networking.hostName = "yodaGaming"; + boot.initrd.luks.devices."luks-root".allowDiscards = true; + yoda.btrfsFileSystems = ["/"]; + #yoda.btrfsMounts = yoda.btrfsFileSystems; + + # List all available kernel versions: + # `nix repl` -> `:l ` -> `pkgs.linuxPackages` and press `TAB` + # Default. + #boot.kernelPackages = pkgs.linuxPackages; + # Latest. + boot.kernelPackages = pkgs.linuxPackages_latest; + # Hardened. + # https://archlinux.org/packages/extra/x86_64/linux-hardened/ + # -> https://github.com/anthraxx/linux-hardened + #boot.kernelPackages = pkgs.linuxPackages_hardened; + # Free/Libre. + # https://en.wikipedia.org/wiki/Linux-libre + #boot.kernelPackages = pkgs.linuxPackages-libre; + + # Most users should never change this value after the initial install, for any reason, even if you’ve upgraded your system to a new NixOS release. + system.stateVersion = "23.11"; +} diff --git a/hosts/yodaGaming/hardware-configuration.nix b/hosts/yodaGaming/hardware-configuration.nix new file mode 100644 index 0000000..2133da2 --- /dev/null +++ b/hosts/yodaGaming/hardware-configuration.nix @@ -0,0 +1,40 @@ +# 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, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/2cd6a268-fa14-469a-a21f-40dfcfaed381"; + fsType = "btrfs"; + options = [ "subvol=@" ]; + }; + + boot.initrd.luks.devices."luks-root".device = "/dev/disk/by-uuid/c033a402-8616-4aa7-922e-556f60a64a6c"; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/BC66-FB6E"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp4s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/modules/ssh-fde-unlock.nix b/modules/ssh-fde-unlock.nix index 528eafe..83186ce 100644 --- a/modules/ssh-fde-unlock.nix +++ b/modules/ssh-fde-unlock.nix @@ -12,7 +12,7 @@ boot.initrd.network.ssh = { enable = true; port = ( - if (config.networking.hostName == "yodaTux") || (config.networking.hostName == "yodaTab") + if (config.networking.hostName == "yodaTux") || (config.networking.hostName == "yodaTab") || (config.networking.hostName == "yodaGaming") then 22 else if (config.networking.hostName == "yodaYoga") then 2225 @@ -41,6 +41,8 @@ then [ "r8169" ] else if (config.networking.hostName == "yodaYoga") || (config.networking.hostName == "yodaNas") then [ "e1000e" ] + else if (config.networking.hostName == "yodaGaming") + then [ "tg3" ] else throw "Please add kernel module of networ card here" ); # diff --git a/modules/ssh-server.nix b/modules/ssh-server.nix index 0ad92e9..b1c4ec5 100644 --- a/modules/ssh-server.nix +++ b/modules/ssh-server.nix @@ -4,7 +4,7 @@ services.openssh = { enable = true; ports = ( - if (config.networking.hostName == "yodaTux") || (config.networking.hostName == "yodaTab") + if (config.networking.hostName == "yodaTux") || (config.networking.hostName == "yodaTab") || (config.networking.hostName == "yodaGaming") then [22] else if (config.networking.hostName == "yodaYoga") then [2224]