A modular system for dynamically enabling and disabling NixOS configurations at runtime. It allows you to keep your base system configuration small while dynamically enabling and disabling heavier components as needed. This is especially useful when you need to keep your initrd + kernel size under a specific limit.
Add this repository as a Nix flake input, then enable the module in your NixOS configuration:
{ inputs = { runtime-modules.url = "github:tupakkatapa/nixos-runtime-modules"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; }; outputs = { self, ... }@inputs: { nixosConfigurations = { yourhostname = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ ./configuration.nix inputs.runtime-modules.nixosModules.runtimeModules { # Module configuration services.runtimeModules = { ... }; } ]; }; }; }; }
enable
– Enables the runtime modules system.flakeUrl
– The base flake reference to extend from.modules
– List of modules that can be dynamically enabled/disabled.
modules = [
{
name = “gaming”;
path = ./gaming.nix;
}
{
name = “virtualization”;
path = ./virtualization.nix;
}
];
};
}” dir=”auto”>
{ services.runtimeModules = { enable = true; flakeUrl = "github:/ ; modules = [ { name = "gaming"; path ="