From f9516c05c5b222d98ae90738358f4271d4e88585 Mon Sep 17 00:00:00 2001 From: seth Date: Thu, 24 Oct 2024 18:32:13 -0400 Subject: hyfetch: init at 1.99.0-unstable-2024-10-23 (#118) * hyfetch: init at 1.99.0-unstable-2024-10-23 * neowofetch: only enable x11 support by default on linux * ci: don't check all systems some packages are broken by deps on lower tier platforms. ci doesn't need to fail over them --- .github/workflows/ci.yaml | 13 +++++-- pkgs/hyfetch/package.nix | 92 +++++++++++++++++++++++++++++++++++++++++++++ pkgs/neowofetch/package.nix | 55 +++++++++++++++++++++++++++ 3 files changed, 156 insertions(+), 4 deletions(-) create mode 100644 pkgs/hyfetch/package.nix create mode 100644 pkgs/neowofetch/package.nix diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e129cf7..461b871 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -51,6 +51,12 @@ jobs: name: getchoo authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} + - name: Evaluate flake + run: | + nix flake check \ + --no-build \ + --show-trace + - name: Run build run: | nix run \ @@ -60,7 +66,7 @@ jobs: --systems '${{ matrix.system }}' \ --option accept-flake-config true \ --option allow-import-from-derivation false \ - --flake '.#packages' + --flake '.#packages.${{ matrix.system }}' check: name: Check flake @@ -77,10 +83,9 @@ jobs: - name: Run check run: | nix flake check \ - --all-systems \ + --accept-flake-config \ --print-build-logs \ - --show-trace \ - --accept-flake-config + --show-trace build-gate: name: Build gate diff --git a/pkgs/hyfetch/package.nix b/pkgs/hyfetch/package.nix new file mode 100644 index 0000000..597999b --- /dev/null +++ b/pkgs/hyfetch/package.nix @@ -0,0 +1,92 @@ +{ + lib, + fastfetch, + fetchFromGitHub, + installShellFiles, + macchina, + makeBinaryWrapper, + neowofetch, + rustPlatform, + unstableGitUpdater, + withAutocomplete ? true, + withColor ? true, + withFastfetch ? true, + withMacchina ? true, +}: + +let + binPath = [ + neowofetch + ] ++ lib.optional withFastfetch fastfetch ++ lib.optional withMacchina macchina; +in +rustPlatform.buildRustPackage rec { + pname = "hyfetch"; + version = "1.99.0-unstable-2024-10-23"; + + src = fetchFromGitHub { + owner = "hykilpikonna"; + repo = "hyfetch"; + rev = "b5b49ecbc095ac20e49c0783121c885752df9001"; + hash = "sha256-W1oMzLACGDvcl8du4L3TuUn79i6HFUFuPEJhc3IPD0E="; + }; + + # https://github.com/hykilpikonna/hyfetch/pull/361 + # + # Upstream will call `neowofetch` with Bash (from the PATH) by default + # We know `neowofetch` has a shebang though, so run it directly to avoid + # adding Bash to the wrapper + # + # Yes, this introduces 2 warnings + postPatch = '' + substituteInPlace crates/hyfetch/src/neofetch_util.rs \ + --replace-fail 'command.arg(neofetch_path)' 'let mut command = Command::new(neofetch_path)' + ''; + + cargoHash = "sha256-4Tz6hqzjlCT5PSa1AzWGU6mBHWxMcsJm9+Uzmsvurps="; + + strictDeps = true; + + nativeBuildInputs = [ + installShellFiles + makeBinaryWrapper + ]; + + cargoBuildNoDefaultFeatures = true; + cargoBuildFeatures = + lib.optional withAutocomplete "autocomplete" + ++ lib.optional withColor "color" + ++ lib.optional withMacchina "macchina"; + + cargoBuildFlags = [ "--package hyfetch" ]; + cargoTestFlags = cargoBuildFlags; + + postInstall = '' + installManPage docs/hyfetch.1 + ''; + + postFixup = '' + wrapProgram "$out"/bin/hyfetch \ + --prefix PATH : ${lib.makeBinPath binPath} + ''; + + passthru = { + updateScript = unstableGitUpdater { }; + }; + + meta = { + description = "neofetch with pride flags <3"; + longDescription = '' + HyFetch is a command-line system information tool fork of neofetch. + HyFetch displays information about your system next to your OS logo + in ASCII representation. The ASCII representation is then colored in + the pattern of the pride flag of your choice. The main purpose of + HyFetch is to be used in screenshots to show other users what + operating system or distribution you are running, what theme or + icon set you are using, etc. + ''; + homepage = "https://github.com/hykilpikonna/HyFetch"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ getchoo ]; + mainProgram = "hyfetch"; + }; +} diff --git a/pkgs/neowofetch/package.nix b/pkgs/neowofetch/package.nix new file mode 100644 index 0000000..8efa167 --- /dev/null +++ b/pkgs/neowofetch/package.nix @@ -0,0 +1,55 @@ +{ + lib, + bash, + hyfetch, + installShellFiles, + makeBinaryWrapper, + pciutils, + stdenvNoCC, + ueberzug, + withX11Support ? stdenvNoCC.hostPlatform.isLinux, +}: + +stdenvNoCC.mkDerivation (finalAttrs: { + pname = "neowofetch"; + + inherit (hyfetch) version src; + + strictDeps = true; + + nativeBuildInputs = [ + installShellFiles + makeBinaryWrapper + ]; + + buildInputs = [ bash ]; + + dontConfigure = true; + dontBuild = true; + + postInstall = '' + mv {neo,neowo}fetch + installBin neowofetch + + mv docs/{neo,neowo}fetch.1 + installManPage docs/neowofetch.1 + ''; + + postFixup = '' + wrapProgram "$out"/bin/neowofetch \ + --prefix PATH : ${lib.makeBinPath finalAttrs.passthru.binPath} + ''; + + passthru = { + binPath = [ pciutils ] ++ lib.optional withX11Support ueberzug; + }; + + meta = { + description = "Fast, highly customizable system info script (Maintained fork)"; + homepage = "https://github.com/hykilpikonna/hyfetch"; + changelog = "https://github.com/hykilpikonna/hyfetch/releases/tag/${finalAttrs.version}"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ getchoo ]; + mainProgram = "neowofetch"; + }; +}) -- cgit v1.2.3