Skip to content

Commit

Permalink
nixos/storage: Don't put whole config in devspec
Browse files Browse the repository at this point in the history
While it may be handy to put the whole configuration of the
corresponding device specification into the values of the options
referring to them, this unfortunately blows up the size of the JSON
output we pass to nixpart.

This is unnecessary because we're only interested in the UUID.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
  • Loading branch information
aszlig committed Jan 14, 2017
1 parent a8952b1 commit c97a18a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions nixos/modules/tasks/storage/default.nix
Expand Up @@ -281,7 +281,7 @@ in
# If no label is set, reference the device via the generated UUID in
# genericOptions.uuid.
(lib.mkIf (config.storage != null && config.label == null) {
device = "/dev/disk/by-uuid/${config.storage.config.uuid}";
device = "/dev/disk/by-uuid/${config.storage.uuid}";
})
];
}));
Expand All @@ -304,7 +304,7 @@ in
# If no label is set, reference the device via the generated UUID in
# genericOptions.uuid.
config = lib.mkIf (config.storage != null && !options.label.isDefined) {
device = "/dev/disk/by-uuid/${config.storage.config.uuid}";
device = "/dev/disk/by-uuid/${config.storage.uuid}";
};
}));
};
Expand Down
8 changes: 4 additions & 4 deletions nixos/modules/tasks/storage/lib.nix
Expand Up @@ -92,10 +92,10 @@ let
in if typeAndName == null then null else rec {
type = lib.head typeAndName;
name = lib.last typeAndName;
# The configuration entry for the storage spec. Note that we don't need to
# check whether ${type} and ${name} exist, because they're already checked
# in assertSpec.
config = cfg.${type}.${name};
# The generated UUID for the storage spec. Note that we don't need to check
# whether ${type} and ${name} exist, because they're already checked in
# assertSpec.
inherit (cfg.${type}.${name}) uuid;
};

/* Validate the device specification and return true if it's valid or false if
Expand Down

0 comments on commit c97a18a

Please sign in to comment.