From 02794af163a7227d44f9878db3b3f3141a782d00 Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Fri, 5 Apr 2024 22:32:40 +0100 Subject: [PATCH] Fix the missing desktop file --- nix/fg42.nix | 33 +++++++++++++++++++-------------- nix/mimes.nix | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 14 deletions(-) create mode 100644 nix/mimes.nix diff --git a/nix/fg42.nix b/nix/fg42.nix index 2b787b8..f41585d 100644 --- a/nix/fg42.nix +++ b/nix/fg42.nix @@ -67,6 +67,8 @@ let paths = map (x: "${x}/bin/") (lib.lists.flatten runtimeBins); pathsStr = lib.strings.concatStrings (lib.strings.intersperse ":" paths); + mimes = import ./mimes.nix; + in stdenv.mkDerivation (final: rec { inherit version; pname = "fg42"; @@ -77,20 +79,6 @@ in stdenv.mkDerivation (final: rec { exec = "${placeholder "out"}/bin/fg42 %F"; comment = "Emacs Editor for advance users"; }; - # [Desktop Entry] - # Encoding=UTF-8 - # Name=FG42 - # GenericName=FG42 - # Comment= - # MimeType=text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-java;application/x-shellscript;text/x-c;text/x-c++;text/x-ruby;text/x-python;text/x-clojure;text/css;text/html;text/x-javascript; - # Type=Application - # Terminal=false - # Categories=Development;TextEditor; - # StartupWMClass=FG42 - # Exec= - # Icon=fg42 - # Version=${version} - # ''; src = srcDir; outputs = [ "out" ]; @@ -98,12 +86,29 @@ in stdenv.mkDerivation (final: rec { buildPhase = '' LISPDIR=$out/share/fg42/ mkdir -p $out/bin + mkdir -p $out/share/applications/ install -d $LISPDIR cp -rv ${src}/lisp/ $LISPDIR cp -rv ${src}/share $out/ cp -rv ${src}/snippets $LISPDIR/snippets + cat >> $out/share/applications/FG42.desktop << EOF + [Desktop Entry] + Encoding=UTF-8 + Name=FG42 + GenericName=FG42 + Comment=The nix base Emacs bundle for advance users + MimeType=${mimes.mimeTypes} + Type=Application + Terminal=false + Categories=Development;TextEditor; + StartupWMClass=FG42 + Exec=${placeholder "out"}/bin/fg42 + Icon=fg42 + Version=${version} + EOF + runHook preBuild cd $LISPDIR diff --git a/nix/mimes.nix b/nix/mimes.nix new file mode 100644 index 0000000..96e5a02 --- /dev/null +++ b/nix/mimes.nix @@ -0,0 +1,34 @@ +# Fg42 - Emacs Editor for advance users +# +# Copyright (c) 2010-2024 Sameer Rahmani +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, version 2. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +rec { + types = [ + "text/x-makefile" + "text/x-c++hdr" + "text/x-c++src" + "text/x-java" + "application/x-shellscript" + "text/x-c" + "text/x-c++" + "text/x-ruby" + "text/x-python" + "text/x-clojure" + "text/css" + "text/html" + "text/x-javascript" + ]; + + mimeTypes = builtins.concatStringsSep ";" types; +}