From 477f24b67b5518f243cae3ad4ab225c0f7dd2fb5 Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Wed, 27 Mar 2024 23:50:44 +0000 Subject: [PATCH] Fix the missing Fira Mono font --- flake.nix | 2 +- nix/desktop.nix | 33 +++++++ nix/fg42.nix | 167 ++++++++++++++------------------ share/applications/fg42.desktop | 13 --- 4 files changed, 106 insertions(+), 109 deletions(-) create mode 100644 nix/desktop.nix delete mode 100644 share/applications/fg42.desktop diff --git a/flake.nix b/flake.nix index 8676cfa..e2384bc 100644 --- a/flake.nix +++ b/flake.nix @@ -55,7 +55,7 @@ ourPackages = pkgs.callPackage ./nix/packages.nix {}; fg42 = pkgs.callPackage ./nix/fg42.nix { - inherit elispPkgs ourPackages nixpkgs; + inherit elispPkgs ourPackages; srcDir = ./.; emacs = lemacs; }; diff --git a/nix/desktop.nix b/nix/desktop.nix new file mode 100644 index 0000000..1fca586 --- /dev/null +++ b/nix/desktop.nix @@ -0,0 +1,33 @@ +# 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 . +{ pkgs, fg42, version }: +{ + desktop = pkgs.writeText "FG42.desktop" '' +[Desktop Entry] +Encoding=UTF-8 +Name=FG42 +GenericName=FG42 +Comment=Emacs Editor for advance users +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=${fg42} %F +Icon=fg42 +Version=${version} + ''; +} diff --git a/nix/fg42.nix b/nix/fg42.nix index 4bc6998..cbfc490 100644 --- a/nix/fg42.nix +++ b/nix/fg42.nix @@ -13,103 +13,86 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -{ - lib, - nixpkgs, - stdenv, - elispPkgs, - srcDir, - emacsPackagesFor, - ourPackages, - writeText, - symlinkJoin, - direnv, - nix, - nil, # nix lsp server +{ lib, stdenv, elispPkgs, srcDir, emacsPackagesFor, ourPackages, direnv +, makeDesktopItem, nix - # python deps - python311, - python3Packages, - # This is a set of system tools required for FG42 - # to work. - pyright, - emacs, - ripgrep, - git, - texinfo, - vazir-fonts, - fira-code, - nerdfonts, - noto-fonts, - gcc, - ltex-ls, - bash, - tree-sitter, +, nil, # nix lsp server - supportWM ? true, - xorg, - slock, +# python deps +python311, python3Packages, +# This is a set of system tools required for FG42 +# to work. +pyright, emacs, ripgrep, git, texinfo, vazir-fonts, fira-code, nerdfonts +, fira-mono, noto-fonts, gcc, ltex-ls, bash, tree-sitter, - supportPython ? true, - supportVerilog ? true, - svls, - verilator, -}: +supportWM ? true, xorg, slock, + +supportPython ? true, supportVerilog ? true, svls, verilator, }: with builtins; let + version = "4.0.0"; getPkg = epkgs: pkg: - if hasAttr pkg epkgs - then getAttr pkg epkgs - else getAttr pkg ourPackages; + if hasAttr pkg epkgs then getAttr pkg epkgs else getAttr pkg ourPackages; emacsBundle = (emacsPackagesFor emacs).withPackages (epkgs: - (map (x: getPkg epkgs x) elispPkgs) ++ [ - epkgs.treesit-grammars.with-all-grammars - ] - ); + (map (x: getPkg epkgs x) elispPkgs) + ++ [ epkgs.treesit-grammars.with-all-grammars ]); maintainers = import ./maintainers.nix; - runtimeBins = [ - ripgrep - git - ltex-ls - tree-sitter - direnv - nix - nil - ] ++ (lib.optional supportPython [ - python311 - # Python deps - python311 - pyright + runtimeBins = [ ripgrep git ltex-ls tree-sitter direnv nix nil ] + ++ (lib.optional supportPython [ + python311 + # Python deps + python311 + pyright - python3Packages.black - python3Packages.pylint - python3Packages.flake8 - ]) ++ (lib.optional supportVerilog [ - svls - ]) ++ (lib.optional (supportVerilog && stdenv.isLinux) [ - # SystemC is required by verilator that at the - # moment is only available on Linux - verilator - ]) ++ (lib.optional (supportWM && stdenv.isLinux) [ - # Window manager supports works on Linux only - xorg.xhost - slock - ]); + python3Packages.black + python3Packages.pylint + python3Packages.flake8 + ]) ++ (lib.optional supportVerilog [ svls ]) + ++ (lib.optional (supportVerilog && stdenv.isLinux) [ + # SystemC is required by verilator that at the + # moment is only available on Linux + verilator + ]) ++ (lib.optional (supportWM && stdenv.isLinux) [ + # Window manager supports works on Linux only + xorg.xhost + slock + ]); paths = map (x: "${x}/bin/") (lib.lists.flatten runtimeBins); pathsStr = lib.strings.concatStrings (lib.strings.intersperse ":" paths); -in stdenv.mkDerivation (final: rec{ +in stdenv.mkDerivation (final: rec { + inherit version; pname = "fg42"; - version = "4.0.0"; + + desktop = makeDesktopItem { + name = "FG42"; + desktopName = "FG42"; + 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" ]; - buildPhase = '' + buildPhase = '' LISPDIR=$out/share/fg42/ mkdir -p $out/bin install -d $LISPDIR @@ -178,32 +161,26 @@ in stdenv.mkDerivation (final: rec{ cat >> $out/share/runtiem_deps << EOF ${vazir-fonts} ${fira-code} + ${fira-mono} ${nerdfonts} ${noto-fonts} ${lib.strings.concatLines paths} + ${desktop}/share/applications/FG42.desktop EOF runHook postBuild ''; installPhase = '' - runHook preInstall + runHook preInstall - #LISPDIR=$out/share/fg42/lisp/ - #emacs --batch -l package --eval "(package-generate-autoloads \"${pname}\" \"$LISPDIR\")" + #LISPDIR=$out/share/fg42/lisp/ + #emacs --batch -l package --eval "(package-generate-autoloads \"${pname}\" \"$LISPDIR\")" - runHook postInstall - ''; + runHook postInstall + ''; - - buildInputs = [ - emacs - emacsBundle - git - texinfo - gcc - bash - ]; + buildInputs = [ emacs emacsBundle git texinfo gcc bash ]; addEmacsNativeLoadPath = true; @@ -214,12 +191,12 @@ in stdenv.mkDerivation (final: rec{ maintainers = [ maintainers.lxsameer ]; description = "The mighty editor for the emacsians"; longDescription = '' - FG42 is a framework to create and editor and window manager based on GNU/Emacs. - It has a pre-defined setup as well which can be installed out of the box. But the - goal of this project is to provide the API necessary to create an integrated editor. + FG42 is a framework to create and editor and window manager based on GNU/Emacs. + It has a pre-defined setup as well which can be installed out of the box. But the + goal of this project is to provide the API necessary to create an integrated editor. - So you need to know about Emacs in advance. - ''; + So you need to know about Emacs in advance. + ''; license = lib.licenses.gpl3Plus; }; diff --git a/share/applications/fg42.desktop b/share/applications/fg42.desktop deleted file mode 100644 index 5619721..0000000 --- a/share/applications/fg42.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Name=FG42 -GenericName=FG42 -Comment=An Emacs base editor for true believers -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=/usr/local/bin/fg42 %F -Icon=fg42 -Version=2.67 \ No newline at end of file