From bd3d8e8fd87e2665b39556e485f4e1ddd9408f95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alu=C3=ADsio=20Augusto=20Silva=20Gon=C3=A7alves?= Date: Sat, 19 Dec 2020 00:39:25 -0300 Subject: [PATCH] export module as system-independent flake output Flake outputs are a mixture of system-dependent and system-independent sets, and flake-utils doesn't do much to distinguish one from the other. Because of that, the `age` NixOS module currently has to be acessed as `agenix.nixosModules.${system}.age`, rather than the documented `agenix.nixosModules.age`. To remedy that, (conceptually) split `outputs` in two, let flake-utils handle the system-dependent half, and merge them to form the actual outputs. The names for the two halves were taken from [1]. Since someone may already be using the current paths, use the singular `nixosModule` output, so it can be accessed as `agenix.nixosModule`. [1]: https://github.com/NixOS/nix/issues/3843#issuecomment-661720562 --- flake.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index ca00c66..35ec2dd 100644 --- a/flake.nix +++ b/flake.nix @@ -4,10 +4,15 @@ inputs.flake-utils.url = "github:numtide/flake-utils"; outputs = { self, nixpkgs, flake-utils }: - flake-utils.lib.eachDefaultSystem (system: - { + let + exports = { + nixosModule = import ./modules/age.nix; + }; + outputs = flake-utils.lib.eachDefaultSystem (system: { nixosModules.age = import ./modules/age.nix; - packages = nixpkgs.legacyPackages.${system}.callPackage ./default.nix {}; + packages = nixpkgs.legacyPackages.${system}.callPackage ./default.nix { }; defaultPackage = self.packages.${system}.agenix; }); + in + exports // outputs; }