Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
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 pkgs',
19 emacs',
20 makeScope,
21 makeOverridable,
22 dontRecurseIntoAttrs,
23}:
24
25let
26
27 mkElpaDevelPackages =
28 { pkgs, lib }:
29 import ../applications/editors/emacs/elisp-packages/elpa-devel-packages.nix {
30 inherit (pkgs) pkgs buildPackages;
31 inherit lib;
32 };
33
34 mkElpaPackages =
35 { pkgs, lib }:
36 import ../applications/editors/emacs/elisp-packages/elpa-packages.nix {
37 inherit (pkgs) pkgs buildPackages;
38 inherit lib;
39 };
40
41 mkNongnuDevelPackages =
42 { pkgs, lib }:
43 import ../applications/editors/emacs/elisp-packages/nongnu-devel-packages.nix {
44 inherit (pkgs) pkgs buildPackages;
45 inherit lib;
46 };
47
48 mkNongnuPackages =
49 { pkgs, lib }:
50 import ../applications/editors/emacs/elisp-packages/nongnu-packages.nix {
51 inherit (pkgs) pkgs buildPackages;
52 inherit lib;
53 };
54
55 # Contains both melpa stable & unstable
56 melpaGeneric =
57 { pkgs, lib }:
58 import ../applications/editors/emacs/elisp-packages/melpa-packages.nix {
59 inherit lib pkgs;
60 };
61
62 mkManualPackages =
63 { pkgs, lib }:
64 import ../applications/editors/emacs/elisp-packages/manual-packages.nix {
65 inherit lib pkgs;
66 };
67
68 emacsWithPackages =
69 { pkgs, lib }:
70 pkgs.callPackage ../applications/editors/emacs/build-support/wrapper.nix {
71 inherit (pkgs.xorg) lndir;
72 inherit lib;
73 };
74
75in
76makeScope pkgs'.newScope (
77 self:
78 makeOverridable (
79 {
80 pkgs ? pkgs',
81 lib ? pkgs.lib,
82 elpaDevelPackages ? mkElpaDevelPackages { inherit pkgs lib; } self,
83 elpaPackages ? mkElpaPackages { inherit pkgs lib; } self,
84 nongnuDevelPackages ? mkNongnuDevelPackages { inherit pkgs lib; } self,
85 nongnuPackages ? mkNongnuPackages { inherit pkgs lib; } self,
86 melpaStablePackages ? melpaGeneric { inherit pkgs lib; } "stable" self,
87 melpaPackages ? melpaGeneric { inherit pkgs lib; } "unstable" self,
88 manualPackages ? mkManualPackages { inherit pkgs lib; } self,
89 }:
90 (
91 { }
92 // elpaDevelPackages
93 // {
94 inherit elpaDevelPackages;
95 }
96 // elpaPackages
97 // {
98 inherit elpaPackages;
99 }
100 // nongnuDevelPackages
101 // {
102 inherit nongnuDevelPackages;
103 }
104 // nongnuPackages
105 // {
106 inherit nongnuPackages;
107 }
108 // melpaStablePackages
109 // {
110 inherit melpaStablePackages;
111 }
112 // melpaPackages
113 // {
114 inherit melpaPackages;
115 }
116 // manualPackages
117 // {
118 inherit manualPackages;
119 }
120 // {
121
122 # Propagate overridden scope
123 emacs = emacs'.overrideAttrs (old: {
124 passthru = (old.passthru or { }) // {
125 pkgs = dontRecurseIntoAttrs self;
126 };
127 });
128
129 trivialBuild = pkgs.callPackage ../applications/editors/emacs/build-support/trivial.nix {
130 inherit (self) emacs;
131 };
132
133 elpaBuild = pkgs.callPackage ../applications/editors/emacs/build-support/elpa.nix {
134 inherit (self) emacs;
135 };
136
137 melpaBuild = pkgs.callPackage ../applications/editors/emacs/build-support/melpa.nix {
138 inherit (self) emacs;
139 };
140
141 emacsWithPackages = emacsWithPackages { inherit pkgs lib; } self;
142 withPackages = emacsWithPackages { inherit pkgs lib; } self;
143
144 }
145 // {
146
147 # Package specific priority overrides goes here
148
149 # EXWM is not tagged very often, prefer it from elpa devel.
150 inherit (elpaDevelPackages) exwm;
151
152 # Telega uploads packages incompatible with stable tdlib to melpa
153 # Prefer the one from melpa stable
154 inherit (melpaStablePackages) telega;
155
156 }
157 )
158 ) { }
159)