Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I4806c58aa0a17f504c9312723ad770166a6a6964
58 lines
1.4 KiB
Nix
58 lines
1.4 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
|
|
rust-overlay = {
|
|
url = "github:oxalica/rust-overlay";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
outputs = {
|
|
nixpkgs,
|
|
rust-overlay,
|
|
...
|
|
}: let
|
|
systems = ["x86_64-linux" "aarch64-linux"];
|
|
forEachSystem = nixpkgs.lib.genAttrs systems;
|
|
pkgsForEach = nixpkgs.legacyPackages;
|
|
in {
|
|
devShells = forEachSystem (system: let
|
|
pkgs = pkgsForEach.${system}.extend rust-overlay.overlays.default;
|
|
in {
|
|
default = pkgs.callPackage ./nix/shell.nix {};
|
|
});
|
|
|
|
formatter = forEachSystem (system: let
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
in
|
|
pkgs.writeShellApplication {
|
|
name = "nix3-fmt-wrapper";
|
|
|
|
runtimeInputs = [
|
|
pkgs.alejandra
|
|
pkgs.fd
|
|
pkgs.prettier
|
|
pkgs.deno
|
|
pkgs.taplo
|
|
pkgs.sql-formatter
|
|
];
|
|
|
|
text = ''
|
|
# Format Nix with Alejandra
|
|
fd "$@" -t f -e nix -x alejandra -q '{}'
|
|
|
|
# Format TOML with Taplo
|
|
fd "$@" -t f -e toml -x taplo fmt '{}'
|
|
|
|
# Format CSS with Prettier
|
|
fd "$@" -t f -e css -x prettier --write '{}'
|
|
|
|
# Format SQL with sql-format
|
|
fd "$@" -t f -e sql -x sql-formatter --fix '{}' -l postgresql
|
|
|
|
# Format Markdown with Deno
|
|
fd "$@" -t f -e md -x deno fmt -q '{}'
|
|
'';
|
|
});
|
|
};
|
|
}
|