NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.06k stars 14.08k forks source link

Package request: fastcompmgr #336772

Closed TanvirOnGH closed 1 month ago

TanvirOnGH commented 2 months ago

Project description

A blazing fast and simple compositor for X11.

Metadata

camerondugan commented 2 months ago

Hey, I was able to get it to build with this config, I'm a complete newbie so guidance is greatly appreciated.

fastcompmgr.nix

{ 
  stdenv,
  fetchFromGitHub,
  xorg,
  pkgs,
}:
stdenv.mkDerivation {
  pname = "fastcompmgr";
  version = "0.3";
  src = fetchFromGitHub {
    owner  = "tycho-kirchner";
    repo = "fastcompmgr";
    rev = "v0.3";
    sha256 = "sha256-UKX0gjhbbXSXfyw/NGA31vTOfgd4kdnxO7lIs+mkgFs=";
  };

  nativeBuildInputs = [ pkgs.pkg-config ];

  buildInputs = [ 
    xorg.libX11
    xorg.libXcomposite
    xorg.libXdamage
    xorg.libXfixes
    xorg.libXrender
  ];

  installPhase = ''
    runHook preInstall
    mkdir -p $out/bin
    cp fastcompmgr $out/bin
    runHook postInstall
  '';
}

and in my default.nix:

let
  nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-unstable";
  pkgs = import nixpkgs { config = {}; overlays = []; };
in
{
  fastcompmgr = pkgs.callPackage ./fastcompmgr.nix { };
}
Sigmanificient commented 2 months ago

Hi @camerondugan, you will need to add a meta attribute set at the end of your package with the description, homepage, license and maintainers key. For this, you might need to add yourself in maintainer list.

Your pull request should have 2 commits:

maintainers: add https://github.com/camerondugan
fastcompmgr: init at 0.3

You should add the package code in pkgs/by-name/fa/fastcompmgr/package.nix. It should build via nix-build -A fastcompmgr command.

Make sure it is also formatted with nixfmt-rfc-style.

You might also want to change a few things, so here is a diff: (LICENSE_NAME & YOU has to be set)

  { 
    stdenv,
    fetchFromGitHub,
    xorg,
    pkgs,
  }:
- stdenv.mkDerivation {
+ stdenv.mkDerivation (finalAttrs: {
    pname = "fastcompmgr";
    version = "0.3";
+ 
    src = fetchFromGitHub {
      owner  = "tycho-kirchner";
      repo = "fastcompmgr";
-     rev = "v0.3";
+     rev = "refs/tags/v${finalAttrs.version}";
-     sha256 = "sha256-UKX0gjhbbXSXfyw/NGA31vTOfgd4kdnxO7lIs+mkgFs=";
+     hash = "sha256-UKX0gjhbbXSXfyw/NGA31vTOfgd4kdnxO7lIs+mkgFs=";
    };

    nativeBuildInputs = [ pkgs.pkg-config ];

    buildInputs = [ 
      xorg.libX11
      xorg.libXcomposite
      xorg.libXdamage
      xorg.libXfixes
      xorg.libXrender
    ];

    installPhase = ''
      runHook preInstall
+ 
      mkdir -p $out/bin
      cp fastcompmgr $out/bin
+ 
      runHook postInstall
    '';
+
+   meta = {
+    description = "Fast compositor for X11";
+    homepage = "https://github.com/tycho-kirchner/fastcompmgr";
+    license = lib.licenses.LICENSE_NAME
+    maintainers = with lib.maintainers; [ YOU ];
+    platforms = lib.platforms.linux;
+   };
-  }
+ })
camerondugan commented 2 months ago

hey @Sigmanificient, I've followed your advice and opened a pull request: #336909

gepbird commented 1 month ago

Fixed by https://github.com/NixOS/nixpkgs/pull/336909