NixOS / nixpkgs

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

Package request: QtGain #299560

Open NurzumSpassda opened 7 months ago

NurzumSpassda commented 7 months ago

Project description

QtGain is a simply frontend for MP3Gain, VorbisGain, AACGain and Metaflac which analyses and adjusts your media files so that they have the same volume without the need to reencode the files.

With QtGain you can simplify this job to replay gain your media files. Simply add your files or folders via drag & drop or select a folder with a file dialog. QtGain starts gaining immediately after adding some files and of course you can add more files while QtGain works on your files. Files which are already gained and need no recalculating are automatically skipped. Files which cannot processed are automatically listed in a dialog box at the end of the job. (Source: https://sourceforge.net/projects/qtgain/).

Metadata


Add a :+1: reaction to issues you find important.

ByteSudoer commented 7 months ago

@NurzumSpassda I created this derivation to package qtgain:

{ lib
, fetchgit
, stdenv
, qt5
, makeDesktopItem
# These followwing dependencies are optional but are needed for more support
, mp3gain
, vorbisgain
, flac
, aacgain
}:
stdenv.mkDerivation(finalAttrs: {
  pname = "qtgain";
  version = "1.0.0";

  src = fetchgit {
    url = "https://git.code.sf.net/p/qtgain/code";
    hash = "sha256-8k197qqJMlnrv01bpTF8iRawbj/2LWeSrxsPOdXCnT4=";
  };

  nativeBuildInputs = [
    qt5.qmake
    qt5.wrapQtAppsHook
  ];

  buildInputs = [
    qt5.qtbase
    mp3gain
    vorbisgain
    flac
    aacgain
  ];

  desktopItem = makeDesktopItem {
    name = "QtGain";
    exec = "qtgain";
    icon = finalAttrs.meta.mainProgram;
    desktopName = finalAttrs.meta.mainProgram;
    categories = [ "Audio" ];
  };

  installPhase = ''
    mkdir -p $out/{bin,share}
    install -Dm0744 bin/qtgain $out/bin
    install -Dm0644 qtgain.png $out/share/pixmmaps/qtgain.png
  '';

  meta = with lib; {
    homePage = "http://www.qt-apps.org/content/show.php/QtGain?content=56842";
    mainProgram = "qtgain";
    license = licenses.gpl2;
  };
})

I saw no point in creating a PR and waiting for it to be merged as the last update on upstream was 4 years ago. you can test this derivation and get back to me.Thx

NurzumSpassda commented 7 months ago

Okay, thanks for the quickly answer. This steps in the configuration.nix or in a single command in the terminal?

Sorry, I'm new in NixOS, but really amazed from this distribution.

ByteSudoer commented 7 months ago

you can create a file nmed qtgain.nix with the following content:

{
  pkgs ? import <nixpkgs> {}
}:
pkgs.stdenv.mkDerivation(finalAttrs: {
  pname = "qtgain";
  version = "1.0.0";

  src = pkgs.fetchgit {
    url = "https://git.code.sf.net/p/qtgain/code";
    hash = "sha256-8k197qqJMlnrv01bpTF8iRawbj/2LWeSrxsPOdXCnT4=";
  };

  nativeBuildInputs = with pkgs;[
    qt5.qmake
    qt5.wrapQtAppsHook
  ];

  buildInputs = with pkgs;[
    qt5.qtbase
    mp3gain
    vorbisgain
    flac
    aacgain
  ];

  desktopItem = pkgs.makeDesktopItem {
    name = "QtGain";
    exec = "qtgain";
    icon = finalAttrs.meta.mainProgram;
    desktopName = finalAttrs.meta.mainProgram;
    categories = [ "Audio" ];
  };

  installPhase = ''
    mkdir -p $out/{bin,share}
    install -Dm0744 bin/qtgain $out/bin
    install -Dm0644 qtgain.png $out/share/pixmmaps/qtgain.png
  '';

  meta = with pkgs.lib; {
    homePage = "http://www.qt-apps.org/content/show.php/QtGain?content=56842";
    mainProgram = "qtgain";
    license = licenses.gpl2;
  };
})

and then run this command nix-build derivation.nix and that will create a symlink to a a directory under /nix/store where you can find you executable binary under the bin directory.

NurzumSpassda commented 7 months ago

Thanks so much. I've the program carefully in my home folder installed. It works fine. I must find the gain programs like mp3gain because NixOS don't use usr/bin but that was easy. In the nix/store I could find the binary files. In the case that's not planned to integrate qtgain in the official packages I can live with this possibility.

NurzumSpassda commented 7 months ago

Short question for last: In case I will deinstall this program which command must I do in the terminal? Just that the entry in nixos-store disappear? Thanks!