Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixpkg file #265

Open
Cloudef opened this issue Apr 17, 2023 · 0 comments
Open

nixpkg file #265

Cloudef opened this issue Apr 17, 2023 · 0 comments

Comments

@Cloudef
Copy link

Cloudef commented Apr 17, 2023

For anyone looking for easy way to install this:

{ pkgs ? import <nixpkgs> {}, stdenv ? pkgs.stdenv, lib ? pkgs.lib, fetchFromGitHub ? pkgs.fetchFromGitHub, fetchurl ? pkgs.fetchurl }:

let
  stb_image = fetchurl {
    url = "https://raw.githubusercontent.com/nothings/stb/5736b15f7ea0ffb08dd38af21067c314d6a3aae9/stb_image.h";
    hash = "sha256-OOCMHFq4hpro1gXdrvqFrT/qJKKWT9Y6CZwMD3nHC8w=";
  };
  stb_image_write = fetchurl {
    url = "https://raw.githubusercontent.com/nothings/stb/5736b15f7ea0ffb08dd38af21067c314d6a3aae9/stb_image_write.h";
    hash = "sha256-y9XwrXqc9EaK/7NjVKHSM4A08sEkc88ajjIFPLaRSgU=";
  };
in stdenv.mkDerivation rec {
  pname = "qoiconv";
  version = "0.0.1";

  src = fetchFromGitHub {
    owner = "phoboslab";
    repo = "qoi";
    rev = "f6dffaf1e8170cdd79945a4fb60f6403e447e020";
    hash = "sha256-yxDvll2kJVnlkPnXqCTC5uRrJnntEhwtd3JqQiPzins=";
  };

  makeFlags = [ "conv" ];

  patchPhase = ''
    ln -s ${stb_image} stb_image.h
    ln -s ${stb_image_write} stb_image_write.h
    '';

  installPhase = ''
    install -Dm744 qoiconv $out/bin/qoiconv
    '';

  meta = with lib; {
    description = "The “Quite OK Image Format” for fast, lossless image compression";
    homepage = "https://github.com/phoboslab/qoi";
    license = licenses.mit;
    maintainers = with maintainers; [];
  };
}

Feel free to contribute into nixpkgs and become a maintainer if you want.
(Would be nice if makefile had install rule that took in the usual PREFIX, and that stb headers were actually included in the repo)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant