forked from vlaci/nix-straight.el
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathdefault.nix
76 lines (60 loc) · 2.16 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{ # Package set to build the Emacs environment from
emacsPackages
# Emacs package to use during build
, emacs ? emacsPackages.emacs
# Your `init.el` file to use for discovering and installing packages
, emacsInitFile
# Additional argument to pass to Emacs or your init file
, emacsArgs ? []
# Additional files you wish to load prior to executing package discovery
# Good place to place to call `advice-add` from
, emacsLoadFiles ? []
# Abort processing if a package not found in `emacsPackages`
# Setting it to false will result in just skipping an unavailable package
, abortOnNotFound ? true }:
let
libstraight = epkgs.callPackage ./libstraight.nix { inherit abortOnNotFound epkgs emacs; };
epkgs =
if !(emacsPackages ? straight) then
emacsPackages.overrideScope' (self: super:
{ straight = self.callPackage ./straight { }; })
else
emacsPackages;
packageJSON = libstraight.packagesJSON {
inherit emacsInitFile emacsLoadFiles emacsArgs;
};
packageList = override:
libstraight.parsePackagesJSON (packageJSON.overrideAttrs override);
emacsEnv = libstraight.emacsEnv { inherit emacsInitFile emacsLoadFiles emacsArgs; };
in {
/* Final environment (.emacs.d) with the populated `straight`` repository
The required packages can be acquired from a call to
`packageList` function.
Type: emacsEnv :: { straightDir :: string, packages :: [derivation] } -> derivation
Example:
emacsEnv {
straightDir = "$out/straight";
packages = packageList (super: { ... } );
};
*/
inherit emacsEnv;
/* Package list inferred from processing `emacsInitFile`
The passed function will be called via an `overrideAttrs
call on the`underlying derivation.
Type: packageList :: attrs -> attrs -> derivation
Example:
packageList (super: {
src = ...;
preInstall = ''
...
''
});
*/
inherit packageList;
/* JSON formatted list of packages
These are the packages needed to be populated in the
`straight` repository. Mostly for diagnostic purposes.
Type: packageJSON :: derivation
*/
inherit packageJSON;
}