Closed mandos closed 5 months ago
I'm definitely interested in a way to customise session names. I like the 3 options you have. I might also suggest we replace the $HOME
part of the path with ~/
to shorten the name
Definitely welcome tests.
As for nix, unsure about the benefit for this repo, but happy to hear an argument there if you think it gives any value beyond a local development environment.
I added a way to shortened HOME path with some specific symbols, I tried to use tilde, but it messed up session attachment.
About nix, easily replicable local development environment alone is a very strong argument to use it, as alternative you can use Docker or just put some tools (BATS) as submodules to lib folder. Currently, I have strong preference towards because of how easy is to set up development or CI/CD environment, but Docker can be fine too.
I think it's ready for review, I removed Nix for now.
Looks great. Happy to merge once the following are addressed:
get_tmux_option
is duplicated in helpers.sh
and session-wizard.tmux
. Can we use one?Tests:
If you prefer, feel free to put tests in another PR if you're keen to get this merged in sooner than later.
Other than that, looks great and I'll definitely be using this.
I would prefer to have tests in PR.
@27medkamal I think, it's ready.
@27medkamal any time estimation when you could look into it?
@mandos apologies for the delay. I'll put it on my list for next week.
While running docker build --tag tmux-session-wizard:dev --file ./Dockerfile .
, I'm getting this
=> [builder 4/5] COPY . . 0.0s
=> ERROR [builder 5/5] RUN --mount=type=cache,target=/nix,from=nixos/nix:latest,source=/nix --mount=type=cache,target=/root/.cache --mount=type=bind,target=/tmp/buil 0.2s
------
> [builder 5/5] RUN --mount=type=cache,target=/nix,from=nixos/nix:latest,source=/nix --mount=type=cache,target=/root/.cache --mount=type=bind,target=/tmp/build <<EOF (nix ...):
0.138 error: flake 'git+file:///tmp/build' does not provide attribute 'packages.aarch64-linux.dev', 'legacyPackages.aarch64-linux.dev' or 'dev'
0.154 error: getting status of '/tmp/output/result': No such file or directory
0.156 cp: missing destination file operand after '/tmp/nix-store-closure'
0.156 Try 'cp --help' for more information.
------
Dockerfile:8
--------------------
7 |
8 | >>> RUN \
9 | >>> --mount=type=cache,target=/nix,from=nixos/nix:latest,source=/nix \
10 | >>> --mount=type=cache,target=/root/.cache \
11 | >>> --mount=type=bind,target=/tmp/build \
12 | >>> <<EOF
13 | >>> nix \
14 | >>> --extra-experimental-features "nix-command flakes" \
15 | >>> --option filter-syscalls false \
16 | >>> --show-trace \
17 | >>> --log-format raw \
18 | >>> build .#dev --out-link /tmp/output/result
19 | >>> cp -R $(nix-store -qR /tmp/output/result) /tmp/nix-store-closure
20 | >>> EOF
21 |
--------------------
ERROR: failed to solve: process "/bin/sh -c nix \\\n --extra-experimental-features \"nix-command flakes\" \\\n --option filter-syscalls false \\\n --show-trace \\\n --log-format raw \\\n build .#dev --out-link /tmp/output/result\n cp -R $(nix-store -qR /tmp/output/result) /tmp/nix-store-closure\n" did not complete successfully: exit code: 1
Thoughts on why this is failing in my environment?
While running docker build --tag tmux-session-wizard:dev --file ./Dockerfile ., I'm getting this
I will check it.
While running
docker build --tag tmux-session-wizard:dev --file ./Dockerfile .
, I'm getting this0.138 error: flake 'git+file:///tmp/build' does not provide attribute 'packages.aarch64-linux.dev', 'legacyPackages.aarch64-linux.dev' or 'dev'
Thoughts on why this is failing in my environment?
It seems like you are running on the aarch64
architecture, which the Nix OS docker image doesn't seem to support. I am not sure how the Dockerfile works though, it might be something else.
I'm commenting since docker build --tag session-wizard-dev --file ./Dockerfile .
does not work for me either but with a different error, I get the following output:
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
[1/2] STEP 1/5: FROM nixos/nix:latest AS builder
[1/2] STEP 2/5: WORKDIR /tmp/build
--> Using cache 5cfb2b587726d2356a29e6e939df066e1948ef096c6f050c7f2fec978963ebc3
--> 5cfb2b587726
[1/2] STEP 3/5: RUN mkdir /tmp/nix-store-closure
--> Using cache 1014dfdee106798f870c14bda6d7844d8a910c772e9b61b75da021f9b20544ed
--> 1014dfdee106
[1/2] STEP 4/5: COPY . .
--> Using cache 855127aad0a04f1eac627e26a9dc28554a057603339ea7f0fe0bc024d2db2ad0
--> 855127aad0a0
[1/2] STEP 5/5: RUN --mount=type=cache,target=/nix,from=nixos/nix:latest,source=/nix --mount=type=cache,target=/root/.cache --mount=type=bind,target=/tmp/build <<EOF
Error: building at STEP "RUN --mount=type=cache,target=/nix,from=nixos/nix:latest,source=/nix --mount=type=cache,target=/root/.cache --mount=type=bind,target=/tmp/build <<EOF": resolving mountpoints for container "7eba972fc3f53834e5cf90d7f47997c2ef47cb490f9394240206051462cda280": no stage found with name nixos/nix:latest
I will check it on mac in this weekend.
@RensOliemans Do you use Docker with buildkit (https://docs.docker.com/build/buildkit)?
@RensOliemans Do you use Docker with buildkit (https://docs.docker.com/build/buildkit)?
My bad, I forgot that I used podman rather than Docker. With podman docker build
fails, but it works properly with Docker 👍.
@27medkamal I change flake to run on followed architectures: aarm64-linux, aarch64-darwin, x86_64-linux and x86_64-linux. Unfortunately I couldn't test it on Darwin but on x86_64-linux (my setup) still works, hope it starts working on yours. Can you test it now?
@27medkamal ping
@mandos I've made a few changes on top:
~
everywhere. I believe the issue you had had to do with how the script used it rather than tmux's interpretation of ~
. I've added quite a few things to handle it.latest
version.Please have a look at the changes and let me know if you think I've missed something.
@27medkamal I will check it in weekend, right now after quick scan looks good for me, but I would like to test it on my machine.
@27medkamal I verified that this version is working on my setup, so I don't mind changes. There are two small issues, for main home folder I didn't get "~", and also with "short-path" option I didn't get "~" too. But for now, I think we can ignore it. I would like to have it in main and resolve it later because I would like to start working on improving tests, maybe to have not only bat but also integration test with real "Tmux".
Best regards
@mandos Thanks for checking. Can you explain what the 2 issues are?
For "full-path" and "short-path" option
t /home/mandos
show me '/home/mandos session name and '/ho/mandos' respectively, for other folders inside home it shows '~' at the begining (so it's ok). I'm not sure if this is intended behavior main "home" folder.
Thanks for picking up on that. I've fixed that
@27medkamal, this is only draft and cannot be considered as finished work. Feature I try to add is to customize way session names are created, current solution doesn't work if name of last folder is same for few sessions (I have few playground or infrastructure projects).
Additionally, I added simple nix flake to manage the development environment and bats to test shell functions.
Let me know if you are interested to extend your project in this direction, or I should keep it in my fork only.