Skip to content

Commit 18dd183

Browse files
authored
Merge branch 'main' into docs/add-skills-plugin-instructions
2 parents a00a0ee + 00815a7 commit 18dd183

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1434
-657
lines changed

.flox/env/manifest.lock

Lines changed: 448 additions & 401 deletions
Large diffs are not rendered by default.

.flox/env/manifest.toml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
version = 1
1+
schema-version = "1.11.0"
22

33
[install]
44
coreutils.pkg-path = "coreutils"
5+
coreutils.outputs = "all"
56
findutils.pkg-path = "findutils"
7+
findutils.outputs = "all"
68
gnutar.pkg-path = "gnutar"
9+
gnutar.outputs = "all"
710
pandoc.pkg-path = "pandoc"
811
poetry.pkg-path = "poetry"
12+
poetry.outputs = "all"
913
python.pkg-path = "python311"
1014
pngquant.pkg-path = "pngquant"
1115
gnused.pkg-path = "gnused"
16+
gnused.outputs = "all"
1217
d2.pkg-path = "d2"
1318

1419
lychee.pkg-path = "lychee"
@@ -17,6 +22,7 @@ lychee.version = ">=0.23"
1722
markdownlint-cli2.pkg-path = "markdownlint-cli2"
1823
markdownlint-cli2.pkg-group = "lint"
1924
curl.pkg-path = "curl"
25+
curl.outputs = "all"
2026

