diff options
| author | Fuwn <[email protected]> | 2024-09-17 18:14:11 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-09-17 18:14:11 -0700 |
| commit | 685ea46ca636ece3f0a9726e9f037eac4426c4cc (patch) | |
| tree | 5637d1061413b8b32242a25211e245178b0d15b3 | |
| parent | 2db46a96a8499d0102d386f23e972891c4443426 (diff) | |
| download | rui-685ea46ca636ece3f0a9726e9f037eac4426c4cc.tar.xz rui-685ea46ca636ece3f0a9726e9f037eac4426c4cc.zip | |
feat: pure home-manager configuration
| -rw-r--r-- | README.md | 48 | ||||
| -rw-r--r-- | flake.nix | 40 |
2 files changed, 80 insertions, 8 deletions
@@ -11,12 +11,6 @@ moment, so anyone can use it. - `rui home news` - Show the latest news from your Home Manager configuration packages -Rui checks the `FLAKE` environment variable for the path to your flake -directory. - -Rui looks at the `FLAKE_EDITOR` environment variable for the editor to use when -opening the flake directory, but falls back to `EDITOR` if it isn't set. - ## Installation ### Add to Flake Inputs (for Flakes Users) @@ -30,7 +24,47 @@ opening the flake directory, but falls back to `EDITOR` if it isn't set. } ``` -### Add to System or Home Manager Packages +### Add to Home Manager (Managed Configuration) + +This method manages the configuration for you with Nix. + +```nix +# ... + +inputs.home-manager.lib.homeManagerConfiguration { + modules = [ + inputs.rui.homeManagerModules.${builtins.currentSystem}.default + ]; +}; + +# ... +``` + +### Configure Rui Using Home Manager + +```nix +{ + programs.rui = { + enable = true; + + settings = { + # Status notifications via `notify-send` + notify = true; + + # Rui falls back on the `FLAKE_EDITOR` and `EDITOR` environment variables + editor = "code"; + + # Rui falls back on the `FLAKE` environment variable + flake = "/path/to/your-flake"; + }; + }; +} +``` + +### Add to System or Home Manager Packages (Manual Configuration) + +Using this method, configuration is done manually by the user in the +`$HOME/.config/rui/config.json` file. ```nix # For flakes users @@ -33,7 +33,7 @@ { packages.default = pkgs.buildGoModule { pname = "rui"; - version = "2024-09-16"; + version = "2024.09.17"; src = pkgs.lib.cleanSource ./.; vendorHash = "sha256-mN/QjzJ4eGfbW1H92cCKvC0wDhCR6IUes2HCZ5YBdPA="; @@ -70,6 +70,44 @@ buildInputs = self.checks.${system}.pre-commit-check.enabledPackages; }; + + homeManagerModules.default = + { config, ... }: + with pkgs.lib; + { + options.programs.rui = { + enable = mkOption { + type = types.bool; + default = false; + }; + + settings = { + editor = mkOption { + type = types.str; + default = ""; + }; + + notify = mkOption { + type = types.bool; + default = false; + }; + + flake = mkOption { + type = types.str; + default = ""; + }; + }; + }; + + config = mkIf config.programs.rui.enable { + home.packages = [ + self.packages.${system}.default + pkgs.libnotify + ]; + + xdg.configFile."rui/config.json".text = builtins.toJSON config.programs.rui.settings; + }; + }; } ); } |