From 99a5c110ac4f5056db66f5d229496508ec85dacd Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 4 Jun 2017 09:07:59 +0200 Subject: tv gitconfig: init --- tv/1systems/nomic.nix | 2 +- tv/1systems/wu.nix | 2 +- tv/1systems/xu.nix | 2 +- tv/1systems/zu.nix | 2 +- tv/2configs/git.nix | 137 ---------------------------------------------- tv/2configs/gitconfig.nix | 19 +++++++ tv/2configs/gitrepos.nix | 137 ++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 160 insertions(+), 141 deletions(-) delete mode 100644 tv/2configs/git.nix create mode 100644 tv/2configs/gitconfig.nix create mode 100644 tv/2configs/gitrepos.nix (limited to 'tv') diff --git a/tv/1systems/nomic.nix b/tv/1systems/nomic.nix index 5469fffd..9b950225 100644 --- a/tv/1systems/nomic.nix +++ b/tv/1systems/nomic.nix @@ -9,7 +9,7 @@ with import ; ../. ../2configs/hw/x220.nix ../2configs/exim-retiolum.nix - ../2configs/git.nix + ../2configs/gitrepos.nix ../2configs/im.nix ../2configs/mail-client.nix ../2configs/nginx/public_html.nix diff --git a/tv/1systems/wu.nix b/tv/1systems/wu.nix index 328e71fd..60f9fa10 100644 --- a/tv/1systems/wu.nix +++ b/tv/1systems/wu.nix @@ -9,7 +9,7 @@ with import ; ../. ../2configs/hw/w110er.nix ../2configs/exim-retiolum.nix - ../2configs/git.nix + ../2configs/gitrepos.nix ../2configs/im.nix ../2configs/mail-client.nix ../2configs/man.nix diff --git a/tv/1systems/xu.nix b/tv/1systems/xu.nix index 288373fc..0a15ba83 100644 --- a/tv/1systems/xu.nix +++ b/tv/1systems/xu.nix @@ -9,7 +9,7 @@ with import ; ../. ../2configs/hw/x220.nix ../2configs/exim-retiolum.nix - ../2configs/git.nix + ../2configs/gitrepos.nix ../2configs/mail-client.nix ../2configs/man.nix ../2configs/nginx/public_html.nix diff --git a/tv/1systems/zu.nix b/tv/1systems/zu.nix index b1b2d58c..5552ef06 100644 --- a/tv/1systems/zu.nix +++ b/tv/1systems/zu.nix @@ -15,7 +15,7 @@ with import ; ../. ../2configs/hw/x220.nix ../2configs/exim-retiolum.nix - ../2configs/git.nix + ../2configs/gitrepos.nix ../2configs/mail-client.nix ../2configs/man.nix ../2configs/nginx/public_html.nix diff --git a/tv/2configs/git.nix b/tv/2configs/git.nix deleted file mode 100644 index 13b12986..00000000 --- a/tv/2configs/git.nix +++ /dev/null @@ -1,137 +0,0 @@ -{ config, lib, pkgs, ... }: - -with import ; - -let { - - body = { - krebs.git = { - enable = true; - cgit = { - settings = { - root-title = "repositories at ${config.krebs.build.host.name}"; - root-desc = "mostly krebs"; - }; - }; - repos = repos; - rules = rules; - }; - }; - - repos = - public-repos // - optionalAttrs config.krebs.build.host.secure restricted-repos; - - rules = concatMap make-rules (attrValues repos); - - public-repos = mapAttrs make-public-repo ({ - } // mapAttrs (_: recursiveUpdate { cgit.section = "1. miscellaneous"; }) { - cac-api = { - cgit.desc = "CloudAtCost API command line interface"; - }; - dic = { - cgit.desc = "dict.leo.org command line interface"; - }; - get = {}; - hstool = { - cgit.desc = "Haskell Development Environment ^_^"; - }; - htgen = { - cgit.desc = "toy HTTP server"; - }; - kirk = { - cgit.desc = "IRC tools"; - }; - load-env = {}; - loldns = { - cgit.desc = "toy DNS server"; - }; - make-snapshot = {}; - much = {}; - netcup = { - cgit.desc = "netcup command line interface"; - }; - populate = { - cgit.desc = "source code installer"; - }; - q = {}; - regfish = {}; - soundcloud = { - cgit.desc = "SoundCloud command line interface"; - }; - stockholm = { - cgit.desc = "NixOS configuration"; - }; - } // mapAttrs (_: recursiveUpdate { cgit.section = "2. Host configurations"; }) { - ni = { - }; - } // mapAttrs (_: recursiveUpdate { cgit.section = "3. Haskell libraries"; }) { - blessings = {}; - mime = {}; - quipper = {}; - scanner = {}; - wai-middleware-time = {}; - web-routes-wai-custom = {}; - xintmap = {}; - xmonad-stockholm = {}; - } // mapAttrs (_: recursiveUpdate { cgit.section = "4. museum"; }) { - cgserver = {}; - crude-mail-setup = {}; - dot-xmonad = {}; - hirc = {}; - make-snapshot = {}; - nixos-infest = {}; - painload = {}; - push = {}; - with-tmpdir = {}; - }); - - restricted-repos = mapAttrs make-restricted-repo ( - { - brain = { - collaborators = with config.krebs.users; [ lass makefu ]; - }; - } // - # TODO don't put secrets/repos.nix into the store - import { inherit config lib pkgs; } - ); - - make-public-repo = name: { cgit ? {}, ... }: { - inherit cgit name; - public = true; - hooks = optionalAttrs (config.krebs.build.host.name == "ni") { - post-receive = pkgs.git-hooks.irc-announce { - # TODO make nick = config.krebs.build.host.name the default - nick = config.krebs.build.host.name; - channel = "#retiolum"; - server = "ni.r"; - verbose = true; - }; - }; - }; - - make-restricted-repo = name: { collaborators ? [], ... }: { - inherit collaborators name; - public = false; - }; - - make-rules = - with git // config.krebs.users; - repo: - singleton { - user = [ tv tv-xu ]; - repo = [ repo ]; - perm = push "refs/*" [ non-fast-forward create delete merge ]; - } ++ - optional repo.public { - user = attrValues config.krebs.users; - repo = [ repo ]; - perm = fetch; - } ++ - optional (repo.collaborators or [] != []) { - user = repo.collaborators; - repo = [ repo ]; - perm = fetch; - }; - -} diff --git a/tv/2configs/gitconfig.nix b/tv/2configs/gitconfig.nix new file mode 100644 index 00000000..771a4b2a --- /dev/null +++ b/tv/2configs/gitconfig.nix @@ -0,0 +1,19 @@ +{ config, pkgs, ... }: + +with import ; + +{ + environment.etc.gitconfig.text = '' + [alias] + patch = !${pkgs.git}/bin/git --no-pager diff --no-color + [diff-so-fancy] + markEmptyLines = false + stripLeadingSymbols = false + [pager] + diff = ${pkgs.gitAndTools.diff-so-fancy}/bin/diff-so-fancy \ + | ${pkgs.less}/bin/less -FRX + [user] + email = tv@krebsco.de + name = tv + ''; +} diff --git a/tv/2configs/gitrepos.nix b/tv/2configs/gitrepos.nix new file mode 100644 index 00000000..13b12986 --- /dev/null +++ b/tv/2configs/gitrepos.nix @@ -0,0 +1,137 @@ +{ config, lib, pkgs, ... }: + +with import ; + +let { + + body = { + krebs.git = { + enable = true; + cgit = { + settings = { + root-title = "repositories at ${config.krebs.build.host.name}"; + root-desc = "mostly krebs"; + }; + }; + repos = repos; + rules = rules; + }; + }; + + repos = + public-repos // + optionalAttrs config.krebs.build.host.secure restricted-repos; + + rules = concatMap make-rules (attrValues repos); + + public-repos = mapAttrs make-public-repo ({ + } // mapAttrs (_: recursiveUpdate { cgit.section = "1. miscellaneous"; }) { + cac-api = { + cgit.desc = "CloudAtCost API command line interface"; + }; + dic = { + cgit.desc = "dict.leo.org command line interface"; + }; + get = {}; + hstool = { + cgit.desc = "Haskell Development Environment ^_^"; + }; + htgen = { + cgit.desc = "toy HTTP server"; + }; + kirk = { + cgit.desc = "IRC tools"; + }; + load-env = {}; + loldns = { + cgit.desc = "toy DNS server"; + }; + make-snapshot = {}; + much = {}; + netcup = { + cgit.desc = "netcup command line interface"; + }; + populate = { + cgit.desc = "source code installer"; + }; + q = {}; + regfish = {}; + soundcloud = { + cgit.desc = "SoundCloud command line interface"; + }; + stockholm = { + cgit.desc = "NixOS configuration"; + }; + } // mapAttrs (_: recursiveUpdate { cgit.section = "2. Host configurations"; }) { + ni = { + }; + } // mapAttrs (_: recursiveUpdate { cgit.section = "3. Haskell libraries"; }) { + blessings = {}; + mime = {}; + quipper = {}; + scanner = {}; + wai-middleware-time = {}; + web-routes-wai-custom = {}; + xintmap = {}; + xmonad-stockholm = {}; + } // mapAttrs (_: recursiveUpdate { cgit.section = "4. museum"; }) { + cgserver = {}; + crude-mail-setup = {}; + dot-xmonad = {}; + hirc = {}; + make-snapshot = {}; + nixos-infest = {}; + painload = {}; + push = {}; + with-tmpdir = {}; + }); + + restricted-repos = mapAttrs make-restricted-repo ( + { + brain = { + collaborators = with config.krebs.users; [ lass makefu ]; + }; + } // + # TODO don't put secrets/repos.nix into the store + import { inherit config lib pkgs; } + ); + + make-public-repo = name: { cgit ? {}, ... }: { + inherit cgit name; + public = true; + hooks = optionalAttrs (config.krebs.build.host.name == "ni") { + post-receive = pkgs.git-hooks.irc-announce { + # TODO make nick = config.krebs.build.host.name the default + nick = config.krebs.build.host.name; + channel = "#retiolum"; + server = "ni.r"; + verbose = true; + }; + }; + }; + + make-restricted-repo = name: { collaborators ? [], ... }: { + inherit collaborators name; + public = false; + }; + + make-rules = + with git // config.krebs.users; + repo: + singleton { + user = [ tv tv-xu ]; + repo = [ repo ]; + perm = push "refs/*" [ non-fast-forward create delete merge ]; + } ++ + optional repo.public { + user = attrValues config.krebs.users; + repo = [ repo ]; + perm = fetch; + } ++ + optional (repo.collaborators or [] != []) { + user = repo.collaborators; + repo = [ repo ]; + perm = fetch; + }; + +} -- cgit v1.2.3