Compare commits

...

2 Commits

7 changed files with 246 additions and 206 deletions

View File

@ -23,7 +23,7 @@
},
"emacs-overlay_2": {
"inputs": {
"flake-utils": "flake-utils_3",
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_3",
"nixpkgs-stable": "nixpkgs-stable_2"
},
@ -42,6 +42,42 @@
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1712014858,
"narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "9126214d0a59633752a136528f5f3b9aa8565b7d",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib_2"
},
"locked": {
"lastModified": 1712014858,
"narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "9126214d0a59633752a136528f5f3b9aa8565b7d",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
@ -64,24 +100,6 @@
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_3": {
"inputs": {
"systems": "systems_3"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
@ -96,24 +114,6 @@
"type": "github"
}
},
"flake-utils_4": {
"inputs": {
"systems": "systems_4"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1707689078,
@ -130,6 +130,42 @@
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"dir": "lib",
"lastModified": 1711703276,
"narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d8fe5e6c92d0d190646fb9f1056741a229980089",
"type": "github"
},
"original": {
"dir": "lib",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib_2": {
"locked": {
"dir": "lib",
"lastModified": 1711703276,
"narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d8fe5e6c92d0d190646fb9f1056741a229980089",
"type": "github"
},
"original": {
"dir": "lib",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1707650010,
@ -213,20 +249,20 @@
"noether": {
"inputs": {
"emacs-overlay": "emacs-overlay_2",
"flake-utils": "flake-utils_4",
"flake-parts": "flake-parts_2",
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1712346647,
"narHash": "sha256-flVg6BjO8umCjYpjRhCmvXeJxF7OoQ+bdh1ZZt2gvUM=",
"lastModified": 1712755154,
"narHash": "sha256-ilCQqdi203dGpAhEh6EBL5Foxo2Bxu/Vhbz+0NBNmIc=",
"ref": "refs/heads/main",
"rev": "17e766cb320eea770ae169745d2e47bfbe80fdfe",
"revCount": 45,
"rev": "e6f3fd58ab283867733e940d1287923e6f0efae4",
"revCount": 46,
"type": "git",
"url": "https://devheroes.codes/lxsameer/noether"
},
"original": {
"rev": "17e766cb320eea770ae169745d2e47bfbe80fdfe",
"rev": "e6f3fd58ab283867733e940d1287923e6f0efae4",
"type": "git",
"url": "https://devheroes.codes/lxsameer/noether"
}
@ -234,7 +270,7 @@
"root": {
"inputs": {
"emacs-overlay": "emacs-overlay",
"flake-utils": "flake-utils_2",
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs_2",
"noether": "noether"
}
@ -268,36 +304,6 @@
"repo": "default",
"type": "github"
}
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_4": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

View File

@ -17,18 +17,19 @@
description = "FG42 - Emacs Editor for advance users";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/442d407992384ed9c0e6d352de75b69079904e4e";
inputs.noether.url = "git+https://devheroes.codes/lxsameer/noether?rev=17e766cb320eea770ae169745d2e47bfbe80fdfe";
inputs.noether.url = "git+https://devheroes.codes/lxsameer/noether?rev=e6f3fd58ab283867733e940d1287923e6f0efae4";
inputs.emacs-overlay.url = "github:nix-community/emacs-overlay/0f7f3b39157419f3035a2dad39fbaf8a4ba0448d";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.flake-parts.url = "github:hercules-ci/flake-parts";
outputs = { self, nixpkgs, ... }@inputs:
inputs.flake-utils.lib.eachDefaultSystem (system:
outputs = { self, nixpkgs, flake-parts, ... }@inputs: flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"aarch64-darwin"
"riscv64-linux"
"x86_64-linux"
];
perSystem = { config, self', inputs', pkgs, system, ... }:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ inputs.emacs-overlay.overlays.package ];
};
test-x = pkgs.writeShellApplication {
name = "test-x";
runtimeInputs = [ pkgs.xorg.xorgserver ];
@ -37,54 +38,23 @@
${pkgs.xorg.xorgserver.out}/bin/Xephyr -br -ac -noreset -screen 800x600 :1
'';
};
lemacs = pkgs.emacs29.override {
withTreeSitter = true;
} // (pkgs.lib.optionalAttrs (pkgs.stdenv.isLinux) {
noether = inputs.noether.outputs.packages.${system}.default;
factory = params: pkgs.callPackage ./nix/factory.nix ({ inherit noether; } // params);
default = (factory {});
in {
packages = {
default = default.fg42;
} // (pkgs.lib.optionalAttrs (system == "x86_64-linux") {
# Gtk causes a flickering issue on WM mode
withGTK3 = false;
toolkit = "lucid";
wm = (factory { emacsParams.toolkit = "lucid"; }).fg42;
motif = (factory { emacsParams.toolkit = "motif"; }).fg42;
});
elispDepsFile = ./lisp/fg42/deps.el;
elispPkgs = pkgs.callPackage ./nix/deps.nix {
inherit elispDepsFile;
};
ourPackages = {
noether-mode = inputs.noether.outputs.packages.${system}.default;
};
fg42 = pkgs.callPackage ./nix/fg42.nix {
inherit elispPkgs ourPackages;
srcDir = ./.;
emacs = lemacs;
};
run-test-wm = pkgs.writeShellApplication {
name = "run-test-wm";
runtimeInputs = [ fg42 ];
text = ''
DISPLAY=:1 ${fg42}/bin/fg42-wm
'';
};
in {
inherit pkgs;
packages.default = fg42;
packages.${system}.default = fg42;
devShells.default = pkgs.mkShell {
nativeBuildInputs = [ fg42 pkgs.fish test-x run-test-wm ];
buildInputs = [ fg42 ];
# shellHook = ''
# fish && exit
# '';
nativeBuildInputs = [ default.fg42 pkgs.fish test-x default.run-test-wm ];
buildInputs = [ default.fg42 ];
};
}
);
};
};
}

