forked from
oppi.li/tbsp
this repo has no description
1{
2 inputs = {
3 nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
4
5 gitignore = {
6 url = "github:hercules-ci/gitignore.nix";
7 inputs.nixpkgs.follows = "nixpkgs";
8 };
9
10 rust-overlay = {
11 url = "github:oxalica/rust-overlay";
12 inputs.nixpkgs.follows = "nixpkgs";
13 };
14 };
15
16 outputs = {
17 self,
18 nixpkgs,
19 gitignore,
20 rust-overlay,
21 }: let
22 inherit (gitignore.lib) gitignoreSource;
23
24 supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
25 forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
26 nixpkgsFor = forAllSystems (system:
27 import nixpkgs {
28 inherit system;
29 overlays = [rust-overlay.overlays.default self.overlays.default];
30 });
31 in {
32 overlays.default = final: prev: {
33 tbsp = with final; let
34 pname = "tbsp";
35 packageMeta = (lib.importTOML ./Cargo.toml).package;
36 rustPlatform = makeRustPlatform {
37 inherit (final) cargo rustc;
38 };
39 in
40 rustPlatform.buildRustPackage {
41 inherit pname;
42 inherit (packageMeta) version;
43
44 src = self;
45 cargoLock.lockFile = ./Cargo.lock;
46
47 meta = with lib; {
48 description = "tree-based source processing language";
49 homepage = "https://git.peppe.rs/languages/tbsp/about";
50 license = licenses.mit;
51 };
52 };
53 };
54
55 defaultPackage = forAllSystems (system: nixpkgsFor."${system}".tbsp);
56 formatter = forAllSystems (system: nixpkgsFor."${system}".alejandra);
57
58 devShell = forAllSystems (system: let
59 pkgs = nixpkgsFor."${system}";
60 in
61 pkgs.mkShell {
62 nativeBuildInputs = [
63 pkgs.cargo-watch
64 pkgs.bacon
65 pkgs.rustfmt
66 pkgs.cargo
67
68 pkgs.rust-bin.nightly.latest.default
69 pkgs.rust-analyzer
70
71 pkgs.mermaid-cli
72 ];
73 RUST_LOG = "info";
74 RUST_BACKTRACE = 1;
75 });
76 };
77}