ufetch: init at 0.3 (#266274)
This commit is contained in:
commit
ba69170047
20
pkgs/by-name/uf/ufetch/0001-optimize-packages-command.patch
Normal file
20
pkgs/by-name/uf/ufetch/0001-optimize-packages-command.patch
Normal file
@ -0,0 +1,20 @@
|
||||
diff --git a/ufetch-nixos b/ufetch-nixos
|
||||
index 2ca8f9d..5102cd7 100755
|
||||
--- a/ufetch-nixos
|
||||
+++ b/ufetch-nixos
|
||||
@@ -9,9 +9,14 @@ host="$(hostname)"
|
||||
os="$(nixos-version)"
|
||||
kernel="$(uname -sr)"
|
||||
uptime="$(uptime | awk -F, '{sub(".*up ",x,$1);print $1}' | sed -e 's/^[ \t]*//')"
|
||||
-packages="$(ls -d -1 /nix/store/*/ | wc -l)"
|
||||
shell="$(basename "${SHELL}")"
|
||||
|
||||
+for profile in $NIX_PROFILES; do
|
||||
+ if [ -d "$profile" ]; then
|
||||
+ packages="$((packages + $( (nix-store -q --requisites "$profile" 2>/dev/null || true) | wc -l)))"
|
||||
+ fi
|
||||
+done
|
||||
+
|
||||
## UI DETECTION
|
||||
|
||||
parse_rcs() {
|
47
pkgs/by-name/uf/ufetch/package.nix
Normal file
47
pkgs/by-name/uf/ufetch/package.nix
Normal file
@ -0,0 +1,47 @@
|
||||
{
|
||||
stdenvNoCC,
|
||||
fetchFromGitLab,
|
||||
lib,
|
||||
full ? true,
|
||||
# see https://gitlab.com/jschx/ufetch for a list
|
||||
osName ? "nixos",
|
||||
}:
|
||||
|
||||
stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
pname = "ufetch";
|
||||
version = "0.3";
|
||||
|
||||
src = fetchFromGitLab {
|
||||
owner = "jschx";
|
||||
repo = "ufetch";
|
||||
rev = "v${finalAttrs.version}";
|
||||
hash = "sha256-1LtVCJrkdI2AUdF5d/OBCoSqjlbZI810cxtcuOs/YWs=";
|
||||
};
|
||||
|
||||
patches = [ ./0001-optimize-packages-command.patch ];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out/bin $out/share/licenses/${finalAttrs.pname}
|
||||
${
|
||||
if !full then
|
||||
"install -Dm755 ufetch-${osName} $out/bin/ufetch"
|
||||
else
|
||||
''
|
||||
install -Dm755 ufetch-* $out/bin
|
||||
ln -s $out/bin/ufetch-${osName} $out/bin/ufetch
|
||||
''
|
||||
}
|
||||
install -Dm644 LICENSE $out/share/licenses/${finalAttrs.pname}/LICENSE
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Tiny system info for Unix-like operating systems";
|
||||
homepage = "https://gitlab.com/jschx/ufetch";
|
||||
license = lib.licenses.mit;
|
||||
platforms = lib.platforms.linux;
|
||||
mainProgram = "ufetch";
|
||||
maintainers = with lib.maintainers; [ mrtnvgr ];
|
||||
};
|
||||
})
|
Loading…
Reference in New Issue
Block a user