home-manager
Switchyard’s flake exposes a home-manager module that installs the package, optionally writes ~/.config/switchyard/config.toml, and registers Switchyard as the default handler for http(s)/text/html.
Setup
Add the flake to your inputs and import the module:
# flake.nix
{
inputs.switchyard.url = "github:alyraffauf/switchyard";
# ...
outputs = { self, nixpkgs, home-manager, switchyard, ... }: {
homeConfigurations.you = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
modules = [
switchyard.homeManagerModules.switchyard
./home.nix
];
};
};
}
# home.nix
{ ... }: {
programs.switchyard = {
enable = true;
setAsDefaultBrowser = true;
};
}
Options
enable(bool, defaultfalse) — Install Switchyard and enable the module.package(package, defaultswitchyard) — The Switchyard derivation to install.setAsDefaultBrowser(bool, defaulttrue) — Register Switchyard as the default handler forx-scheme-handler/http,x-scheme-handler/https, andtext/htmlviaxdg.mimeApps.settings(TOML, default{}) — Contents of~/.config/switchyard/config.toml. Freeform; any key from Switchyard’sConfigstruct is accepted, omitted keys fall back to built-in defaults.
Declarative Configuration
settings is a freeform TOML value — any key Switchyard understands is accepted, and new fields added to Switchyard’s Config struct work without changes to the module:
programs.switchyard.settings = {
favorite_browser = "firefox";
remove_tracking_parameters = true;
rules = [
{
name = "work";
browser = "chromium";
conditions = [ { type = "domain"; pattern = "corp.example.com"; } ];
}
];
};
Warning: Switchyard overwrites
config.tomlon every in-app config change. Edits made through the GUI will be lost on the nexthome-manager switch. Treatsettingsas declarative: pick one source of truth.
See the configuration reference for the full schema.