bin.nix (1661B)
1 { lib, stdenv, fetchfromgh, appimageTools, undmg }: 2 let 3 inherit (stdenv.hostPlatform) system; 4 throwSystem = throw "Unsupported system: ${system}"; 5 6 pname = "klogg-bin"; 7 version = "22.06"; 8 9 suffix = { 10 x86_64-linux = "Linux-amd64.AppImage"; 11 x86_64-darwin = "OSX-Qt5.dmg"; 12 }.${system} or throwSystem; 13 14 src = fetchfromgh { 15 owner = "variar"; 16 repo = "klogg"; 17 version = "v${version}"; 18 name = "klogg-${version}.0.1289-${suffix}"; 19 hash = { 20 x86_64-linux = "sha256-XawJ6VOF0XtMrl7iefm13quv83X171k9eKiXClrklZI="; 21 x86_64-darwin = "sha256-5d93ItDYUYUt2cw0Sd1C0f7z507dqMINwEs4y4UrD+w="; 22 }.${system} or throwSystem; 23 }; 24 25 appimageContents = appimageTools.extract { 26 inherit pname version src; 27 }; 28 29 meta = with lib; { 30 description = "A fast, advanced log explorer based on glogg project"; 31 homepage = "https://klogg.filimonov.dev/"; 32 license = licenses.gpl3Plus; 33 platforms = [ "x86_64-linux" "x86_64-darwin" ]; 34 maintainers = [ maintainers.sikmir ]; 35 skip.ci = true; 36 }; 37 38 linux = appimageTools.wrapType2 rec { 39 inherit pname version src meta; 40 41 extraInstallCommands = '' 42 mv $out/bin/{${pname}-${version},klogg} 43 install -Dm644 ${appimageContents}/klogg.desktop -t $out/share/applications 44 install -Dm644 ${appimageContents}/klogg.png -t $out/share/icons/hicolor/scalable/apps 45 ''; 46 }; 47 48 darwin = stdenv.mkDerivation { 49 inherit pname version src meta; 50 51 nativeBuildInputs = [ undmg ]; 52 53 sourceRoot = "."; 54 55 installPhase = '' 56 mkdir -p $out/Applications 57 cp -r *.app $out/Applications 58 ''; 59 }; 60 in 61 if stdenv.isDarwin 62 then darwin 63 else linux