Skip to content

Commit

Permalink
export module as system-independent flake output
Browse files Browse the repository at this point in the history
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]: NixOS/nix#3843 (comment)
  • Loading branch information
AluisioASG committed Dec 19, 2020
1 parent 8af9714 commit c1cbfe7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit c1cbfe7

Please sign in to comment.