Repository with preconfigured environments for different languages and test suits, to get you started fast for your kata.
Pick the kata from kata-log.rocks
Before exploring the project, there are several things that need to be prepared first as explained below.
Make sure that you have the following package installed in your machine:
nix
(follow this guide) with flakes enabledgit
This repository can be used using plain nix-build
or nix-shell
. This is possible with the help of flake-compat
as mentioned in default.nix. To build the package, just run:
$ nix-build -A defaultNix.legacyPackages.x86_64-linux.nix.typescript
and to enter into Nix shell, run:
$ nix-shell
If you want to use this repo with flakes
feature, please enable it using the following method:
Linux and Windows Subsystem Linux 2 (WSL2)
Install Nix as instructed above. Next, install nixUnstable
by running the following code:
nix-env -iA nixpkgs.nixFlakes
Lastly, open your ~/.config/nix/nix.conf
or /etc/nix/nix.conf
file and add:
experimental-features = nix-command flakes
NixOS
Add the following code into your configuration.nix
:
{ pkgs, ... }: {
nix = {
package = pkgs.nixFlakes;
extraOptions = ''
experimental-features = nix-command flakes
'';
};
}
Clone this repository, and enter into it:
$ git clone https://github.com/dejanr/friday-kata.git
$ cd friday-kata
run nix develop
and wait until the downloading/caching the dependencies are finished.
Once it is finished, you can refer to the documentation below:
Building package in Nix Flakes is simply by running the following code:
nix build .#friday-kata.nix.typescript
The above example will build friday-kata-typescript
package which is a node project built with yarn and typescript. Here is the breakdown of the command:
nix build
- is a nix v2 command to build package.#friday-kata.nix.typescript
.
- it means the directory containflake.nix
,#
- it is to separate between directory and package,friday-kata.nix.typescript
- is the package describe in the overlay that we want to build.
The result of the build will be available in the result
folder.
By running nix develop
in the project, some command as written in devshell.nix will be available in the PATH
.
There is also custom script that can be created to simplify the command as specified in the commands
attributes in devshell.nix.
Please refer to devshell.nix for further commands and packages.