mirror of
https://github.com/nix-community/nix-direnv.git
synced 2025-11-27 12:41:08 +01:00
Merge pull request #195 from nix-community/docs
Template refactoring + fix version
This commit is contained in:
commit
980ed5c62e
7 changed files with 16 additions and 12 deletions
|
|
@ -88,8 +88,8 @@ keep-outputs = true
|
||||||
Put the following lines in your `.envrc`:
|
Put the following lines in your `.envrc`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
if ! has nix_direnv_version || ! nix_direnv_version 2.1.0; then
|
if ! has nix_direnv_version || ! nix_direnv_version 2.1.1; then
|
||||||
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.1.0/direnvrc" "sha256-FAT2R9yYvVg516v3LiogjIc8YfsbWbMM/itqWsm5xTA="
|
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.1.1/direnvrc" "sha256-b6qJ4r34rbE23yWjMqbmu3ia2z4b2wIlZUksBke/ol0="
|
||||||
fi
|
fi
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
10
flake.nix
10
flake.nix
|
|
@ -12,7 +12,9 @@
|
||||||
test-runner = pkgs.callPackage ./run-tests.nix {};
|
test-runner = pkgs.callPackage ./run-tests.nix {};
|
||||||
};
|
};
|
||||||
defaultPackage = self.packages.${system}.default;
|
defaultPackage = self.packages.${system}.default;
|
||||||
devShell = pkgs.callPackage ./shell.nix { };
|
devShells.default = pkgs.callPackage ./shell.nix { };
|
||||||
|
# FIXME backward compat, drop soon
|
||||||
|
devShell = self.devShells.default;
|
||||||
apps.test-runner = {
|
apps.test-runner = {
|
||||||
type = "app";
|
type = "app";
|
||||||
program = "${self.packages.${system}.test-runner}";
|
program = "${self.packages.${system}.test-runner}";
|
||||||
|
|
@ -21,9 +23,11 @@
|
||||||
overlay = final: prev: {
|
overlay = final: prev: {
|
||||||
nix-direnv = final.callPackage ./default.nix { };
|
nix-direnv = final.callPackage ./default.nix { };
|
||||||
};
|
};
|
||||||
defaultTemplate = {
|
templates.default = {
|
||||||
path = ./template;
|
path = ./templates/flake;
|
||||||
description = "nix flake new -t github:Mic92/nix-direnv .";
|
description = "nix flake new -t github:Mic92/nix-direnv .";
|
||||||
};
|
};
|
||||||
|
# FIXME backward compat, drop soon
|
||||||
|
defaultTemplate = self.templates.default;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ fi
|
||||||
sed -i direnvrc \
|
sed -i direnvrc \
|
||||||
-e 's!\(declare major=\).*\( # UPDATE(nix-direnv version)\)!\1'"${ver[0]@Q} minor=${ver[1]@Q} patch=${ver[2]@Q}"'\2!'
|
-e 's!\(declare major=\).*\( # UPDATE(nix-direnv version)\)!\1'"${ver[0]@Q} minor=${ver[1]@Q} patch=${ver[2]@Q}"'\2!'
|
||||||
|
|
||||||
sed -i README.md template/.envrc \
|
sed -i README.md templates/flake/.envrc \
|
||||||
-e 's!\(nix-direnv/\).*\(/direnvrc\)!\1'"${version}"'\2!' \
|
-e 's!\(nix-direnv/\).*\(/direnvrc\)!\1'"${version}"'\2!' \
|
||||||
-e 's?\( ! nix_direnv_version \)[0-9.]\+\(; \)?\1'"${version}"'\2?'
|
-e 's?\( ! nix_direnv_version \)[0-9.]\+\(; \)?\1'"${version}"'\2?'
|
||||||
git add README.md direnvrc
|
git add README.md direnvrc
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ cd "$SCRIPT_DIR/.."
|
||||||
tag=$(curl --silent "https://api.github.com/repos/nix-community/nix-direnv/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
tag=$(curl --silent "https://api.github.com/repos/nix-community/nix-direnv/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
||||||
sha256=$(direnv fetchurl "https://raw.githubusercontent.com/nix-community/nix-direnv/${tag}/direnvrc" | grep -m1 -o 'sha256-.*')
|
sha256=$(direnv fetchurl "https://raw.githubusercontent.com/nix-community/nix-direnv/${tag}/direnvrc" | grep -m1 -o 'sha256-.*')
|
||||||
|
|
||||||
sed -i README.md template/.envrc -e "s!sha256-.*!${sha256}\"!"
|
sed -i README.md templates/flake/.envrc -e "s!sha256-.*!${sha256}\"!"
|
||||||
git add README.md template/.envrc
|
git add README.md templates/flake/.envrc
|
||||||
git commit -m "update fetchurl checksum"
|
git commit -m "update fetchurl checksum"
|
||||||
#git push
|
#git push
|
||||||
|
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
if ! has nix_direnv_version || ! nix_direnv_version 2.1.0; then
|
|
||||||
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.1.0/direnvrc" "sha256-FAT2R9yYvVg516v3LiogjIc8YfsbWbMM/itqWsm5xTA="
|
|
||||||
fi
|
|
||||||
use flake
|
|
||||||
4
templates/flake/.envrc
Normal file
4
templates/flake/.envrc
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
if ! has nix_direnv_version || ! nix_direnv_version 2.1.1; then
|
||||||
|
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.1.1/direnvrc" "sha256-b6qJ4r34rbE23yWjMqbmu3ia2z4b2wIlZUksBke/ol0="
|
||||||
|
fi
|
||||||
|
use flake
|
||||||
Loading…
Add table
Add a link
Reference in a new issue