1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-18 07:49:48 +01:00

fastfetch: add module

PR #5363
This commit is contained in:
afresquet 2024-05-02 02:23:11 +02:00 committed by Robert Helgesson
parent 6e277d9566
commit f61917cbaa
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED
9 changed files with 164 additions and 0 deletions

View file

@ -13,6 +13,12 @@
github = "abayomi185";
githubId = 21103047;
};
afresquet = {
name = "Alvaro Fresquet";
email = "alvarofresquet@gmail.com";
github = "afresquet";
githubId = 29437693;
};
amesgen = {
name = "amesgen";
email = "amesgen@amesgen.de";

View file

@ -1607,6 +1607,17 @@ in {
between windows, and is also a widget engine.
'';
}
{
time = "2024-05-10T10:30:58+00:00";
message = ''
A new module is available: 'programs.fastfetch'.
Fastfetch is a Neofetch-like tool for fetching system information and
displaying them in a pretty way. See
https://github.com/fastfetch-cli/fastfetch for more.
'';
}
];
};
}

View file

@ -87,6 +87,7 @@ let
./programs/emacs.nix
./programs/eww.nix
./programs/eza.nix
./programs/fastfetch.nix
./programs/fd.nix
./programs/feh.nix
./programs/firefox.nix

View file

@ -0,0 +1,65 @@
{ pkgs, lib, config, ... }:
let
inherit (lib) mkEnableOption mkPackageOption mkOption mkIf literalExpression;
cfg = config.programs.fastfetch;
jsonFormat = pkgs.formats.json { };
in {
meta.maintainers = with lib.hm.maintainers; [ afresquet ];
options.programs.fastfetch = {
enable = mkEnableOption "Fastfetch";
package = mkPackageOption pkgs "fastfetch" { };
settings = mkOption {
type = jsonFormat.type;
default = { };
example = literalExpression ''
{
logo = {
source = "nixos_small";
padding = {
right = 1;
};
};
display = {
binaryPrefix = "si";
color = "blue";
separator = " ";
};
modules = [
{
type = "datetime";
key = "Date";
format = "{1}-{3}-{11}";
}
{
type = "datetime";
key = "Time";
format = "{14}:{17}:{20}";
}
"break"
"player"
"media"
];
};
'';
description = ''
Configuration written to {file}`$XDG_CONFIG_HOME/fastfetch/config.jsonc`.
See <https://github.com/fastfetch-cli/fastfetch/wiki/Json-Schema>
for the documentation.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
xdg.configFile."fastfetch/config.jsonc" = mkIf (cfg.settings != { }) {
source = jsonFormat.generate "config.jsonc" cfg.settings;
};
};
}

View file

@ -71,6 +71,7 @@ in import nmtSrc {
./modules/programs/dircolors
./modules/programs/direnv
./modules/programs/emacs
./modules/programs/fastfetch
./modules/programs/feh
./modules/programs/fish
./modules/programs/gallery-dl

View file

@ -0,0 +1,28 @@
{
"display": {
"binaryPrefix": "si",
"color": "blue",
"separator": "  "
},
"logo": {
"padding": {
"right": 1
},
"source": "nixos_small"
},
"modules": [
{
"format": "{1}-{3}-{11}",
"key": "Date",
"type": "datetime"
},
{
"format": "{14}:{17}:{20}",
"key": "Time",
"type": "datetime"
},
"break",
"player",
"media"
]
}

View file

@ -0,0 +1,39 @@
{
programs.fastfetch = {
enable = true;
settings = {
logo = {
source = "nixos_small";
padding = { right = 1; };
};
display = {
binaryPrefix = "si";
color = "blue";
separator = " ";
};
modules = [
{
type = "datetime";
key = "Date";
format = "{1}-{3}-{11}";
}
{
type = "datetime";
key = "Time";
format = "{14}:{17}:{20}";
}
"break"
"player"
"media"
];
};
};
test.stubs.fastfetch = { };
nmt.script = let configFile = "home-files/.config/fastfetch/config.jsonc";
in ''
assertFileExists "${configFile}"
assertFileContent "${configFile}" ${./basic-configuration.jsonc}
'';
}

View file

@ -0,0 +1,9 @@
{
programs.fastfetch.enable = true;
test.stubs.fastfetch = { };
nmt.script = ''
assertPathNotExists "home-files/.config/fastfetch/config.jsonc"
'';
}

View file

@ -0,0 +1,4 @@
{
fastfetch-default-configuration = ./default-configuration.nix;
fastfetch-basic-configuration = ./basic-configuration.nix;
}