summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/simple
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2021-02-15 19:09:42 +0100
committermakefu <github@syntax-fehler.de>2021-02-15 19:09:42 +0100
commitda0ab68232757e19e1ec26e88331b88afea9e8fc (patch)
tree00ebd863f07b8e569a856107f08be8de9ff3a8bc /krebs/5pkgs/simple
parentdc7dca887a082666b3e4c7592239131181bc42c1 (diff)
parent9365aff352d99b7506bafbef6682de7bfb00df27 (diff)
Merge remote-tracking branch 'tv/master'
Diffstat (limited to 'krebs/5pkgs/simple')
-rw-r--r--krebs/5pkgs/simple/gitignore.nix46
1 files changed, 46 insertions, 0 deletions
diff --git a/krebs/5pkgs/simple/gitignore.nix b/krebs/5pkgs/simple/gitignore.nix
new file mode 100644
index 000000000..b3c750a08
--- /dev/null
+++ b/krebs/5pkgs/simple/gitignore.nix
@@ -0,0 +1,46 @@
+{ pkgs }:
+
+/* gitignore - Filter for intentionally untracked lines or blocks of code
+
+This is a filter that allows specifying intentionally untracked lines and
+blocks of code that Git should ignore.
+
+Example:
+
+ int main(void) {
+ printf("I would never say derp.\n");
+ //#gitignore-begin
+ printf("DERP!\n");
+ //#gitignore-end
+ printf("DERP!\n"); //#gitignore
+ return 0;
+ }
+
+Installation:
+
+ Define a filter, e.g. in ~/.config/git/config[1]:
+
+ [filter "gitignore"]
+ clean = gitignore
+ smudge = cat
+
+ Assing that filter to some paths, e.g. in ~/.config/git/attributes[2]:
+
+ *.hs filter=gitignore
+ *.c filter=gitignore
+ ...
+
+ [1]: For more information about defining filters see git-config(1).
+ [2]: For more information about assigning filters see gitattributes(5).
+*/
+
+pkgs.execBin "gitignore" {
+ filename = "${pkgs.gnused}/bin/sed";
+ argv = [
+ "gitignore"
+ /* sed */ ''
+ /#gitignore-begin/,/#gitignore-end/d
+ /#gitignore/d
+ ''
+ ];
+}