From e11627bd8f4938892fc231b1d4adace2332bccae Mon Sep 17 00:00:00 2001 From: Jimbo Date: Thu, 27 Feb 2025 11:42:57 -0500 Subject: [PATCH] Add Jules' RockPro64 --- flake.nix | 1 + hosts/envy/default.nix | 1 + hosts/midas/default.nix | 1 + hosts/prophet/boot/default.nix | 2 +- hosts/redmond/boot/default.nix | 2 +- hosts/redmond/default.nix | 1 + hosts/rubble/default.nix | 21 +++++ hosts/rubble/disko/default.nix | 90 +++++++++++++++++++ hosts/rubble/hardware/default.nix | 9 ++ hosts/rubble/id_ed25519.pub | 1 + hosts/rubble/users/default.nix | 4 + hosts/rubble/users/main/default.nix | 7 ++ .../programs/gui/looking-glass/default.nix | 2 +- .../accounts/users/custom/main/default.nix | 1 + modules/system/devices/boot/default.nix | 1 + .../system/devices/boot/extlinux/default.nix | 10 +++ .../system/devices/boot/plymouth/default.nix | 4 +- modules/system/devices/video/default.nix | 2 +- 18 files changed, 155 insertions(+), 5 deletions(-) create mode 100644 hosts/rubble/default.nix create mode 100644 hosts/rubble/disko/default.nix create mode 100644 hosts/rubble/hardware/default.nix create mode 100644 hosts/rubble/id_ed25519.pub create mode 100644 hosts/rubble/users/default.nix create mode 100644 hosts/rubble/users/main/default.nix create mode 100644 modules/system/devices/boot/extlinux/default.nix diff --git a/flake.nix b/flake.nix index 85f240f..3ea84bb 100644 --- a/flake.nix +++ b/flake.nix @@ -65,6 +65,7 @@ kitty = mkNix [ ./hosts/kitty ]; # Dell Optiplex 7010 midas = mkNix [ ./hosts/midas ]; # Dell Optiplex 5040 prophet = mkNix [ ./hosts/prophet ]; # Oracle Neoverse-N1 + rubble = mkNix [ ./hosts/rubble ]; # ROCKPro64 SBC }; # home-manager switch --flake /etc/nixos#username diff --git a/hosts/envy/default.nix b/hosts/envy/default.nix index 7682b0f..86dbc07 100644 --- a/hosts/envy/default.nix +++ b/hosts/envy/default.nix @@ -17,6 +17,7 @@ system = { desktop.enable = true; lanzaboote.enable = true; + fancyboot.enable = true; wireless.enable = true; wireguard.client.enable = true; libvirtd.enable = true; diff --git a/hosts/midas/default.nix b/hosts/midas/default.nix index 3d1e5ff..fff98f7 100644 --- a/hosts/midas/default.nix +++ b/hosts/midas/default.nix @@ -16,6 +16,7 @@ system = { desktop.enable = true; lanzaboote.enable = true; + fancyboot.enable = true; libvirtd.enable = true; stateVersion = "24.11"; }; diff --git a/hosts/prophet/boot/default.nix b/hosts/prophet/boot/default.nix index 3293d0c..09fcf4e 100644 --- a/hosts/prophet/boot/default.nix +++ b/hosts/prophet/boot/default.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, ... }: +{ pkgs, ... }: { boot = { kernelPackages = pkgs.linuxPackages_hardened; diff --git a/hosts/redmond/boot/default.nix b/hosts/redmond/boot/default.nix index 5205a4d..0fe3db8 100644 --- a/hosts/redmond/boot/default.nix +++ b/hosts/redmond/boot/default.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ ... }: { boot.kernelParams = [ "radeon.cik_support=0" diff --git a/hosts/redmond/default.nix b/hosts/redmond/default.nix index c309ba8..1f77ab0 100644 --- a/hosts/redmond/default.nix +++ b/hosts/redmond/default.nix @@ -18,6 +18,7 @@ system = { desktop.enable = true; lanzaboote.enable = true; + fancyboot.enable = true; wireless.enable = true; wireguard.client.enable = true; stateVersion = "24.05"; diff --git a/hosts/rubble/default.nix b/hosts/rubble/default.nix new file mode 100644 index 0000000..1bbf19c --- /dev/null +++ b/hosts/rubble/default.nix @@ -0,0 +1,21 @@ +{ ... }: +{ + imports = [ + ./disko + ./hardware + ./users + ../../modules/system + ]; + + networking = { + hostName = "rubble"; + hostId = "3d16423a"; + }; + + system = { + desktop.enable = true; + extlinux.enable = true; + wireguard.client.enable = true; + stateVersion = "24.11"; + }; +} diff --git a/hosts/rubble/disko/default.nix b/hosts/rubble/disko/default.nix new file mode 100644 index 0000000..4022bcc --- /dev/null +++ b/hosts/rubble/disko/default.nix @@ -0,0 +1,90 @@ +{ config, disko, ... }: +{ + imports = [ disko.nixosModules.disko ]; + + disko.devices = { + disk = { + "${config.networking.hostName}" = { + type = "disk"; + device = "/dev/mmcblk1"; + content = { + type = "gpt"; + partitions = { + ESP = { + priority = 1; + size = "2G"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "umask=0077" ]; + }; + }; + luks = { + size = "100%"; + content = { + type = "luks"; + name = "${config.networking.hostName}-disk"; + settings.allowDiscards = true; + passwordFile = "/tmp/secret.key"; + content = { + type = "lvm_pv"; + vg = "${config.networking.hostName}"; + }; + }; + }; + }; + }; + }; + }; + + lvm_vg = { + "${config.networking.hostName}" = { + type = "lvm_vg"; + lvs = { + root = { + size = "100%"; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; + subvolumes = { + "/root" = { + mountpoint = "/"; + mountOptions = [ "compress=zstd" "noatime" "ssd" ]; + }; + "/prev" = { + mountpoint = "/prev"; + mountOptions = [ "compress=zstd" "noatime" "ssd" "noexec" ]; + }; + "/nix" = { + mountpoint = "/nix"; + mountOptions = [ "compress=zstd" "noatime" "ssd" ]; + }; + + # Impermanence + "/persist" = { + mountpoint = "/persist"; + mountOptions = [ "compress=zstd" "noatime" "ssd" ]; + }; + "/persist/.snapshots" = { }; + "/persist/home/${config.sysusers.main}" = { }; + "/persist/home/${config.sysusers.main}/.snapshots" = { }; + }; + }; + }; + swap = { + size = "4G"; + content = { + type = "swap"; + discardPolicy = "both"; + }; + }; + }; + }; + }; + }; + + # Needed for impermanence + fileSystems."/persist".neededForBoot = true; +} diff --git a/hosts/rubble/hardware/default.nix b/hosts/rubble/hardware/default.nix new file mode 100644 index 0000000..807641a --- /dev/null +++ b/hosts/rubble/hardware/default.nix @@ -0,0 +1,9 @@ +{ config, lib, modulesPath, ... }: +{ + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + + boot.initrd.kernelModules = [ "ahci" "dm-snapshot" "mmc_core" "pcie_rockchip_host" "phy_rockchip_pcie" "rockchip_dfi" "rockchip_thermal" "rtc_rk808" "rockchip_saradc" "uas" "fusb302" ]; + + networking.useDHCP = lib.mkDefault true; + nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux"; +} diff --git a/hosts/rubble/id_ed25519.pub b/hosts/rubble/id_ed25519.pub new file mode 100644 index 0000000..d68e4cd --- /dev/null +++ b/hosts/rubble/id_ed25519.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF4oyz5yAvmVZDdr3NL2AmlnCA6Z17b2Vj0FXj07DFiv jimbo@rubble diff --git a/hosts/rubble/users/default.nix b/hosts/rubble/users/default.nix new file mode 100644 index 0000000..57e7f20 --- /dev/null +++ b/hosts/rubble/users/default.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + imports = [ ./main ]; +} diff --git a/hosts/rubble/users/main/default.nix b/hosts/rubble/users/main/default.nix new file mode 100644 index 0000000..fed1d31 --- /dev/null +++ b/hosts/rubble/users/main/default.nix @@ -0,0 +1,7 @@ +{ config, lib, ... }: +{ + home-manager.users."${config.sysusers.main}".home = { + desktop.enable = true; + stateVersion = lib.mkForce config.system.stateVersion; + }; +} diff --git a/modules/home/programs/gui/looking-glass/default.nix b/modules/home/programs/gui/looking-glass/default.nix index cac6897..9e1f6b1 100644 --- a/modules/home/programs/gui/looking-glass/default.nix +++ b/modules/home/programs/gui/looking-glass/default.nix @@ -1,7 +1,7 @@ { config, ... }: { programs.looking-glass-client = { - enable = config.home.desktop.enable; + enable = if config.home.desktop.enable && config.nixpkgs.system == "x86_64-linux" then true else false; settings = { input = { rawMouse = true; diff --git a/modules/system/accounts/users/custom/main/default.nix b/modules/system/accounts/users/custom/main/default.nix index 79cfe4a..fe5fbf9 100644 --- a/modules/system/accounts/users/custom/main/default.nix +++ b/modules/system/accounts/users/custom/main/default.nix @@ -19,6 +19,7 @@ ../../../../../../hosts/kitty/id_ed25519.pub ../../../../../../hosts/midas/id_ed25519.pub ../../../../../../hosts/prophet/id_ed25519.pub + ../../../../../../hosts/rubble/id_ed25519.pub ]; openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJahAoF74BY6GCTsFkt1ADKaraFgJJozW1Y1aBTLK0j9 Pixel9" diff --git a/modules/system/devices/boot/default.nix b/modules/system/devices/boot/default.nix index 25be28b..42ea1f1 100644 --- a/modules/system/devices/boot/default.nix +++ b/modules/system/devices/boot/default.nix @@ -1,6 +1,7 @@ { ... }: { imports = [ + ./extlinux ./lanzaboote ./plymouth ./services diff --git a/modules/system/devices/boot/extlinux/default.nix b/modules/system/devices/boot/extlinux/default.nix new file mode 100644 index 0000000..95858ea --- /dev/null +++ b/modules/system/devices/boot/extlinux/default.nix @@ -0,0 +1,10 @@ +{ config, lib, ... }: +{ + options.system.extlinux.enable = lib.mkEnableOption "Enable extlinux"; + + config.boot.loader = lib.mkIf config.system.extlinux.enable { + grub.enable = false; + systemd-boot.enable = lib.mkForce false; + generic-extlinux-compatible.enable = true; + }; +} diff --git a/modules/system/devices/boot/plymouth/default.nix b/modules/system/devices/boot/plymouth/default.nix index 48c0cc8..8c8c2de 100644 --- a/modules/system/devices/boot/plymouth/default.nix +++ b/modules/system/devices/boot/plymouth/default.nix @@ -1,6 +1,8 @@ { config, lib, ... }: { - boot = lib.mkIf config.system.desktop.enable { + options.system.fancyboot.enable = lib.mkEnableOption "Enable Plymouth"; + + config.boot = lib.mkIf config.system.desktop.enable { plymouth.enable = true; loader.timeout = lib.mkForce 0; consoleLogLevel = lib.mkForce 0; diff --git a/modules/system/devices/video/default.nix b/modules/system/devices/video/default.nix index bf73acf..adcee9a 100644 --- a/modules/system/devices/video/default.nix +++ b/modules/system/devices/video/default.nix @@ -7,7 +7,7 @@ hardware.graphics = { enable = config.system.desktop.enable; - enable32Bit = true; + enable32Bit = if config.nixpkgs.hostPlatform == "x86_64-linux" then true else false; extraPackages = with pkgs; [ vulkan-loader vulkan-validation-layers