From 90ea287d60aa49903415b8d52ec25e99b897352d Mon Sep 17 00:00:00 2001 From: Raphael Date: Sun, 16 Mar 2025 20:21:45 +0100 Subject: [PATCH] feat: adding the server configuration --- flake.nix | 37 ++++++++----- hosts/fix/configuration.nix | 5 ++ hosts/server/configuration.nix | 68 +++++++++++++++++++++++ hosts/server/hardware-configuration.nix | 73 +++++++++++++++++++++++++ 4 files changed, 170 insertions(+), 13 deletions(-) create mode 100644 hosts/server/configuration.nix create mode 100644 hosts/server/hardware-configuration.nix diff --git a/flake.nix b/flake.nix index f75b9a5..6eb8023 100644 --- a/flake.nix +++ b/flake.nix @@ -17,20 +17,31 @@ config.allowUnfree = true; }; in { - nixosConfigurations."nixos-fix" = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - ./hosts/fix/configuration.nix - ]; - specialArgs = { - inherit inputs; + nixosConfigurations = { + "nixos-fix" = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./hosts/fix/configuration.nix + ]; + specialArgs = { + inherit inputs; + }; + }; + "nixos-server" = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./hosts/server/configuration.nix + ]; + specialArgs = { + inherit inputs; + }; + }; + "nixos-asahi" = nixpkgs.lib.nixosSystem { + system = "aarch64-linux"; + modules = [ + ./hosts/asahi/configuration.nix + ]; }; - }; - nixosConfigurations."nixos-asahi" = nixpkgs.lib.nixosSystem { - system = "aarch64-linux"; - modules = [ - ./hosts/asahi/configuration.nix - ]; }; }; } diff --git a/hosts/fix/configuration.nix b/hosts/fix/configuration.nix index c106d2a..4c243a5 100644 --- a/hosts/fix/configuration.nix +++ b/hosts/fix/configuration.nix @@ -74,6 +74,11 @@ ]; programs = { + appimage = { + enable = true; + binfmt = true; + package = pkgs.appimage-run.override { extraPkgs = pkgs: [ pkgs.libthai ]; }; + }; hyprland = { enable = true; xwayland.enable = true; diff --git a/hosts/server/configuration.nix b/hosts/server/configuration.nix new file mode 100644 index 0000000..e4f275f --- /dev/null +++ b/hosts/server/configuration.nix @@ -0,0 +1,68 @@ +{ inputs, config, pkgs, lib, ... }: + +{ + imports = [ + ../global.nix + ./hardware-configuration.nix + ../../modules/games/global.nix + ../../services/discord.nix + ../../services/games.nix + ]; + + networking = { + hostName = "nixos-fix"; + firewall.enable = false; + networkmanager.enable = true; + wireless.enable = false; + }; + + service = { + minecraft = { + enium-pv = true; + }; + bot_discord = { + master = true; + music = true; + tempvoc = true; + ticket = true; + }; + }; + + users = { + defaultUserShell = pkgs.zsh; + }; + + # Bootloader. + boot.loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + + services = { + seatd.enable = true; + openssh = { + enable = true; + ports = [ 42131 ]; + }; + pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; + udev.extraRules = '' + SUBSYSTEM=="usb", ATTR{idVendor}=="0483", ATTR{idProduct}=="5740", MODE="0666" + ''; + redis.servers."" = { + enable = true; + }; + postgresql = { + enable = true; + }; + }; + + virtualisation.docker.enable = true; + + system.stateVersion = "24.05"; +} diff --git a/hosts/server/hardware-configuration.nix b/hosts/server/hardware-configuration.nix new file mode 100644 index 0000000..aedd31c --- /dev/null +++ b/hosts/server/hardware-configuration.nix @@ -0,0 +1,73 @@ +# 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") + ]; + +# services.dbus.enable = true; + boot = { + initrd = { + availableKernelModules = [ + "xhci_pci" + "ahci" + "usbhid" + "sd_mod" + ]; + kernelModules = []; + }; + kernelModules = [ + "kvm-intel" + ]; + extraModulePackages = []; + }; + + fileSystems = { + "/" = { + device = "/dev/disk/by-uuid/a943d592-57d3-497e-bf43-49b50ac73f0b"; + fsType = "ext4"; + }; + "/boot" = { + device = "/dev/disk/by-uuid/5AAB-0026"; + fsType = "vfat"; + options = [ + "fmask=0077" + "dmask=0077" + ]; + }; + "/mnt/data" = { + device = "/dev/disk/by-uuid/5729d30c-5806-4ccd-8a2a-080a258084dc"; + fsType = "ext4"; + }; + }; + + 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.docker0.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true; + + services.xserver.videoDrivers = ["nvidia"]; + + hardware = { + graphics.enable = true; + nvidia = { + open = false; + modesetting.enable = true; + powerManagement.enable = false; + powerManagement.finegrained = false; + nvidiaSettings = true; + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; + }; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}