Skip to content

Commit 4610b76

Browse files
authored
Merge pull request #46 from emacs-twist/flake-partition
Isolate the dev-only flake inputs to improve performance
2 parents 4b81e19 + 7db7a15 commit 4610b76

File tree

6 files changed

+637
-80
lines changed

6 files changed

+637
-80
lines changed

.github/workflows/update-data.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
schedule:
55
- cron: '0 15 * * 1'
66
workflow_dispatch:
7+
pull_request:
8+
paths:
9+
- dev/**
710

811
concurrency:
912
group: ${{ github.workflow }}-${{ github.ref }}

dev/flake-module.nix

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{ inputs, ... }:
2+
{
3+
perSystem =
4+
{
5+
system,
6+
pkgs,
7+
self',
8+
lib,
9+
...
10+
}:
11+
let
12+
emacsPackages = inputs.emacs-ci.packages.${system};
13+
in
14+
{
15+
_module.args.pkgs = inputs.nixpkgs.legacyPackages.${system}.extend inputs.twist.overlays.default;
16+
17+
devShells = {
18+
default = pkgs.mkShell { buildInputs = [ pkgs.just ]; };
19+
};
20+
21+
packages = {
22+
default = pkgs.linkFarm "default" (
23+
[
24+
{
25+
name = "default.nix";
26+
path = pkgs.writeText "emacs-builtins-default-nix" ''{${
27+
lib.concatMapStrings (name: "${name} = import ./${name}.nix;\n") (builtins.attrNames emacsPackages)
28+
}}'';
29+
}
30+
]
31+
++ (lib.mapAttrsToList (emacsName: emacsPackage: {
32+
name = "${emacsName}.nix";
33+
path =
34+
pkgs.runCommand "build-${emacsName}-builtins-nix"
35+
{
36+
buildInputs = [ emacsPackage ];
37+
}
38+
''
39+
EMACS_VERSION="$(emacs --version \
40+
| grep -F "GNU Emacs" \
41+
| grep -oE "[[:digit:]]+(:?\.[[:digit:]]+)+")"
42+
echo >>$out '{'
43+
echo >>$out " version = \"''${EMACS_VERSION}\";"
44+
echo >>$out ' libraries = ['
45+
sed -e 's/^/"/' -e 's/$/"/' ${
46+
(pkgs.emacsTwist {
47+
inherit emacsPackage;
48+
initFiles = [ ];
49+
lockDir = null;
50+
inventories = [ ];
51+
}).builtinLibraryList
52+
} >>$out
53+
echo >>$out ' ];'
54+
echo >>$out '}'
55+
'';
56+
}) emacsPackages)
57+
);
58+
};
59+
};
60+
}

0 commit comments

Comments
 (0)