mirror of
https://github.com/nix-community/flakelight.git
synced 2025-06-21 10:07:51 +02:00
Clean up README
This commit is contained in:
parent
68a0941bbd
commit
ec68d50b4a
75
README.md
75
README.md
@ -37,7 +37,22 @@ The following modules are also available:
|
|||||||
|
|
||||||
The following is an example flake.nix for a devshell, using the passed in
|
The following is an example flake.nix for a devshell, using the passed in
|
||||||
nixpkgs. It outputs `devShell.${system}.default` attributes for each configured
|
nixpkgs. It outputs `devShell.${system}.default` attributes for each configured
|
||||||
system. Systems can be left unset to use the default.
|
system. `systems` can be set to change configured systems from the default.
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
inputs.flakelight.url = "github:accelbread/flakelight";
|
||||||
|
outputs = { flakelight, ... }
|
||||||
|
flakelight ./. {
|
||||||
|
devShell.packages = pkgs: [ pkgs.hello pkgs.coreutils ];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
With this flake, calling `nix develop` will make `hello` and `coreutils`
|
||||||
|
available.
|
||||||
|
|
||||||
|
To use a different nixpkgs, you can instead use:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{
|
{
|
||||||
@ -48,15 +63,11 @@ system. Systems can be left unset to use the default.
|
|||||||
outputs = { flakelight, ... }@inputs:
|
outputs = { flakelight, ... }@inputs:
|
||||||
flakelight ./. {
|
flakelight ./. {
|
||||||
inherit inputs;
|
inherit inputs;
|
||||||
systems = [ "x86_64-linux" "aarch64-linux" ];
|
|
||||||
devShell.packages = pkgs: [ pkgs.hello pkgs.coreutils ];
|
devShell.packages = pkgs: [ pkgs.hello pkgs.coreutils ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
With this flake, calling `nix develop` will make `hello` and `coreutils`
|
|
||||||
available.
|
|
||||||
|
|
||||||
### Rust package
|
### Rust package
|
||||||
|
|
||||||
The following is an example flake for a Rust project using `flakelight-rust`,
|
The following is an example flake for a Rust project using `flakelight-rust`,
|
||||||
@ -70,7 +81,19 @@ Package metadata is taken from the project's `Cargo.toml`.
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Alternatively, you can just use the `flakelight-rust` module as follows:
|
The above flake exports the following:
|
||||||
|
|
||||||
|
- Per-system attributes for default systems (`x86_64-linux` and `aarch64-linux`)
|
||||||
|
- `packages.${system}.default` attributes for each system
|
||||||
|
- `overlays.default` providing an overlay with the package (built with the
|
||||||
|
applied pkg set's dependencies)
|
||||||
|
- `devShells.${system}.default` that provides `rust-analyzer`, `cargo`, `clippy`,
|
||||||
|
`rustc`, and `rustfmt` as well as sets `RUST_SRC_PATH`
|
||||||
|
- `checks.${system}.${check}` attributes for build, test, clippy, and formatting
|
||||||
|
checks
|
||||||
|
- `formatter.${system}` with additional support for formatting Rust files
|
||||||
|
|
||||||
|
Equivalently, you can just import the `flakelight-rust` module as follows:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{
|
{
|
||||||
@ -84,20 +107,8 @@ Alternatively, you can just use the `flakelight-rust` module as follows:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The above flakes export the following:
|
See [flakelight-rust.nix][flakelight-rust] to see how you could configure it
|
||||||
|
without the module.
|
||||||
- Per-system attributes for default systems (`x86_64-linux` and `aarch64-linux`)
|
|
||||||
- `packages.${system}.default` attributes for each system
|
|
||||||
- `overlays.default` providing an overlay with the package (built with the
|
|
||||||
applied pkg set's dependencies)
|
|
||||||
- `devShells.${system}.default` that provides `rust-analyzer`, `cargo`, `clippy`,
|
|
||||||
`rustc`, and `rustfmt` as well as sets `RUST_SRC_PATH`
|
|
||||||
- `checks.${system}.${check}` attributes for build, test, clippy, and formatting
|
|
||||||
checks
|
|
||||||
- `formatter.${system}` with additional support for formatting Rust files.
|
|
||||||
|
|
||||||
See [flakelight-rust.nix][flakelight-rust] to see how to configure it without the
|
|
||||||
module.
|
|
||||||
|
|
||||||
[flakelight-rust]: https://github.com/accelbread/flakelight-rust/blob/master/flakelight-rust.nix
|
[flakelight-rust]: https://github.com/accelbread/flakelight-rust/blob/master/flakelight-rust.nix
|
||||||
|
|
||||||
@ -107,10 +118,10 @@ The following example flake is for a C project with a simple `make` setup.
|
|||||||
|
|
||||||
```nix
|
```nix
|
||||||
{
|
{
|
||||||
|
description = "My C application.";
|
||||||
inputs.flakelight.url = "github:accelbread/flakelight";
|
inputs.flakelight.url = "github:accelbread/flakelight";
|
||||||
outputs = { flakelight, ... }:
|
outputs = { flakelight, ... }:
|
||||||
flakelight ./. {
|
flakelight ./. {
|
||||||
description = "My C application.";
|
|
||||||
license = "AGPL-3.0-or-later";
|
license = "AGPL-3.0-or-later";
|
||||||
|
|
||||||
package = { stdenv, defaultMeta }:
|
package = { stdenv, defaultMeta }:
|
||||||
@ -127,7 +138,10 @@ The following example flake is for a C project with a simple `make` setup.
|
|||||||
|
|
||||||
devShell.packages = pkgs: with pkgs; [ clang-tools coreutils ];
|
devShell.packages = pkgs: with pkgs; [ clang-tools coreutils ];
|
||||||
|
|
||||||
formatters."*.c | *.h" = "clang-format -i";
|
formatters = {
|
||||||
|
"*.h" = "clang-format -i";
|
||||||
|
"*.c" = "clang-format -i";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -135,13 +149,14 @@ The following example flake is for a C project with a simple `make` setup.
|
|||||||
This flake exports the following:
|
This flake exports the following:
|
||||||
|
|
||||||
- Per-system attributes for default systems (`x86_64-linux` and `aarch64-linux`)
|
- Per-system attributes for default systems (`x86_64-linux` and `aarch64-linux`)
|
||||||
- `packages.${system}.default` attributes for each system
|
- `packages.${system}.default` attributes for each system, with license and
|
||||||
|
description set
|
||||||
- `overlays.default` providing an overlay with the package (built with the
|
- `overlays.default` providing an overlay with the package (built with the
|
||||||
applied pkg set's dependencies)
|
applied pkg set's dependencies)
|
||||||
- `devShells.${system}.default` that provides `clang-tools` and `coreutils`.
|
- `devShells.${system}.default` that provides `clang-tools` and `coreutils`
|
||||||
- `checks.${system}.${check}` attributes for build and formatting checks.
|
- `checks.${system}.${check}` attributes for build and formatting checks.
|
||||||
- `formatter.${system}` with additional support for formatting `c` and `h` files
|
- `formatter.${system}` with additional support for formatting `c` and `h` files
|
||||||
with `clang-format`.
|
with `clang-format`
|
||||||
|
|
||||||
### C application using autoloads
|
### C application using autoloads
|
||||||
|
|
||||||
@ -152,15 +167,18 @@ like the following. Most attributes can be autoloaded.
|
|||||||
|
|
||||||
```nix
|
```nix
|
||||||
{
|
{
|
||||||
|
description = "My C application.";
|
||||||
inputs.flakelight.url = "github:accelbread/flakelight";
|
inputs.flakelight.url = "github:accelbread/flakelight";
|
||||||
outputs = { flakelight, ... }@inputs:
|
outputs = { flakelight, ... }@inputs:
|
||||||
flakelight ./. {
|
flakelight ./. {
|
||||||
description = "My C application.";
|
|
||||||
license = "AGPL-3.0-or-later";
|
license = "AGPL-3.0-or-later";
|
||||||
|
|
||||||
devShell.packages = pkgs: with pkgs; [ clang-tools coreutils ];
|
devShell.packages = pkgs: with pkgs; [ clang-tools coreutils ];
|
||||||
|
|
||||||
formatters."*.c | *.h" = "clang-format -i";
|
formatters = {
|
||||||
|
"*.h" = "clang-format -i";
|
||||||
|
"*.c" = "clang-format -i";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -180,3 +198,6 @@ stdenv.mkDerivation {
|
|||||||
meta = defaultMeta;
|
meta = defaultMeta;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
A leading underscore in filename is stripped (default needs to be escaped to not
|
||||||
|
conflict with dir import).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user