Emacs module seems to work now... good enough for merge into master.

This commit is contained in:
Kevin Baensch 2019-11-17 23:13:50 +01:00
parent 986ca7f5cd
commit 886a3b0dc8
20 changed files with 903 additions and 94 deletions

View file

@ -389,22 +389,23 @@ in
};
config = mkIf cfg.enable {
environment.systemPackages = let
finalPackage = (pkgs.emacsWithPackages (epkgs:
let
getPkg = v:
if isFunction v then [ (v epkgs) ]
else optional (isString v && hasAttr v epkgs) epkgs.${v};
in
[ epkgs.use-package ]
++ optional hasBind epkgs.bind-key
++ optional hasBind epkgs.diminish
++ (
concatMap (v: getPkg (v.package))
(builtins.attrValues cfg.usePackage)
)));
in [
((pkgs.emacsPackagesNgGen finalPackage).trivialBuild {
machine.pkgsets.emacs.pkgs = epkgs:
let
getPkg = v:
if isFunction v then [ (v epkgs) ]
else optional (isString v && hasAttr v epkgs) epkgs.${v};
in
[ epkgs.use-package ]
++ optional hasBind epkgs.bind-key
++ optional hasBind epkgs.diminish
++ (
concatMap (v: getPkg (v.package))
(builtins.attrValues cfg.usePackage)
);
machine.pkgsets.emacs.pkgwrap = (pkgs.emacsWithPackages config.machine.pkgsets.emacs.pkgs);
environment.systemPackages = [
((pkgs.emacsPackagesNgGen config.machine.pkgsets.emacs.pkgwrap).trivialBuild {
pname = "hm-init";
version = "0";
src = pkgs.writeText "hm-init.el" initFile;
@ -413,6 +414,7 @@ in
})
];
# This has no effect, will have to add a wrapper to emacs (or just copy this to ~/.emacs.d/init.el)
environment.etc."emacs.d/init.el".text = ''
(require 'hm-init)
(provide 'init)

View file

@ -13,14 +13,14 @@ let
name = pname;
value = rec {
pkgwrap = mkOption {
type = types.listOf types.package;
type = with types; oneOf [ package (listOf package) ];
default = cfg.pkgsets."${pname}".pkgs;
description = ''
Package Wrapper for packages using a wrapper function (like python, emacs, haskell, ...)
'';
};
pkgs = mkOption {
type = with types; listOf (nullOr attrs);
type = types.unspecified;
default = [];
description = ''
${pname} package list.
@ -37,7 +37,8 @@ in {
The list of metapackages to be installed.
'';
};
pkgsets = listToAttrs (map pkgOption metapkgs);
# Package names containing '::' are sub packages and should not have their own pkgset.
pkgsets = listToAttrs (map pkgOption (lists.filter (v: !(strings.hasInfix "::" v)) metapkgs));
services = mkOption {
type = types.listOf types.str;
default = [];