From 3f68b557251528bee56802afe212f61288f4992f Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Sat, 17 Dec 2022 23:11:05 +0000 Subject: [PATCH] Add serveric configs --- flake.nix | 4 ++ keys/tvb.serveric.pub | 1 + machine/serveric/default.nix | 76 +++++++++++++++++++++ machine/serveric/hardware-configuration.nix | 40 +++++++++++ 4 files changed, 121 insertions(+) create mode 100644 keys/tvb.serveric.pub create mode 100644 machine/serveric/default.nix create mode 100644 machine/serveric/hardware-configuration.nix diff --git a/flake.nix b/flake.nix index 567ff43..3babedf 100644 --- a/flake.nix +++ b/flake.nix @@ -18,5 +18,9 @@ specialArgs = attrs; modules = [ ./machine/stagirite ]; }; + nixosConfigurations.serveric = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ ./machine/serveric ]; + }; }; } diff --git a/keys/tvb.serveric.pub b/keys/tvb.serveric.pub new file mode 100644 index 0000000..58fe3a3 --- /dev/null +++ b/keys/tvb.serveric.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDUYCjEQPQ/i3GrUuyzxAgakQVjJkSJ+n01QMaiSvktQD2iujNtUlh3c2jJYy9yTBD71XcUruBFwwgeBUkKgDPITfrx0QYAu+yPPM3wQt35YXopuSu3zjjaimPpkwcNlaad74sa6poRXEUSa8W1oaFExJyot2anJEsyHb4S8iaOFZCre8ev5M5zzWtVcHdCpGjN/kKGlhuZZnaJHERtgt521V8F6xIThmPM2NNWaqmUWFQVI6o1P+PAobRVdlJGFCvum9Yk5zp+cAO5Kk+WjN4QU/5aZ9hoGMMp8STgU9fOy2JStAItGh8ZbW5YMLMuQvs9qD676DNLGNvzGR8KgTPWk52bvPzYLzMh8PPM6tZ/kMnTyF7hhyI2mC3LUE5kDOkK07BXI0PGtnblb0MbGdCUPXJJ+9/FAAw4La5nZdB+E9Ey5X5vO08uOuUe0wGOwQKN5JbjavDdZh6KHgKe8tUJ7L6Rkst60LH0MhrVB43KspbLJfwZ67uGB3v8zozuUWyJHaXGmJ4GfF4DzOmo2QR6sYgIaXehE5AIRosnVIwVP9Q6mkl4Edag46uUQtNZHCjbY/KyWIksful/sUfJi59zk2MEbf5ZDbgnYKEWPfBjMqLVy58voRW5v/vfBizTW2xFE0UTPXUcrzSMa9rbqej/GqWUZW8sHJev1vquR6cHOQ== tvb@ericthebox diff --git a/machine/serveric/default.nix b/machine/serveric/default.nix new file mode 100644 index 0000000..20bce2f --- /dev/null +++ b/machine/serveric/default.nix @@ -0,0 +1,76 @@ +{ config, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "serveric"; + networking.networkmanager.enable = true; + + i18n.defaultLocale = "en_US.UTF-8"; + + # Enable CUPS to print documents. + # services.printing.enable = true; + + # Enable sound. + # sound.enable = true; + # hardware.pulseaudio.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.tvb = { + initialPassword = "badpassword"; + isNormalUser = true; + extraGroups = [ + "wheel" # Enable sudo + ]; + openssh.authorizedKeys.keyFiles = [ + ../../keys/monitor.isidore.pub + ../../keys/tvb.serveric.pub + ../../keys/tvb.palamas.pub + ../../keys/tvb.stagirite.pub + ../../keys/tvb.vagrant.pub + ]; + }; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + vim + wget + htop + git + ]; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; + + # Enable the OpenSSH daemon. + services.openssh.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + networking.firewall.enable = false; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "22.11"; # Did you read the comment? + +} + diff --git a/machine/serveric/hardware-configuration.nix b/machine/serveric/hardware-configuration.nix new file mode 100644 index 0000000..a17e98e --- /dev/null +++ b/machine/serveric/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" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/79f05eab-abdc-4055-bbbc-3037dfa84b7f"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/AF12-B72C"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/ee3b8b2e-d1d4-4bf5-a66a-2a6a2fa2471f"; } + ]; + + # 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.eno1.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}