diff --git a/.envrc b/.envrc index 5bce6abda..650d3bd6b 100644 --- a/.envrc +++ b/.envrc @@ -1,10 +1,9 @@ -if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then - source_url 'https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc' 'sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs=' +if ! has nix_direnv_version || ! nix_direnv_version 3.0.5; then + source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.5/direnvrc" "sha256-RuwIS+QKFj/T9M2TFXScjBsLR6V3A17YVoEW/Q6AZ1w=" fi -watch_file flake.nix -watch_file flake.lock - -if ! use flake . --impure; then +DEVENV_ROOT_FILE="$(mktemp)" +printf %s "${PWD}" > "${DEVENV_ROOT_FILE}" +if ! use flake . --override-input devenv-root "file+file://${DEVENV_ROOT_FILE}"; then printf '%s\n' "devenv could not be built. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2 fi diff --git a/flake.lock b/flake.lock index 76b655a0d..c26dd0ec0 100644 --- a/flake.lock +++ b/flake.lock @@ -39,11 +39,11 @@ "pre-commit-hooks": "pre-commit-hooks" }, "locked": { - "lastModified": 1724504184, - "narHash": "sha256-gP6000c2+zHKJHAxCD3BftvAjmb4CPAZamRAHNxN2MM=", + "lastModified": 1724763216, + "narHash": "sha256-oW2bwCrJpIzibCNK6zfIDaIQw765yMAuMSG2gyZfGv0=", "owner": "cachix", "repo": "devenv", - "rev": "51338b58fd666f448db7486ec145dbe52db9b829", + "rev": "1e4ef61205b9aa20fe04bf1c468b6a316281c4f1", "type": "github" }, "original": { @@ -52,6 +52,18 @@ "type": "github" } }, + "devenv-root": { + "flake": false, + "locked": { + "narHash": "sha256-d6xi4mKdjkX2JFicDIv5niSzpyI0m/Hnm8GGAIU04kY=", + "type": "file", + "url": "file:///dev/null" + }, + "original": { + "type": "file", + "url": "file:///dev/null" + } + }, "devenv_2": { "inputs": { "flake-compat": [ @@ -122,11 +134,11 @@ ] }, "locked": { - "lastModified": 1722555600, - "narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=", + "lastModified": 1725024810, + "narHash": "sha256-ODYRm8zHfLTH3soTFWE452ydPYz2iTvr9T8ftDMUQ3E=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "8471fe90ad337a8074e957b69ca4d0089218391d", + "rev": "af510d4a62d071ea13925ce41c95e3dec816c01d", "type": "github" }, "original": { @@ -269,11 +281,11 @@ ] }, "locked": { - "lastModified": 1720642556, - "narHash": "sha256-qsnqk13UmREKmRT7c8hEnz26X3GFFyIQrqx4EaRc1Is=", + "lastModified": 1724996935, + "narHash": "sha256-njRK9vvZ1JJsP8oV2OgkBrpJhgQezI03S7gzskCcHos=", "owner": "nlewo", "repo": "nix2container", - "rev": "3853e5caf9ad24103b13aa6e0e8bcebb47649fe4", + "rev": "fa6bb0a1159f55d071ba99331355955ae30b3401", "type": "github" }, "original": { @@ -407,11 +419,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1724224976, - "narHash": "sha256-Z/ELQhrSd7bMzTO8r7NZgi9g5emh+aRKoCdaAv5fiO0=", + "lastModified": 1724819573, + "narHash": "sha256-GnR7/ibgIH1vhoy8cYdmXE6iyZqKqFxQSVkFgosBh6w=", "owner": "nixos", "repo": "nixpkgs", - "rev": "c374d94f1536013ca8e92341b540eba4c22f9c62", + "rev": "71e91c409d1e654808b2621f28a327acfdad8dc2", "type": "github" }, "original": { @@ -477,6 +489,7 @@ "root": { "inputs": { "devenv": "devenv", + "devenv-root": "devenv-root", "flake-parts": "flake-parts", "nix2container": "nix2container", "nixpkgs": "nixpkgs_3", diff --git a/flake.nix b/flake.nix index ab653ea56..86529cc1b 100644 --- a/flake.nix +++ b/flake.nix @@ -4,6 +4,11 @@ inputs = { devenv.url = "github:cachix/devenv"; + devenv-root = { + url = "file+file:///dev/null"; + flake = false; + }; + flake-parts = { url = "github:hercules-ci/flake-parts"; inputs.nixpkgs-lib.follows = "nixpkgs"; @@ -53,9 +58,14 @@ # # Thank you! -Xarvex - name = "TagStudio"; + devenv.root = + let + devenvRoot = builtins.readFile inputs.devenv-root.outPath; + in + # If not overriden (/dev/null), --impure is necessary. + pkgs.lib.mkIf (devenvRoot != "") devenvRoot; - dotenv.disableHint = true; + name = "TagStudio"; # Derived from previous flake iteration. packages = (with pkgs; [