fix: resolve evaluation purity, missing packages, and brittle paths
This commit is contained in:
@@ -9,12 +9,7 @@ let
|
||||
# Unified state reading function
|
||||
# Handles both JSON and plain text files with graceful fallbacks
|
||||
readState = { file, default }:
|
||||
let
|
||||
# In pure evaluation mode (like nix build .#vm), absolute paths as strings
|
||||
# will cause an error in pathExists/readFile.
|
||||
isFileSafe = ! (builtins.isString file && lib.hasPrefix "/" file);
|
||||
in
|
||||
if isFileSafe && builtins.pathExists file then
|
||||
if builtins.pathExists file then
|
||||
let
|
||||
content = builtins.readFile file;
|
||||
cleanContent = lib.removeSuffix "\n" content;
|
||||
|
||||
Reference in New Issue
Block a user