Skip to content

Commit

Permalink
feat(hm-modules): add hyfetch
Browse files Browse the repository at this point in the history
  • Loading branch information
isabelroses committed Feb 21, 2024
1 parent f1dd32a commit ed5f0db
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 21 deletions.
44 changes: 23 additions & 21 deletions home/isabel/programs/configs/cli/hyfetch.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
{
lib,
pkgs,
self,
...
}: let
inherit (lib) ldTernary;
in {
home.packages = [pkgs.hyfetch];
imports = [self.homeManagerModules.hyfetch];
disabledModules = ["programs/hyfetch.nix"];

xdg.configFile = {
"neofetch/config.conf".text = ''
programs.hyfetch = {
enable = true;

settings = {
preset = "lesbian";
mode = "rgb";
light_dark = "dark";
lightness = 0.56;
color_align = {
mode = "horizontal";
custom_colors = [];
fore_back = null;
};
backend = "neofetch";
distro = null;
pride_month_shown = [];
pride_month_disable = false;
};

neofetchConfig = ''
print_info() {
prin " \n \n ╭───────┤ $(color 5)${ldTernary pkgs " NixOS" " MacOS"} $(color 15)├───────╮"
info " " kernel
Expand Down Expand Up @@ -53,23 +73,5 @@ in {
crop_offset="center" # northwest north northeast west center east southwest south southeast
gap=1 # num -num
'';

"hyfetch.json".text = ''
{
"preset": "lesbian",
"mode": "rgb",
"light_dark": "dark",
"lightness": 0.56,
"color_align": {
"mode": "horizontal",
"custom_colors": [],
"fore_back": null
},
"backend": "neofetch",
"distro": null,
"pride_month_shown": [],
"pride_month_disable": false
}
'';
};
}
1 change: 1 addition & 0 deletions modules/extra/home-manager/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
imports = [
./gtklock.nix
./hyfetch.nix
./swaync.nix
];
}
67 changes: 67 additions & 0 deletions modules/extra/home-manager/hyfetch.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
lib,
pkgs,
config,
...
}: let
inherit (lib) mkEnableOption mkPackageOption mkOption mkIf types;

cfg = config.programs.hyfetch;

settingsFormat = pkgs.formats.json {};
in {
options.programs.hyfetch = {
enable = mkEnableOption "hyfetch";

package = mkPackageOption pkgs "hyfetch" {};

settings = mkOption {
default = {};
type = settingsFormat.type;
description = ''
Configuration written to {file}`$XDG_CONFIG_HOME/hyfetch.json`.
See https://github.com/hykilpikonna/hyfetch/blob/master/docs/hyfetch.1 for more help.
'';
example = lib.literalExpression ''
{
preset = "lesbian";
mode = "rgb";
light_dark = "dark";
lightness = 0.56;
color_align = {
mode = "horizontal";
custom_colors = [];
fore_back = null;
};
backend = "neofetch";
distro = null;
pride_month_shown = [];
pride_month_disable = false;
};
'';
};

neofetchConfig = mkOption {
default = {};
type = with types; nullOr (either path lines);
description = ''
Configuration written to {file}`$XDG_CONFIG_HOME/neofetch/config.conf`.
See https://github.com/dylanaraps/neofetch/blob/master/neofetch.1 for more help/
'';
};
};

config = mkIf cfg.enable {
home.packages = [cfg.package];

xdg.configFile = {
"hyfetch.json" = mkIf (cfg.settings != {}) {source = settingsFormat.generate "hyfetch.json" cfg.settings;};
"neofetch/config.conf" = mkIf (cfg.neofetchConfig != {}) {
source =
if builtins.isPath cfg.neofetchConfig || lib.isStorePath cfg.neofetchConfig
then cfg.neofetchConfig
else pkgs.writeText "neofetch/config.conf" cfg.neofetchConfig;
};
};
};
}

0 comments on commit ed5f0db

Please sign in to comment.