From 40012e5ed4affbb5af7ea59770eb8d8fd1a5991b Mon Sep 17 00:00:00 2001 From: Farid Zakaria Date: Mon, 29 Jul 2024 08:09:40 -0700 Subject: [PATCH] Remove import for NixOS/HM modules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using `files` on a NixOS option in the `nix repl` it fails to follow the attribute of agenix module. Discussing with @roberth has explained that this is a "common bug" on account of mis-using the `import` for modules. From what I understand, the `import` statement brings it into the current context so you lose the attribute of where it's defined. Here is what I currently see: ``` nix-repl> options.age.ageBin.files [ "/nix/store/8kpmdb63f5i9mwdyirqki7hvvglgy1va-source/machines/nyx/configuration.nix" ] ``` After this change, the value in agenix is reported instead. ``` ❯ nix repl --extra-experimental-features 'flakes repl-flake' \ --override-input agenix /home/fmzakari/code/github.com/ryantm/agenix . nix-repl> options.age.ageBin.files [ "/nix/store/99gc8rhgw43k201k34pshcsygdvbhmpy-source/modules/age.nix" ] ``` --- flake.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 587138e..3a68940 100644 --- a/flake.nix +++ b/flake.nix @@ -23,13 +23,13 @@ }: let eachSystem = nixpkgs.lib.genAttrs (import systems); in { - nixosModules.age = import ./modules/age.nix; + nixosModules.age = ./modules/age.nix; nixosModules.default = self.nixosModules.age; - darwinModules.age = import ./modules/age.nix; + darwinModules.age = ./modules/age.nix; darwinModules.default = self.darwinModules.age; - homeManagerModules.age = import ./modules/age-home.nix; + homeManagerModules.age = ./modules/age-home.nix; homeManagerModules.default = self.homeManagerModules.age; overlays.default = import ./overlay.nix;