From f41cd58e54949da6978c8dadf19114c6ebbb6f8e Mon Sep 17 00:00:00 2001 From: Vinzenz Schroeter Date: Sat, 26 Oct 2024 14:59:00 +0200 Subject: [PATCH] transform the other hosts to flake --- common/globalinstalls.nix | 5 +- flake.nix | 24 +++++++++- hosts/hetzner-vpn1/default.nix | 9 ++++ .../hetzner-vpn1/environment.nix | 11 +---- .../hetzner-vpn1/hardware.nix | 1 - hosts/vinzenz-lpt2/default.nix | 2 + hosts/vinzenz-lpt2/environment.nix | 4 +- hosts/vinzenz-pc2/default.nix | 9 ++++ .../vinzenz-pc2/environment.nix | 30 +++++------- .../vinzenz-pc2/hardware.nix | 14 +++--- modules/amd-graphics.nix | 24 ++++++++++ modules_bak/hardware/amd.nix | 47 ------------------- 12 files changed, 90 insertions(+), 90 deletions(-) create mode 100644 hosts/hetzner-vpn1/default.nix rename modules_bak/hetzner-vpn1.nix => hosts/hetzner-vpn1/environment.nix (93%) rename modules_bak/hardware/hetzner-vpn1.nix => hosts/hetzner-vpn1/hardware.nix (99%) create mode 100644 hosts/vinzenz-pc2/default.nix rename modules_bak/vinzenz-pc2.nix => hosts/vinzenz-pc2/environment.nix (67%) rename modules_bak/hardware/vinzenz-pc2.nix => hosts/vinzenz-pc2/hardware.nix (87%) create mode 100644 modules/amd-graphics.nix delete mode 100644 modules_bak/hardware/amd.nix diff --git a/common/globalinstalls.nix b/common/globalinstalls.nix index b602f99..20bf11d 100644 --- a/common/globalinstalls.nix +++ b/common/globalinstalls.nix @@ -22,14 +22,11 @@ zsh.enable = true; htop.enable = true; iotop.enable = true; + git.enable = true; nano = { enable = true; syntaxHighlight = true; }; - git = { - enable = true; - package = pkgs.gitFull; - }; }; }; } diff --git a/flake.nix b/flake.nix index d50aed4..ffc2c07 100644 --- a/flake.nix +++ b/flake.nix @@ -19,7 +19,6 @@ }: let common-modules = [ lix-module.nixosModules.default - home-manager.nixosModules.home-manager ./common ]; in { @@ -29,9 +28,32 @@ modules = common-modules ++ [ + home-manager.nixosModules.home-manager ./hosts/vinzenz-lpt2 ]; }; + vinzenz-pc2 = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = + common-modules + ++ [ + home-manager.nixosModules.home-manager + ./hosts/vinzenz-pc2 + ]; + }; + hetzner-vpn1 = nixpkgs.lib.nixosSystem { + system = "aarch64-linux"; + modules = + common-modules + ++ [ + ./hosts/hetzner-vpn1 + + { + # uncomment for build check on non arm system (requires --impure) + # nixpkgs.buildPlatform = builtins.currentSystem; + } + ]; + }; }; }; } diff --git a/hosts/hetzner-vpn1/default.nix b/hosts/hetzner-vpn1/default.nix new file mode 100644 index 0000000..e2d62fe --- /dev/null +++ b/hosts/hetzner-vpn1/default.nix @@ -0,0 +1,9 @@ +{...}: { + imports = [ + ./hardware.nix + ./environment.nix + ]; + config = { + networking.hostName = "hetzner-vpn1"; + }; +} diff --git a/modules_bak/hetzner-vpn1.nix b/hosts/hetzner-vpn1/environment.nix similarity index 93% rename from modules_bak/hetzner-vpn1.nix rename to hosts/hetzner-vpn1/environment.nix index 7a06a07..280d8d7 100644 --- a/modules_bak/hetzner-vpn1.nix +++ b/hosts/hetzner-vpn1/environment.nix @@ -24,18 +24,11 @@ pc2 = "vinzenz-pc2.donkey-pentatonic.ts.net"; in { imports = [ - (import ./modules { - hostName = "hetzner-vpn1"; - enableHomeManager = false; - }) + ../../users/vinzenz.nix + ../../users/ronja.nix ]; config = { - my = { - enabledUsers = ["ronja" "vinzenz"]; - tailscale.enable = true; - }; - users.users = { root.openssh.authorizedKeys.keys = [ ''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICdYqY3Y1/f1bsAi5Qfyr/UWuX9ixu96IeAlhoQaJkbf'' diff --git a/modules_bak/hardware/hetzner-vpn1.nix b/hosts/hetzner-vpn1/hardware.nix similarity index 99% rename from modules_bak/hardware/hetzner-vpn1.nix rename to hosts/hetzner-vpn1/hardware.nix index e147668..7494a08 100644 --- a/modules_bak/hardware/hetzner-vpn1.nix +++ b/hosts/hetzner-vpn1/hardware.nix @@ -96,7 +96,6 @@ services.udev.extraRules = '' ATTR{address}=="96:00:02:87:7f:c9", NAME="eth0" - ''; }; } diff --git a/hosts/vinzenz-lpt2/default.nix b/hosts/vinzenz-lpt2/default.nix index 20b21b3..987bf07 100644 --- a/hosts/vinzenz-lpt2/default.nix +++ b/hosts/vinzenz-lpt2/default.nix @@ -5,5 +5,7 @@ ]; config = { networking.hostName = "vinzenz-lpt2"; + + nix.settings.extra-platforms = ["aarch64-linux"]; }; } diff --git a/hosts/vinzenz-lpt2/environment.nix b/hosts/vinzenz-lpt2/environment.nix index e85de40..66e6fe9 100644 --- a/hosts/vinzenz-lpt2/environment.nix +++ b/hosts/vinzenz-lpt2/environment.nix @@ -27,11 +27,11 @@ ''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFCJUpbpB3KEKVoKWsKoar9J4RNah8gmQoSH6jQEw5dY vinzenz-pixel-JuiceSSH'' ''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO1CRn4yYTL4XUdCebE8Z4ZeuMujBjorTdWifg911EOv vinzenz-pc2 home roaming'' ]; - # + #users.users.ronja.openssh.authorizedKeys.keys = [ # ''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIALWKm+d6KL6Vl3grPOcGouiNTkvdhXuWJmcrdEBY2nw ronja-ssh-host-key'' #]; - # + services.nginx = { enable = true; diff --git a/hosts/vinzenz-pc2/default.nix b/hosts/vinzenz-pc2/default.nix new file mode 100644 index 0000000..356f331 --- /dev/null +++ b/hosts/vinzenz-pc2/default.nix @@ -0,0 +1,9 @@ +{...}: { + imports = [ + ./hardware.nix + ./environment.nix + ]; + config = { + networking.hostName = "vinzenz-pc2"; + }; +} diff --git a/modules_bak/vinzenz-pc2.nix b/hosts/vinzenz-pc2/environment.nix similarity index 67% rename from modules_bak/vinzenz-pc2.nix rename to hosts/vinzenz-pc2/environment.nix index 82b0dd6..bde8e94 100644 --- a/modules_bak/vinzenz-pc2.nix +++ b/hosts/vinzenz-pc2/environment.nix @@ -1,26 +1,18 @@ {pkgs, ...}: { imports = [ - (import ./modules { - hostName = "vinzenz-pc2"; - enableHomeManager = true; - }) + ../../home + ../../home/gnome.nix + ../../users/vinzenz.nix + ../../modules/desktop-environment.nix + ../../modules/gnome.nix + ../../modules/gaming.nix + ../../modules/printing.nix ]; config = { - my = { - enabledUsers = ["vinzenz" "ronja"]; - tailscale.enable = true; - desktop = { - enableGnome = true; - enableGaming = true; - enablePrinting = true; - }; - buildtools = { - native = true; - dotnet = true; - rust = true; - jetbrains-remote-server = true; - }; + home-manager.users = { + vinzenz = import ../../home/vinzenz; + ronja = import ../../home/ronja; }; users.users.vinzenz.openssh.authorizedKeys.keys = [ @@ -39,7 +31,7 @@ port = 8542; host = "100.125.93.127"; # tailscale withoutConnectionToken = true; - extraPackages = with pkgs; [nodejs gitFull gh direnv]; + extraPackages = with pkgs; [nodejs git gh direnv]; }; virtualisation.podman = { diff --git a/modules_bak/hardware/vinzenz-pc2.nix b/hosts/vinzenz-pc2/hardware.nix similarity index 87% rename from modules_bak/hardware/vinzenz-pc2.nix rename to hosts/vinzenz-pc2/hardware.nix index 3f6ce4a..65b63d8 100644 --- a/modules_bak/hardware/vinzenz-pc2.nix +++ b/hosts/vinzenz-pc2/hardware.nix @@ -1,12 +1,12 @@ {...}: { + imports = [ + ../../modules/desktop-hardware.nix + ../../modules/amd-graphics.nix + ]; config = { - my.hardware = { - enableCommonDesktopSettings = true; - amd = { - cpu = true; - gpu = true; - }; - }; + # amd cpu + boot.kernelModules = ["kvm-amd"]; + hardware.cpu.amd.updateMicrocode = true; boot = { initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "sd_mod"]; # "usb_storage" diff --git a/modules/amd-graphics.nix b/modules/amd-graphics.nix new file mode 100644 index 0000000..426119e --- /dev/null +++ b/modules/amd-graphics.nix @@ -0,0 +1,24 @@ +{ + lib, + config, + pkgs, + ... +}: { + config = { + boot.kernelModules = ["amdgpu"]; + services.xserver.videoDrivers = ["amdgpu"]; + + hardware.opengl = { + extraPackages = with pkgs; [ + amdvlk + ]; + extraPackages32 = with pkgs; [ + driversi686Linux.amdvlk + ]; + }; + + environment.systemPackages = with pkgs; [ + nvtopPackages.amd + ]; + }; +} diff --git a/modules_bak/hardware/amd.nix b/modules_bak/hardware/amd.nix deleted file mode 100644 index 06f3a85..0000000 --- a/modules_bak/hardware/amd.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ - lib, - config, - pkgs, - ... -}: let - cfg = config.my.hardware.amd; -in { - options.my.hardware.amd = { - cpu = lib.mkEnableOption "amd cpu"; - gpu = lib.mkEnableOption "amd gpu"; - radeon = lib.mkEnableOption "amd legacy gpu"; # old hardware, dont judge - }; - - config = lib.mkMerge [ - (lib.mkIf cfg.cpu { - boot.kernelModules = ["kvm-amd"]; - hardware.cpu.amd.updateMicrocode = true; - }) - - (lib.mkIf cfg.gpu { - boot.kernelModules = ["amdgpu"]; - services.xserver.videoDrivers = ["amdgpu"]; - - hardware.opengl = { - extraPackages = with pkgs; [ - amdvlk - ]; - extraPackages32 = with pkgs; [ - driversi686Linux.amdvlk - ]; - }; - - environment.systemPackages = with pkgs; [ - nvtopPackages.amd - ]; - }) - - (lib.mkIf cfg.radeon { - boot.kernelModules = ["radeon"]; - services.xserver.videoDrivers = ["radeon"]; - environment.systemPackages = with pkgs; [ - radeontop - ]; - }) - ]; -}