From e234807139b62109866955b19767143a49ffe850 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Sat, 23 Dec 2023 20:26:40 +0800 Subject: [PATCH] setups: migrate TOML format to Nix This allows us to do much more. --- flake.nix | 4 +-- images.toml | 46 -------------------------- users.toml => setups/home-manager.nix | 12 +++---- setups/nixos.nix | 47 +++++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 55 deletions(-) delete mode 100644 images.toml rename users.toml => setups/home-manager.nix (60%) create mode 100644 setups/nixos.nix diff --git a/flake.nix b/flake.nix index 57333800..e2d2450e 100644 --- a/flake.nix +++ b/flake.nix @@ -81,10 +81,10 @@ # A set of images with their metadata that is usually built for usual # purposes. The format used here is whatever formats nixos-generators # support. - images = lib'.importTOML ./images.toml; + images = import ./setups/nixos.nix { lib = lib'; inherit inputs; }; # A set of users with their metadata to be deployed with home-manager. - users = lib'.importTOML ./users.toml; + users = import ./setups/home-manager.nix { lib = lib'; inherit inputs; }; # A set of image-related utilities for the flake outputs. inherit (import ./lib/extras/images.nix { inherit inputs; lib = lib'; }) mkHost mkHome mkImage listImagesWithSystems; diff --git a/images.toml b/images.toml deleted file mode 100644 index 8a31f65c..00000000 --- a/images.toml +++ /dev/null @@ -1,46 +0,0 @@ -# This is a custom data for this project where it lists the images found in -# this flake. This can range from NixOS configurations intended to be deployed -# for servers and desktops to installers. -# -# The data is then used for the image creation functions found in `flake.nix`. -# Each of the entry should correspond to one of the hosts in `./hosts/` -# directory. -# -# Take note, any images with the "iso" format is essentially made to be -# deployed somewhere (e.g., desktop, homelab server, VPS). -[ni] -systems = [ "x86_64-linux" ] -format = "iso" - -[plover] -systems = [ "x86_64-linux" ] -format = "iso" -domain = "foodogsquared.one" - -[plover.deploy] -hostname = "plover.foodogsquared.one" -auto-rollback = true -magic-rollback = true - -[void] -systems = [ "x86_64-linux" ] -format = "vm" - -[bootstrap] -systems = [ - "aarch64-linux", - "x86_64-linux", -] -format = "install-iso" -nixpkgs-channel = "nixos-unstable-small" - -[graphical-installer] -systems = [ - "aarch64-linux", - "x86_64-linux", -] -format = "install-iso" - -[winnowing] -systems = [ "x86_64-linux" ] -format = "iso" diff --git a/users.toml b/setups/home-manager.nix similarity index 60% rename from users.toml rename to setups/home-manager.nix index a6f03ab5..9192beb6 100644 --- a/users.toml +++ b/setups/home-manager.nix @@ -1,11 +1,9 @@ # This is project data for deploying home-manager users with this flake. Each # of the users defined here should correspond to one of the home-manager users # at `./users/home-manager/`. -[foo-dogsquared] -systems = [ - "aarch64-linux", - "x86_64-linux", -] +{ lib, inputs }: -[plover] -systems = [ "x86_64-linux" ] +{ + foo-dogsquared.systems = [ "aarch64-linux" "x86_64-linux" ]; + plover.systems = [ "x86_64-linux" ]; +} diff --git a/setups/nixos.nix b/setups/nixos.nix new file mode 100644 index 00000000..efe16110 --- /dev/null +++ b/setups/nixos.nix @@ -0,0 +1,47 @@ +# This is a custom data for this project where it lists the images found in +# this flake. This can range from NixOS configurations intended to be deployed +# for servers and desktops to installers. +# +# The data is then used for the image creation functions found in `flake.nix`. +# Each of the entry should correspond to one of the hosts in `./hosts/` +# directory. +{ lib, inputs }: + +{ + ni = { + systems = [ "x86_64-linux" ]; + format = "iso"; + }; + + plover = { + systems = [ "x86_64-linux" ]; + format = "iso"; + domain = "foodogsquared.one"; + deploy = { + hostname = "plover.foodogsquared.one"; + auto-rollback = true; + magic-rollback = true; + }; + }; + + void = { + systems = [ "x86_64-linux" ]; + format = "vm"; + }; + + bootstrap = { + systems = [ "aarch64-linux" "x86_64-linux" ]; + format = "install-iso"; + nixpkgs-channel = "nixos-unstable-small"; + }; + + graphical-installer = { + systems = [ "aarch64-linux" "x86_64-linux" ]; + format = "install-iso"; + }; + + winnowing = { + systems = [ "x86_64-linux" ]; + format = "iso"; + }; +}