diff options
| author | 2026-02-10 09:51:35 -0800 | |
|---|---|---|
| committer | 2026-02-10 09:51:35 -0800 | |
| commit | b589d2fd23ec077eb2dfe818c427831467cde054 (patch) | |
| tree | 67810cce2e171050f02657819547468aa60c1a9b | |
| parent | 185ffdf4e30c816313eeefdbf9f0ca7dfff4c255 (diff) | |
| download | new-dotfiles-b589d2fd23ec077eb2dfe818c427831467cde054.tar.gz new-dotfiles-b589d2fd23ec077eb2dfe818c427831467cde054.zip | |
git: Add ignore patterns option
| -rw-r--r-- | oni/home/services/git.scm | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/oni/home/services/git.scm b/oni/home/services/git.scm index 8af29ec..b1db06e 100644 --- a/oni/home/services/git.scm +++ b/oni/home/services/git.scm @@ -1,4 +1,5 @@ (define-module (oni home services git) + #:use-module (srfi srfi-1) #:use-module ((gnu home services) #:select (service-type service-extension @@ -39,6 +40,13 @@ (name (pascal-case (substring field-name (1+ (string-index field-name #\-))) #\-))) (format #f "~a=~a~%" name (if value "true" "false")))) +(define (list-of-strings? obj) + (and (list? obj) + (every string? obj))) + +(define (serialize-list-of-strings field value) + (string-append (string-join value "\n"))) + (define-configuration home-git-configuration (package (package git) @@ -61,6 +69,9 @@ (advice-detached-head (boolean #t) "Show warning about being in a detached-head state?") + (ignore-patterns + (list-of-strings '()) + "Ignore patterns.") (extra maybe-string "Any extra configuration.")) @@ -83,7 +94,11 @@ (serialize-configuration config (filter-prefix "init-" home-git-configuration-fields)) "[advice]\n" (serialize-configuration config (filter-prefix "advice-" home-git-configuration-fields)) - (home-git-configuration-extra config)))))) + (home-git-configuration-extra config))) + ("git/ignore" + ,(mixed-text-file + "gitignore" + (serialize-list-of-strings #f (home-git-configuration-ignore-patterns config))))))) (define home-git-service-type (service-type |
