From a0a3dcde99c4a8aa19b23ead79c08eedca30d002 Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Sat, 8 Oct 2022 01:04:01 +0300 Subject: 2022-10-08 --- configurations/default.nix | 14 +++++ configurations/manwe/default.nix | 41 +++---------- configurations/melian/default.nix | 117 ++++++++++++++++++------------------- configurations/varda/default.nix | 45 ++++---------- configurations/yavanna/default.nix | 30 ---------- 5 files changed, 89 insertions(+), 158 deletions(-) (limited to 'configurations') diff --git a/configurations/default.nix b/configurations/default.nix index 40c133f..684b4e4 100644 --- a/configurations/default.nix +++ b/configurations/default.nix @@ -18,6 +18,7 @@ with lib; let }); in mapAttrs' mkConfiguration { + # A dummy configuration to test the "headless" profile. test-headless = { modules = with inputs; [ "${nixpkgs}/nixos/modules/profiles/qemu-guest.nix" @@ -31,6 +32,7 @@ in }; }; + # A dummy configuration to test the "headful" profile. test-headful = { modules = with inputs; [ "${nixpkgs}/nixos/modules/profiles/qemu-guest.nix" @@ -44,12 +46,22 @@ in }; }; + # Planned: a beefy tower desktop PC. + # eonwe.modules = with inputs; [ + # nixos-hardware.nixosModules.common-cpu-amd + # nixos-hardware.nixosModules.common-gpu-amd + # nixos-hardware.nixosModules.common-pc-ssd + # nixpkgs.nixosModules.notDetected + # ]; + + # ThinkPad T480. melian.modules = with inputs; [ nixos-hardware.nixosModules.common-pc-laptop-ssd nixos-hardware.nixosModules.lenovo-thinkpad-t480 nixpkgs.nixosModules.notDetected ]; + # VPS: Germany manwe.modules = with inputs; [ "${nixpkgs}/nixos/modules/profiles/qemu-guest.nix" nixos-hardware.nixosModules.common-cpu-amd @@ -57,6 +69,7 @@ in nixpkgs.nixosModules.notDetected ]; + # VPS: Germany varda.modules = with inputs; [ "${nixpkgs}/nixos/modules/profiles/qemu-guest.nix" nixos-hardware.nixosModules.common-cpu-amd @@ -64,6 +77,7 @@ in nixpkgs.nixosModules.notDetected ]; + # VPS: France yavanna.modules = with inputs; [ "${nixpkgs}/nixos/modules/profiles/qemu-guest.nix" nixos-hardware.nixosModules.common-cpu-intel diff --git a/configurations/manwe/default.nix b/configurations/manwe/default.nix index 5531cb9..db08c3f 100644 --- a/configurations/manwe/default.nix +++ b/configurations/manwe/default.nix @@ -43,45 +43,20 @@ with lib; { vaultwarden.enable = true; }; - networking = let - interface = "eth0"; - in { - interfaces.${interface} = { - ipv4.addresses = [ - { - inherit (this.ipv4) address; - prefixLength = 22; - } - ]; - - ipv6.addresses = [ - { - inherit (this.ipv6) address; - prefixLength = 64; - } - ]; - }; - - defaultGateway = { - inherit interface; - address = this.ipv4.gateway; - }; - - defaultGateway6 = { - inherit interface; - address = this.ipv6.gateway; - }; - - nat.externalInterface = interface; - }; - boot = { loader.grub = { enable = true; device = "/dev/sda"; }; - initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod"]; + initrd.availableKernelModules = [ + "ata_piix" + "sd_mod" + "sr_mod" + "uhci_hcd" + "virtio_pci" + "virtio_scsi" + ]; }; fileSystems = { diff --git a/configurations/melian/default.nix b/configurations/melian/default.nix index 0aca218..3ef0e46 100644 --- a/configurations/melian/default.nix +++ b/configurations/melian/default.nix @@ -7,7 +7,6 @@ with lib; { nixfiles.modules = { games = { lutris.enable = true; - minecraft.client.enable = true; steam.enable = true; }; @@ -38,31 +37,45 @@ with lib; { }; }; - fileSystems = { - "/boot" = { - device = "/dev/disk/by-uuid/1083-C8A0"; - fsType = "vfat"; - }; - - "/" = { - device = "/dev/disk/by-uuid/bb8b09dc-cc67-47e5-8280-532b17a9e62a"; - fsType = "xfs"; - options = ["noatime"]; - }; + hardware.trackpoint = { + enable = true; + speed = 500; + sensitivity = 250; }; - # NOTE This will make hibernation extremely hard if on an encrypted partition. - # This also could not work on ZFS or Btrfs. - swapDevices = [ - { - device = "/swapfile"; - size = 8 * 1024; - } - ]; + powerManagement = let + modprobe = "${pkgs.kmod}/bin/modprobe"; + in { + enable = true; - zramSwap = { + # This fixes an issue with not being able to suspend or wake up from suspend + # due to a kernel bug[1]. + # + # [1]: https://bbs.archlinux.org/viewtopic.php?id=270964 + # [1]: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/522998 + # [1]: https://bugs.launchpad.net/ubuntu/+source/pm-utils/+bug/562484/comments/3 + # [1]: https://gist.github.com/ioggstream/8f380d398aef989ac455b93b92d42048 + powerDownCommands = "${modprobe} -r xhci_pci"; + powerUpCommands = "${modprobe} xhci_pci"; + }; + + services.thinkfan = { enable = true; - memoryPercent = 25; + + settings = { + sensors = [ + { + hwmon = "/sys/class/hwmon"; + name = "coretemp"; + indices = [1]; + } + ]; + fans = [{tpacpi = "/proc/acpi/ibm/fan";}]; + levels = [ + ["level auto" 0 50] + ["level disengaged" 50 32767] + ]; + }; }; boot = { @@ -91,48 +104,30 @@ with lib; { }; }; - hardware.trackpoint = { - enable = true; - speed = 500; - sensitivity = 250; - }; - - powerManagement = let - modprobe = "${pkgs.kmod}/bin/modprobe"; - in { - enable = true; + fileSystems = { + "/boot" = { + device = "/dev/disk/by-uuid/1083-C8A0"; + fsType = "vfat"; + }; - # This fixes an issue with not being able to suspend or wake up from suspend - # due to a kernel bug[1]. - # - # [1]: https://bbs.archlinux.org/viewtopic.php?id=270964 - # [1]: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/522998 - # [1]: https://bugs.launchpad.net/ubuntu/+source/pm-utils/+bug/562484/comments/3 - # [1]: https://gist.github.com/ioggstream/8f380d398aef989ac455b93b92d42048 - powerDownCommands = "${modprobe} -r xhci_pci"; - powerUpCommands = "${modprobe} xhci_pci"; + "/" = { + device = "/dev/disk/by-uuid/bb8b09dc-cc67-47e5-8280-532b17a9e62a"; + fsType = "xfs"; + options = ["noatime"]; + }; }; - services = { - thinkfan = { - enable = true; - - settings = { - sensors = [ - { - hwmon = "/sys/class/hwmon"; - name = "coretemp"; - indices = [1]; - } - ]; - fans = [{tpacpi = "/proc/acpi/ibm/fan";}]; - levels = [ - ["level auto" 0 50] - ["level disengaged" 50 32767] - ]; - }; - }; + # NOTE This will make hibernation extremely hard if on an encrypted partition. + # This also could not work on ZFS or Btrfs. + swapDevices = [ + { + device = "/swapfile"; + size = 8 * 1024; + } + ]; - # xserver.videoDrivers = ["intel" "modesetting"]; + zramSwap = { + enable = true; + memoryPercent = 25; }; } diff --git a/configurations/varda/default.nix b/configurations/varda/default.nix index ac7b493..5e0914e 100644 --- a/configurations/varda/default.nix +++ b/configurations/varda/default.nix @@ -7,41 +7,11 @@ with lib; { nixfiles.modules = { wireguard.client.enable = true; - # games.minecraft.server = { - # enable = true; - # memory = "6G"; - # }; - acme.enable = true; - }; - - networking = let - interface = "eth0"; - in { - interfaces.${interface} = { - ipv4.addresses = [ - { - inherit (this.ipv4) address; - prefixLength = 22; - } - ]; - - ipv6.addresses = [ - { - inherit (this.ipv6) address; - prefixLength = 64; - } - ]; - }; - - defaultGateway = { - inherit interface; - address = this.ipv4.gateway; - }; - defaultGateway6 = { - inherit interface; - address = this.ipv6.gateway; + games.minecraft.server = { + enable = false; # Disabled because no one is playing now. + memory = "6G"; }; }; @@ -55,7 +25,14 @@ with lib; { }; }; - initrd.availableKernelModules = ["ata_piix" "sd_mod" "sr_mod" "uhci_hcd" "virtio_pci" "virtio_scsi"]; + initrd.availableKernelModules = [ + "ata_piix" + "sd_mod" + "sr_mod" + "uhci_hcd" + "virtio_pci" + "virtio_scsi" + ]; }; fileSystems = { diff --git a/configurations/yavanna/default.nix b/configurations/yavanna/default.nix index aa3118e..e3172a6 100644 --- a/configurations/yavanna/default.nix +++ b/configurations/yavanna/default.nix @@ -14,36 +14,6 @@ with lib; { rtorrent.enable = true; }; - networking = let - interface = "eth0"; - in { - interfaces.${interface} = { - ipv4.addresses = [ - { - inherit (this.ipv4) address; - prefixLength = 24; - } - ]; - - ipv6.addresses = [ - { - inherit (this.ipv6) address; - prefixLength = 128; - } - ]; - }; - - defaultGateway = { - inherit interface; - address = this.ipv4.gateway; - }; - - defaultGateway6 = { - inherit interface; - address = this.ipv6.gateway; - }; - }; - boot = { loader.grub = { enable = true; -- cgit v1.2.3