From b0094ce0e498b9661de62e472121aaaf5b83c40d Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 9 Nov 2015 02:58:21 +0100 Subject: stockholm: check if default.nix exists before importing --- krebs/4lib/default.nix | 2 ++ 1 file changed, 2 insertions(+) (limited to 'krebs/4lib') diff --git a/krebs/4lib/default.nix b/krebs/4lib/default.nix index 396307c22..f907fe871 100644 --- a/krebs/4lib/default.nix +++ b/krebs/4lib/default.nix @@ -14,6 +14,8 @@ rec { types = import ./types.nix { inherit lib; }; + dir.has-default-nix = path: pathExists (path + "/default.nix"); + dns = import ./dns.nix { inherit lib; }; listset = import ./listset.nix { inherit lib; }; shell = import ./shell.nix { inherit lib; }; -- cgit v1.2.3 From 1f4d7ffa50483cde6024fe910fb16d0c8040e245 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 9 Nov 2015 18:34:02 +0100 Subject: tv git: move old stuff to the museum section --- krebs/4lib/default.nix | 3 +++ 1 file changed, 3 insertions(+) (limited to 'krebs/4lib') diff --git a/krebs/4lib/default.nix b/krebs/4lib/default.nix index f907fe871..3f27ea891 100644 --- a/krebs/4lib/default.nix +++ b/krebs/4lib/default.nix @@ -30,4 +30,7 @@ rec { subdirsOf = path: mapAttrs (name: _: path + "/${name}") (filterAttrs (_: eq "directory") (readDir path)); + + mapAttrValues = f: mapAttrs (_: f); + setAttr = name: value: set: set // { ${name} = value; }; } -- cgit v1.2.3 From 193bb70e2ea95a56839fdd79985ed27f4962426d Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 9 Nov 2015 19:07:26 +0100 Subject: {tv => krebs} git lib & git hooks --- krebs/4lib/default.nix | 6 ++++-- krebs/4lib/git.nix | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 krebs/4lib/git.nix (limited to 'krebs/4lib') diff --git a/krebs/4lib/default.nix b/krebs/4lib/default.nix index 3f27ea891..1cabeae27 100644 --- a/krebs/4lib/default.nix +++ b/krebs/4lib/default.nix @@ -3,7 +3,7 @@ with builtins; with lib; -rec { +let out = rec { eq = x: y: x == y; @@ -17,6 +17,7 @@ rec { dir.has-default-nix = path: pathExists (path + "/default.nix"); dns = import ./dns.nix { inherit lib; }; + git = import ./git.nix { lib = lib // out; }; listset = import ./listset.nix { inherit lib; }; shell = import ./shell.nix { inherit lib; }; tree = import ./tree.nix { inherit lib; }; @@ -33,4 +34,5 @@ rec { mapAttrValues = f: mapAttrs (_: f); setAttr = name: value: set: set // { ${name} = value; }; -} + +}; in out diff --git a/krebs/4lib/git.nix b/krebs/4lib/git.nix new file mode 100644 index 000000000..d50ba2018 --- /dev/null +++ b/krebs/4lib/git.nix @@ -0,0 +1,42 @@ +{ lib, ... }: + +let + inherit (lib) addNames escapeShellArg makeSearchPath optionalString; + + commands = addNames { + git-receive-pack = {}; + git-upload-pack = {}; + }; + + receive-modes = addNames { + fast-forward = {}; + non-fast-forward = {}; + create = {}; + delete = {}; + merge = {}; # TODO implement in git.nix + }; + + permissions = { + fetch = { + allow-commands = [ + commands.git-upload-pack + ]; + }; + + push = ref: extra-modes: { + allow-commands = [ + commands.git-receive-pack + commands.git-upload-pack + ]; + allow-receive-ref = ref; + allow-receive-modes = [ receive-modes.fast-forward ] ++ extra-modes; + }; + }; + + refs = { + master = "refs/heads/master"; + all-heads = "refs/heads/*"; + }; + +in +commands // receive-modes // permissions // refs -- cgit v1.2.3