Merge pull request #184 from blaggacao/fix/module-identity-II

fix: format module identity
This commit is contained in:
Lassulus 2023-01-02 19:04:01 +01:00 committed by GitHub
commit 30516cb2b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 10 deletions

View File

@ -1,4 +1,11 @@
{ lib, ... }: {
{ lib, ... }: rec {
_file = ./format-module.nix;
# This deliberate key makes sure this module will be deduplicated
# regardless of the accessor path: either via flake's nixosModule
# or as part of the nixos-generate command. These two store paths
# of the module may differ and hence don't serve as a key
key = "github:nix-community/nixos-generators/format-module.nix";
options = {
filename = lib.mkOption {
type = lib.types.str;

View File

@ -8,14 +8,7 @@
, flakeAttr ? null
}:
let
module = rec {
# ensures that this module has the same key as
# the format-module that ships with 'nixos-generators.nixosModules.*'.
# Thereby, it will be deduplicated by the module system.
_file = ./format-module.nix;
key = _file;
imports = [ ./format-module.nix];
};
module = import ./format-module.nix;
# Will only get evaluated when used, so no worries
flake = builtins.getFlake flakeUri;
@ -29,7 +22,7 @@ in
import "${toString nixpkgs}/nixos/lib/eval-config.nix" {
inherit system;
modules = [
(import ./format-module.nix)
module
formatConfig
configuration
];