dev.fron.io nixrc / e1d4f26
flake: emacs-overlay is now a flake Tony Olagbaiye 1 year, 1 day ago
4 changed file(s) with 215 addition(s) and 256 deletion(s). Raw diff Collapse all Expand all
00 {
11 "nodes": {
2 "bhipple": {
3 "flake": false,
4 "info": {
5 "lastModified": 1588980568,
6 "narHash": "sha256-VhdtKNEfxZy5aZ0qV4zvpocu0hgP6LiyRkhozPRAf7E="
7 },
8 "locked": {
9 "owner": "bhipple",
10 "repo": "nur-packages",
11 "rev": "21b57141cef21dd87235f16a0ed6aac522f1472f",
12 "type": "github"
13 },
14 "original": {
15 "owner": "bhipple",
16 "repo": "nur-packages",
17 "type": "github"
18 }
19 },
202 "dwarffs": {
213 "info": {
224 "lastModified": 1587561848,
3921 }
4022 },
4123 "emacs": {
42 "flake": false,
43 "info": {
44 "lastModified": 1589098608,
45 "narHash": "sha256-NNNigdZMvwAoJWplpS+vdLMMaPudSlUJMl9/SghsXCE="
24 "info": {
25 "lastModified": 1589257414,
26 "narHash": "sha256-4/gmohOeHnBub6PdQBwPwgFTeIPdrb+MdxJMyM4QDXg="
4627 },
4728 "locked": {
4829 "owner": "nix-community",
4930 "repo": "emacs-overlay",
50 "rev": "794c52bbe0d65ea9fac9e6340a92bc29f430aed2",
31 "rev": "4cd31e9b52379fb2df5ff5028d90bf6b8e6ebb16",
5132 "type": "github"
5233 },
5334 "original": {
5435 "owner": "nix-community",
5536 "repo": "emacs-overlay",
56 "type": "github"
57 }
58 },
59 "epkgs": {
60 "info": {
61 "lastModified": 1589083644,
62 "narHash": "sha256-jz3HBwXOI81RN/FNSEpuQTxGOyos8AX32n8x/ygBeEI="
63 },
64 "locked": {
65 "owner": "bqv",
66 "repo": "nixpkgs",
67 "rev": "214554fa91a2930a11ccf1f73b4cb85f6dedfd9a",
68 "type": "github"
69 },
70 "original": {
71 "owner": "bqv",
72 "ref": "emacs-native-pkgs",
73 "repo": "nixpkgs",
7437 "type": "github"
7538 }
7639 },
209172 },
210173 "nixpkgs": {
211174 "info": {
212 "lastModified": 1589104183,
213 "narHash": "sha256-jEU1eQZESa8wpxS+ZzfsqyqAPULDI4xtwDXUSZVfX1g="
214 },
215 "locked": {
216 "owner": "nixos",
217 "repo": "nixpkgs",
218 "rev": "eb639a82e01849c17c976c64d5329c93e7990b8e",
175 "lastModified": 1589256470,
176 "narHash": "sha256-00nSkm0lv9HLLHNBt9TG3iclVEKYTKRK5drIYIfhSyA="
177 },
178 "locked": {
179 "owner": "nixos",
180 "repo": "nixpkgs",
181 "rev": "90b6042d04c74966c005db97d4c3e3903ce39671",
219182 "type": "github"
220183 },
221184 "original": {
245208 },
246209 "nixpkgs_3": {
247210 "info": {
248 "lastModified": 1589081048,
249 "narHash": "sha256-EI4zL+UqXQAsA4G/jB8USikcofeWB0JnqwUcoVMC+Xg="
250 },
251 "locked": {
252 "owner": "nixos",
253 "repo": "nixpkgs",
254 "rev": "e5e3090908036fa3cb616c13f78255b44211a06f",
211 "lastModified": 1589225516,
212 "narHash": "sha256-Fnz4my3H3543J6ywc57nf7FkQINJG7JkZlLONQs1Wys="
213 },
214 "locked": {
215 "owner": "nixos",
216 "repo": "nixpkgs",
217 "rev": "84701d5f5a7ffbad95168fb9dda30bccc705b7c0",
255218 "type": "github"
256219 },
257220 "original": {
283246 },
284247 "root": {
285248 "inputs": {
286 "bhipple": "bhipple",
287249 "dwarffs": "dwarffs",
288250 "emacs": "emacs",
289 "epkgs": "epkgs",
290251 "home": "home",
291252 "large": "nixpkgs_2",
292253 "master": "nixpkgs",
22
33 description = "A highly structured configuration database.";
44
5 inputs.master.url = "github:nixos/nixpkgs/master";
6 inputs.staged.url = "github:nixos/nixpkgs/staging";
7 inputs.small.url = "github:nixos/nixpkgs/nixos-unstable-small";
8 inputs.large.url = "github:nixos/nixpkgs/nixos-unstable";
9
10 inputs.nix.url = "github:nixos/nix/flakes";
11 inputs.nix.inputs.nixpkgs.follows = "master";
12
13 inputs.dwarffs.url = "github:edolstra/dwarffs";
14 inputs.dwarffs.inputs.nixpkgs.follows = "master";
15
16 inputs.home.url = "github:rycee/home-manager/bqv-flakes";
17 inputs.home.inputs.nixpkgs.follows = "large";
18
19 inputs.nur.url = "github:nix-community/NUR";
20 inputs.nur.inputs.nixpkgs.follows = "small";
21
22 inputs.naersk.url = "github:nmattia/naersk";
23 inputs.naersk.inputs.nixpkgs.follows = "large";
24
25 inputs.nixexprs = { url = "https://nixos.org/channels/nixos-unstable/nixexprs.tar.xz"; flake = false; };
26
27 inputs.emacs = { url = "github:nix-community/emacs-overlay"; flake = false; };
28 inputs.mozilla = { url = "github:mozilla/nixpkgs-mozilla"; flake = false; };
29 inputs.snack = { url = "github:nmattia/snack"; flake = false; };
30 inputs.napalm = { url = "github:nmattia/napalm"; flake = false; };
31
32 inputs.bhipple = { url = "github:bhipple/nur-packages"; flake = false; };
33 inputs.epkgs = { url = "github:bqv/nixpkgs/emacs-native-pkgs"; };
34
35 outputs = inputs@{ self, master, staged, small, large,
36 nix, dwarffs, home, nur, naersk, nixexprs,
37 emacs, mozilla, snack, napalm, bhipple, epkgs
38 }:
39 let
40 inherit (builtins) listToAttrs baseNameOf attrNames attrValues readDir trace concatStringsSep;
41 inherit (master.lib) fold recursiveUpdate setAttrByPath mapAttrs genAttrs filterAttrs;
42 inherit (master.lib) removeSuffix removePrefix splitString const flatten;
43 forAllSystems = genAttrs [ "x86_64-linux" "i686-linux" "aarch64-linux" ];
44 diffTrace = left: right: string: value: if left != right then trace string value else value;
45
46 config = { allowUnfree = true; };
47
48 fetchPullRequestForSystem = system: args@{ id, rev ? null, sha256 ? master.lib.fakeSha256, ... }:
49 mapAttrs (k: v: trace "pkgs.${k} pinned to nixpks/pull/${toString id}" v)
50 (import (builtins.fetchTarball {
51 name = "nixpkgs-pull-request-${toString id}"; inherit sha256;
52 url = if ! builtins.isNull rev
53 then "https://github.com/NixOS/nixpkgs/archive/${rev}.zip"
54 else "https://github.com/NixOS/nixpkgs/archive/pull/${toString id}/head.zip";
55 }) {
56 inherit system config;
57 overlays = attrValues self.overlays;
58 } // (removeAttrs args [ "id" "rev" "hash" ]));
59
60 pkgsForSystem = system: import large rec {
61 inherit system config;
62 overlays = (attrValues self.overlays) ++ [
63 (self: super: { master =
64 mapAttrs (k: v: diffTrace (baseNameOf master) (baseNameOf super.path) "pkgs.${k} pinned to nixpkgs/master" v)
65 (import master { inherit config system; overlays = []; });
66 })
67 (self: super: { staged =
68 mapAttrs (k: v: diffTrace (baseNameOf staged) (baseNameOf super.path) "pkgs.${k} pinned to nixpkgs/staging" v)
69 (import staged { inherit config system; overlays = []; });
70 })
71 (self: super: { small =
72 mapAttrs (k: v: diffTrace (baseNameOf small) (baseNameOf super.path) "pkgs.${k} pinned to nixpkgs/nixos-unstable-small" v)
73 (import small { inherit config system; overlays = []; });
74 })
75 (self: super: { large =
76 mapAttrs (k: v: diffTrace (baseNameOf large) (baseNameOf super.path) "pkgs.${k} pinned to nixpkgs/nixos-unstable" v)
77 (import large { inherit config system; overlays = []; });
78 })
79 (self: super: let
80 pkgs = epkgs.legacyPackages.${system};
81 in import emacs pkgs pkgs)
82 #(import emacs)
83 (import mozilla)
84 (pkgs: const {
85 naersk = naersk.lib.${system};
86 snack = pkgs.callPackage (import "${inputs.snack}/snack-lib");
87 napalm = pkgs.callPackage inputs.napalm;
88 nixexprs = inputs.nixexprs;
89 inherit (master.legacyPackages.${system}) pulseeffects;
90 inherit (staged.legacyPackages.${system}) libgccjit sof-firmware;
91 inherit (import bhipple { inherit pkgs; }) gccemacs;
92 })
93 nix.overlay
94 nur.overlay
95 self.overlay
96 ];
5 inputs = {
6 master.url = "github:nixos/nixpkgs/master";
7 staged.url = "github:nixos/nixpkgs/staging";
8 small.url = "github:nixos/nixpkgs/nixos-unstable-small";
9 large.url = "github:nixos/nixpkgs/nixos-unstable";
10
11 nix.url = "github:nixos/nix/flakes";
12 nix.inputs.nixpkgs.follows = "master";
13
14 dwarffs.url = "github:edolstra/dwarffs";
15 dwarffs.inputs.nixpkgs.follows = "master";
16
17 home.url = "github:rycee/home-manager/bqv-flakes";
18 home.inputs.nixpkgs.follows = "large";
19
20 nur.url = "github:nix-community/NUR";
21 nur.inputs.nixpkgs.follows = "small";
22
23 naersk.url = "github:nmattia/naersk";
24 naersk.inputs.nixpkgs.follows = "large";
25
26 emacs.url = "github:nix-community/emacs-overlay";
27
28 mozilla = { url = "github:mozilla/nixpkgs-mozilla"; flake = false; };
29 snack = { url = "github:nmattia/snack"; flake = false; };
30 napalm = { url = "github:nmattia/napalm"; flake = false; };
31
32 nixexprs = { url = "https://nixos.org/channels/nixos-unstable/nixexprs.tar.xz"; flake = false; };
33 };
34
35 outputs = inputs: with builtins; let
36 channels = with inputs; {
37 pkgs = large;
38 modules = master;
39 lib = master;
40 };
41 inherit (channels.lib) lib;
42
43 forAllSystems = lib.genAttrs [ "x86_64-linux" "i686-linux" "aarch64-linux" ];
44 diffTrace = left: right: string: value: if left != right then trace string value else value;
45
46 config = { allowUnfree = true; };
47
48 fetchPullRequestForSystem = system: args@{ id, rev ? null, sha256 ? lib.fakeSha256, ... }:
49 mapAttrs (k: v: trace "pkgs.${k} pinned to nixpks/pull/${toString id}" v)
50 (import (builtins.fetchTarball {
51 name = "nixpkgs-pull-request-${toString id}"; inherit sha256;
52 url = if ! builtins.isNull rev
53 then "https://github.com/NixOS/nixpkgs/archive/${rev}.zip"
54 else "https://github.com/NixOS/nixpkgs/archive/pull/${toString id}/head.zip";
55 }) {
56 inherit system config;
57 overlays = attrValues self.overlays;
58 } // (removeAttrs args [ "id" "rev" "hash" ]));
59
60 channelToOverlay = { system, config, flake, branch }: (final: prev: { ${flake} =
61 mapAttrs (k: v: diffTrace (baseNameOf inputs.${flake}) (baseNameOf prev.path) "pkgs.${k} pinned to nixpkgs/${branch}" v)
62 (import inputs.${flake} { inherit config system; overlays = []; });
63 });
64
65 pkgsForSystem = system: import channels.pkgs rec {
66 inherit system config;
67 overlays = (attrValues inputs.self.overlays) ++ [
68 (channelToOverlay { inherit system config; flake = "master"; branch = "master"; })
69 (channelToOverlay { inherit system config; flake = "staged"; branch = "staging"; })
70 (channelToOverlay { inherit system config; flake = "small"; branch = "nixos-unstable-small"; })
71 (channelToOverlay { inherit system config; flake = "large"; branch = "nixos-unstable"; })
72 (import inputs.mozilla)
73 (pkgs: lib.const {
74 naersk = inputs.naersk.lib.${system};
75 snack = pkgs.callPackage (import "${inputs.snack}/snack-lib");
76 napalm = pkgs.callPackage inputs.napalm;
77 nixexprs = inputs.nixexprs;
78 inherit (inputs.small.legacyPackages.${system}) pulseeffects;
79 inherit (inputs.staged.legacyPackages.${system}) libgccjit sof-firmware;
80 })
81 inputs.nix.overlay
82 inputs.emacs.overlay
83 inputs.nur.overlay
84 inputs.self.overlay
85 ];
86 };
87
88 in {
89 nixosConfigurations = let
90 system = "x86_64-linux";
91 pkgs = pkgsForSystem system;
92 specialArgs = {
93 usr = import ./lib/utils.nix { inherit lib; };
94 nurModules = nur.nixosModules;
95 nurOverlays = nur.overlays;
96
97 domains = import ./secrets/domains.nix;
98 hosts = import ./secrets/hosts.nix;
9799 };
98100
99 in {
100 nixosConfigurations = let
101 system = "x86_64-linux";
102 pkgs = pkgsForSystem system;
103 nixpkgs = master;
104 specialArgs = {
105 usr = import ./lib/utils.nix { inherit (nixpkgs) lib; };
106 nurModules = nur.nixosModules;
107 nurOverlays = nur.overlays;
108
109 domains = import ./secrets/domains.nix;
110 hosts = import ./secrets/hosts.nix;
111 };
112
113 inherit (specialArgs) usr;
114 config = hostName: nixpkgs.lib.nixosSystem {
115 inherit system;
116
117 inherit specialArgs;
118
119 modules = let
120 inherit (home.nixosModules) home-manager;
121
122 core = ./profiles/core.nix;
123
124 global = {
125 networking.hostName = hostName;
126
127 nix.registry = nixpkgs.lib.mapAttrs (id: flake: {
128 inherit flake;
129 from = { inherit id; type = "indirect"; };
130 }) inputs;
131 nix.nixPath = [
132 "nixpkgs=${nixpkgs}"
133 "nixos-config=/etc/nixos/configuration.nix"
134 "nixpkgs-overlays=/etc/nixos/overlays"
135 ];
136
137 system.configurationRevision = self.rev
138 or (throw "Refusing to build from an unclean source tree!");
139
140 system.extraSystemBuilderCmds = '' ln -s '${./.}' "$out/flake" '';
141
142 nixpkgs = {
143 inherit pkgs;
144 };
145
146 home-manager.useGlobalPkgs = true;
147 };
148
149 local = import "${toString ./hosts}/${hostName}";
150
151 flakeModules = import ./modules/list.nix;
152
153 in flakeModules ++ [ core global local home-manager
154 dwarffs.nixosModules.dwarffs ];
155 };
156 in usr.recImport {
157 dir = ./hosts;
158 _import = config;
101 inherit (specialArgs) usr;
102 config = hostName: lib.nixosSystem {
103 inherit system;
104
105 inherit specialArgs;
106
107 modules = let
108 inherit (inputs.home.nixosModules) home-manager;
109 inherit (inputs.dwarffs.nixosModules) dwarffs;
110
111 core = ./profiles/core.nix;
112
113 global = {
114 networking.hostName = hostName;
115
116 nix.registry = lib.mapAttrs (id: flake: {
117 inherit flake;
118 from = { inherit id; type = "indirect"; };
119 }) inputs;
120 nix.nixPath = [
121 "nixpkgs=${channels.pkgs}"
122 "nixos-config=/etc/nixos/configuration.nix"
123 "nixpkgs-overlays=/etc/nixos/overlays"
124 ];
125
126 system.configurationRevision = if (inputs.self ? rev) then inputs.self.rev else "dirty";
127
128 system.extraSystemBuilderCmds = ''
129 ln -s '${./.}' "$out/flake"
130 '' + (if ! (inputs.self ? rev) then ''
131 echo "Cannot switch to a dirty configuration"
132 exit 1
133 '' else "");
134
135 nixpkgs = {
136 inherit pkgs;
137 };
138
139 home-manager.useGlobalPkgs = true;
140 };
141
142 local = import "${toString ./hosts}/${hostName}";
143
144 flakeModules = import ./modules/list.nix;
145
146 in flakeModules ++ [ core global local home-manager dwarffs ];
159147 };
160
161 legacyPackages = forAllSystems pkgsForSystem;
162
163 overlay = import ./pkgs;
164
165 overlays = listToAttrs (map (name: {
166 name = removeSuffix ".nix" name;
167 value = import (./overlays + "/${name}");
168 }) (attrNames (readDir ./overlays)));
169
170 packages = forAllSystems (system: let
171 pkgs = pkgsForSystem system;
172 in filterAttrs (_: p: (p.meta.broken or null) != true) {
173 inherit (pkgs.emacsPackages) bitwarden ivy-exwm flycheck-purescript eterm-256color;
174 inherit (pkgs) dgit dejavu_nerdfont electronmail flarectl fsnoop;
175 inherit (pkgs.guilePackages) guile-gcrypt guile-git guile-json guile-sqlite3;
176 inherit (pkgs.guilePackages) guile-ssh guile-gnutls bytestructures;
177 inherit (pkgs) guix matrix-appservice-irc matrix-construct mx-puppet-discord;
178 inherit (pkgs.pleroma) pleroma_be pleroma_fe masto_fe;
179 inherit (pkgs) pure sddm-chili shflags yacy;
180
181 inherit (pkgs) nheko;
182 inherit (pkgs.weechatScripts) weechat-matrix;
183 });
184
185 nixosModules = let
186 mergeAll = fold recursiveUpdate {};
187 pathsToAttrs = map (file:
188 let
189 cleanFile = removeSuffix ".nix" (removePrefix "./" (toString file));
190 in setAttrByPath (splitString "/" cleanFile) (import file)
191 );
192
193 # modules
194 moduleList = import ./modules/list.nix;
195 modulesAttrs = mergeAll (pathsToAttrs moduleList);
196
197 # profiles
198 profilesList = import ./profiles/list.nix;
199 profilesAttrs = { profiles = mergeAll (pathsToAttrs profilesList); };
200 in modulesAttrs // profilesAttrs;
201
202 secrets = concatStringsSep "\n" ([]
203 ++ (attrValues (import ./secrets/domains.nix))
204 ++ (flatten (map attrValues (attrValues (import ./secrets/hosts.nix))))
148 in usr.recImport {
149 dir = ./hosts;
150 _import = config;
151 };
152
153 legacyPackages = forAllSystems pkgsForSystem;
154
155 overlay = import ./pkgs;
156
157 overlays = listToAttrs (map (name: {
158 name = lib.removeSuffix ".nix" name;
159 value = import (./overlays + "/${name}");
160 }) (attrNames (readDir ./overlays)));
161
162 packages = forAllSystems (system: let
163 pkgs = pkgsForSystem system;
164 in lib.filterAttrs (_: p: (p.meta.broken or null) != true) {
165 inherit (pkgs.emacsPackages) bitwarden ivy-exwm flycheck-purescript eterm-256color;
166 inherit (pkgs) dgit dejavu_nerdfont electronmail flarectl fsnoop;
167 inherit (pkgs.guilePackages) guile-gcrypt guile-git guile-json guile-sqlite3;
168 inherit (pkgs.guilePackages) guile-ssh guile-gnutls bytestructures;
169 inherit (pkgs) guix matrix-appservice-irc matrix-construct mx-puppet-discord;
170 inherit (pkgs.pleroma) pleroma_be pleroma_fe masto_fe;
171 inherit (pkgs) pure sddm-chili shflags yacy;
172
173 inherit (pkgs) nheko;
174 inherit (pkgs.weechatScripts) weechat-matrix;
175 });
176
177 nixosModules = let
178 mergeAll = fold recursiveUpdate {};
179 pathsToAttrs = map (file:
180 let
181 cleanFile = removeSuffix ".nix" (removePrefix "./" (toString file));
182 in setAttrByPath (splitString "/" cleanFile) (import file)
205183 );
206 };
184
185 # modules
186 moduleList = import ./modules/list.nix;
187 modulesAttrs = mergeAll (pathsToAttrs moduleList);
188
189 # profiles
190 profilesList = import ./profiles/list.nix;
191 profilesAttrs = { profiles = mergeAll (pathsToAttrs profilesList); };
192 in modulesAttrs // profilesAttrs;
193
194 secrets = concatStringsSep "\n" ([]
195 ++ (attrValues (import ./secrets/domains.nix))
196 ++ (lib.flatten (map attrValues (attrValues (import ./secrets/hosts.nix))))
197 );
198 };
207199 }
00 { config, lib, pkgs, ... }:
11
2 let inherit (lib) fileContents;
2 let
3 inherit (lib) fileContents;
34 in {
45 nix.package = pkgs.nix;
56
1616 sha256 = "1f22bxwq53hhdjlakmqz66y63vix5ybpnc1pk9fpy18wjh871scq";
1717 };
1818 patches = [];
19 postPatch = ''
20 substituteInPlace lisp/loadup.el \
21 --replace '(emacs-repository-get-version)' '"${src.rev}"' \
22 --replace '(emacs-repository-get-branch)' '"feature/native-comp"'
23 '';
1924
2025 # When this is enabled, emacs does native compilation lazily after starting
2126 # up, resulting in quicker package builds up-front, at the cost of slower