This commit is contained in:
2024-08-28 15:04:53 +03:00
parent 83e94f9051
commit 0b756f3af0
13 changed files with 210 additions and 30 deletions
+73
View File
@@ -0,0 +1,73 @@
{ lib, ... }:
{
# mkFeatureEnableOption = { suiteEnable, ...} @ attrs :
# lib.mkOption (builtins.removeAttrs (lib.mergeAttrs attrs {
# default = true;
# example = true;
# type = lib.types.bool;
# apply = old: suiteEnable && old;
# }) ["suiteEnable"]);
# mkDependentFeatureEnableOption = { suiteEnable, otherOption, ...} @ attrs :
# lib.mkOption (builtins.removeAttrs (lib.mergeAttrs attrs {
# default = true;
# example = true;
# type = lib.types.bool;
# apply = old: suiteEnable && otherOption && old;
# }) ["suiteEnable" "otherOption"]);
# mkSuiteEnableOption = { suiteDependents, ... } @ attrs :
# lib.mkOption lib.mergeAttrs attrs {
# default = [];
# example = [];
# type = lib.types.list;
# apply = old: old || lib.lists.any suiteEnabledPred suiteDependents;
# };
mkFeatureEnableOption = { ... } @ attrs :
lib.mkOption (lib.mergeAttrs attrs {
default = true;
example = true;
type = lib.types.bool;
});
mkSuiteEnableOption = { ... } @ attrs :
lib.mkOption (lib.mergeAttrs attrs {
default = false;
example = true;
type = lib.types.bool;
});
trivialFromOrg = { ... } @ attrs : (
lib.mergeAttrs attrs {
preBuild = ''
for file in ./*.org
do
emacs --batch --eval "(require 'org)" --eval "(org-babel-tangle-file \"$file\" (concat (file-name-sans-extension \"$file\") \".el\") \"emacs-lisp\")"
done
'';
unpackCmd = ''
case "$curSrc" in
*.el)
# keep original source filename without the hash
local filename=$(basename "$curSrc")
filename="''${filename:33}"
cp $curSrc $filename
chmod +w $filename
sourceRoot="."
;;
*.org)
# keep original source filename without the hash
local filename=$(basename "$curSrc")
filename="''${filename:33}"
cp $curSrc $filename
chmod +w $filename
sourceRoot="."
;;
*)
_defaultUnpack "$curSrc"
;;
esac
'';
});
}