From 3e7f1217726b4b07664f0039cdda99339007e2f4 Mon Sep 17 00:00:00 2001 From: fortuneteller2k Date: Sat, 18 Nov 2023 03:18:12 +0800 Subject: [PATCH] parts: add an option for headless configurations --- hosts/default.nix | 1 + modules/parts/nixos.nix | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hosts/default.nix b/hosts/default.nix index 0d089b3..38041bf 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -13,6 +13,7 @@ mistral = { system = "x86_64-linux"; stateVersion = "23.05"; + server = true; modules = [ inputs.nix-minecraft.nixosModules.minecraft-servers diff --git a/modules/parts/nixos.nix b/modules/parts/nixos.nix index 69f79e1..de0b321 100644 --- a/modules/parts/nixos.nix +++ b/modules/parts/nixos.nix @@ -9,6 +9,8 @@ let nixosOpts = opts@{ config, name, ... }: { options = { + server = lib.mkEnableOption "Host is a headless server configuration."; + system = lib.mkOption { type = types.enum [ "aarch64-linux" "x86_64-linux" ]; description = "System architecture for the configuration."; @@ -35,10 +37,10 @@ let config._nixos = withSystem config.system (ctx: inputs.nixpkgs.lib.nixosSystem { - modules = config.modules ++ [ + modules = config.modules ++ lib.optionals (!config.server) [ # Shared configuration across all NixOS machines ../shared/nixos - + ] ++ [ ({ pkgs, ... }: { inherit (ctx) nix nixpkgs; _module.args = ctx.extraModuleArgs;