View File

@ -44,8 +44,8 @@
:config
(setq-default company-backends
'((company-capf :with company-yasnippet) :separate
(company-keywords company-dabbrev company-ispell) :separate
'((company-capf :with company-yasnippet :separate)
(company-keywords company-dabbrev company-ispell :separate)
company-files))
(bind-key [remap completion-at-point] #'company-complete company-mode-map))

View File

@ -36,10 +36,11 @@
(require 'fg42/wm)
(require 'fg42/org)
(require 'fg42/minibuffer)
(require 'fg42/graphics))
(require 'fg42/graphics)
(require 'fg42/modeline))
(require 'server)
(require 'fg42/modeline)
(defvar fg42/font '("Fira Mono" 12)
@ -158,26 +159,26 @@ contextual information."
"This cube controls the different aspect of buffer navigation"
:bind ("C-<tab>" . ace-window))
(when-not-wm
(when-not-wm
(use! flyspell
"Spell checking on the fly"
:commands (flyspell-mode flyspell-prog-mode)
:init
(setq-default ispell-program-name "aspell")
(setq-default ispell-extra-args '("--sug-mode=ultra"
"--lang=en_US"
"--camel-case")))
(use! flyspell
"Spell checking on the fly"
:commands (flyspell-mode flyspell-prog-mode)
:init
(setq-default ispell-program-name "aspell")
(setq-default ispell-extra-args '("--sug-mode=ultra"
"--lang=en_US"
"--camel-case")))
(use! savehist
"Persist history over Emacs restarts. Vertico sorts by history position."
:init
(savehist-mode))
(use! savehist
"Persist history over Emacs restarts. Vertico sorts by history position."
:init
(savehist-mode))
(use! display-line-numbers
"The builtin replacement of linum. It's is pretty fast."
:config
(global-display-line-numbers-mode 1)))
(use! display-line-numbers
"The builtin replacement of linum. It's is pretty fast."
:config
(global-display-line-numbers-mode 1)))
(use! yasnippet
@ -240,12 +241,9 @@ shipped with Emacs."
(setq tooltip-use-echo-area t)
(setq x-gtk-use-system-tooltips nil)
;; Switch from `dabbrev-expand' to `hippie-expand'
(global-set-key [remap dabbrev-expand] 'hippie-expand)
;; Global configurations
(tool-bar-mode -1)
(tooltip-mode nil)
(menu-bar-mode -1)
(when (display-graphic-p)
@ -253,25 +251,32 @@ shipped with Emacs."
(pixel-scroll-precision-mode)
(scroll-bar-mode -1))
(column-number-mode t)
(show-paren-mode t)
(electric-pair-mode 1)
(global-company-mode)
;; git changes in the fringe
(global-diff-hl-mode)
(noether-global-mode)
;; Rectangular select
(cua-selection-mode t)
;; Yank the region on type
(delete-selection-mode 1)
(defalias 'yes-or-no-p 'y-or-n-p)
;; Hooks ---
(add-hook
'emacs-startup-hook
(lambda ()
;; Switch from `dabbrev-expand' to `hippie-expand'
(global-set-key [remap dabbrev-expand] 'hippie-expand)
(column-number-mode t)
(show-paren-mode t)
(electric-pair-mode 1)
(global-company-mode)
;; git changes in the fringe
(global-diff-hl-mode)
;; Modeline replacement
(noether-global-mode)
;; Rectangular select
(cua-selection-mode t)
;; Yank the region on type
(delete-selection-mode 1)))
;; Deletel extra trailing white spaces on save
(add-hook 'before-save-hook 'delete-trailing-whitespace)

View File

@ -54,9 +54,8 @@
"Smart mode line is a pretty simple yet fantastic alternative
to Emacs modeline."
:if (display-graphic-p)
:after projectile
;;:after projectile
:commands noether-global-mode
:config
(require 'noether-views)

50
nix/factory.nix Normal file
View File

@ -0,0 +1,50 @@
# Fg42 - Emacs Editor for advance users
#
# Copyright (c) 2010-2024 Sameer Rahmani <lxsameer@gnu.org>
#
# 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 <http://www.gnu.org/licenses/>.
{ lib, stdenv, emacs29, callPackage, writeShellApplication, noether
, emacsParams ? {},
fg42Params ? {}
} :
let
lemacs = emacs29.override {
withTreeSitter = true;
} // emacsParams;
elispDepsFile = ../lisp/fg42/deps.el;
elispPkgs = callPackage ./deps.nix {
inherit elispDepsFile;
};
ourPackages = {
noether-mode = noether;
};
fg42 = callPackage ./fg42.nix ({
inherit elispPkgs ourPackages;
srcDir = ../.;
emacs = lemacs;
} // fg42Params);
run-test-wm = writeShellApplication {
name = "run-test-wm";
runtimeInputs = [ fg42 ];
text = ''
DISPLAY=:1 ${fg42}/bin/fg42-wm
'';
};
in { inherit fg42 run-test-wm; }

View File

@ -14,21 +14,21 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
{ lib, stdenv, elispPkgs, srcDir, emacsPackagesFor, ourPackages, direnv
, makeDesktopItem, nix
, makeFontsConf, nix
, nil, # nix lsp server
# 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
# 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, fd
, aspellWithDicts,
supportWM ? true, xorg, slock,
supportWM ? true, xorg, slock,
supportPython ? true, supportVerilog ? true, svls, verilator, }:
supportPython ? true, supportVerilog ? true, svls, verilator, }:
with builtins;
let
version = "4.0.0";
@ -43,43 +43,50 @@ let
dicts = aspellWithDicts (dicts: with dicts; [ en en-computers en-science ]);
runtimeBins = [ ripgrep git ltex-ls tree-sitter direnv nix nil dicts fd ]
++ (lib.optional supportPython [
python311
# Python deps
python311
pyright
runtimeBins = [
ripgrep git tree-sitter direnv nix nil dicts fd
]
++ (lib.optional (!stdenv.buildPlatform.isRiscV) [
# Not supported on Risc-V
ltex-ls
])
++ (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);
mimes = import ./mimes.nix;
fontsConf = makeFontsConf {
fontDirectories = [
vazir-fonts
fira-code
nerdfonts
fira-mono
noto-fonts
];
};
in stdenv.mkDerivation (final: rec {
inherit version;
pname = "fg42";
desktop = makeDesktopItem {
name = "FG42";
desktopName = "FG42";
exec = "${placeholder "out"}/bin/fg42 %F";
comment = "Emacs Editor for advance users";
};
src = srcDir;
outputs = [ "out" ];
@ -92,6 +99,8 @@ in stdenv.mkDerivation (final: rec {
cp -rv ${src}/lisp/ $LISPDIR
cp -rv ${src}/share $out/
cp -rv ${src}/snippets $LISPDIR/snippets
cp "${fontsConf}" $LISPDIR/fonts.conf
export FONTCONFIG_FILE="$LISPDIR/fonts.conf"
cat >> $out/share/applications/FG42.desktop << EOF
[Desktop Entry]
@ -122,6 +131,7 @@ in stdenv.mkDerivation (final: rec {
export FG42_EMACSD=~/.fg42/v4/emacs.d
export FG42_USE_NIX=true;
export PATH=${pathsStr}:$PATH
export FONTCONFIG_FILE="$LISPDIR/fonts.conf"
LIBRARY_PATH="\$(${stdenv.cc}/bin/cc -print-file-name=libgccjit.so):\$LIBRARY_PATH" \
FG42_WM=fales ${emacsBundle}/bin/emacs \
@ -139,6 +149,7 @@ in stdenv.mkDerivation (final: rec {
export FG42_EMACSD=~/.fg42/v4/emacs.d
export FG42_USE_NIX=true;
export PATH=${pathsStr}:\$PATH
export FONTCONFIG_FILE="$LISPDIR/fonts.conf"
# Disable access control for the current user.
${xorg.xhost}/bin/xhost +SI:localuser:\$USER
@ -173,7 +184,6 @@ in stdenv.mkDerivation (final: rec {
${nerdfonts}
${noto-fonts}
${lib.strings.concatLines paths}
${desktop}/share/applications/FG42.desktop
EOF
runHook postBuild