Flatten emacs-ng package location

Signed-off-by: Magic_RB <magic_rb@redalder.org>
This commit is contained in:
Magic_RB 2023-05-28 12:43:49 +02:00
parent 44df8c3076
commit 177d3c74a0
No known key found for this signature in database
GPG key ID: 08D5287CC5DDCA0E
2 changed files with 196 additions and 186 deletions

View file

@ -31,8 +31,13 @@ in {
rWrapper.override
{packages = with rPackages; [ggplot2];};
in
(pkgs.magic_rb.emacs.override
(pkgs.emacs-magicrb.override
{
pkgs.emacs = pkgs.emacs.overrideAttrs
(old:
{
# patches = [ ./native-comp-driver-options.patch ];
});
march = config.magic_rb.optimisation.march;
hunspell.enable = true;
hunspell.dictionaries = with pkgs.hunspellDicts; [en_US];

View file

@ -22,27 +22,25 @@
meta = removeAttrs cfg.hunspell.package.meta ["outputsToInstall"];
};
in {
magic_rb =
prev.magic_rb
or {}
// {
libvterm-emacs = stdenv.mkDerivation {
name = "vterm-emacs";
src = vtermModule;
buildInputs = with prev; [cmake libtool glib.dev libvterm-neovim];
cmakeFlags = [
"-DEMACS_SOURCE=${emacs}"
"-DUSE_SYSTEM_LIBVTERM=ON"
];
installPhase = ''
mkdir -p $out/lib
install ../vterm-module.so $out/lib
'';
};
emacs =
callPackage
(module: let
libvterm-emacs = stdenv.mkDerivation {
name = "vterm-emacs";
src = vtermModule;
buildInputs = with prev; [cmake libtool glib.dev libvterm-neovim];
cmakeFlags = [
"-DEMACS_SOURCE=${emacs}"
"-DUSE_SYSTEM_LIBVTERM=ON"
];
installPhase = ''
mkdir -p $out/lib
install ../vterm-module.so $out/lib
'';
};
emacs-magicrb =
callPackage
(module:
let
mkPkgOption = name:
mkOption {
description = "`${name}` package.";
@ -52,180 +50,187 @@
evaled =
evalModules
{
modules =
[module]
++ singleton
({config, ...}: {
options = {
pkgs = {
giflib = mkPkgOption "giflib";
librsvg = mkPkgOption "librsvg";
glib-networking = mkPkgOption "glib-networking";
webkitgtk = mkPkgOption "webkitgtk";
xorg = mkOption {
description = "`xorg` package set.";
default = prev.xorg;
type = with types; attrsOf package;
};
makeWrapper = mkPkgOption "makeWrapper";
libvterm-emacs = mkOption {
description = "`libvterm-emacs` package.";
default = final.magic_rb.libvterm-emacs;
type = types.package;
};
tree-sitter = mkOption {
description = "`tree-sitter` package.";
default = prev.tree-sitter;
type = types.package;
};
};
{
modules =
[module]
++ singleton
({config, ...}: {
options = {
pkgs = {
gcc = mkOption {
description = "`gcc` package.";
default = prev.libgccjit.stdenv.cc;
type = types.package;
};
gnumake = mkPkgOption "gnumake";
emacs = mkPkgOption "emacs";
giflib = mkPkgOption "giflib";
librsvg = mkPkgOption "librsvg";
glib-networking = mkPkgOption "glib-networking";
webkitgtk = mkPkgOption "webkitgtk";
xorg = mkOption {
description = "`xorg` package set.";
default = prev.xorg;
type = with types; attrsOf package;
};
makeWrapper = mkPkgOption "makeWrapper";
libvterm-emacs = mkOption {
description = "`libvterm-emacs` package.";
default = final.libvterm-emacs;
type = types.package;
};
tree-sitter = mkOption {
description = "`tree-sitter` package.";
default = prev.tree-sitter;
type = types.package;
};
};
march = mkOption {
description = ''
Optimize for a specific architecture.
'';
type = with types; nullOr str;
default = null;
};
march = mkOption {
description = ''
Optimize for a specific architecture.
'';
type = with types; nullOr str;
default = null;
};
additionalPackages = mkOption {
description = ''
Additional packages to add statically to the Emacs closure, requires a
restart of Emacs for changes to take effect.
'';
type = with types; listOf package;
default = [];
};
additionalPackages = mkOption {
description = ''
Additional packages to add statically to the Emacs closure, requires a
restart of Emacs for changes to take effect.
'';
type = with types; listOf package;
default = [];
};
environment = mkOption {
description = ''
Set additional environment variables.
'';
type = with types; attrsOf (oneOf [str path]);
default = {};
};
environment = mkOption {
description = ''
Set additional environment variables.
'';
type = with types; attrsOf (oneOf [str path]);
default = {};
};
hunspell = {
enable = mkEnableOption "Enable hunspell and dictionaries";
package = mkPkgOption "hunspell";
dictionaries = mkOption {
description = ''
Dictionaries included with Hunspell.
'';
type = with types; listOf package;
default = [];
};
};
hunspell = {
enable = mkEnableOption "Enable hunspell and dictionaries";
package = mkPkgOption "hunspell";
dictionaries = mkOption {
description = ''
Dictionaries included with Hunspell.
'';
type = with types; listOf package;
default = [];
};
};
output = {
base = mkOption {
readOnly = true;
type = types.package;
description = ''
Emacs base output without additional packages available.
'';
output = {
base = mkOption {
readOnly = true;
type = types.package;
description = ''
Emacs base output without additional packages available.
'';
};
bundle = mkOption {
readOnly = true;
type = types.package;
description = ''
Emacs bundle with additional packages.
'';
};
};
};
bundle = mkOption {
readOnly = true;
type = types.package;
description = ''
Emacs bundle with additional packages.
'';
config = {
additionalPackages =
(optional config.hunspell.enable (hunspellWithDicts config))
++ [ ];
output.base =
(config.pkgs.emacs.override
{
withX = false;
withPgtk = true;
inherit (prev)
gtk3-x11
gtk3
gsettings-desktop-schemas;
withSQLite3 = true;
nativeComp = true;
srcRepo = true;
inherit (prev)
autoreconfHook
texinfo;
withWebP = true;
})
.overrideAttrs
(old: {
version = "30.0.50";
src = emacs;
configureFlags = [
"--disable-build-details"
"--with-native-compilation"
"--with-treesit"
"--with-xpm=yes"
"--with-jpeg=yes"
"--with-png=yes"
"--with-gif=yes"
"--with-tiff=yes"
"--with-json=yes"
"--with-cairo"
"--without-x"
"--with-pgtk"
"--with-modules"
"--prefix=\${out}"
];
NIX_CFLAGS_COMPILE = "-O2 -pipe ${optionalString (config.march != null) ("-march=" + config.march)}";
buildInputs =
old.buildInputs
++ (with config.pkgs;
[
giflib librsvg glib-networking
webkitgtk xorg.libXpm tree-sitter
]);
makeFlags =
old.makeFlags
or []
++ [
"NATIVE_FULL_AOT=1"
];
});
output.bundle = with config.pkgs;
with config.output;
stdenv.mkDerivation {
inherit (base) pname version;
phases = ["buildPhase"];
nativeBuildInputs = [makeWrapper];
buildPhase = ''
mkdir -p $out/bin
${xorg.lndir}/bin/lndir -silent ${base} $out
wrapProgram $out/bin/emacs \
--set EMACSLOADPATH ${base}/share/emacs/site-lisp:${libvterm-emacs}/lib: \
--prefix PATH : ${makeBinPath config.additionalPackages} \
${concatStringsSep " " (mapAttrsToList (k: v: "--set " + k + " " + v) config.environment)}
'';
};
};
};
};
config = {
additionalPackages =
optional config.hunspell.enable (hunspellWithDicts config);
output.base =
(prev.emacs.override
{
withX = false;
withGTK3 = false;
nativeComp = true;
srcRepo = true;
libXaw = null;
Xaw3d = null;
gconf = null;
alsa-lib = null;
acl = null;
gpm = null;
AppKit = null;
GSS = null;
ImageIO = null;
sigtool = null;
})
.overrideAttrs
(old: {
version = "30.0.50";
src = emacs;
configureFlags = [
"--disable-build-details"
"--with-native-compilation"
"--with-treesit"
"--with-xpm=yes"
"--with-jpeg=yes"
"--with-png=yes"
"--with-gif=yes"
"--with-tiff=yes"
"--with-json=yes"
"--with-cairo"
"--without-x"
"--with-pgtk"
"--with-modules"
"--prefix=\${out}"
];
NIX_CFLAGS_COMPILE = "-O2 -pipe ${optionalString (config.march != null) ("-march=" + config.march)}";
buildInputs =
old.buildInputs
++ (with config.pkgs;
[
giflib librsvg glib-networking
webkitgtk xorg.libXpm tree-sitter
]);
makeFlags =
old.makeFlags
or []
++ [
"NATIVE_FULL_AOT=1"
];
});
output.bundle = with config.pkgs;
with config.output;
stdenv.mkDerivation {
inherit (base) pname version;
phases = ["buildPhase"];
nativeBuildInputs = [makeWrapper];
buildPhase = ''
mkdir -p $out/bin
${xorg.lndir}/bin/lndir -silent ${base} $out
wrapProgram $out/bin/emacs \
--set EMACSLOADPATH ${base}/share/emacs/site-lisp:${libvterm-emacs}/lib: \
--prefix PATH : ${makeBinPath config.additionalPackages} \
${concatStringsSep " " (mapAttrsToList (k: v: "--set " + k + " " + v) config.environment)}
'';
};
};
});
};
});
};
in
evaled.config.output)
{};
};
{};
};
}