From f296afc1f2964a1b677ee13833c766d3c54d3cea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Wed, 17 Jul 2024 10:04:10 +0100 Subject: [PATCH] add airnix stub --- flake.nix | 1 + nixos/boxes/airnix/README.md | 10 ++++++++ nixos/boxes/airnix/boot.nix | 11 +++++++++ nixos/boxes/airnix/default.nix | 24 +++++++++++++++++++ nixos/boxes/airnix/disks.nix | 44 ++++++++++++++++++++++++++++++++++ 5 files changed, 90 insertions(+) create mode 100644 nixos/boxes/airnix/README.md create mode 100644 nixos/boxes/airnix/boot.nix create mode 100644 nixos/boxes/airnix/default.nix create mode 100644 nixos/boxes/airnix/disks.nix diff --git a/flake.nix b/flake.nix index 6a1ba88b..0605c0f5 100644 --- a/flake.nix +++ b/flake.nix @@ -174,6 +174,7 @@ bolty = mkServer nixpkgs-stable "x86_64-linux" "bolty"; cupsnet = mkServer nixpkgs-stable "aarch64-linux" "cupsnet"; mb1 = mkServer nixpkgs-stable "x86_64-linux" "mb1"; + airnix = mkServer nixpkgs-stable "aarch64-linux" "airnix"; homescreen = mkRaspi nixpkgs-stable "homescreen"; bootstrap = nixpkgs-stable.lib.nixosSystem rec { diff --git a/nixos/boxes/airnix/README.md b/nixos/boxes/airnix/README.md new file mode 100644 index 00000000..201468d0 --- /dev/null +++ b/nixos/boxes/airnix/README.md @@ -0,0 +1,10 @@ +## this is a VM on mac book air M1, so aarch64 + +- boot from minimal nixos installer image + + > 604ad1abbcfdd93bc6258be695a7d289756921c0e6d9b4f3afb8e98c823052ec nixos-minimal-24.05.2780.53e81e790209-aarch64-linux.iso + > https://releases.nixos.org/nixos/unstable/nixos-23.05pre470969.0e19daa510e/nixos-minimal-23.05pre470969.0e19daa510e-x86_64-linux.iso + +- launch in paralells +- change root password +- From macbook host `nix run github:numtide/nixos-anywhere -- root@IP --flake '.#airnix'` diff --git a/nixos/boxes/airnix/boot.nix b/nixos/boxes/airnix/boot.nix new file mode 100644 index 00000000..19483e80 --- /dev/null +++ b/nixos/boxes/airnix/boot.nix @@ -0,0 +1,11 @@ +{ + config, + pkgs, + inputs, + lib, + ... +}: { + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.kernelPackages = pkgs.linuxPackages_latest; +} diff --git a/nixos/boxes/airnix/default.nix b/nixos/boxes/airnix/default.nix new file mode 100644 index 00000000..2ee0a45a --- /dev/null +++ b/nixos/boxes/airnix/default.nix @@ -0,0 +1,24 @@ +{ + config, + pkgs, + inputs, + lib, + ... +}: { + imports = [ + "${inputs.nixpkgs-stable}/nixos/modules/profiles/qemu-guest.nix" + ../cli.nix + ../send-logs.nix + ./boot.nix + ./disks.nix + ]; + networking.hostName = "airnix"; + + zramSwap = { + enable = true; + algorithm = "zstd"; + memoryPercent = 100; + }; + + time.timeZone = "Europe/London"; +} diff --git a/nixos/boxes/airnix/disks.nix b/nixos/boxes/airnix/disks.nix new file mode 100644 index 00000000..ef85d323 --- /dev/null +++ b/nixos/boxes/airnix/disks.nix @@ -0,0 +1,44 @@ +{ + disko.devices = { + disk = { + a = { + type = "disk"; + device = "/dev/sda"; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "64M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + zfs = { + size = "100%"; + content = { + type = "zfs"; + pool = "zroot"; + }; + }; + }; + }; + }; + }; + zpool = { + zroot = { + type = "zpool"; + mode = "mirror"; + rootFsOptions = { + compression = "zstd"; + }; + mountpoint = "/"; + + datasets = { + }; + }; + }; + }; +}