summaryrefslogtreecommitdiff
path: root/tw
diff options
context:
space:
mode:
authorTimo Wilken2023-05-22 23:21:50 +0200
committerTimo Wilken2023-05-22 23:25:16 +0200
commite299e679691a0a7d08a76d81f9bee802694763af (patch)
treefc229b001fa105ec0e56006156de27beb96f8345 /tw
parentdbb97d9a63f8404c52dbf5bbdaa0862e5e8e6a78 (diff)
Fix PGP key in private gitconfig
Diffstat (limited to 'tw')
-rw-r--r--tw/home.scm53
-rw-r--r--tw/home/cern.scm4
-rw-r--r--tw/home/files/gitconfig43
-rw-r--r--tw/home/lap.scm6
4 files changed, 58 insertions, 48 deletions
diff --git a/tw/home.scm b/tw/home.scm
index e0f19a9f..6f53b8b2 100644
--- a/tw/home.scm
+++ b/tw/home.scm
@@ -172,8 +172,7 @@ auto-expand-secmem
(local-file "home/files/prompt.zsh")))))
(simple-service 'common-config home-xdg-configuration-files-service-type
- `(("git/config" ,(local-file "home/files/gitconfig"))
- ("htop/htoprc" ,(local-file "home/files/htoprc"))
+ `(("htop/htoprc" ,(local-file "home/files/htoprc"))
("lesskey" ,(local-file "home/files/lesskey"))
("ranger/rc.conf" ,(local-file "home/files/ranger.conf"))
("tmux/tmux.conf" ,(local-file "home/files/tmux.conf"))
@@ -411,9 +410,6 @@ auto-expand-secmem
("X11/XCompose" ,(local-file "home/files/XCompose")) ; see also: $XCOMPOSEFILE variable
("X11/Xresources" ,(local-file "home/files/Xresources"))))
- (simple-service 'work-git-config home-files-service-type
- `(("src/alice/.gitconfig" ,(local-file "home/files/gitconfig-cern"))))
-
(simple-service 'emacs-config home-xdg-configuration-files-service-type
`(("emacs/include" ,(local-file "home/files/emacs-packages" #:recursive? #t))
("emacs/early-init.el" ,(local-file "home/files/emacs-early-init.el"))
@@ -561,3 +557,50 @@ auto-expand-secmem
,(local-file "home/files/emacsclient.desktop"))))
(gnupg-services #:gui-pinentry? #t)))
+
+(define-public (gitconfig email signing-key)
+ (mixed-text-file "gitconfig" "\
+# This is Git's per-user configuration file.
+[user]
+ name = Timo Wilken
+ email = " email "
+ signingkey = " signing-key "
+[commit]
+ gpgsign = true
+[url \"https://\"]
+ insteadOf = git://
+[url \"ssh://git@gitlab.cern.ch:7999/\"]
+ insteadOf = https://gitlab.cern.ch/
+[url \"ssh://git@ssh.github.com/\"]
+ insteadOf = gh:
+[gui]
+ fontui = -family \\\"Fira Sans\\\" -size 10 -weight normal -slant roman -underline 0 -overstrike 0
+ fontdiff = -family \\\"Hermit\\\" -size 10 -weight normal -slant roman -underline 0 -overstrike 0
+ tabsize = 4
+[merge]
+ summary = true
+ conflictstyle = diff3
+[color]
+ ui = auto
+[pull]
+ rebase = false
+ ff = only
+[alias]
+ glog = log --decorate --graph --oneline
+ plog = log --decorate --graph --oneline --pretty=tformat:\\\"%C(yellow)%h %Cgreen%as %Cblue%<(10,trunc)%an%Cred%d%Creset %s\\\"
+[init]
+ defaultBranch = master
+[advice]
+ detachedHead = false
+# https://sw.kovidgoyal.net/kitty/kittens/diff/
+[diff]
+ tool = kitty
+ guitool = kitty.gui
+[difftool]
+ prompt = false
+ trustExitCode = true
+[difftool \"kitty\"]
+ cmd = " kitty "/bin/kitty +kitten diff $LOCAL $REMOTE
+[difftool \"kitty.gui\"]
+ cmd = " kitty "/bin/kitty " kitty "/bin/kitty +kitten diff $LOCAL $REMOTE
+"))
diff --git a/tw/home/cern.scm b/tw/home/cern.scm
index d9ea38bb..e7b4124d 100644
--- a/tw/home/cern.scm
+++ b/tw/home/cern.scm
@@ -127,6 +127,10 @@
(string-append (getenv "XDG_CONFIG_HOME")
"/X11/ridge-view.jpg")))))))
+ ;; On my work machine, Git must always use my work PGP key.
+ (simple-service 'gitconfig home-xdg-configuration-files-service-type
+ `(("git/config" ,(gitconfig "timo.wilken@cern.ch" "C2249BBE5E8761C943A0CFA1B7B3914BF63ACD7C"))))
+
(openssh-service #f)
(append %common-services %interactive-services pim-services)))))
diff --git a/tw/home/files/gitconfig b/tw/home/files/gitconfig
deleted file mode 100644
index 6bed5cc8..00000000
--- a/tw/home/files/gitconfig
+++ /dev/null
@@ -1,43 +0,0 @@
-# This is Git's per-user configuration file.
-[user]
- name = Timo Wilken
- email = timo.wilken@cern.ch
- signingkey = C2249BBE5E8761C943A0CFA1B7B3914BF63ACD7C
-[commit]
- gpgsign = true
-[url "https://"]
- insteadOf = git://
-[url "ssh://git@gitlab.cern.ch:7999/"]
- insteadOf = https://gitlab.cern.ch/
-[url "ssh://git@ssh.github.com/"]
- insteadOf = gh:
-[gui]
- fontui = -family \"Fira Sans\" -size 10 -weight normal -slant roman -underline 0 -overstrike 0
- fontdiff = -family \"Hermit\" -size 10 -weight normal -slant roman -underline 0 -overstrike 0
- tabsize = 4
-[merge]
- summary = true
- conflictstyle = diff3
-[color]
- ui = auto
-[pull]
- rebase = false
- ff = only
-[alias]
- glog = log --decorate --graph --oneline
- plog = log --decorate --graph --oneline --pretty=tformat:\"%C(yellow)%h %Cgreen%as %Cblue%<(10,trunc)%an%Cred%d%Creset %s\"
-[init]
- defaultBranch = master
-[advice]
- detachedHead = false
-# https://sw.kovidgoyal.net/kitty/kittens/diff/
-[diff]
- tool = kitty
- guitool = kitty.gui
-[difftool]
- prompt = false
- trustExitCode = true
-[difftool "kitty"]
- cmd = kitty +kitten diff $LOCAL $REMOTE
-[difftool "kitty.gui"]
- cmd = kitty kitty +kitten diff $LOCAL $REMOTE
diff --git a/tw/home/lap.scm b/tw/home/lap.scm
index 44f345da..2b3c848d 100644
--- a/tw/home/lap.scm
+++ b/tw/home/lap.scm
@@ -199,6 +199,12 @@
(string-append (getenv "HOME")
"/pictures/Backgrounds/greece/IMG_20181201_104748_DRO.jpg")))))))
+ ;; On my private machine, I want to use my private PGP key normally, and
+ ;; my work key only for work repositories.
+ (simple-service 'gitconfig home-xdg-configuration-files-service-type
+ `(("git/config" ,(gitconfig "git@twilken.net" "53EC3C06856883DD92355BC22FC78504681F69B0"))
+ ("src/alice/.gitconfig" ,(local-file "files/gitconfig-cern"))))
+
(openssh-service #t)
(append pim-services %interactive-services %common-services)))))