Skip to content

Commit bc38e56

Browse files
committed
feat(flake): remove impurity, update nix-direnv
Use path as an input that can be overriden automatically when direnv is in use. nix-direnv version present in .envrc has been updated, using watch_file on the flake is already handled.
1 parent 4b35df0 commit bc38e56

File tree

3 files changed

+42
-20
lines changed

3 files changed

+42
-20
lines changed

.envrc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
2-
source_url 'https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc' 'sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs='
1+
if ! has nix_direnv_version || ! nix_direnv_version 3.0.5; then
2+
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.5/direnvrc" "sha256-RuwIS+QKFj/T9M2TFXScjBsLR6V3A17YVoEW/Q6AZ1w="
33
fi
44

5-
watch_file flake.nix
6-
watch_file flake.lock
7-
8-
if ! use flake . --impure; then
5+
DEVENV_ROOT_FILE="$(mktemp)"
6+
printf %s "${PWD}" > "${DEVENV_ROOT_FILE}"
7+
if ! use flake . --override-input devenv-root "file+file://${DEVENV_ROOT_FILE}"; then
98
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
109
fi

flake.lock

Lines changed: 25 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
inputs = {
55
devenv.url = "github:cachix/devenv";
66

7+
devenv-root = {
8+
url = "file+file:///dev/null";
9+
flake = false;
10+
};
11+
712
flake-parts = {
813
url = "github:hercules-ci/flake-parts";
914
inputs.nixpkgs-lib.follows = "nixpkgs";
@@ -53,9 +58,14 @@
5358
#
5459
# Thank you! -Xarvex
5560

56-
name = "TagStudio";
61+
devenv.root =
62+
let
63+
devenvRoot = builtins.readFile inputs.devenv-root.outPath;
64+
in
65+
# If not overriden (/dev/null), --impure is necessary.
66+
pkgs.lib.mkIf (devenvRoot != "") devenvRoot;
5767

58-
dotenv.disableHint = true;
68+
name = "TagStudio";
5969

6070
# Derived from previous flake iteration.
6171
packages = (with pkgs; [

0 commit comments

Comments
 (0)