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 | |
48 | keepassxc-home-type)) |
49 | |
50 | (define-record-type* <keepassxc-configuration> |
51 | keepassxc-configuration make-keepassxc-configuration |
52 | keepassxc-configuration? |
53 | (last-databases keepassxc-last-databases |
54 | (default '())) |
55 | (last-dir keepassxc-last-dir |
56 | (default #f)) |
57 | (last-opened-databases keepassxc-last-opened-databases |
58 | (default '())) |
59 | (show-toolbar? keepassxc-show-toolbar? |
60 | (default #t)) |
61 | (hide-passwords? keepassxc-hide-passwords? |
62 | (default #t)) |
63 | (hide-usernames? keepassxc-hide-usernames? |
64 | (default #f)) |
65 | (compact-mode? keepassxc-compact-mode? |
66 | (default #f)) |
67 | (theme keepassxc-theme |
68 | (default "auto")) |
69 | (ensure-every? keepassxc-ensure-every? |
70 | (default #t)) |
71 | (exclude-alike? keepassxc-exclude-alike? |
72 | (default #t)) |
73 | (password-length keepassxc-password-length |
74 | (default 28)) |
75 | (use-eascii? keepassxc-use-eascii? |
76 | (default #f)) |
77 | (use-lower-case? keepassxc-use-lower-case? |
78 | (default #t)) |
79 | (use-upper-case? keepassxc-use-upper-case? |
80 | (default #t)) |
81 | (use-numbers? keepassxc-use-numbers? |
82 | (default #t)) |
83 | (use-special-chars? keepassxc-use-special-chars? |
84 | (default #f)) |
85 | (type keepassxc-type |
86 | (default 0)) |
87 | (word-count keepassxc-word-count |
88 | (default 7)) |
89 | (wordlist keepassxc-wordlist |
90 | (default "eff_large.wordlist")) |
91 | (word-separator keepassxc-word-separator |
92 | (default " "))) |
93 | |
94 | (define keepassxc-home-type |
95 | (home-type |
96 | (name 'keepassxc) |
97 | (extensions |
98 | (list |
99 | (home-extension |
100 | (target root-home-type) |
101 | (compute (lambda (config) |
102 | (let ((keepassxc.ini |
103 | (make-ini-file "keepassxc.ini" |
104 | `(("General" |
105 | (("LastDatabases" |
106 | ,(string-join |
107 | (keepassxc-last-databases config) |
108 | ", ")) |
109 | ("LastDir" |
110 | ,(or (keepassxc-last-dir config) "")) |
111 | ("LastOpenedDatabases" |
112 | ,(string-join |
113 | (keepassxc-last-opened-databases config) |
114 | ", ")))) |
115 | ("GUI" |
116 | (("HidePasswords" |
117 | ,(keepassxc-hide-passwords? config)) |
118 | ("HideUsernames" |
119 | ,(keepassxc-hide-usernames? config)) |
120 | ("ApplicationTheme" |
121 | ,(keepassxc-theme config)) |
122 | ("CompactMode" |
123 | ,(keepassxc-compact-mode? config)))) |
124 | ("generator" |
125 | (("EASCII" |
126 | ,(keepassxc-use-eascii? config)) |
127 | ("EnsureEvery" |
128 | ,(keepassxc-ensure-every? config)) |
129 | ("ExcludeAlike" |
130 | ,(keepassxc-exclude-alike? config)) |
131 | ("Length" |
132 | ,(keepassxc-password-length config)) |
133 | ("LowerCase" |
134 | ,(keepassxc-use-lower-case? config)) |
135 | ("Numbers" |
136 | ,(keepassxc-use-numbers? config)) |
137 | ("SpecialChars" |
138 | ,(keepassxc-use-special-chars? config)) |
139 | ("Type" |
140 | ,(keepassxc-type config)) |
141 | ("UpperCase" |
142 | ,(keepassxc-use-upper-case? config)) |
143 | ("WordCount" |
144 | ,(keepassxc-word-count config)) |
145 | ("WordList" |
146 | ,(keepassxc-wordlist config)) |
147 | ("WordSeparator" |
148 | ,(keepassxc-word-separator config)))))))) |
149 | `((".config/keepassxc/keepassxc.ini" ,keepassxc.ini)))))))))) |
150 |