From c1cbfe75b0e2b26fa0918c5634d13c8364d04599 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]. [1]: https://github.com/NixOS/nix/issues/3843#issuecomment-661720562 --- flake.nix | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index ca00c66..bbf5101 100644 --- a/flake.nix +++ b/flake.nix @@ -4,10 +4,14 @@ inputs.flake-utils.url = "github:numtide/flake-utils"; outputs = { self, nixpkgs, flake-utils }: - flake-utils.lib.eachDefaultSystem (system: - { + let + exports = { nixosModules.age = import ./modules/age.nix; - packages = nixpkgs.legacyPackages.${system}.callPackage ./default.nix {}; + }; + outputs = flake-utils.lib.eachDefaultSystem (system: { + packages = nixpkgs.legacyPackages.${system}.callPackage ./default.nix { }; defaultPackage = self.packages.${system}.agenix; }); + in + exports // outputs; }