From 4ae51647a0905d2a517ab5019cdb0c5d5be54c3d Mon Sep 17 00:00:00 2001 From: Fuwn Date: Fri, 27 Sep 2024 07:41:03 +0000 Subject: feat(rui): allow-unfree configuration option --- README.md | 3 +++ flake.nix | 7 ++++++- rui.go | 16 ++++++++++++---- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 49caf34..b666424 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,9 @@ inputs.home-manager.lib.homeManagerConfiguration { # Rui falls back on the `FLAKE` environment variable flake = "/path/to/your-flake"; + + # Allow unfree packages + allow-unfree = false; }; }; } diff --git a/flake.nix b/flake.nix index 1c4fc99..ddf3288 100644 --- a/flake.nix +++ b/flake.nix @@ -41,7 +41,7 @@ { packages.default = pkgs.buildGoModule { pname = "rui"; - version = "2024.09.23"; + version = "2024.09.27"; src = pkgs.lib.cleanSource ./.; vendorHash = "sha256-mN/QjzJ4eGfbW1H92cCKvC0wDhCR6IUes2HCZ5YBdPA="; @@ -114,6 +114,11 @@ type = types.str; default = ""; }; + + allow-unfree = mkOption { + type = types.bool; + default = false; + }; }; }; diff --git a/rui.go b/rui.go index ea261b7..c76870e 100644 --- a/rui.go +++ b/rui.go @@ -11,10 +11,11 @@ import ( ) type Configuration struct { - Notify bool `json:"notify"` - Editor string `json:"editor"` - Flake string `json:"flake"` - Notifier string `json:"notifier"` + Notify bool `json:"notify"` + Editor string `json:"editor"` + Flake string `json:"flake"` + Notifier string `json:"notifier"` + AllowUnfree bool `json:"allow-unfree"` } type ActionDetails struct { @@ -116,6 +117,13 @@ func main() { }, }, }, + Before: func(c *cli.Context) error { + if configuration.AllowUnfree { + c.Set("allow-unfree", "1") + } + + return nil + }, Commands: []*cli.Command{ { Name: "hs", -- cgit v1.2.3