Break up the git feature in its own module

This commit is contained in:
Sameer Rahmani 2024-04-16 22:34:30 +01:00
parent 1e62751b69
commit 71dbe6ef93
Signed by: lxsameer
GPG Key ID: 8741FACBF412FFA5
4 changed files with 25 additions and 3 deletions

View File

@ -16,12 +16,31 @@
{ pkgs, ... }:
final: prev:
rec {
/*
Create a value to be accessable on the Elisp side as a variable.
*/
defVar = name: defaultValue: docstring: {
inherit name defaultValue docstring;
};
/*
Create a value to be accessable on the Elisp side as a constant.
*/
defConst = defVar;
/* Creates an Option attribute set for a boolean value option i.e an
option to be toggled on or off. The option is enabled by default:
Example:
mkAndEnableOption "foo"
=> { _type = "option"; default = true; description = "Whether to enable foo."; example = true; type = { ... }; }
*/
mkAndEnableOption = name: prev.mkOption {
default = true;
example = true;
description = "Whether to enable ${name}.";
type = prev.types.bool;
};
makeFG42Drv = { pname, version, ... }@args:
(pkgs.emacsPackages.trivialBuild args).overrideAttrs (old: {

View File

@ -24,6 +24,7 @@ let
modules = [
./editor
./elisp
./git
];
pkgsModule = { config, ... }: {

View File

@ -22,7 +22,8 @@
{ lib, config, pkgs, makeFG42Drv, ... }:
with lib;
let
cfg = config.fg42.features;
cfg = config.fg42.features.git;
deps =
(with pkgs.emacsPackages; [
magit
@ -38,7 +39,7 @@ let
};
in
{
options.fg42.features.git = mkEnableOption "git";
options.fg42.features.git.enable = mkAndEnableOption "git";
config = mkIf cfg.enable {
fg42.elispPackages = [ drv ] ++ deps;
@ -46,5 +47,7 @@ in
fg42.paths = (with pkgs;[
git
]);
fg42.requires = [ drv.pname ];
};
}

View File

@ -104,7 +104,6 @@ in
fg42.requires = mkOption {
type = types.listOf types.str;
readOnly = true;
description = ''
A list of Emacs packages to preload in compile time.