aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md48
-rw-r--r--flake.nix40
2 files changed, 80 insertions, 8 deletions
diff --git a/README.md b/README.md
index 3f69d37..63a2cb2 100644
--- a/README.md
+++ b/README.md
@@ -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
diff --git a/flake.nix b/flake.nix
index 415469b..557efdc 100644
--- a/flake.nix
+++ b/flake.nix
@@ -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;
+ };
+ };
}
);
}