source .env in devshell if one is pressent

This commit is contained in:
nelind
2025-12-28 13:09:01 +00:00
committed by Tangled
parent 2e3fd6b0c1
commit 613a65b393
2 changed files with 20 additions and 2 deletions
+2 -1
View File
@@ -1 +1,2 @@
use flake;
use flake path:.;
+18 -1
View File
@@ -1,4 +1,5 @@
{
lib,
mkShell,
callPackage,
rustPlatform,
@@ -25,7 +26,23 @@ in mkShell {
env = {
RUST_SRC_PATH = rustPlatform.rustLibSrc;
};
}
# isabel if this is like a horrible way to do this forgive me for my sins ig
# if you can make this better go do it and tell me how or something :3
// builtins.fromTOML (
(s: if s == "" then s else s + "\"") (lib.replaceStrings [ "\n" "=" "\"" ] [ "\"\n" "=\"" "\\\"" ]
(lib.concatStringsSep "\n"
(lib.filter (line: !lib.hasPrefix "#" line && line != "")
(lib.splitString "\n"
(if lib.pathIsRegularFile ./.env
then (lib.readFile ./.env)
else ""
)
)
)
)
)
);
packages = [
just