
the conversion procedure is simple: - find all things that look like options, ie calls to either `mkOption` or `lib.mkOption` that take an attrset. remember the attrset as the option - for all options, find a `description` attribute who's value is not a call to `mdDoc` or `lib.mdDoc` - textually convert the entire value of the attribute to MD with a few simple regexes (the set from mdize-module.sh) - if the change produced a change in the manual output, discard - if the change kept the manual unchanged, add some text to the description to make sure we've actually found an option. if the manual changes this time, keep the converted description this procedure converts 80% of nixos options to markdown. around 2000 options remain to be inspected, but most of those fail the "does not change the manual output check": currently the MD conversion process does not faithfully convert docbook tags like <code> and <package>, so any option using such tags will not be converted at all.
70 lines
1.9 KiB
Nix
70 lines
1.9 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.services.xserver.windowManager.exwm;
|
|
loadScript = pkgs.writeText "emacs-exwm-load" ''
|
|
${cfg.loadScript}
|
|
${optionalString cfg.enableDefaultConfig ''
|
|
(require 'exwm-config)
|
|
(exwm-config-default)
|
|
''}
|
|
'';
|
|
packages = epkgs: cfg.extraPackages epkgs ++ [ epkgs.exwm ];
|
|
exwm-emacs = pkgs.emacsWithPackages packages;
|
|
in
|
|
|
|
{
|
|
options = {
|
|
services.xserver.windowManager.exwm = {
|
|
enable = mkEnableOption "exwm";
|
|
loadScript = mkOption {
|
|
default = "(require 'exwm)";
|
|
type = types.lines;
|
|
example = ''
|
|
(require 'exwm)
|
|
(exwm-enable)
|
|
'';
|
|
description = lib.mdDoc ''
|
|
Emacs lisp code to be run after loading the user's init
|
|
file. If enableDefaultConfig is true, this will be run
|
|
before loading the default config.
|
|
'';
|
|
};
|
|
enableDefaultConfig = mkOption {
|
|
default = true;
|
|
type = lib.types.bool;
|
|
description = lib.mdDoc "Enable an uncustomised exwm configuration.";
|
|
};
|
|
extraPackages = mkOption {
|
|
type = types.functionTo (types.listOf types.package);
|
|
default = epkgs: [];
|
|
defaultText = literalExpression "epkgs: []";
|
|
example = literalExpression ''
|
|
epkgs: [
|
|
epkgs.emms
|
|
epkgs.magit
|
|
epkgs.proofgeneral
|
|
]
|
|
'';
|
|
description = ''
|
|
Extra packages available to Emacs. The value must be a
|
|
function which receives the attrset defined in
|
|
<varname>emacs.pkgs</varname> as the sole argument.
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
services.xserver.windowManager.session = singleton {
|
|
name = "exwm";
|
|
start = ''
|
|
${exwm-emacs}/bin/emacs -l ${loadScript}
|
|
'';
|
|
};
|
|
environment.systemPackages = [ exwm-emacs ];
|
|
};
|
|
}
|