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