diff --git a/lisp/fg42.el b/lisp/fg42.el index a6f1994..fba10d2 100644 --- a/lisp/fg42.el +++ b/lisp/fg42.el @@ -50,6 +50,9 @@ (when (file-exists-p user-init-file) (require 'fg42/cube) + (require 'fg42/flags) + (require 'fg42/cubes/fg42) + (load user-init-file)) (add-hook 'emacs-startup-hook diff --git a/lisp/fg42/cubes/editor.el b/lisp/fg42/cubes/editor.el index 13af4a3..48f3460 100644 --- a/lisp/fg42/cubes/editor.el +++ b/lisp/fg42/cubes/editor.el @@ -144,6 +144,7 @@ contextual information." :flag-default t (fpkg/use exec-path-from-shell :init + (require 'exec-path-from-shell) (when (memq window-system '(mac ns x)) (exec-path-from-shell-initialize)))) diff --git a/lisp/fg42/deps.el b/lisp/fg42/deps.el index ca40dcf..99fb8d5 100644 --- a/lisp/fg42/deps.el +++ b/lisp/fg42/deps.el @@ -116,6 +116,7 @@ mini-modeline smart-mode-line all-the-icons + exwm ) (provide 'fg42/deps) diff --git a/lisp/fg42/utils.el b/lisp/fg42/utils.el index a5cabe9..2216daf 100644 --- a/lisp/fg42/utils.el +++ b/lisp/fg42/utils.el @@ -167,7 +167,7 @@ last item in second form, etc." "A wrapper for autloading FN at FILE with the given DOCSTRING. This macro looks inside of the cubes directories. If the INTERACTIVE param is non-nil value it means that the function can be called interactively." - `(autoload ,fn (expand-file-name (format "core/fg42/cubes/%s" ,file) fg42-home) + `(autoload ,fn (expand-file-name (format "lisp/fg42/cubes/%s" ,file) fg42-home) ,docstring ,interactive)) diff --git a/nix/fg42.nix b/nix/fg42.nix index 7685c6c..bacee88 100644 --- a/nix/fg42.nix +++ b/nix/fg42.nix @@ -37,92 +37,99 @@ bash, }: with builtins; +let + getPkg = epkgs: pkg: + if hasAttr pkg epkgs + then getAttr pkg epkgs + else getAttr pkg ourPackages; -stdenv.mkDerivation (final: - let - getPkg = epkgs: pkg: - if hasAttr pkg epkgs - then getAttr pkg epkgs - else getAttr pkg ourPackages; + emacsBundle = (emacsPackagesFor emacs).withPackages (epkgs: + (map (x: getPkg epkgs x) elispPkgs) + ); - emacsBundle = (emacsPackagesFor emacs).withPackages (epkgs: - (map (x: getPkg epkgs x) elispPkgs) - ); + maintainers = import ./maintainers.nix; +in stdenv.mkDerivation (final: rec{ + pname = "fg42$"; + version = "4.0.0"; - maintainers = import ./maintainers.nix; + src = srcDir; + outputs = [ "out" ]; - in rec{ - pname = "fg42"; - version = "4.0.0"; + buildPhase = '' + LISPDIR=$out/share/fg42/ + mkdir -p $out/bin + install -d $LISPDIR + cp -rv ${src}/lisp/ $LISPDIR + cp -rv ${src}/share $out/ - src = srcDir; - outputs = [ "out" ]; + runHook preBuild - buildPhase = '' - LISPDIR=$out/share/fg42/ - mkdir -p $out/bin - install -d $LISPDIR - cp -rv ${src}/lisp/ $LISPDIR - cp -rv ${src}/share $out/ + cd $LISPDIR + emacs -L . --batch -f batch-byte-compile *.el + cd - - runHook preBuild + cat >> $out/bin/fg42 << EOF + #!${stdenv.shell} - cd $LISPDIR - emacs -L . --batch -f batch-byte-compile *.el - cd - + export FG42_HOME=${placeholder "out"}/share/fg42/ + export FG42_EMACSD=~/.fg42/v4/emacs.d + export FG42_USE_NIX=true; - cat >> $out/bin/fg42 << EOF - #!${stdenv.shell} + LIBRARY_PATH="\$(${stdenv.cc}/bin/cc -print-file-name=libgccjit.so):\$LIBRARY_PATH" \ + FG42_WM=fales ${emacsBundle}/bin/emacs \ + --name FG42 \ + -q --no-splash --title FG42 \ + -l \$FG42_HOME/lisp/fg42/init.el "\$@" + EOF + chmod +x $out/bin/fg42 + runHook postBuild - export FG42_HOME=${placeholder "out"}/share/fg42/ - export FG42_EMACSD=~/.fg42/v4/emacs.d - export FG42_USE_NIX=true; + cat >> $out/bin/fg42-wm << EOF + #!${stdenv.shell} - LIBRARY_PATH="\$(${stdenv.cc}/bin/cc -print-file-name=libgccjit.so):\$LIBRARY_PATH" \ - FG42_WM=false ${emacsBundle}/bin/emacs \ - --name FG42 \ - -q --no-splash --title FG42 \ - -l \$FG42_HOME/lisp/fg42/init.el "\$@" - EOF - chmod +x $out/bin/fg42 + export FG42_HOME=${placeholder "out"}/share/fg42/ + export FG42_EMACSD=~/.fg42/v4/emacs.d + export FG42_USE_NIX=true; - cat >> $out/bin/fg42-wm << EOF - #!${stdenv.shell} + # Disable access control for the current user. + xhost +SI:localuser:$USER - export FG42_HOME=${placeholder "out"}/share/fg42/ - export FG42_EMACSD=~/.fg42/v4/emacs.d - export FG42_USE_NIX=true; - # Disable access control for the current user. - xhost +SI:localuser:$USER + # Make Java applications aware this is a non-reparenting window manager. + export _JAVA_AWT_WM_NONREPARENTING=1 - # Make Java applications aware this is a non-reparenting window manager. - export _JAVA_AWT_WM_NONREPARENTING=1 + # Set default cursor. + xsetroot -cursor_name left_ptr - # Set default cursor. - xsetroot -cursor_name left_ptr + # Set keyboard repeat rate. + xset r rate 400 30 - # Set keyboard repeat rate. - xset r rate 400 30 + # Uncomment the following block to use the exwm-xim module. + # export XMODIFIERS=@im=exwm-xim + # export GTK_IM_MODULE=xim + # export QT_IM_MODULE=xim + # export CLUTTER_IM_MODULE=xim - # Uncomment the following block to use the exwm-xim module. - # export XMODIFIERS=@im=exwm-xim - # export GTK_IM_MODULE=xim - # export QT_IM_MODULE=xim - # export CLUTTER_IM_MODULE=xim + LIBRARY_PATH="\$(${stdenv.cc}/bin/cc -print-file-name=libgccjit.so):\$LIBRARY_PATH" \ + FG42_WM=true ${emacsBundle}/bin/emacs \ + --name FG42 \ + -q --no-splash --title FG42 \ + -l \$FG42_HOME/lisp/fg42/init.el "\$@" + EOF + chmod +x $out/bin/fg42-wm - LIBRARY_PATH="\$(${stdenv.cc}/bin/cc -print-file-name=libgccjit.so):\$LIBRARY_PATH" \ - FG42_WM=true ${emacsBundle}/bin/emacs \ - --name FG42 \ - -q --no-splash --title FG42 \ - -l \$FG42_HOME/lisp/fg42/init.el "\$@" - EOF - chmod +x $out/bin/fg42-wm + cat >> $out/share/runtiem_deps << EOF + ${vazir-fonts} + ${fira-code} + ${nerdfonts} + ${ripgrep} + ${git} + ${ltex-ls} + EOF - runHook postBuild + runHook postBuild + ''; - ''; - - installPhase = '' + installPhase = '' runHook preInstall #LISPDIR=$out/share/fg42/lisp/ @@ -132,39 +139,37 @@ stdenv.mkDerivation (final: ''; - buildInputs = [ - gcc - emacs - texinfo - emacsBundle - ripgrep - git - texinfo - vazir-fonts - fira-code - nerdfonts - gcc - ltex-ls - bash - ]; + buildInputs = [ + emacs + texinfo + emacsBundle + ripgrep + git + texinfo + vazir-fonts + fira-code + nerdfonts + gcc + ltex-ls + bash + ]; + addEmacsNativeLoadPath = true; - addEmacsNativeLoadPath = true; - - meta = { - broken = false; - platforms = emacs.meta.platforms; - homepage = "https://fg42.org/"; - maintainers = [ maintainers.lxsameer ]; - description = "The mighty editor for the emacsians"; - longDescription = '' + meta = { + broken = false; + platforms = emacs.meta.platforms; + homepage = "https://fg42.org/"; + 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. So you need to know about Emacs in advance. ''; - license = lib.licenses.gpl3Plus; - }; + license = lib.licenses.gpl3Plus; + }; - }) +})