# Exported variable but import does not see it

**URL:** <https://forum.systemcrafters.net/t/exported-variable-but-import-does-not-see-it/1930>\
**Category:** Guix\
**Tags:** guile\
**Created:** [March 25, 2026, 8:46pm UTC](https://forum.systemcrafters.net/t/exported-variable-but-import-does-not-see-it/1930 "2026-03-25T20:46:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Danylo](https://avatars.discourse-cdn.com/v4/letter/d/5f9b8f/32.png) [@Danylo](https://forum.systemcrafters.net/u/Danylo)\
**Post date:** [March 25, 2026, 8:46pm UTC](https://forum.systemcrafters.net/t/exported-variable-but-import-does-not-see-it/1930/1 "2026-03-25T20:46:30Z")

</div>

I’ve added a new module for sops, but building the system configuration results in an error (I’m new to Guix)

```auto
ice-9/eval.scm:223:20: In procedure proc:
error: %sops-service: unbound variable

```

My GUILE\_LOAD\_PATH is correct because other modules work. I’m not sure what’s so special about this one. Tried renaming exported variable name, but the same error occurred.

Consider

`services/sops.scm`

```auto
(define-module (services sops)
	  #:use-module (sops secrets)
	  #:use-module (sops services sops))
	
	(define common.yaml
	  (local-file "../secrets/common.yaml"))
	
	(define secrets
	  (list (sops-secret (key '("github" "token"))
	                     (file common.yaml)
	                     (user "danylo")
	                     (permissions 256))))
	
	(define-public %sops-service
	  (service sops-secrets-service-type
	           (sops-service-configuration (generate-key? #t)
	                                       (secrets secrets))))

```

and

`systems/guixbox.scm`

```auto
(define-module (systems guixbox)
	  #:use-module (services sops) ; <------------------- import
	  #:use-module (gnu)
; ...
)

(define %my-services
	  (list (service plasma-desktop-service-type)
	        %sops-service ; <----------------------------- here I need to use it
	        ; ...
	        (set-xorg-configuration
	         (xorg-configuration (keyboard-layout %keyboard-layout)))))

```

See [https://codeberg.org/knightpp/guixos/commit/1aebaf7ddafba0676b8da9af4ef246d0bb3199a2](https://codeberg.org/knightpp/guixos/commit/1aebaf7ddafba0676b8da9af4ef246d0bb3199a2)

---

<div class="post-metadata">

**Author:** ![Danylo](https://avatars.discourse-cdn.com/v4/letter/d/5f9b8f/32.png) [@Danylo](https://forum.systemcrafters.net/u/Danylo)\
**Post date:** [March 26, 2026, 6:56am UTC](https://forum.systemcrafters.net/t/exported-variable-but-import-does-not-see-it/1930/2 "2026-03-26T06:56:52Z")

</div>

Fixed by importing

```auto
  #:use-module (guix gexp)
  #:use-module (gnu services)

```

But I think it is a bug, there were no warnings, guile just discarded whole module.

---

<div class="post-metadata">

**Author:** ![Danylo](https://avatars.discourse-cdn.com/v4/letter/d/5f9b8f/32.png) [@Danylo](https://forum.systemcrafters.net/u/Danylo)\
**Post date:** [March 26, 2026, 7:47am UTC](https://forum.systemcrafters.net/t/exported-variable-but-import-does-not-see-it/1930/3 "2026-03-26T07:47:34Z")

</div>

I created a repro see [https://codeberg.org/guix/guix/issues/1246#issuecomment-12118509](https://codeberg.org/guix/guix/issues/1246#issuecomment-12118509)

---

<div class="post-metadata">

**Author:** ![juipeltje](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.systemcrafters.net/juipeltje/32/1178_2.png) [@juipeltje](https://forum.systemcrafters.net/u/juipeltje)\
**Post date:** [March 27, 2026, 3:34pm UTC](https://forum.systemcrafters.net/t/exported-variable-but-import-does-not-see-it/1930/4 "2026-03-27T15:34:55Z")

</div>

From my relatively short experience this usually happens to me when the module that the variable is defined in has a mistake in it, and you can usually find it by running that specific module through the repl. I do think it’s kinda weird though how modules are handled sometimes. For example i recently had the issue where i was using the same variable in two separate home.scm modules for two different machines, and every time i ran home reconfigure on one of them, it would complain about the variable in the other home.scm module being undefined, and then continues as usual. I managed to get rid of the error by adding the different home.scm modules to each others module list, but i really feel like that shouldn’t be necessary.

---

<div class="post-metadata">

**Author:** ![Danylo](https://avatars.discourse-cdn.com/v4/letter/d/5f9b8f/32.png) [@Danylo](https://forum.systemcrafters.net/u/Danylo)\
**Post date:** [March 27, 2026, 6:27pm UTC](https://forum.systemcrafters.net/t/exported-variable-but-import-does-not-see-it/1930/5 "2026-03-27T18:27:15Z")

</div>

Yes. I figured out that there’s a way to open repl and it actually fails when creating repro. Probably Guix build handles modules/errors differently.

This can scare away newcomers, with little knowledge it’s impossible to see what’s wrong 🫠
