-
Notifications
You must be signed in to change notification settings - Fork 100
/
flake.nix
64 lines (57 loc) · 1.8 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
{
description = "markdown-toc flake";
inputs = {
nixpkgs = {
type = "github";
owner = "NixOS";
repo = "nixpkgs";
ref = "nixpkgs-unstable";
follows = "nix/nixpkgs";
};
flake-utils = {
type = "github";
owner = "numtide";
repo = "flake-utils";
ref = "master";
};
};
outputs = { self, nix, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem
(system:
let lib = nixpkgs.lib;
pkgs = nixpkgs.legacyPackages.${system};
pname = "markdown-toc";
version = "0.1.5";
in rec {
packages."${system}" = {
markdown-toc = pkgs.stdenv.mkDerivation {
inherit pname version;
src = ./.;
buildInputs = with pkgs.emacs.pkgs; [
emacs s dash markdown-mode
];
unpackPhase = ''
cp $src/${pname}.el .
'';
buildPhase = ''
emacs -L . --batch -f batch-byte-compile *.el
'';
installPhase =
let install-dir = "$out/share/emacs/site-lisp/elpa/${pname}-${version}/"; in
''
mkdir -p ${install-dir}
cp -v *.el *.elc ${install-dir}
'';
doCheck = false;
meta = {
description = "A simple TOC generator for markdown file.";
homepage = https://github.com/ardumont/markdown-toc;
license = lib.licenses.gpl2;
maintainers = with lib.maintainers; [ ardumont ];
};
};
};
devShell = import ./shell.nix { pkgs = pkgs // packages."${system}"; };
defaultPackage = packages."${system}".markdown-toc;
});
}