-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
flake.nix
119 lines (104 loc) · 5.35 KB
/
flake.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# Copyright (C) 2022 Positron Solutions
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{
description = "This flake provides CI & local development dependencies";
# inputs are pinned via flake.lock. The normal way to update an individual
# version is:
# nix flake lock --update-input emacs-overlay
# Tracking can be accomplished via CI and machine commits
inputs = {
# stable branches are recommended for CI, regression spotting. Testing with
# multiple versions can be done via input overrides, such as:
# nix build .#ci --override-input nixpkgs github:nixpkgs/nixpkgs/unstable
nixpkgs.url = "github:nixos/nixpkgs?ref=release-22.11";
flake-utils.url = "github:numtide/flake-utils";
emacs-overlay.url = "github:nix-community/emacs-overlay";
# slave Emacs overlay to our nixpkgs. This doesn't do a lot except reduce
# the closure size and allow us to control both nixpkgs versions with one
# declaration.
emacs-overlay.inputs.nixpkgs.follows = "nixpkgs";
emacs-overlay.inputs.flake-utils.follows = "flake-utils";
};
outputs = inputs:
with inputs;
flake-utils.lib.eachDefaultSystem (system:
let
# instantaite nixpkgs with the emacs overlay applied.
pkgs = import nixpkgs {
inherit system;
overlays = [ emacs-overlay.overlay ];
};
# List of Emacsen to generate development shells for.
emacsPackages = [
"emacs-unstable"
"emacs-git"
"emacs28"
"emacs29"
"emacs"
];
# To explore available attributes, you can instantiate nixpkgs with the emacs overlay in a nix repl:
# pkgs = import (builtins.getFlake "nixpkgs") { system = builtins.currentSystem; overlays = [ (builtins.getFlake ("emacs-overlay")).overlay ];}
# pkgs.emacs will tab complete. pkgs.emacs.version etc describe what's inside.
# let's have a development shell per Emacs!
devShells = pkgs.lib.genAttrs emacsPackages (emacsPkg:
pkgs.mkShell {
packages = [
# pkgs, contains many dependencies you can provide to your elisp
# programs. Search for packages here:
# https://search.nixos.org/packages
pkgs.git # for elisp-repo-kit-clone.
# https://github.com/nix-community/emacs-overlay
# The emacs overlay provides up-to-date snapshots of Melpa packages.
# These will be pure & pinned, so you need to update the flake lock
# or use appropriate options.
#
# This expression builds an Emacs that loads the packages passed
# to emacsWithPackages on startup.
((pkgs.emacsPackagesFor pkgs.${emacsPkg}).emacsWithPackages
(epkgs: [
# List your project's dependencies here:
# epkgs.melpaPackages.dash
# epkgs.melpaStablePackages.dash
# epkgs.elpaPackages.dash
# epkgs.dash
# Development dependencies
epkgs.elpaPackages.relint
epkgs.melpaPackages.elisp-lint
# epkgs.melpaPackages.buttercup # XXX finish after #218 on buttercup
# epkgs.melpaPackages.elsa # XXX did not work out of the box
# Dependencies of elisp-repo-kit itself. These are no longer
# needed by your repo after cloning.
epkgs.elpaPackages.project
epkgs.melpaPackages.auto-compile
epkgs.melpaPackages.license-templates
# Optionally override derivations.
# melpaPackages.weechat.overrideAttrs(old: {
# # probably you want to override the src attribute
# patches = [ ./weechat-el.patch ];
# })
]))
];
});
in {
# The output set, where all useful things go. If your nix flake exposes
# packages, overlays, shells, or nix utils, they can be exposed here for
# downstream consumption.
# Augment the devShells with a default so that `nix develop` knows what
# to do. Run `nix flake show` to see the results. Per-system,
# per-Emacs, we have a development environment avaialble.
devShells = devShells // { default = devShells.emacs-git; };
});
}