-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
87 lines (84 loc) · 2.74 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
# Copyright © 2022–2024 Hraban Luyat
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
{
description = "Hraban's git tools";
inputs = {
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
cl-nix-lite.url = "github:hraban/cl-nix-lite";
flake-utils = {
url = "flake-utils";
inputs.systems.follows = "systems";
};
systems.url = "systems";
};
outputs = { self, nixpkgs, flake-utils, cl-nix-lite, ... }: let
git-hly = { sbcl, pkgs, lib }: let
pkgs' = pkgs.extend cl-nix-lite.overlays.default;
inherit (pkgs') lispPackagesLite;
in with lispPackagesLite; lispDerivation {
lispSystem = "git-hly";
pname = "git-hly";
version = "0.0.1";
src = lib.cleanSource ./.;
lispDependencies = [
alexandria
arrow-macros
asdf
inferior-shell
trivia
lispPackagesLite."trivia.ppcre"
];
# Override this to to disable the per-child command symlinking
symlinkCommands = true;
# I’m not sure if this is genius or awful? If I have to ask, it’s
# probably awful.
postBuild = ''
# Ideally, I should be able to access overridden args in the derivation itself
# by passing a callback to lispDerivation, just like stdenv.mkDerivation...
if [[ $symlinkCommands == "1" ]]; then
${sbcl}/bin/sbcl --script <<EOF | while read cmd ; do (cd bin && ln -s git-hly git-$cmd) ; done
(require :asdf)
(asdf:load-system "git-hly")
(format T "~{~(~A~)~^~%~}~%" (git-hly/src/cmd::cmd-names))
EOF
fi
'';
installPhase = "mkdir -p $out; cp -r bin $out/";
dontStrip = true;
meta = {
license = lib.licenses.agpl3Only;
};
};
in flake-utils.lib.eachDefaultSystem (system:
with rec {
pkgs = nixpkgs.legacyPackages.${system};
sbclNoRefs = pkgs.sbcl.overrideAttrs {
bootstrapLisp = pkgs.lib.getExe pkgs.sbcl;
purgeNixReferences = true;
coreCompression = false;
doCheck = false;
};
};
{
packages = {
default = pkgs.callPackage git-hly { };
norefs = (pkgs.extend (self: super: {
sbcl = sbclNoRefs;
})).callPackage git-hly {};
};
});
}