Merge pull request '[PR]: Repair the dev env by: Updating .envrc to new nix-direnv version, Updating flake.lock to fix pnpm version, downgrading to node version 18 and documenting the process' (#10235) from kartonrad/calckey:fix-dev-enviroment into develop
Reviewed-on: https://codeberg.org/calckey/calckey/pulls/10235
This commit is contained in:
commit
41ba921780
4
.envrc
4
.envrc
|
@ -1,4 +1,4 @@
|
||||||
if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
|
if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then
|
||||||
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
|
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8="
|
||||||
fi
|
fi
|
||||||
use flake . --impure
|
use flake . --impure
|
||||||
|
|
|
@ -7,8 +7,8 @@ Please note, however, that this environment will not work on Windows outside of
|
||||||
|
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
|
|
||||||
- Installed the [Nix Package Manager](https://nixos.org/download.html)
|
- Installed the [Nix Package Manager](https://nixos.org/download.html) (use the comman on their website)
|
||||||
- Installed [direnv](https://direnv.net/docs/installation.html) and added its hook to your shell.
|
- Installed [direnv](https://direnv.net/docs/installation.html) and added its hook to your shell. (package manager)
|
||||||
|
|
||||||
Once the repo is cloned to your computer, follow these next few steps inside the Calckey folder:
|
Once the repo is cloned to your computer, follow these next few steps inside the Calckey folder:
|
||||||
|
|
||||||
|
@ -20,3 +20,89 @@ Once the repo is cloned to your computer, follow these next few steps inside the
|
||||||
- You should now see the admin user creation screen!
|
- You should now see the admin user creation screen!
|
||||||
|
|
||||||
Note: When you want to restart a dev server, all you need to do is run `devenv up`, no other steps are necessary.
|
Note: When you want to restart a dev server, all you need to do is run `devenv up`, no other steps are necessary.
|
||||||
|
|
||||||
|
# Possible Troubles with the dev enviroment
|
||||||
|
(this doesn't have to be done under normal conditions, this is for future reference)
|
||||||
|
|
||||||
|
### direnv
|
||||||
|
If you have any trouble with `direnv allow`
|
||||||
|
Check that the contents of `.envrc` have the same version of nix-direnv that is specified here:
|
||||||
|
> nix-direnv under -> installation -> using direnv source url
|
||||||
|
> https://github.com/nix-community/nix-direnv#direnv-source_url
|
||||||
|
|
||||||
|
there should be no errors during `direnv allow`
|
||||||
|
|
||||||
|
### outdated nix packages
|
||||||
|
if `install-deps` or any subsequent command doesn't run due to versioning problems
|
||||||
|
`flake.nix` and `flake.lock` may be outdated
|
||||||
|
|
||||||
|
delete `flake.lock`, or better, run `nix flake update --extra-experimental-features flakes --extra-experimental-features nix-command`
|
||||||
|
after that, run `direnv rebuild`
|
||||||
|
|
||||||
|
if there are any errors, you might have to change `flake.nix`
|
||||||
|
(because the available options can change between versions - consider getting support in [the matrix channel](https://matrix.to/#/#calckey:matrix.fedibird.com))
|
||||||
|
|
||||||
|
### after changing a node version
|
||||||
|
in my case, i had to change the node version from 19, to 18
|
||||||
|
|
||||||
|
! before proceeding, make sure to delete all build artifacts!
|
||||||
|
remove `node_modules` and `built` folders, and maybe `.devenv` and `.direnv` as well
|
||||||
|
manually, or run `npm cache clean --force` and `pnpm cleanall`
|
||||||
|
|
||||||
|
### Windows Subsystem for Linux
|
||||||
|
if `devenv up` terminates because of wrong folder permissions,
|
||||||
|
|
||||||
|
create the file `/etc/wsl.conf` in your distro and add
|
||||||
|
```shell
|
||||||
|
[automount]
|
||||||
|
options = "metadata"
|
||||||
|
```
|
||||||
|
|
||||||
|
this allows `chmod` calls to actually have an effect.
|
||||||
|
the build scripts DO actually set the permissions, it just needs to work in wsl.
|
||||||
|
|
||||||
|
### devenv up
|
||||||
|
devenv up may take a looong time. (some say this is fake news, maybe it was bad luck in my case)
|
||||||
|
|
||||||
|
do not get spooked by this error:
|
||||||
|
```
|
||||||
|
> calckey@14.0.0-dev32 start /mnt/.../calckey
|
||||||
|
> pnpm --filter backend run start
|
||||||
|
|
||||||
|
|
||||||
|
> backend@ start /mnt/.../calckey/packages/backend
|
||||||
|
> pnpm node ./built/index.js
|
||||||
|
|
||||||
|
node:internal/modules/cjs/loader:1078
|
||||||
|
throw err;
|
||||||
|
^
|
||||||
|
|
||||||
|
Error: Cannot find module '/mnt/.../calckey/packages/backend/built/index.js'
|
||||||
|
at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
|
||||||
|
at Module._load (node:internal/modules/cjs/loader:920:27)
|
||||||
|
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
|
||||||
|
at node:internal/main/run_main_module:23:47 {
|
||||||
|
code: 'MODULE_NOT_FOUND',
|
||||||
|
requireStack: []
|
||||||
|
}
|
||||||
|
|
||||||
|
Node.js v18.16.0
|
||||||
|
undefined
|
||||||
|
/mnt/.../calckey/packages/backend:
|
||||||
|
ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL backend@ start: `pnpm node ./built/index.js`
|
||||||
|
Exit status 1
|
||||||
|
ELIFECYCLE Command failed with exit code 1.
|
||||||
|
```
|
||||||
|
|
||||||
|
the script is designed to constantly try to start the server, while the build is still running.
|
||||||
|
this just means that the build isn't finished yet.
|
||||||
|
|
||||||
|
at some point you should see a banner that says "Calckey" in big letters -
|
||||||
|
then you're good to go and can run `migrate` (in another terminal)!
|
||||||
|
|
||||||
|
if you don't see the banner,
|
||||||
|
and it's for some reason stuck on `Finished 'build' after 917 ms` for a view minutes,
|
||||||
|
|
||||||
|
just leave devenv running and open another terminal in the folder
|
||||||
|
run `migrate` and then `pnpm --filter backend run start` by yourself
|
||||||
|
the server should start
|
||||||
|
|
54
flake.lock
54
flake.lock
|
@ -8,11 +8,11 @@
|
||||||
"pre-commit-hooks": "pre-commit-hooks"
|
"pre-commit-hooks": "pre-commit-hooks"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1682953188,
|
"lastModified": 1685521914,
|
||||||
"narHash": "sha256-MFH6yK7QnEV6+T96Pt++lH8ozDn4YqzaOXAS6u5h3mM=",
|
"narHash": "sha256-0fdFP5IASLwJ0PSXrErW8PZon9TVYmi8VRF8OtjGkV4=",
|
||||||
"owner": "cachix",
|
"owner": "cachix",
|
||||||
"repo": "devenv",
|
"repo": "devenv",
|
||||||
"rev": "c388b8c57116a71174d26b09c0c38b4b6b5bac3a",
|
"rev": "e206d8f2e3e8d6aa943656052f15bdfea8146b8d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -29,11 +29,11 @@
|
||||||
"rust-analyzer-src": "rust-analyzer-src"
|
"rust-analyzer-src": "rust-analyzer-src"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1682922129,
|
"lastModified": 1685514167,
|
||||||
"narHash": "sha256-qnhkfksuuSLbN5UJM+KSCMSRC13bXosr6Ed3NwerRno=",
|
"narHash": "sha256-urRxF0ZGSNeZjM4kALNg3wTh7fBscbqQmS6S/HU7Wms=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "fenix",
|
"repo": "fenix",
|
||||||
"rev": "c1f90f80ba4d60bea60685dd4515fb22d53279cc",
|
"rev": "3abfea51663583186f687c49a157eab1639349ca",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -63,11 +63,11 @@
|
||||||
"nixpkgs-lib": "nixpkgs-lib"
|
"nixpkgs-lib": "nixpkgs-lib"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1680392223,
|
"lastModified": 1685457039,
|
||||||
"narHash": "sha256-n3g7QFr85lDODKt250rkZj2IFS3i4/8HBU2yKHO3tqw=",
|
"narHash": "sha256-bEFtQm+YyLxQjKQAaBHJyPN1z2wbhBnr2g1NJWSYjwM=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-parts",
|
||||||
"rev": "dcc36e45d054d7bb554c9cdab69093debd91a0b5",
|
"rev": "80717d11615b6f42d1ad2e18ead51193fc15de69",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -155,11 +155,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1677534593,
|
"lastModified": 1678875422,
|
||||||
"narHash": "sha256-PuZSAHeq4/9pP/uYH1FcagQ3nLm/DrDrvKi/xC9glvw=",
|
"narHash": "sha256-T3o6NcQPwXjxJMn2shz86Chch4ljXgZn746c2caGxd8=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "3ad64d9e2d5bf80c877286102355b1625891ae9a",
|
"rev": "126f49a01de5b7e35a43fd43f891ecf6d3a51459",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -172,11 +172,11 @@
|
||||||
"nixpkgs-lib": {
|
"nixpkgs-lib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "lib",
|
"dir": "lib",
|
||||||
"lastModified": 1680213900,
|
"lastModified": 1682879489,
|
||||||
"narHash": "sha256-cIDr5WZIj3EkKyCgj/6j3HBH4Jj1W296z7HTcWj1aMA=",
|
"narHash": "sha256-sASwo8gBt7JDnOOstnps90K1wxmVfyhsTPPNTGBPjjg=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "e3652e0735fbec227f342712f180f4f21f0594f2",
|
"rev": "da45bf6ec7bbcc5d1e14d3795c025199f28e0de0",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -205,11 +205,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs-stable": {
|
"nixpkgs-stable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1673800717,
|
"lastModified": 1678872516,
|
||||||
"narHash": "sha256-SFHraUqLSu5cC6IxTprex/nTsI81ZQAtDvlBvGDWfnA=",
|
"narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "2f9fd351ec37f5d479556cd48be4ca340da59b8f",
|
"rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -221,11 +221,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1682929865,
|
"lastModified": 1685399834,
|
||||||
"narHash": "sha256-jxVrgnf5QNjO+XoxDxUWtN2G5xyJSGZ5SWDQFxMuHxc=",
|
"narHash": "sha256-Lt7//5snriXSdJo5hlVcDkpERL1piiih0UXIz1RUcC4=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "f2e9a130461950270f87630b11132323706b4d91",
|
"rev": "58c85835512b0db938600b6fe13cc3e3dc4b364e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -250,11 +250,11 @@
|
||||||
"nixpkgs-stable": "nixpkgs-stable"
|
"nixpkgs-stable": "nixpkgs-stable"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1677160285,
|
"lastModified": 1682596858,
|
||||||
"narHash": "sha256-tBzpCjMP+P3Y3nKLYvdBkXBg3KvTMo3gvi8tLQaqXVY=",
|
"narHash": "sha256-Hf9XVpqaGqe/4oDGr30W8HlsWvJXtMsEPHDqHZA6dDg=",
|
||||||
"owner": "cachix",
|
"owner": "cachix",
|
||||||
"repo": "pre-commit-hooks.nix",
|
"repo": "pre-commit-hooks.nix",
|
||||||
"rev": "2bd861ab81469428d9c823ef72c4bb08372dd2c4",
|
"rev": "fb58866e20af98779017134319b5663b8215d912",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -274,11 +274,11 @@
|
||||||
"rust-analyzer-src": {
|
"rust-analyzer-src": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1682886915,
|
"lastModified": 1685465261,
|
||||||
"narHash": "sha256-FPQKPvlHIU2DsDF6GMoRtrZhil0vHi6MFd8vpKEx/n8=",
|
"narHash": "sha256-aJ2nUinUrNcFi+pb47bS5IIAeSiUEEPLJY8W4Q8Pcjk=",
|
||||||
"owner": "rust-lang",
|
"owner": "rust-lang",
|
||||||
"repo": "rust-analyzer",
|
"repo": "rust-analyzer",
|
||||||
"rev": "3a27518fee5a723005299cf49e2d58a842a261ca",
|
"rev": "d2b3caa5b5694125fad04a9699e919444439f6a2",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
languages.typescript.enable = true;
|
languages.typescript.enable = true;
|
||||||
# Enable javascript for NPM and PNPM
|
# Enable javascript for NPM and PNPM
|
||||||
languages.javascript.enable = true;
|
languages.javascript.enable = true;
|
||||||
languages.javascript.package = pkgs.nodejs_19;
|
languages.javascript.package = pkgs.nodejs_18;
|
||||||
# Enable stable Rust for the backend
|
# Enable stable Rust for the backend
|
||||||
languages.rust.enable = true;
|
languages.rust.enable = true;
|
||||||
languages.rust.version = "stable";
|
languages.rust.version = "stable";
|
||||||
|
|
Loading…
Reference in New Issue