qt-chat-app

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

derivation.nix (1920B)


      1 { lib
      2 , stdenv
      3 , cmake
      4 , qt6
      5 , wrapQtAppsHook
      6 , rust
      7 , rustPlatform
      8 , pkg-config
      9 , git
     10 , cacert
     11 , Security ? null
     12 , SystemConfiguration ? null
     13 , libsecret ? null
     14 , dbus ? null
     15 , llvmPackages ? null
     16 }:
     17 
     18 let
     19   pname = "Beegram";
     20   version = "1.0.0";
     21 
     22   buildInputs = [
     23     qt6.qtbase
     24     qt6.qtdeclarative
     25     qt6.qt5compat
     26   ] ++ lib.optionals stdenv.isDarwin [
     27     Security
     28     SystemConfiguration
     29   ] ++ lib.optionals stdenv.isLinux [
     30     libsecret
     31     dbus
     32   ];
     33 
     34   nativeBuildInputs = [
     35     cmake
     36     wrapQtAppsHook
     37     rust
     38     pkg-config
     39     git
     40     cacert
     41   ];
     42 
     43 in
     44 stdenv.mkDerivation rec {
     45   inherit pname version;
     46 
     47   src = ./.;
     48 
     49   inherit nativeBuildInputs buildInputs;
     50 
     51   env = lib.optionalAttrs (llvmPackages != null) {
     52     LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
     53   };
     54 
     55   preConfigure = ''
     56     export CARGO_HOME=$TMPDIR/cargo
     57     mkdir -p $CARGO_HOME
     58   '';
     59 
     60   postInstall = lib.optionalString stdenv.isDarwin ''
     61     mkdir -p $out/Applications/${pname}.app/Contents/{MacOS,Resources}
     62     mv $out/bin/demo $out/Applications/${pname}.app/Contents/MacOS/
     63 
     64     cat > $out/Applications/${pname}.app/Contents/Info.plist << EOF
     65     <?xml version="1.0" encoding="UTF-8"?>
     66     <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
     67     <plist version="1.0">
     68     <dict>
     69       <key>CFBundleExecutable</key>
     70       <string>demo</string>
     71       <key>CFBundleIdentifier</key>
     72       <string>com.example.telegram-clone</string>
     73       <key>CFBundleName</key>
     74       <string>${pname}</string>
     75       <key>CFBundleVersion</key>
     76       <string>${version}</string>
     77       <key>CFBundlePackageType</key>
     78       <string>APPL</string>
     79     </dict>
     80     </plist>
     81     EOF
     82 
     83     rmdir $out/bin || true
     84   '';
     85 
     86   meta = with lib; {
     87     description = "Beegram, a messaging application built using Qt";
     88     license = licenses.mit;
     89     maintainers = [ ];
     90     platforms = platforms.unix;
     91   };
     92 }