diff --git a/modules/modules.nix b/modules/modules.nix index c1025ba7..cf29397d 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -211,6 +211,7 @@ let ./programs/octant.nix ./programs/offlineimap.nix ./programs/oh-my-posh.nix + ./programs/onagre.nix ./programs/onedrive.nix ./programs/onlyoffice.nix ./programs/opam.nix diff --git a/modules/programs/onagre.nix b/modules/programs/onagre.nix new file mode 100644 index 00000000..c559c09c --- /dev/null +++ b/modules/programs/onagre.nix @@ -0,0 +1,74 @@ +{ + lib, + pkgs, + config, + ... +}: +let + inherit (lib) + types + mkIf + mkEnableOption + mkPackageOption + mkOption + ; + + cfg = config.programs.onagre; +in +{ + meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ]; + + options.programs.onagre = { + enable = mkEnableOption "onagre"; + package = mkPackageOption pkgs "onagre" { nullable = true; }; + style = mkOption { + type = types.lines; + default = ""; + example = '' + .onagre { + --exit-unfocused: false; + height: 250px; + width: 400px; + --font-family: "Iosevka,Iosevka Nerd Font"; + font-size: 18px; + background: #151515; + color: #414141; + padding: 10px; + + .container { + .rows { + --height: fill-portion 6; + .row-selected { + color: #ffffff; + --spacing: 3px; + } + } + + .scrollable { + background: #151515; + width: 0; + .scroller { + width: 0; + color: #151515; + } + } + } + } + ''; + description = '' + Configuration file to be written to theme.scss for setting + Onagre's theme. The documentation can be found here: + + ''; + }; + }; + + config = mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "programs.onagre" pkgs lib.platforms.linux) + ]; + + home.packages = mkIf (cfg.package != null) [ cfg.package ]; + xdg.configFile."onagre/theme.scss" = mkIf (cfg.style != "") { text = cfg.style; }; + }; +} diff --git a/tests/default.nix b/tests/default.nix index 8901ec45..c37c4556 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -385,6 +385,7 @@ import nmtSrc { ./modules/programs/mpvpaper ./modules/programs/ncmpcpp-linux ./modules/programs/nh + ./modules/programs/onagre ./modules/programs/onedrive ./modules/programs/pqiv ./modules/programs/rbw diff --git a/tests/modules/programs/onagre/default.nix b/tests/modules/programs/onagre/default.nix new file mode 100644 index 00000000..eb796f4f --- /dev/null +++ b/tests/modules/programs/onagre/default.nix @@ -0,0 +1 @@ +{ onagre-example-config = ./example-config.nix; } diff --git a/tests/modules/programs/onagre/example-config.nix b/tests/modules/programs/onagre/example-config.nix new file mode 100644 index 00000000..d6e6d2f0 --- /dev/null +++ b/tests/modules/programs/onagre/example-config.nix @@ -0,0 +1,93 @@ +{ + programs.onagre = { + enable = true; + style = '' + .onagre { + background: #d6d6d6; + color: #000000; + --icon-theme: "Papirus"; + --font-family: "DejaVuSans"; + --icon-size: 24; + border-radius: 8%; + border-color: #d6d6d6; + border-width: 4px; + padding: 5px; + + .container { + .rows { + --height: fill-portion 6; + .row { + --width: 392; + + .icon { + padding-top: 4px; + } + + .category-icon { + padding-left: 5px; + --icon-size: 11; + } + + .title { + font-size: 18px; + } + + .description { + font-size: 12px; + } + } + + .row-selected { + --width: 392; + border-radius: 8%; + background: #c0c0c0; + + .icon { + padding-top: 4px; + } + + .category-icon { + padding-left: 5px; + --icon-size: 11; + } + + .title { + font-size: 20px; + } + + .description { + font-size: 12px; + } + } + } + + .search { + border-radius: 5%; + background: #ffffff; + --height: fill-portion 1; + padding: 4px; + .input { + font-size: 20px; + } + } + + .scrollable { + width: 2px; + border-radius: 5%; + background: #c0c0c0; + .scroller { + width: 4px; + color: #a1a1a1; + } + } + } + } + ''; + }; + + nmt.script = '' + assertFileExists home-files/.config/onagre/theme.scss + assertFileContent home-files/.config/onagre/theme.scss \ + ${./style} + ''; +} diff --git a/tests/modules/programs/onagre/style b/tests/modules/programs/onagre/style new file mode 100644 index 00000000..7fca12c7 --- /dev/null +++ b/tests/modules/programs/onagre/style @@ -0,0 +1,80 @@ +.onagre { + background: #d6d6d6; + color: #000000; + --icon-theme: "Papirus"; + --font-family: "DejaVuSans"; + --icon-size: 24; + border-radius: 8%; + border-color: #d6d6d6; + border-width: 4px; + padding: 5px; + + .container { + .rows { + --height: fill-portion 6; + .row { + --width: 392; + + .icon { + padding-top: 4px; + } + + .category-icon { + padding-left: 5px; + --icon-size: 11; + } + + .title { + font-size: 18px; + } + + .description { + font-size: 12px; + } + } + + .row-selected { + --width: 392; + border-radius: 8%; + background: #c0c0c0; + + .icon { + padding-top: 4px; + } + + .category-icon { + padding-left: 5px; + --icon-size: 11; + } + + .title { + font-size: 20px; + } + + .description { + font-size: 12px; + } + } + } + + .search { + border-radius: 5%; + background: #ffffff; + --height: fill-portion 1; + padding: 4px; + .input { + font-size: 20px; + } + } + + .scrollable { + width: 2px; + border-radius: 5%; + background: #c0c0c0; + .scroller { + width: 4px; + color: #a1a1a1; + } + } + } +}