mirror of
https://github.com/mjallen18/snowfall-lib.git
synced 2026-04-18 00:55:58 -05:00
docs: add comments explaining unsafeDiscardStringContext usage
Add clear documentation for all uses of unsafeDiscardStringContext, explaining that it's necessary when building flake outputs based on file paths, as Nix doesn't allow using paths as attribute names directly.
This commit is contained in:
@@ -48,6 +48,8 @@ in
|
||||
};
|
||||
in
|
||||
{
|
||||
# We are building flake outputs based on file paths. Nix doesn't allow this
|
||||
# so we have to explicitly discard the string's path context to use it as an attribute name.
|
||||
name = builtins.unsafeDiscardStringContext (snowfall-lib.path.get-parent-directory check);
|
||||
drv = callPackageWith extra-inputs check { };
|
||||
};
|
||||
|
||||
@@ -41,6 +41,8 @@ in
|
||||
create-module-metadata = module: {
|
||||
name =
|
||||
let
|
||||
# We are building flake outputs based on file paths. Nix doesn't allow this
|
||||
# so we have to explicitly discard the string's path context for string manipulation.
|
||||
path-name = builtins.replaceStrings [ (builtins.toString src) "/default.nix" ] [ "" "" ] (
|
||||
builtins.unsafeDiscardStringContext module
|
||||
);
|
||||
|
||||
@@ -111,6 +111,8 @@ in
|
||||
create-overlay = (
|
||||
overlays: file:
|
||||
let
|
||||
# We are building flake outputs based on file paths. Nix doesn't allow this
|
||||
# so we have to explicitly discard the string's path context to use it as an attribute name.
|
||||
name = builtins.unsafeDiscardStringContext (snowfall-lib.path.get-parent-directory file);
|
||||
overlay =
|
||||
final: prev:
|
||||
@@ -159,6 +161,8 @@ in
|
||||
create-package-overlay =
|
||||
package-overlays: file:
|
||||
let
|
||||
# We are building flake outputs based on file paths. Nix doesn't allow this
|
||||
# so we have to explicitly discard the string's path context to use it as an attribute name.
|
||||
name = builtins.unsafeDiscardStringContext (snowfall-lib.path.get-parent-directory file);
|
||||
overlay =
|
||||
final: prev:
|
||||
|
||||
@@ -48,6 +48,8 @@ in
|
||||
};
|
||||
in
|
||||
{
|
||||
# We are building flake outputs based on file paths. Nix doesn't allow this
|
||||
# so we have to explicitly discard the string's path context to use it as an attribute name.
|
||||
name = builtins.unsafeDiscardStringContext (snowfall-lib.path.get-parent-directory shell);
|
||||
drv = callPackageWith extra-inputs shell { };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user