77 lines
2.2 KiB
Nix
77 lines
2.2 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
treefmt-nix.url = "github:numtide/treefmt-nix";
|
|
nci.url = "github:yusdacra/nix-cargo-integration";
|
|
devshell = {
|
|
url = "github:numtide/devshell";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
nixConfig = {
|
|
extra-trusted-public-keys =
|
|
[ "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=" ];
|
|
extra-substituters = [ "https://devenv.cachix.org" ];
|
|
};
|
|
|
|
outputs = { self, flake-parts, ... }@inputs:
|
|
flake-parts.lib.mkFlake { inherit inputs; } {
|
|
imports = [
|
|
inputs.devshell.flakeModule
|
|
inputs.treefmt-nix.flakeModule
|
|
inputs.nci.flakeModule
|
|
];
|
|
systems = inputs.nixpkgs.lib.systems.flakeExposed;
|
|
perSystem = { config, pkgs, ... }: rec {
|
|
treefmt = {
|
|
programs = {
|
|
nixfmt-rfc-style.enable = true;
|
|
rustfmt.enable = true;
|
|
};
|
|
projectRootFile = ./flake.nix;
|
|
};
|
|
|
|
nci.projects."nite".path = ./.;
|
|
nci.crates."nite" = { };
|
|
|
|
packages = config.nci.outputs."nite".packages.release;
|
|
|
|
devshells.default = let
|
|
zcommands = [ "ar" "cc" "c++" ];
|
|
zcc = pkgs.writeShellScriptBin "zcc" ''
|
|
zig cc $@
|
|
'';
|
|
|
|
libs = with pkgs; [ fontconfig freetype ];
|
|
in {
|
|
imports = [ (inputs.devshell + "/extra/language/c.nix") ];
|
|
env = [{
|
|
name = "AR";
|
|
value = pkgs.writeShellScript "zar" ''
|
|
zig ar $@
|
|
'';
|
|
}];
|
|
|
|
devshell.name = "nite";
|
|
language.c.compiler = zcc;
|
|
language.c.includes = libs;
|
|
|
|
commands = [
|
|
{
|
|
help = "format the entire tree";
|
|
name = "format";
|
|
command = "${config.treefmt.build.wrapper}/bin/treefmt .";
|
|
}
|
|
{
|
|
help = "launch the editor";
|
|
name = "nite";
|
|
command = "RUST_LOG=info,nite=trace cargo run";
|
|
}
|
|
];
|
|
};
|
|
};
|
|
};
|
|
}
|