From f82576a91c3f1709ce14cf5787ff75b823fba771 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Fri, 27 Sep 2024 00:53:38 -0700 Subject: feat(rui): extra-args configuration option --- README.md | 16 +++++++++++----- flake.nix | 5 +++++ rui.go | 15 ++++++++++----- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index b666424..2c6fcab 100644 --- a/README.md +++ b/README.md @@ -45,23 +45,29 @@ inputs.home-manager.lib.homeManagerConfiguration { ```nix { programs.rui = { - enable = true; + enable = true; # Defaults to false settings = { - # Status notifications via `notify-send` + # Status notifications via `notify-send`; defaults to false notify = true; - # The command to use for sending notifications, view a cool example below! + # The command to use for sending notifications, view a cool example below; + # defaults to `notify-send` notifier = "notify-send"; # Rui falls back on the `FLAKE_EDITOR` and `EDITOR` environment variables + # if `editor` is unset editor = "code"; - # Rui falls back on the `FLAKE` environment variable + # Rui falls back on the `FLAKE` environment variable if `flake` is unset flake = "/path/to/your-flake"; - # Allow unfree packages + # Allow unfree packages; defaults to false allow-unfree = false; + + # Extra arguments to pass to `nixos-rebuild` and `home-manager`; defaults + # to [ ] + extra-args = [ "--impure" ]; }; }; } diff --git a/flake.nix b/flake.nix index ddf3288..e9b1e25 100644 --- a/flake.nix +++ b/flake.nix @@ -119,6 +119,11 @@ type = types.bool; default = false; }; + + extra-args = mkOption { + type = types.listOf types.str; + default = [ ]; + }; }; }; diff --git a/rui.go b/rui.go index c76870e..2f06d43 100644 --- a/rui.go +++ b/rui.go @@ -11,11 +11,12 @@ import ( ) type Configuration struct { - Notify bool `json:"notify"` - Editor string `json:"editor"` - Flake string `json:"flake"` - Notifier string `json:"notifier"` - AllowUnfree bool `json:"allow-unfree"` + Notify bool `json:"notify"` + Editor string `json:"editor"` + Flake string `json:"flake"` + Notifier string `json:"notifier"` + AllowUnfree bool `json:"allow-unfree"` + ExtraArgs []string `json:"extra-args"` } type ActionDetails struct { @@ -160,6 +161,8 @@ func main() { flake := configuration.Flake extraArgs := c.Args().Slice() + extraArgs = append(extraArgs, configuration.ExtraArgs...) + if flake == "" { flake = os.Getenv("FLAKE") } @@ -329,6 +332,8 @@ func home(c *cli.Context, action int) error { extraArgs := c.Args().Slice() name, verb, usableWithNH := actionDetails(action) + extraArgs = append(extraArgs, configuration.ExtraArgs...) + if err := notify("Queued home " + name); err != nil { return err } -- cgit v1.2.3