keepassxc.scm
1 | ;;; Guix Home Manager. |
2 | ;;; |
3 | ;;; Copyright © 2019, 2020 Julien Lepiller <julien@lepiller.eu> |
4 | ;;; |
5 | ;;; This program is free software: you can redistribute it and/or modify |
6 | ;;; it under the terms of the GNU General Public License as published by |
7 | ;;; the Free Software Foundation, either version 3 of the License, or |
8 | ;;; (at your option) any later version. |
9 | ;;; |
10 | ;;; This program is distributed in the hope that it will be useful, |
11 | ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | ;;; GNU General Public License for more details. |
14 | ;;; |
15 | ;;; You should have received a copy of the GNU General Public License |
16 | ;;; along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | |
18 | (define-module (home keepassxc) |
19 | #:use-module (guix build utils) |
20 | #:use-module (guix gexp) |
21 | #:use-module (guix records) |
22 | #:use-module (gnu packages lxde) |
23 | #:use-module (ice-9 match) |
24 | #:use-module (home utils) |
25 | #:use-module (home) |
26 | #:export (keepassxc-configuration |
27 | keepassxc-last-databases |
28 | keepassxc-last-dir |
29 | keepassxc-last-opened-databases |
30 | keepassxc-show-toolbar? |
31 | keepassxc-hide-passwords? |
32 | keepassxc-hide-usernames? |
33 | keepassxc-compact-mode? |
34 | keepassxc-theme |
35 | keepassxc-eaasci? |
36 | keepassxc-ensure-every? |
37 | keepassxc-exclude-alike? |
38 | keepassxc-password-length |
39 | keepassxc-use-lower-case? |
40 | keepassxc-use-numbers? |
41 | keepassxc-use-special-chars? |
42 | keepassxc-type |
43 | keepassxc-use-upper-case? |
44 | keepassxc-word-count |
45 | keepassxc-wordlist |
46 | keepassxc-word-separator |
47 | keepassxc-browser-integration? |
48 | keepassxc-browser-sort-by-username? |
49 | keepassxc-browser-can-unlock? |
50 | keepassxc-browser-adapt-url? |
51 | keepassxc-browser-best-match-only? |
52 | keepassxc-browser-expired? |
53 | keepassxc-browser-search-all-databases? |
54 | |
55 | keepassxc-home-type)) |
56 | |
57 | (define-record-type* <keepassxc-configuration> |
58 | keepassxc-configuration make-keepassxc-configuration |
59 | keepassxc-configuration? |
60 | (last-databases keepassxc-last-databases |
61 | (default '())) |
62 | (last-dir keepassxc-last-dir |
63 | (default #f)) |
64 | (last-opened-databases keepassxc-last-opened-databases |
65 | (default '())) |
66 | (show-toolbar? keepassxc-show-toolbar? |
67 | (default #t)) |
68 | (hide-passwords? keepassxc-hide-passwords? |
69 | (default #t)) |
70 | (hide-usernames? keepassxc-hide-usernames? |
71 | (default #f)) |
72 | (compact-mode? keepassxc-compact-mode? |
73 | (default #f)) |
74 | (theme keepassxc-theme |
75 | (default "auto")) |
76 | (ensure-every? keepassxc-ensure-every? |
77 | (default #t)) |
78 | (exclude-alike? keepassxc-exclude-alike? |
79 | (default #t)) |
80 | (password-length keepassxc-password-length |
81 | (default 28)) |
82 | (use-eascii? keepassxc-use-eascii? |
83 | (default #f)) |
84 | (use-lower-case? keepassxc-use-lower-case? |
85 | (default #t)) |
86 | (use-upper-case? keepassxc-use-upper-case? |
87 | (default #t)) |
88 | (use-numbers? keepassxc-use-numbers? |
89 | (default #t)) |
90 | (use-special-chars? keepassxc-use-special-chars? |
91 | (default #f)) |
92 | (type keepassxc-type |
93 | (default 0)) |
94 | (word-count keepassxc-word-count |
95 | (default 7)) |
96 | (wordlist keepassxc-wordlist |
97 | (default "eff_large.wordlist")) |
98 | (word-separator keepassxc-word-separator |
99 | (default " ")) |
100 | ;; browser integration |
101 | (browser-integration? keepassxc-browser-integration? |
102 | (default #f)) |
103 | (browser-sort-by-username? keepassxc-browser-sort-by-username? |
104 | (default #f)) |
105 | (browser-can-unlock? keepassxc-browser-can-unlock? |
106 | (default #t)) |
107 | (browser-adapt-url? keepassxc-browser-adapt-url? |
108 | (default #t)) |
109 | (browser-best-match-only? keepassxc-browser-best-match-only? |
110 | (default #f)) |
111 | (browser-expired? keepassxc-browser-expired? |
112 | (default #f)) |
113 | (browser-search-all-databases? keepassxc-browser-search-all-databases? |
114 | (default #f))) |
115 | |
116 | (define keepassxc-home-type |
117 | (home-type |
118 | (name 'keepassxc) |
119 | (extensions |
120 | (list |
121 | (home-extension |
122 | (target root-home-type) |
123 | (compute (lambda (config) |
124 | (let ((keepassxc.ini |
125 | (make-ini-file "keepassxc.ini" |
126 | `(("General" |
127 | (("LastDatabases" |
128 | ,(string-join |
129 | (keepassxc-last-databases config) |
130 | ", ")) |
131 | ("LastDir" |
132 | ,(or (keepassxc-last-dir config) "")) |
133 | ("LastOpenedDatabases" |
134 | ,(string-join |
135 | (keepassxc-last-opened-databases config) |
136 | ", ")))) |
137 | ("Browser" |
138 | (("AllowExpiredCredentials" |
139 | ,(keepassxc-browser-expired? config)) |
140 | ("BestMatchOnly" |
141 | ,(keepassxc-browser-best-match-only? config)) |
142 | ("Enabled" |
143 | ,(keepassxc-browser-integration? config)) |
144 | ("MatchUrlScheme" |
145 | ,(keepassxc-browser-best-match-only? config)) |
146 | ("SearchInAllDatabases" |
147 | ,(keepassxc-browser-search-all-databases? config)) |
148 | ("SortByUsernam" |
149 | ,(keepassxc-browser-sort-by-username? config)) |
150 | ("UnlockDatabase" |
151 | ,(keepassxc-browser-can-unlock? config)))) |
152 | ("GUI" |
153 | (("HidePasswords" |
154 | ,(keepassxc-hide-passwords? config)) |
155 | ("HideUsernames" |
156 | ,(keepassxc-hide-usernames? config)) |
157 | ("ApplicationTheme" |
158 | ,(keepassxc-theme config)) |
159 | ("CompactMode" |
160 | ,(keepassxc-compact-mode? config)))) |
161 | ("generator" |
162 | (("EASCII" |
163 | ,(keepassxc-use-eascii? config)) |
164 | ("EnsureEvery" |
165 | ,(keepassxc-ensure-every? config)) |
166 | ("ExcludeAlike" |
167 | ,(keepassxc-exclude-alike? config)) |
168 | ("Length" |
169 | ,(keepassxc-password-length config)) |
170 | ("LowerCase" |
171 | ,(keepassxc-use-lower-case? config)) |
172 | ("Numbers" |
173 | ,(keepassxc-use-numbers? config)) |
174 | ("SpecialChars" |
175 | ,(keepassxc-use-special-chars? config)) |
176 | ("Type" |
177 | ,(keepassxc-type config)) |
178 | ("UpperCase" |
179 | ,(keepassxc-use-upper-case? config)) |
180 | ("WordCount" |
181 | ,(keepassxc-word-count config)) |
182 | ("WordList" |
183 | ,(keepassxc-wordlist config)) |
184 | ("WordSeparator" |
185 | ,(keepassxc-word-separator config)))))))) |
186 | `((".config/keepassxc/keepassxc.ini" ,keepassxc.ini)))))))))) |
187 |