2127
[hook]
2228
on-activate = '''
@@ -35,9 +41,7 @@ echo "1. 👉 Python environment activated"
3541
#
3642
# Set the version of Flox to the latest stable version
3743
#
38-
if [ ! -f "FLOX_VERSION" ]; then
39-
curl -s --fail https://downloads.flox.dev/by-env/stable/LATEST_VERSION 2>/dev/null > FLOX_VERSION
40-
fi
44+
curl -s --fail https://downloads.flox.dev/by-env/stable/LATEST_VERSION 2>/dev/null > FLOX_VERSION
4145
export FLOX_VERSION=$(cat FLOX_VERSION | xargs)
4246
echo "2. 👉 FLOX_VERSION set to $FLOX_VERSION"
4347

.github/actions/common-setup/action.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ runs:
3030
using: "composite"
3131
steps:
3232
- name: "Setup Tailscale"
33-
uses: "tailscale/github-action@v4"
33+
uses: tailscale/github-action@306e68a486fd2350f2bfc3b19fcd143891a4a2d8 # v4
34+
3435
if: ${{ inputs.TAILSCALE_AUTH_KEY }}
3536
with:
3637
oauth-secret: "${{ inputs.TAILSCALE_AUTH_KEY }}"
@@ -39,10 +40,12 @@ runs:
3940
use-cache: true
4041

4142
- name: "Install newer Nix"
42-
uses: "cachix/install-nix-action@v24"
43+
uses: cachix/install-nix-action@96951a368ba55167b55f1c916f7d416bac6505fe # v31.10.3
44+
4345

4446
- name: "Configure Nix"
45-
uses: "flox/configure-nix-action@main"
47+
uses: flox/configure-nix-action@1ee58d63463cb1870ab73d9df0acfd9d8ba671f8 # main
48+
4649
with:
4750
github-access-token: "${{ inputs.GITHUB_ACCESS_TOKEN }}"
4851
substituter: "${{ inputs.SUBSTITUTER }}"

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,9 @@ updates:
2626
all:
2727
patterns:
2828
- "*"
29+
30+
31+
- package-ecosystem: "github-actions"
32+
directory: "/.github/actions/common-setup"
33+
schedule:
34+
interval: "weekly"

.github/workflows/auto-label.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ jobs:
1414
issues: write
1515
steps:
1616
- name: Add label automatically to new issues and PRs
17-
uses: actions-ecosystem/action-add-labels@v1
17+
uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf # v1
18+
1819
with:
1920
github_token: "${{ secrets.GITHUB_TOKEN }}"
2021
labels: "documentation"

.github/workflows/ci.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- "preview"
99
- "k8s-docs"
1010
pull_request:
11+
merge_group:
1112

1213
permissions:
1314
contents: "write"
@@ -31,15 +32,18 @@ jobs:
3132

3233
steps:
3334
- name: "Checkout"
34-
uses: "actions/checkout@v6"
35+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
36+
3537
with:
3638
fetch-depth: 0
3739

3840
- name: "Install Flox"
39-
uses: "flox/install-flox-action@main"
41+
uses: flox/install-flox-action@c94e7e1ab56ae14fe98bae4fd84384fd135f0c2a # main
42+
4043

4144
- name: "Build"
42-
uses: "flox/activate-action@main"
45+
uses: flox/activate-action@6ab4a3d38cfd06f31910d0a5fe7e57ffa76ad750 # main
46+
4347
with:
4448
command: |
4549
mkdocs build
@@ -49,19 +53,22 @@ jobs:
4953
cp netlify.toml ./public/
5054
5155
- name: "Check markdown lint"
52-
uses: "flox/activate-action@main"
56+
uses: flox/activate-action@6ab4a3d38cfd06f31910d0a5fe7e57ffa76ad750 # main
57+
5358
with:
5459
command: "markdownlint-cli2"
5560

5661
- name: "Check external links"
5762
if: ${{ github.event_name == 'pull_request' }}
58-
uses: "flox/activate-action@main"
63+
uses: flox/activate-action@6ab4a3d38cfd06f31910d0a5fe7e57ffa76ad750 # main
64+
5965
with:
6066
command: "./check_links.sh"
6167

6268
- name: "Publish to Netlify"
6369
if: ${{ github.repository_owner == 'flox' }}
64-
uses: "nwtgck/actions-netlify@v3.0"
70+
uses: nwtgck/actions-netlify@4cbaf4c08f1a7bfa537d6113472ef4424e4eb654 # v3.0
71+
6572
env:
6673
NETLIFY_AUTH_TOKEN: "${{ secrets.MANAGED_NETLIFY_TOKEN }}"
6774
NETLIFY_SITE_ID: "${{ vars.MANAGED_NETLIFY_FLOXDOCS_ID }}"

.github/workflows/update.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,19 @@ jobs:
1717

1818
steps:
1919
- name: "Checkout"
20-
uses: "actions/checkout@v6"
20+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
21+
2122

2223
- name: "Install flox"
23-
uses: "flox/install-flox-action@main"
24+
uses: flox/install-flox-action@c94e7e1ab56ae14fe98bae4fd84384fd135f0c2a # main
25+
2426

2527
- name: "Run upgrade"
2628
run: "flox -vvv upgrade"
2729

2830
- name: "Create Pull Request"
29-
uses: "peter-evans/create-pull-request@v8"
31+
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8
32+
3033
with:
3134
token: "${{ secrets.MANAGED_FLOXBOT_GITHUB_ACCESS_TOKEN_REPO_SCOPE }}"
3235
add-paths: ".flox"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ Live at: [flox.dev/docs](https://flox.dev/docs).
66

77
```
88
$ flox activate
9-
You are now using the environment 'floxdocs'.
9+
You are now using the environment 'floxdocs'.
1010
1111
λ (floxdocs) $ flox services start mkdocs
12-
Service 'mkdocs' started.
12+
Service 'mkdocs' started.
1313
1414
```
1515
Once mkdocs service started you can preview the documentation at

docs/concepts/activation.md

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ it stands to reason that _how you use them_ is also an important part of Flox.
1414

1515
There are four different ways to use an environment,
1616
and two different modes that an environment can be activated in.
17-
At the end of the day, though, it all boils down to properly configuring a
18-
shell.
17+
Regardless of the method, activation works by configuring a shell.
1918
The `hook` and `profile` scripts specified in your manifest are run as part of
2019
configuring that shell.
2120
Understanding when and why they're run will help you take full advantage
@@ -30,9 +29,15 @@ Flox configures a shell,
3029
making all of the packages and environment variables specified in your
3130
manifest available, as mentioned above.
3231

33-
The most basic way to activate an environment is simply by calling
32+
Activation doesn't always mean creating a new shell.
33+
Depending on how you invoke `flox activate`,
34+
Flox may start a subshell, configure your current shell in-place,
35+
or directly exec a command without an intermediate shell at all.
36+
The [four methods](#four-different-ways-to-activate) are described below.
37+
38+
The most common way to activate an environment is simply by calling
3439
`flox activate`,
35-
which puts you into a subshell with everything configured:
40+
which starts a new subshell with everything configured:
3641

3742
```{ .console .no-copy }
3843
$ flox activate
@@ -54,6 +59,15 @@ environment rather than from elsewhere on your system.
5459
## Four different ways to activate
5560

5661
We mentioned above that there are four different ways to use an environment.
62+
Each method differs in whether `hook.on-activate` and `profile` scripts are
63+
run:
64+
65+
| Mode | Command | `hook.on-activate` | `profile.*` |
66+
| --- | --- | :---: | :---: |
67+
| Subshell | `flox activate` | :white_check_mark: | :white_check_mark: |
68+
| In-place | `eval "$(flox activate)"` | :white_check_mark: | :white_check_mark: |
69+
| Shell command | `flox activate -c` | :white_check_mark: | :white_check_mark: |
70+
| Exec | `flox activate --` | :white_check_mark: | :x: |
5771

5872
### Subshell
5973

@@ -97,6 +111,14 @@ eval "$(flox activate)"
97111
In both cases Flox emits a script that configures the shell,
98112
and the shell executes that code to configure itself.
99113

114+
!!! tip "direnv integration"
115+
116+
If you use [direnv](https://direnv.net/) with `use flox` in your
117+
`.envrc`, the activation is in-place and both `hook.on-activate` and
118+
`[profile]` scripts are run.
119+
Note that `profile.common` must use shell-agnostic syntax — see
120+
the [guidance below](#hook-vs-profile-in-a-nutshell).
121+
100122
```d2 scale="1.0"
101123
shape: sequence_diagram
102124
user_shell: User shell
@@ -283,7 +305,10 @@ here is some simple guidance:
283305

284306
**profile**:
285307

286-
- Syntax depends on the shell.
308+
- Syntax depends on the shell. `profile.common` is sourced by _all_ shells
309+
(Bash, Zsh, Fish, and tcsh), so avoid constructs like `export VAR=value`
310+
that are not portable. Use the shell-specific `profile.bash`, `profile.zsh`,
311+
etc. sections for non-portable syntax.
287312
- Can define functions and aliases.
288313
- Can source scripts needed for other programs to work properly e.g. the `activate` script for a Python virtual environment.
289314
- _Can_ define environment variables that need to be computed.

docs/concepts/composition.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ This can be surprising, so check the manifests of the included environments and
130130
It's reasonable to assume that the manifests of the included environments will change over time and at some point you will want to bring in the latest versions of those manifests.
131131
This is accomplished with the `flox include upgrade` command.
132132

133-
Running this command will check each of the included environments and determine if there were changes to their manifests.
134-
If the changes to the manifest have been built by the included environment, then the new manifest will be included.
133+
Running this command will check each of the included environments and check if the environments have changed.
134+
In order for changes to be pulled in, the included environment must have a lockfile corresponding to the latest changes to the manifest.
135+
For example, suppose an environment `my-go-project` includes a `go-tools` environment.
136+
If the `manifest.toml` for `go-tools` is modified without using `flox edit`, then `flox include upgrade` for `my-go-project` won't be able use the changes to the `go-tools` manifest.
137+
Using `flox edit` for `go-tools` would re-lock the environment using the latest manifest, and then `flox include upgrade` for `my-go-project` could pull in the changes.
135138
At this point the merge process runs again, a new merged manifest is produced, and the composed environment is rebuilt from the new merged manifest.

0 commit comments

Comments
 (0)