Add generator for init.el
To be used for more concise tests of specific module combinations.
This commit is contained in:
parent
95c1a5d594
commit
4597bb574e
2 changed files with 31 additions and 2 deletions
|
|
@ -18,7 +18,9 @@
|
|||
testers,
|
||||
tmux,
|
||||
writeText,
|
||||
writeTextDir,
|
||||
makeDoomPackages,
|
||||
toInit,
|
||||
}:
|
||||
let
|
||||
common = {
|
||||
|
|
@ -27,6 +29,8 @@ let
|
|||
doomLocalDir = "~/.local/share/nix-doom-unstraightened";
|
||||
};
|
||||
mkDoom = args: (makeDoomPackages (common // args)).doomEmacs;
|
||||
mkDoomDir = args: writeTextDir "init.el" (toInit args);
|
||||
minimalDoomDir = mkDoomDir { config = [ "default" ]; };
|
||||
doomTest = assertion: args: testers.testEqualContents {
|
||||
inherit assertion;
|
||||
expected = writeText "doom-expected" "Doom functions";
|
||||
|
|
@ -46,11 +50,11 @@ let
|
|||
in {
|
||||
minimal = mkDoom { doomDir = ./doomdirs/minimal; };
|
||||
minimalEmacs = (makeDoomPackages (common // {
|
||||
doomDir = ./doomdirs/minimal;
|
||||
doomDir = minimalDoomDir;
|
||||
})).emacsWithDoom;
|
||||
full = mkDoom {
|
||||
full = true;
|
||||
doomDir = ./doomdirs/minimal;
|
||||
doomDir = minimalDoomDir;
|
||||
};
|
||||
example = mkDoom { doomDir = ./doomdirs/example; };
|
||||
example-without-loader = mkDoom {
|
||||
|
|
|
|||
25
flake.nix
25
flake.nix
|
|
@ -36,6 +36,7 @@
|
|||
eachSystem = nixpkgs.lib.genAttrs (import systems);
|
||||
in
|
||||
f: eachSystem (system: f nixpkgs.legacyPackages.${system});
|
||||
|
||||
doomFromPackages = pkgs: args: let
|
||||
# Hack to avoid pkgs.extend having to instantiate an additional nixpkgs.
|
||||
#
|
||||
|
|
@ -50,8 +51,32 @@
|
|||
};
|
||||
in
|
||||
pkgs.callPackages self mergedArgs;
|
||||
|
||||
toInit = let
|
||||
inherit (nixpkgs.lib) concatLines concatStringsSep isList isString mapAttrsToList toPretty;
|
||||
in
|
||||
attrs:
|
||||
concatLines (
|
||||
[ "(doom!" ]
|
||||
++ (mapAttrsToList (
|
||||
cat: modules:
|
||||
(concatLines (
|
||||
[ (":" + cat) ]
|
||||
++ (map (
|
||||
mod:
|
||||
if isString mod then mod
|
||||
else if isList mod then "(" + (concatStringsSep " " mod) + ")"
|
||||
else abort "${toPretty mod} not supported"
|
||||
))
|
||||
modules
|
||||
))
|
||||
) attrs)
|
||||
++ [ ")" ]
|
||||
);
|
||||
|
||||
in {
|
||||
checks = perSystemPackages (pkgs: pkgs.callPackages ./checks.nix {
|
||||
inherit toInit;
|
||||
makeDoomPackages = doomFromPackages pkgs;
|
||||
});
|
||||
packages = perSystemPackages (pkgs: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue