flake: export nixosModules.gaming for guests with their own hardware

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-09-09 19:10:03 +01:00
parent 7be860ad0c
commit 42b1f16938
2 changed files with 73 additions and 7 deletions

View file

@ -39,19 +39,44 @@
} @ inputs:
let
system = "x86_64-linux";
baseModules = hostname: [
./hosts/${hostname}.nix
./common.nix
home-manager.nixosModules.home-manager
stylix.nixosModules.stylix
./settings/stylix.nix
];
mkHost = hostname: extraModules: nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = { inherit inputs; };
modules = [
./hosts/${hostname}.nix
./common.nix
home-manager.nixosModules.home-manager
stylix.nixosModules.stylix
./settings/stylix.nix
] ++ extraModules;
modules = baseModules hostname ++ extraModules;
};
in
{
# Everything FredOS-Gaming is, minus the hardware — for anyone who wants
# to run this config on their own machine. They import this module next
# to their own hardware-configuration.nix from their own flake (readme.md
# has the snippet). `_module.args` stands in for mkHost's specialArgs,
# which a plain module can't set.
nixosModules.gaming = { lib, ... }: {
imports = baseModules "FredOS-Gaming";
_module.args.inputs = inputs;
# Hostname gates every FredOS-Gaming module, so it has to keep matching.
# These four otherwise live in hosts/hardware/FredOS-Gaming.nix, which
# is exactly the file a guest replaces.
networking.hostName = "FredOS-Gaming";
nixpkgs.hostPlatform = lib.mkDefault system;
system.stateVersion = lib.mkDefault "25.11";
boot.loader.systemd-boot.enable = lib.mkDefault true;
boot.loader.efi.canTouchEfiVariables = lib.mkDefault true;
# nordhammer.it is my build server and those are my SSH keys; neither
# belongs on someone else's machine.
nix.distributedBuilds = lib.mkForce false;
users.users.fred.openssh.authorizedKeys.keys = lib.mkForce [ ];
};
nixosConfigurations = {
FredOS-Gaming = mkHost "FredOS-Gaming" [ ./hosts/hardware/FredOS-Gaming.nix ];
FredOS-Mediaserver = mkHost "FredOS-Mediaserver" [ ./hosts/hardware/FredOS-Mediaserver.nix ];