···11+---
22+title: home-manager
33+description: Install Switchyard and register it as the default browser via home-manager.
44+order: 22
55+---
66+77+Switchyard's flake exposes a [home-manager](https://nix-community.github.io/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`.
88+99+## Setup
1010+1111+Add the flake to your inputs and import the module:
1212+1313+```nix
1414+# flake.nix
1515+{
1616+ inputs.switchyard.url = "github:alyraffauf/switchyard";
1717+ # ...
1818+ outputs = { self, nixpkgs, home-manager, switchyard, ... }: {
1919+ homeConfigurations.you = home-manager.lib.homeManagerConfiguration {
2020+ pkgs = nixpkgs.legacyPackages.x86_64-linux;
2121+ modules = [
2222+ switchyard.homeManagerModules.switchyard
2323+ ./home.nix
2424+ ];
2525+ };
2626+ };
2727+}
2828+```
2929+3030+```nix
3131+# home.nix
3232+{ ... }: {
3333+ programs.switchyard = {
3434+ enable = true;
3535+ setAsDefaultBrowser = true;
3636+ };
3737+}
3838+```
3939+4040+## Options
4141+4242+- **`enable`** *(bool, default `false`)* — Install Switchyard and enable the module.
4343+- **`package`** *(package, default `switchyard`)* — The Switchyard derivation to install.
4444+- **`setAsDefaultBrowser`** *(bool, default `true`)* — Register Switchyard as the default handler for `x-scheme-handler/http`, `x-scheme-handler/https`, and `text/html` via `xdg.mimeApps`.
4545+- **`settings`** *(TOML, default `{}`)* — Contents of `~/.config/switchyard/config.toml`. Freeform; any key from Switchyard's `Config` struct is accepted, omitted keys fall back to built-in defaults.
4646+4747+## Declarative Configuration
4848+4949+`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:
5050+5151+```nix
5252+programs.switchyard.settings = {
5353+ favorite_browser = "firefox";
5454+ remove_tracking_parameters = true;
5555+ rules = [
5656+ {
5757+ name = "work";
5858+ browser = "chromium";
5959+ conditions = [ { type = "domain"; pattern = "corp.example.com"; } ];
6060+ }
6161+ ];
6262+};
6363+```
6464+6565+> **Warning:** Switchyard overwrites `config.toml` on every in-app config change. Edits made through the GUI will be lost on the next `home-manager switch`. Treat `settings` as declarative: pick one source of truth.
6666+6767+See the [configuration reference](/docs/configuration/) for the full schema.
+3-1
website/src/content/docs/nixos-flatpak.md
···44order: 25
55---
6677-On NixOS, browser desktop files live in `/run/current-system/sw/share/applications`. That path is not visible inside Flatpak by default, so Switchyard may not detect host browsers.
77+NixOS users should consider using the Nix package and/or the [home-manager module](/docs/home-manager/). If you do use the Flatpak, Switchyard may not be able to accurately discover your installed browsers.
88+99+On NixOS, browser desktop files live in `/run/current-system/sw/share/applications`. That path is not visible inside Flatpak by default.
810911To expose them to Switchyard, add the path to the Flatpak sandbox and include it in the XDG application search path:
1012