mirror of
https://github.com/mjallen18/snowfall-lib.git
synced 2026-04-18 09:05: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
|
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);
|
name = builtins.unsafeDiscardStringContext (snowfall-lib.path.get-parent-directory check);
|
||||||
drv = callPackageWith extra-inputs check { };
|
drv = callPackageWith extra-inputs check { };
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ in
|
|||||||
create-module-metadata = module: {
|
create-module-metadata = module: {
|
||||||
name =
|
name =
|
||||||
let
|
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" ] [ "" "" ] (
|
path-name = builtins.replaceStrings [ (builtins.toString src) "/default.nix" ] [ "" "" ] (
|
||||||
builtins.unsafeDiscardStringContext module
|
builtins.unsafeDiscardStringContext module
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -111,6 +111,8 @@ in
|
|||||||
create-overlay = (
|
create-overlay = (
|
||||||
overlays: file:
|
overlays: file:
|
||||||
let
|
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);
|
name = builtins.unsafeDiscardStringContext (snowfall-lib.path.get-parent-directory file);
|
||||||
overlay =
|
overlay =
|
||||||
final: prev:
|
final: prev:
|
||||||
@@ -159,6 +161,8 @@ in
|
|||||||
create-package-overlay =
|
create-package-overlay =
|
||||||
package-overlays: file:
|
package-overlays: file:
|
||||||
let
|
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);
|
name = builtins.unsafeDiscardStringContext (snowfall-lib.path.get-parent-directory file);
|
||||||
overlay =
|
overlay =
|
||||||
final: prev:
|
final: prev:
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ in
|
|||||||
};
|
};
|
||||||
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);
|
name = builtins.unsafeDiscardStringContext (snowfall-lib.path.get-parent-directory shell);
|
||||||
drv = callPackageWith extra-inputs shell { };
|
drv = callPackageWith extra-inputs shell { };
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user