From 737603403aabdeb3e6860c2a25609fd2cf1f757b Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Thu, 17 Aug 2023 02:03:48 +0800 Subject: [PATCH] feat: aarch64 host - suzu --- flake.lock | 63 +++++++++++++++++++-- flake.nix | 92 +++++++++++++++++++++++-------- hosts/12kingdoms/suzu/default.nix | 61 ++++++++++++++++++++ hosts/README.md | 4 ++ modules/nixos/remote-building.nix | 4 ++ 5 files changed, 195 insertions(+), 29 deletions(-) create mode 100644 hosts/12kingdoms/suzu/default.nix diff --git a/flake.lock b/flake.lock index 122a1b50..75935cd2 100644 --- a/flake.lock +++ b/flake.lock @@ -421,6 +421,23 @@ "type": "github" } }, + "mesa-panfork": { + "flake": false, + "locked": { + "lastModified": 1670633863, + "narHash": "sha256-4eZHMiYS+sRDHNBtLZTA8ELZnLns7yT3USU5YQswxQ0=", + "owner": "panfork", + "repo": "mesa", + "rev": "120202c675749c5ef81ae4c8cdc30019b4de08f4", + "type": "gitlab" + }, + "original": { + "owner": "panfork", + "ref": "csf", + "repo": "mesa", + "type": "gitlab" + } + }, "mysecrets": { "flake": false, "locked": { @@ -461,7 +478,7 @@ "nix-eval-jobs": { "inputs": { "flake-parts": "flake-parts_2", - "nixpkgs": "nixpkgs_5", + "nixpkgs": "nixpkgs_6", "treefmt-nix": "treefmt-nix" }, "locked": { @@ -533,6 +550,25 @@ "type": "github" } }, + "nixos-rk3588": { + "inputs": { + "mesa-panfork": "mesa-panfork", + "nixpkgs": "nixpkgs_4" + }, + "locked": { + "lastModified": 1692208784, + "narHash": "sha256-3AetKtb1oz1vJ7ZTy78v642Bwz/NxPahNCVN9eqO8rU=", + "owner": "ryan4yin", + "repo": "nixos-rk3588", + "rev": "db96e4436b369a3b7e52e285347bed2bec6337b6", + "type": "github" + }, + "original": { + "owner": "ryan4yin", + "repo": "nixos-rk3588", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1677676435, @@ -601,7 +637,7 @@ "flake-compat": "flake-compat", "lib-aggregate": "lib-aggregate", "nix-eval-jobs": "nix-eval-jobs", - "nixpkgs": "nixpkgs_6", + "nixpkgs": "nixpkgs_7", "nixpkgs_sirula": "nixpkgs_sirula" }, "locked": { @@ -651,6 +687,22 @@ } }, "nixpkgs_4": { + "locked": { + "lastModified": 1691486536, + "narHash": "sha256-W2jYTn6rNiJEpjXkOiZxNltgxxwgeZE5cQ967NgsrHU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "8fa39adf946a4470610b38fd7aff0a73ad4356c3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.05-small", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_5": { "locked": { "lastModified": 1691693223, "narHash": "sha256-9t8ZY1XNAsWqxAJmXgg+GXqF5chORMVnBT6PSHaRV3I=", @@ -666,7 +718,7 @@ "type": "github" } }, - "nixpkgs_5": { + "nixpkgs_6": { "locked": { "lastModified": 1691629382, "narHash": "sha256-6bil2OX12qy2CD6dLDxSTKRu6aUKRZfT/Qw3pg1050Q=", @@ -682,7 +734,7 @@ "type": "github" } }, - "nixpkgs_6": { + "nixpkgs_7": { "locked": { "lastModified": 1691654369, "narHash": "sha256-gSILTEx1jRaJjwZxRlnu3ZwMn1FVNk80qlwiCX8kmpo=", @@ -751,7 +803,8 @@ "nix-darwin": "nix-darwin", "nixos-generators": "nixos-generators", "nixos-licheepi4a": "nixos-licheepi4a", - "nixpkgs": "nixpkgs_4", + "nixos-rk3588": "nixos-rk3588", + "nixpkgs": "nixpkgs_5", "nixpkgs-darwin": "nixpkgs-darwin", "nixpkgs-unstable": "nixpkgs-unstable", "nixpkgs-wayland": "nixpkgs-wayland", diff --git a/flake.nix b/flake.nix index bc35b730..895cfb3d 100644 --- a/flake.nix +++ b/flake.nix @@ -21,6 +21,7 @@ home-manager, nixos-generators, nixos-licheepi4a, + nixos-rk3588, ... }: let username = "ryan"; @@ -30,7 +31,8 @@ x64_system = "x86_64-linux"; x64_darwin = "x86_64-darwin"; riscv64_system = "riscv64-linux"; - allSystems = [x64_system x64_darwin]; + aarch64_system = "aarch64-linux"; + allSystems = [x64_system x64_darwin riscv64_system aarch64_system]; nixosSystem = import ./lib/nixosSystem.nix; macosSystem = import ./lib/macosSystem.nix; @@ -97,6 +99,15 @@ }; rolling_yukina_tags = ["riscv" "yukina"]; + # 大木 鈴, Ōki Suzu + _12kingdoms_suzu_modules = { + nixos-modules = [ + ./hosts/12kingdoms/suzu + ]; + # home-module = import ./home/linux/server.nix; + }; + _12kingdoms_suzu_tags = ["aarch" "suzu"]; + x64_specialArgs = { inherit username userfullname useremail; @@ -112,7 +123,7 @@ nixosConfigurations = let base_args = { inherit home-manager nixos-generators; - nixpkgs = nixpkgs; # or nixpkgs-unstable + nixpkgs = nixpkgs; # or nixpkgs-unstable system = x64_system; specialArgs = x64_specialArgs; }; @@ -130,47 +141,76 @@ # colmena - remote deployment via SSH colmena = let + # x86_64 related x64_base_args = { inherit home-manager; - nixpkgs = nixpkgs; # or nixpkgs-unstable + nixpkgs = nixpkgs; # or nixpkgs-unstable specialArgs = x64_specialArgs; }; + # riscv64 related # using the same nixpkgs as nixos-licheepi4a to utilize the cross-compilation cache. - lpi4a_pkgs = import nixos-licheepi4a.inputs.nixpkgs { system = x64_system; }; - lpi4a_specialArgs = { - inherit username userfullname useremail; - pkgsKernel = nixos-licheepi4a.packages.${x64_system}.pkgsKernelCross; - } // inputs; + lpi4a_pkgs = import nixos-licheepi4a.inputs.nixpkgs {system = x64_system;}; + lpi4a_specialArgs = + { + inherit username userfullname useremail; + pkgsKernel = nixos-licheepi4a.packages.${x64_system}.pkgsKernelCross; + } + // inputs; lpi4a_base_args = { inherit home-manager; - nixpkgs = nixos-licheepi4a.inputs.nixpkgs; # or nixpkgs-unstable + nixpkgs = nixos-licheepi4a.inputs.nixpkgs; # or nixpkgs-unstable specialArgs = lpi4a_specialArgs; targetUser = "root"; }; + + # aarch64 related + # using the same nixpkgs as nixos-rk3588 to utilize the cross-compilation cache. + rk3588_pkgs = import nixos-rk3588.inputs.nixpkgs {system = x64_system;}; + rk3588_specialArgs = + { + inherit username userfullname useremail; + } + // nixos-rk3588.inputs; + rk3588_base_args = { + inherit home-manager; + nixpkgs = nixos-rk3588.inputs.nixpkgs; # or nixpkgs-unstable + specialArgs = rk3588_specialArgs; + targetUser = "root"; + }; in { meta = { - nixpkgs = import nixpkgs { system = x64_system; }; + nixpkgs = import nixpkgs {system = x64_system;}; specialArgs = x64_specialArgs; nodeSpecialArgs = { + # riscv64 SBCs nozomi = lpi4a_specialArgs; yukina = lpi4a_specialArgs; + + # aarch64 SBCs + suzu = rk3588_specialArgs; }; nodeNixpkgs = { nozomi = lpi4a_pkgs; yukina = lpi4a_pkgs; + + # aarch64 SBCs + suzu = rk3588_pkgs; }; }; # proxmox virtual machines(x86_64) - aquamarine = colemnaSystem (idol_aquamarine_modules // x64_base_args // { host_tags = idol_aquamarine_tags; }); - ruby = colemnaSystem (idol_ruby_modules // x64_base_args // { host_tags = idol_ruby_tags; }); - kana = colemnaSystem (idol_kana_modules // x64_base_args // { host_tags = idol_kana_tags; }); + aquamarine = colemnaSystem (idol_aquamarine_modules // x64_base_args // {host_tags = idol_aquamarine_tags;}); + ruby = colemnaSystem (idol_ruby_modules // x64_base_args // {host_tags = idol_ruby_tags;}); + kana = colemnaSystem (idol_kana_modules // x64_base_args // {host_tags = idol_kana_tags;}); # riscv64 SBCs - nozomi = colemnaSystem (rolling_nozomi_modules // lpi4a_base_args // { host_tags = rolling_nozomi_tags; }); - yukina = colemnaSystem (rolling_yukina_modules // lpi4a_base_args // { host_tags = rolling_yukina_tags; }); + nozomi = colemnaSystem (rolling_nozomi_modules // lpi4a_base_args // {host_tags = rolling_nozomi_tags;}); + yukina = colemnaSystem (rolling_yukina_modules // lpi4a_base_args // {host_tags = rolling_yukina_tags;}); + + # aarch64 SBCs + suzu = colemnaSystem (_12kingdoms_suzu_modules // rk3588_base_args // {host_tags = _12kingdoms_suzu_tags;}); }; # take system images for idols @@ -213,12 +253,13 @@ inherit nix-darwin home-manager system specialArgs nixpkgs; }; in { - harmonica = macosSystem (base_args // { - darwin-modules = [ - ./hosts/harmonica - ]; - home-module = import ./home/darwin; - }); + harmonica = macosSystem (base_args + // { + darwin-modules = [ + ./hosts/harmonica + ]; + home-module = import ./home/darwin; + }); }; # format the nix code in this flake @@ -229,7 +270,6 @@ ); }; - # This is the standard format for flake.nix. `inputs` are the dependencies of the flake, # Each item in `inputs` will be passed as a parameter to the `outputs` function after being pulled and built. inputs = { @@ -261,7 +301,7 @@ # community wayland nixpkgs nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland"; # anyrun - a wayland launcher - anyrun ={ + anyrun = { url = "github:Kirottu/anyrun"; inputs.nixpkgs.follows = "nixpkgs"; }; @@ -300,7 +340,12 @@ flake = false; }; + # riscv64 SBCs nixos-licheepi4a.url = "github:ryan4yin/nixos-licheepi4a"; + # nixos-jh7110.url = "github:ryan4yin/nixos-jh7110"; + + # aarch64 SBCs + nixos-rk3588.url = "github:ryan4yin/nixos-rk3588"; # color scheme - catppuccin catppuccin-btop = { @@ -345,7 +390,6 @@ }; }; - # the nixConfig here only affects the flake itself, not the system configuration! nixConfig = { experimental-features = ["nix-command" "flakes"]; diff --git a/hosts/12kingdoms/suzu/default.nix b/hosts/12kingdoms/suzu/default.nix new file mode 100644 index 00000000..ea4774cb --- /dev/null +++ b/hosts/12kingdoms/suzu/default.nix @@ -0,0 +1,61 @@ +{ + config, + username, + nixos-rk3588, + ... +} @ args: +############################################################# +# +# Aquamarine - A NixOS VM running on Proxmox +# +############################################################# +{ + imports = [ + { + nixpkgs.crossSystem = { + config = "aarch64-unknown-linux-gnu"; + }; + } + + # import the rk3588 module, which contains the configuration for bootloader/kernel/firmware + (nixos-rk3588 + "/modules/boards/orangepi5.nix") + + ../../../modules/nixos/core-riscv64.nix + ../../../modules/nixos/user-group.nix + ]; + + users.users.root.openssh.authorizedKeys.keys = config.users.users."${username}".openssh.authorizedKeys.keys; + + networking = { + hostName = "suzu"; # Define your hostname. + wireless.enable = false; # Enables wireless support via wpa_supplicant. + networkmanager.enable = false; + + # Configure network proxy if necessary + # proxy.default = "http://user:password@proxy:port/"; + # proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + interfaces.end1 = { + useDHCP = false; + ipv4.addresses = [ + { + address = "192.168.5.107"; + prefixLength = 24; + } + ]; + }; + defaultGateway = "192.168.5.201"; + nameservers = [ + "119.29.29.29" # DNSPod + "223.5.5.5" # AliDNS + ]; + }; + + # 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 = "23.05"; # Did you read the comment? +} diff --git a/hosts/README.md b/hosts/README.md index e3d19d06..a4995d89 100644 --- a/hosts/README.md +++ b/hosts/README.md @@ -10,6 +10,9 @@ 1. `nozomi`: Lichee Pi 4A, TH1520(4xC910@2.0G), 8GB RAM + 32G eMMC + 64G SD Card. 2. `yukina`: Lichee Pi 4A(Internal Test Version), TH1520(4xC910@2.0G), 8GB RAM + 8G eMMC + 128G SD Card. 3. `chiaya`: Milk-V Mars, JH7110(4xU74@1.5 GHz), 4G RAM + No eMMC + 64G SD Card. +4. `12kingdoms`: Currently only one aarch64 host + 1. `suzu`: Orange Pi 5, RK3588s(4xA76 + 4xA55), GPU(4Cores, Mail-G610), NPU(6Tops@int8), 8G RAM + 256G SSD. + # idols - Oshi no Ko @@ -39,3 +42,4 @@ My All RISCV64 hosts. ![](/_img/rolling_girls.webp) +[List of Twelve Kingdoms characters](https://en.wikipedia.org/wiki/List_of_Twelve_Kingdoms_characters) diff --git a/modules/nixos/remote-building.nix b/modules/nixos/remote-building.nix index 94fea2e5..9b27dbeb 100644 --- a/modules/nixos/remote-building.nix +++ b/modules/nixos/remote-building.nix @@ -102,6 +102,10 @@ Host chiaya HostName 192.168.5.106 Port 22 + + Host suzu + HostName 192.168.5.107 + Port 22 ''; # define the host key for remote builders so that nix can verify all the remote builders