2015-07-11 16:55:22 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
2015-07-24 20:48:00 +02:00
|
|
|
|
2016-10-20 20:54:38 +02:00
|
|
|
with import <stockholm/lib>;
|
2015-11-09 18:52:11 +01:00
|
|
|
|
2017-01-05 21:03:23 +01:00
|
|
|
let {
|
2015-07-11 16:55:22 +02:00
|
|
|
|
2017-01-05 21:03:23 +01:00
|
|
|
body = {
|
2020-07-13 11:39:42 +02:00
|
|
|
|
|
|
|
nixpkgs.config.packageOverrides = super: {
|
|
|
|
cgit = pkgs.symlinkJoin {
|
|
|
|
name = "${super.cgit.name}-tv";
|
|
|
|
paths = [
|
|
|
|
(pkgs.runCommand "${super.cgit.name}-tv-overrides" {
|
|
|
|
} /* sh */ ''
|
|
|
|
mkdir -p $out/lib/cgit/filters
|
|
|
|
cd $out/lib/cgit/filters
|
|
|
|
cp \
|
|
|
|
${super.cgit}/lib/cgit/filters/syntax-highlighting.py \
|
|
|
|
${super.cgit}/lib/cgit/filters/.syntax-highlighting.py-wrapped \
|
|
|
|
.
|
|
|
|
sed -i "s:${super.cgit}:$out:" syntax-highlighting.py
|
|
|
|
sed -i '
|
|
|
|
s:^\(formatter =\).*:\1 HtmlFormatter(style="algol_nu"):
|
|
|
|
' .syntax-highlighting.py-wrapped
|
|
|
|
'')
|
|
|
|
super.cgit
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2015-07-24 11:44:49 +02:00
|
|
|
krebs.git = {
|
2015-07-24 00:24:12 +02:00
|
|
|
enable = true;
|
2016-06-07 03:14:21 +02:00
|
|
|
cgit = {
|
|
|
|
settings = {
|
2018-09-28 16:20:48 +02:00
|
|
|
about-filter = pkgs.exec "krebs.cgit.about-filter" rec {
|
|
|
|
filename = "${pkgs.pythonPackages.markdown2}/bin/markdown2";
|
|
|
|
argv = [
|
|
|
|
filename
|
|
|
|
"--extras=fenced-code-blocks"
|
|
|
|
];
|
|
|
|
envp = {};
|
|
|
|
};
|
|
|
|
readme = [
|
|
|
|
":README.md"
|
|
|
|
];
|
2016-06-07 03:14:21 +02:00
|
|
|
root-desc = "mostly krebs";
|
2018-09-28 16:20:48 +02:00
|
|
|
root-title = "repositories at ${config.krebs.build.host.name}";
|
2020-07-13 11:39:02 +02:00
|
|
|
source-filter = "${pkgs.cgit}/lib/cgit/filters/syntax-highlighting.py";
|
2016-06-07 03:14:21 +02:00
|
|
|
};
|
|
|
|
};
|
2016-02-03 13:36:54 +01:00
|
|
|
repos = repos;
|
2015-08-24 11:22:05 +02:00
|
|
|
rules = rules;
|
2015-07-24 00:24:12 +02:00
|
|
|
};
|
2015-07-11 16:55:22 +02:00
|
|
|
};
|
|
|
|
|
2018-08-28 21:48:00 +02:00
|
|
|
cgit-clear-cache = pkgs.cgit-clear-cache.override {
|
|
|
|
inherit (config.krebs.git.cgit.settings) cache-root;
|
|
|
|
};
|
|
|
|
|
2015-08-24 11:22:05 +02:00
|
|
|
repos =
|
2015-07-24 19:33:20 +02:00
|
|
|
public-repos //
|
2015-08-24 11:22:05 +02:00
|
|
|
optionalAttrs config.krebs.build.host.secure restricted-repos;
|
2015-07-24 19:33:20 +02:00
|
|
|
|
2015-07-24 00:24:12 +02:00
|
|
|
rules = concatMap make-rules (attrValues repos);
|
2015-07-11 16:55:22 +02:00
|
|
|
|
2015-10-17 08:00:35 +02:00
|
|
|
public-repos = mapAttrs make-public-repo ({
|
2016-06-07 03:14:21 +02:00
|
|
|
} // mapAttrs (_: recursiveUpdate { cgit.section = "1. miscellaneous"; }) {
|
2016-11-24 22:40:55 +01:00
|
|
|
dic = {
|
|
|
|
cgit.desc = "dict.leo.org command line interface";
|
|
|
|
};
|
2018-07-13 14:24:57 +02:00
|
|
|
disko = {
|
|
|
|
cgit.desc = "declarative partitioning and formatting tool";
|
|
|
|
};
|
2019-02-07 19:04:19 +01:00
|
|
|
flameshot-once = {
|
|
|
|
cgit.desc = "flameshot runner that automatically starts/stops the daemon";
|
|
|
|
};
|
2018-09-25 19:02:09 +02:00
|
|
|
fswm = {
|
|
|
|
cgit.desc = "simple full screen window manager";
|
|
|
|
};
|
2017-04-18 19:58:49 +02:00
|
|
|
htgen = {
|
|
|
|
cgit.desc = "toy HTTP server";
|
|
|
|
};
|
2018-05-03 18:41:08 +02:00
|
|
|
krops = {
|
2018-02-28 22:38:42 +01:00
|
|
|
cgit.desc = "deployment tools";
|
|
|
|
};
|
2020-11-24 20:13:48 +01:00
|
|
|
mailaids = {
|
|
|
|
cgit.desc = "Assortment of aids for working with electronic mail";
|
|
|
|
};
|
2015-07-24 00:24:12 +02:00
|
|
|
much = {};
|
2016-10-23 18:15:20 +02:00
|
|
|
netcup = {
|
|
|
|
cgit.desc = "netcup command line interface";
|
|
|
|
};
|
2018-09-28 15:16:11 +02:00
|
|
|
nix-writers = {
|
|
|
|
cgit.desc = "collection of package builders";
|
|
|
|
};
|
2016-10-23 18:15:20 +02:00
|
|
|
populate = {
|
|
|
|
cgit.desc = "source code installer";
|
|
|
|
};
|
2017-04-18 19:58:53 +02:00
|
|
|
q = {};
|
2019-01-13 23:42:22 +01:00
|
|
|
reaktor2 = {};
|
2015-07-24 00:24:12 +02:00
|
|
|
regfish = {};
|
|
|
|
stockholm = {
|
2016-06-07 03:14:21 +02:00
|
|
|
cgit.desc = "NixOS configuration";
|
2015-07-24 00:24:12 +02:00
|
|
|
};
|
2018-12-28 14:49:44 +01:00
|
|
|
with-ssh = {};
|
2016-11-24 22:40:55 +01:00
|
|
|
} // mapAttrs (_: recursiveUpdate { cgit.section = "2. Host configurations"; }) {
|
|
|
|
ni = {
|
|
|
|
};
|
|
|
|
} // mapAttrs (_: recursiveUpdate { cgit.section = "3. Haskell libraries"; }) {
|
2015-10-17 08:00:35 +02:00
|
|
|
blessings = {};
|
2018-11-13 02:47:03 +01:00
|
|
|
hc = {};
|
2015-10-17 08:00:35 +02:00
|
|
|
mime = {};
|
|
|
|
quipper = {};
|
|
|
|
scanner = {};
|
2015-07-24 00:24:12 +02:00
|
|
|
wai-middleware-time = {};
|
|
|
|
web-routes-wai-custom = {};
|
|
|
|
xintmap = {};
|
2015-11-09 18:01:30 +01:00
|
|
|
xmonad-stockholm = {};
|
2016-11-24 22:40:55 +01:00
|
|
|
} // mapAttrs (_: recursiveUpdate { cgit.section = "4. museum"; }) {
|
2018-09-28 15:18:43 +02:00
|
|
|
cac-api = {
|
|
|
|
cgit.desc = "CloudAtCost API command line interface";
|
|
|
|
};
|
2015-11-09 18:34:02 +01:00
|
|
|
cgserver = {};
|
|
|
|
crude-mail-setup = {};
|
|
|
|
dot-xmonad = {};
|
2017-04-18 19:58:37 +02:00
|
|
|
hirc = {};
|
2018-09-28 15:18:43 +02:00
|
|
|
hstool = {
|
|
|
|
cgit.desc = "Haskell Development Environment ^_^";
|
|
|
|
};
|
|
|
|
kirk = {
|
|
|
|
cgit.desc = "IRC tools";
|
|
|
|
};
|
2016-11-24 22:40:55 +01:00
|
|
|
make-snapshot = {};
|
2015-11-09 18:34:02 +01:00
|
|
|
nixos-infest = {};
|
|
|
|
painload = {};
|
2016-11-24 22:40:55 +01:00
|
|
|
push = {};
|
2019-01-13 23:42:14 +01:00
|
|
|
Reaktor = {};
|
2016-11-24 22:40:55 +01:00
|
|
|
with-tmpdir = {};
|
2018-09-28 15:18:43 +02:00
|
|
|
get = {};
|
|
|
|
load-env = {};
|
|
|
|
loldns = {
|
|
|
|
cgit.desc = "toy DNS server";
|
|
|
|
};
|
|
|
|
soundcloud = {
|
|
|
|
cgit.desc = "SoundCloud command line interface";
|
|
|
|
};
|
2015-10-17 08:00:35 +02:00
|
|
|
});
|
2015-07-11 16:55:22 +02:00
|
|
|
|
2015-07-24 19:33:20 +02:00
|
|
|
restricted-repos = mapAttrs make-restricted-repo (
|
|
|
|
{
|
|
|
|
brain = {
|
2015-07-24 20:48:00 +02:00
|
|
|
collaborators = with config.krebs.users; [ lass makefu ];
|
2018-08-28 21:48:00 +02:00
|
|
|
hooks = {
|
|
|
|
post-receive = /* sh */ ''
|
|
|
|
(${irc-announce { cgit_endpoint = null; }})
|
|
|
|
${cgit-clear-cache}/bin/cgit-clear-cache
|
|
|
|
'';
|
2017-06-19 23:07:51 +02:00
|
|
|
};
|
2015-07-24 19:33:20 +02:00
|
|
|
};
|
|
|
|
} //
|
2015-09-27 00:22:50 +02:00
|
|
|
# TODO don't put secrets/repos.nix into the store
|
|
|
|
import <secrets/repos.nix> { inherit config lib pkgs; }
|
2015-07-24 19:33:20 +02:00
|
|
|
);
|
|
|
|
|
2017-06-19 23:07:51 +02:00
|
|
|
irc-announce = args: pkgs.git-hooks.irc-announce (recursiveUpdate {
|
2017-10-01 14:31:00 +02:00
|
|
|
channel = "#xxx";
|
2017-06-19 22:46:26 +02:00
|
|
|
# TODO make nick = config.krebs.build.host.name the default
|
|
|
|
nick = config.krebs.build.host.name;
|
2017-10-01 13:43:00 +02:00
|
|
|
server = "irc.r";
|
2017-06-19 22:46:26 +02:00
|
|
|
verbose = true;
|
2017-06-19 23:07:51 +02:00
|
|
|
} args);
|
2017-06-19 22:46:26 +02:00
|
|
|
|
2016-06-07 03:14:21 +02:00
|
|
|
make-public-repo = name: { cgit ? {}, ... }: {
|
|
|
|
inherit cgit name;
|
2015-07-24 00:24:12 +02:00
|
|
|
public = true;
|
2018-08-28 21:48:00 +02:00
|
|
|
hooks = {
|
|
|
|
post-receive = /* sh */ ''
|
|
|
|
(${optionalString (config.krebs.build.host.name == "ni")
|
|
|
|
(irc-announce {})})
|
|
|
|
${cgit-clear-cache}/bin/cgit-clear-cache
|
|
|
|
'';
|
2015-07-11 16:55:22 +02:00
|
|
|
};
|
2015-07-24 00:24:12 +02:00
|
|
|
};
|
2015-07-11 16:55:22 +02:00
|
|
|
|
2017-06-19 22:46:26 +02:00
|
|
|
make-restricted-repo = name: { collaborators ? [], hooks ? {}, ... }: {
|
2018-08-28 21:48:00 +02:00
|
|
|
inherit collaborators name;
|
2015-07-24 19:33:20 +02:00
|
|
|
public = false;
|
2018-08-28 21:48:00 +02:00
|
|
|
hooks = hooks // {
|
|
|
|
post-receive = /* sh */ ''
|
2018-10-11 11:33:03 +02:00
|
|
|
(${hooks.post-receive or ":"})
|
2018-08-28 21:48:00 +02:00
|
|
|
${cgit-clear-cache}/bin/cgit-clear-cache
|
|
|
|
'';
|
|
|
|
};
|
2015-07-24 19:33:20 +02:00
|
|
|
};
|
|
|
|
|
2015-07-24 00:24:12 +02:00
|
|
|
make-rules =
|
2015-07-24 20:48:00 +02:00
|
|
|
with git // config.krebs.users;
|
2015-07-24 00:24:12 +02:00
|
|
|
repo:
|
|
|
|
singleton {
|
2016-02-07 05:17:07 +01:00
|
|
|
user = [ tv tv-xu ];
|
2015-07-24 00:24:12 +02:00
|
|
|
repo = [ repo ];
|
|
|
|
perm = push "refs/*" [ non-fast-forward create delete merge ];
|
|
|
|
} ++
|
2016-02-03 13:36:54 +01:00
|
|
|
optional (repo.collaborators or [] != []) {
|
2015-07-24 19:33:20 +02:00
|
|
|
user = repo.collaborators;
|
|
|
|
repo = [ repo ];
|
|
|
|
perm = fetch;
|
2015-07-24 00:24:12 +02:00
|
|
|
};
|
2015-07-11 16:55:22 +02:00
|
|
|
|
2017-01-05 21:03:23 +01:00
|
|
|
}
|