mirror of
https://github.com/neon-mmd/websurfx.git
synced 2024-12-22 12:28:21 -05:00
📝 Developer environment setup on NixOS (#454)
* 🧑💻feat: update nix flake dev environment - This removes installing `docker`, `rust-analyzer`, `rustfmt` imperatively. `nodejs` is used to install dev dependencies `stylelint-config-standard` and `postcss-lit` - The `shellHook`s adds `rusty-hook` CLI to the PATH and the node dev dependencies to the NODE_PATH. * 📝 docs(developing): update NixOS dev environment setup * fix: remove nonvital guide and improve grammar --------- Co-authored-by: neon_arch <mustafadhuleb53@gmail.com>
This commit is contained in:
parent
12843414f8
commit
0943b8b8c4
@ -212,12 +212,6 @@ This section covers how to setup the project for development using the `NixOS de
|
||||
Before you start working on the project. You will need the following packages installed on your system:
|
||||
|
||||
- `Git` installed on your system. The installation instructions for this can be found [here](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).
|
||||
- Finally, The latest version of `Docker` is installed on your system which will be used to avoid introducing unexpected issues when working on the project. The installation instructions for this can be found [here](https://docs.docker.com/engine/install/).
|
||||
|
||||
> Optionally, On `NixOS` the above-mentioned required packages except for `stylelint` and `cargo-watch` could also be installed by following the link to the installation instructions provided below:
|
||||
>
|
||||
> - `Git`: https://search.nixos.org/packages?channel=23.05&show=git&from=0&size=50&sort=relevance&type=packages&query=git
|
||||
> - `Docker`: https://search.nixos.org/packages?channel=23.05&show=docker&from=0&size=50&sort=relevance&type=packages&query=docker
|
||||
|
||||
#### Setting up Pre-commit Checks
|
||||
|
||||
@ -234,7 +228,11 @@ Then run the following command to setup the `NixOS dev-shell`:
|
||||
nix develop
|
||||
```
|
||||
|
||||
Once you have finished running the above commands then run the following command to setup the `pre-commit` checks:
|
||||
> You can use `nix-direnv` to simplify entering into the `nix-shell`. Its setup is beyond the scope of this guide. Read more about it here: [nix-direnv](https://github.com/nix-community/nix-direnv)
|
||||
|
||||
This will add `docker`, `cargo-watch`, and other dev environment essentials to your `nix-shell` so you don't have to install everything imperatively.
|
||||
|
||||
After finishing the commands above, run the following command to setup the `pre-commit` checks:
|
||||
|
||||
```shell
|
||||
cargo test
|
||||
@ -244,14 +242,16 @@ By running the above-mentioned command, it will automatically set up all the pre
|
||||
|
||||
#### Post Setup Requirements
|
||||
|
||||
After you have done setting up pre-commit checks, then you may need to fulfill a few more requirements to finish setting up the development environment with `NixOS dev-shell`. These include:
|
||||
|
||||
- `Cargo-watch` installed on your system which will allow you to auto-build the project when any checks occur in the source code files in the codebase (`websurfx` directory). Before you install `cargo-watch` on your system, make sure you have `cargo` installed on your system. To install `cargo-watch` run the following command:
|
||||
The final step is to run
|
||||
|
||||
```shell
|
||||
cargo install cargo-watch
|
||||
npm i -D stylelint-config-standard postcss-lit`
|
||||
```
|
||||
|
||||
This will add `node_modules` in the current directory.
|
||||
|
||||
Run `git commit` and if every thing is setup correctly, it should say that your branch is up to date.
|
||||
|
||||
#### Running the Project
|
||||
|
||||
If you have followed the above section then you should now be inside a `dev-shell` environment. In the same environment run the following command to run the project:
|
||||
|
10
flake.nix
10
flake.nix
@ -32,24 +32,32 @@
|
||||
buildInputs = [
|
||||
actionlint
|
||||
cargo
|
||||
docker
|
||||
haskellPackages.hadolint
|
||||
nodejs
|
||||
nodePackages_latest.cspell
|
||||
nodePackages_latest.eslint
|
||||
nodePackages_latest.markdownlint-cli2
|
||||
nodePackages_latest.stylelint
|
||||
redis
|
||||
rustPackages.clippy
|
||||
rust-analyzer
|
||||
cargo-watch
|
||||
rustc
|
||||
rustfmt
|
||||
yamllint
|
||||
openssl
|
||||
pkg-config
|
||||
];
|
||||
RUST_SRC_PATH = rustPlatform.rustLibSrc;
|
||||
shellHook = ''
|
||||
export PATH="$PATH:$HOME/.cargo/bin"
|
||||
export NODE_PATH="$NODE_PATH:./node_modules"
|
||||
'';
|
||||
};
|
||||
|
||||
# Build via "nix build .#websurfx", which is basically just
|
||||
# calls the build function
|
||||
packages.websurfx = packages.default;
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user