nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1# package.el-based emacs packages
2
3## FOR USERS
4#
5# Recommended: simply use `emacsWithPackages` with the packages you want.
6#
7# Alternative: use `emacs`, install everything to a system or user profile
8# and then add this at the start your `early-init.el`:
9/*
10 ;; optional. use this if you install emacs packages to the system profile
11 (add-to-list 'package-directory-list "/run/current-system/sw/share/emacs/site-lisp/elpa")
12
13 ;; optional. use this if you install emacs packages to user profiles (with nix-env)
14 (add-to-list 'package-directory-list "~/.nix-profile/share/emacs/site-lisp/elpa")
15*/
16
17{
18 lib,
19 pkgs',
20 emacs',
21}:
22
23let
24
25 mkElpaDevelPackages =
26 { pkgs, lib }:
27 import ../applications/editors/emacs/elisp-packages/elpa-devel-packages.nix {
28 inherit (pkgs) pkgs buildPackages;
29 inherit lib;
30 };
31
32 mkElpaPackages =
33 { pkgs, lib }:
34 import ../applications/editors/emacs/elisp-packages/elpa-packages.nix {
35 inherit (pkgs) pkgs buildPackages;
36 inherit lib;
37 };
38
39 mkNongnuDevelPackages =
40 { pkgs, lib }:
41 import ../applications/editors/emacs/elisp-packages/nongnu-devel-packages.nix {
42 inherit (pkgs) pkgs buildPackages;
43 inherit lib;
44 };
45
46 mkNongnuPackages =
47 { pkgs, lib }:
48 import ../applications/editors/emacs/elisp-packages/nongnu-packages.nix {
49 inherit (pkgs) pkgs buildPackages;
50 inherit lib;
51 };
52
53 # Contains both melpa stable & unstable
54 melpaGeneric =
55 { pkgs, lib }:
56 import ../applications/editors/emacs/elisp-packages/melpa-packages.nix {
57 inherit lib pkgs;
58 };
59
60 mkManualPackages =
61 { pkgs, lib }:
62 import ../applications/editors/emacs/elisp-packages/manual-packages.nix {
63 inherit lib pkgs;
64 };
65
66 emacsWithPackages =
67 { pkgs, lib }:
68 pkgs.callPackage ../applications/editors/emacs/build-support/wrapper.nix {
69 inherit (pkgs) lndir;
70 inherit lib;
71 };
72
73in
74lib.makeScope pkgs'.newScope (
75 self:
76 lib.makeOverridable (
77 {
78 pkgs ? pkgs',
79 lib ? pkgs.lib,
80 elpaDevelPackages ? mkElpaDevelPackages { inherit pkgs lib; } self,
81 elpaPackages ? mkElpaPackages { inherit pkgs lib; } self,
82 nongnuDevelPackages ? mkNongnuDevelPackages { inherit pkgs lib; } self,
83 nongnuPackages ? mkNongnuPackages { inherit pkgs lib; } self,
84 melpaStablePackages ? melpaGeneric { inherit pkgs lib; } "stable" self,
85 melpaPackages ? melpaGeneric { inherit pkgs lib; } "unstable" self,
86 manualPackages ? mkManualPackages { inherit pkgs lib; } self,
87 }:
88 (
89 { }
90 // elpaDevelPackages
91 // {
92 inherit elpaDevelPackages;
93 }
94 // elpaPackages
95 // {
96 inherit elpaPackages;
97 }
98 // nongnuDevelPackages
99 // {
100 inherit nongnuDevelPackages;
101 }
102 // nongnuPackages
103 // {
104 inherit nongnuPackages;
105 }
106 // melpaStablePackages
107 // {
108 inherit melpaStablePackages;
109 }
110 // melpaPackages
111 // {
112 inherit melpaPackages;
113 }
114 // manualPackages
115 // {
116 inherit manualPackages;
117 }
118 // {
119
120 # Propagate overridden scope
121 emacs = emacs'.overrideAttrs (old: {
122 passthru = (old.passthru or { }) // {
123 pkgs = lib.dontRecurseIntoAttrs self;
124 };
125 });
126
127 trivialBuild = pkgs.callPackage ../applications/editors/emacs/build-support/trivial.nix {
128 inherit (self) emacs;
129 };
130
131 elpaBuild = pkgs.callPackage ../applications/editors/emacs/build-support/elpa.nix {
132 inherit (self) emacs;
133 };
134
135 melpaBuild = pkgs.callPackage ../applications/editors/emacs/build-support/melpa.nix {
136 inherit (self) emacs;
137 };
138
139 emacsWithPackages = emacsWithPackages { inherit pkgs lib; } self;
140 withPackages = emacsWithPackages { inherit pkgs lib; } self;
141
142 }
143 // {
144
145 # Package specific priority overrides goes here
146
147 # EXWM is not tagged very often, prefer it from elpa devel.
148 inherit (elpaDevelPackages) exwm;
149
150 # Telega uploads packages incompatible with stable tdlib to melpa
151 # Prefer the one from melpa stable
152 inherit (melpaStablePackages) telega;
153
154 }
155 )
156 ) { }
157)