Skip to content

Commit

Permalink
Revert "sops: Add age support."
Browse files Browse the repository at this point in the history
This reverts commit 9459e12.
  • Loading branch information
fishinthecalculator committed May 15, 2024
1 parent df3d4b3 commit 8df7dcd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 41 deletions.
2 changes: 0 additions & 2 deletions modules/sops/activation.scm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#:export (activate-secrets))

(define* (activate-secrets config-file
age-key-file
gnupg-home
sops-secrets
sops-package
Expand Down Expand Up @@ -45,7 +44,6 @@
(not (member file `("." ".." ,@exclude))))
string<?))

(setenv "SOPS_AGE_KEY_FILE" #$age-key-file)
(setenv "GNUPGHOME" #$gnupg-home)
(setenv "SOPS_GPG_EXEC" #$gpg)

Expand Down
24 changes: 3 additions & 21 deletions modules/sops/home/services/sops.scm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#:use-module (guix packages)
#:use-module (gnu packages gnupg)
#:use-module (gnu packages golang)
#:use-module (gnu packages golang-crypto)
#:use-module (sops packages sops)
#:use-module (sops activation)
#:use-module (sops secrets)
Expand All @@ -20,24 +19,15 @@
home-sops-service-configuration
home-sops-service-configuration?
home-sops-service-configuration-fields
home-sops-service-configuration-age
home-sops-service-configuration-gnupg
home-sops-service-configuration-sops
home-sops-service-configuration-config
home-sops-service-configuration-gnupg-home
home-sops-service-configuration-age-key-file
home-sops-service-configuration-secrets))

(define list-of-sops-secrets?
(list-of sops-secret?))

(define-configuration/no-serialization home-sops-service-configuration
(age
(package age)
"The @code{age} package used to perform decryption.")
(gnupg
(package gnupg)
"The @code{GnuPG} package used to perform decryption.")
(sops
(package sops)
"The @code{SOPS} package used to perform decryption.")
Expand All @@ -47,21 +37,14 @@
(gnupg-home
(string "~/.gnupg")
"The homedir of GnuPG, i.e. where keys used to decrypt SOPS secrets will be looked for.")
(age-key-file
(string "~/.config/sops/age/keys.txt")
"The file containing the corresponding @code{age} identities where SOPS will look for
when decrypting a secret.")
(secrets
(list-of-sops-secrets '())
"The @code{sops-secret} records managed by the @code{home-sops-secrets-service-type}."))

(define (home-sops-secrets-shepherd-service config)
(when config
(let* ((config-file
(home-sops-service-configuration-config config))
(age-key-file
(home-sops-service-configuration-age-key-file config))
(gnupg-home
(home-sops-service-configuration-config config))(gnupg-home
(home-sops-service-configuration-gnupg-home config))
(secrets (home-sops-service-configuration-secrets config))
(sops (home-sops-service-configuration-sops config)))
Expand All @@ -76,7 +59,6 @@ when decrypting a secret.")
(list
#$(program-file "home-sops-secrets-entrypoint"
(activate-secrets config-file
age-key-file
gnupg-home
secrets
sops)))))
Expand All @@ -95,8 +77,7 @@ when decrypting a secret.")
(service-type (name 'home-sops-secrets)
(extensions (list (service-extension home-profile-service-type
(lambda (config)
(list (home-sops-service-configuration-age config)
(home-sops-service-configuration-gnupg config)
(list age gnupg
(home-sops-service-configuration-sops config))))
(service-extension home-activation-service-type
(lambda _
Expand All @@ -106,6 +87,7 @@ when decrypting a secret.")
(mkdir-p secrets-directory)))))
(service-extension home-shepherd-service-type
home-sops-secrets-shepherd-service)))
(default-value #f)
(compose concatenate)
(extend secrets->home-sops-service-configuration)
(description
Expand Down
20 changes: 2 additions & 18 deletions modules/sops/services/sops.scm
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,17 @@
sops-service-configuration
sops-service-configuration?
sops-service-configuration-fields
sops-service-configuration-age
sops-service-configuration-gnupg
sops-service-configuration-sops
sops-service-configuration-config
sops-service-configuration-generate-key?
sops-service-configuration-gnupg-home
sops-service-configuration-age-key-file
sops-service-configuration-secrets-directory
sops-service-configuration-secrets))

(define list-of-sops-secrets?
(list-of sops-secret?))

(define-configuration/no-serialization sops-service-configuration
(age
(package age)
"The @code{age} package used to perform decryption.")
(gnupg
(package gnupg)
"The @code{GnuPG} package used to perform decryption.")
(sops
(package sops)
"The @code{SOPS} package used to perform decryption.")
Expand All @@ -57,10 +48,6 @@ more than welcome to provide your own key in the keyring.")
(gnupg-home
(string "/root/.gnupg")
"The homedir of GnuPG, i.e. where keys used to decrypt SOPS secrets will be looked for.")
(age-key-file
(string "/root/.config/sops/age/keys.txt")
"The file containing the corresponding @code{age} identities where SOPS will look for
when decrypting a secret.")
(secrets-directory
(string "/run/secrets")
"The path on the filesystem where the secrets will be decrypted.")
Expand All @@ -74,8 +61,6 @@ when decrypting a secret.")
(sops-service-configuration-config config))
(generate-key?
(sops-service-configuration-generate-key? config))
(age-key-file
(sops-service-configuration-age-key-file config))
(gnupg-home
(sops-service-configuration-gnupg-home config))
(secrets (sops-service-configuration-secrets config))
Expand All @@ -93,7 +78,6 @@ when decrypting a secret.")
(list
#$(program-file "sops-secrets-entrypoint"
(activate-secrets config-file
age-key-file
gnupg-home
secrets
sops
Expand Down Expand Up @@ -123,8 +107,7 @@ when decrypting a secret.")
(service-type (name 'sops-secrets)
(extensions (list (service-extension profile-service-type
(lambda (config)
(list (sops-service-configuration-age config)
(sops-service-configuration-gnupg config)
(list age gnupg
(sops-service-configuration-sops config))))
(service-extension file-system-service-type
%sops-secrets-file-system)
Expand All @@ -137,6 +120,7 @@ when decrypting a secret.")
(mkdir-p secrets-directory)))))
(service-extension shepherd-root-service-type
sops-secrets-shepherd-service)))
(default-value #f)
(compose concatenate)
(extend secrets->sops-service-configuration)
(description
Expand Down

0 comments on commit 8df7dcd

Please sign in to comment.