place scaffolding that enables cargo and nix builds
This commit is contained in:
7
Cargo.lock
generated
Normal file
7
Cargo.lock
generated
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "billbot"
|
||||||
|
version = "0.1.0"
|
8
Cargo.toml
Normal file
8
Cargo.toml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[package]
|
||||||
|
name = "billbot"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
34
README.md
34
README.md
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
_To :b:reserve and prötec_
|
_To :b:reserve and prötec_
|
||||||
|
|
||||||
This will be a [Matrix](https://matrix.org) bot used to track
|
This will be a [Matrix][matrix] bot used to track
|
||||||
informal debts between some (small) group of individuals.
|
informal debts between some (small) group of individuals.
|
||||||
|
|
||||||
its goals are (in order of importance):
|
its goals are (in order of importance):
|
||||||
@@ -42,3 +42,35 @@ below is an example of how this bot might work:
|
|||||||
> @user:host paid @other:host $NNN.MM
|
> @user:host paid @other:host $NNN.MM
|
||||||
- maybe state the remaining position?
|
- maybe state the remaining position?
|
||||||
> @user:host now owes $other:host $X.YY
|
> @user:host now owes $other:host $X.YY
|
||||||
|
|
||||||
|
|
||||||
|
## Development/Hacking
|
||||||
|
|
||||||
|
this project is built with [cargo][cargo], the [Rust][rust] package manager. simply run:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ cargo build
|
||||||
|
$ ./target/debug/billbot
|
||||||
|
```
|
||||||
|
|
||||||
|
it can also be built with [nix][nix]:
|
||||||
|
```sh
|
||||||
|
$ nix build
|
||||||
|
$ ./result/bin/billbot
|
||||||
|
```
|
||||||
|
|
||||||
|
a nix development environment (i.e. access to the correct toolchain) can be entered like so:
|
||||||
|
```sh
|
||||||
|
$ nix develop
|
||||||
|
```
|
||||||
|
|
||||||
|
after which ordinary cargo commands can be used:
|
||||||
|
```sh
|
||||||
|
nix-shell> cargo build
|
||||||
|
nix-shell> ./target/debug/billbot
|
||||||
|
```
|
||||||
|
|
||||||
|
[matrix]: https://matrix.org
|
||||||
|
[cargo]: https://doc.rust-lang.org/cargo
|
||||||
|
[rust]: https://rust-lang.org
|
||||||
|
[nix]: https://nixos.org
|
||||||
|
42
flake.lock
generated
Normal file
42
flake.lock
generated
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1678901627,
|
||||||
|
"narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1680122840,
|
||||||
|
"narHash": "sha256-zCQ/9iFHzCW5JMYkkHMwgK1/1/kTMgCMHq4THPINpAU=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "a575c243c23e2851b78c00e9fa245232926ec32f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"id": "nixpkgs",
|
||||||
|
"ref": "nixos-22.11",
|
||||||
|
"type": "indirect"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
37
flake.nix
Normal file
37
flake.nix
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
{
|
||||||
|
description = "Billbot matrix billshare bot";
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "nixpkgs/nixos-22.11";
|
||||||
|
flake-utils.url = github:numtide/flake-utils;
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, flake-utils }:
|
||||||
|
with flake-utils.lib; eachSystem allSystems (system:
|
||||||
|
let
|
||||||
|
pkgs = import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
};
|
||||||
|
in rec {
|
||||||
|
packages = {
|
||||||
|
# docs: <nixpkgs>/doc/languages-frameworks/rust.section.md
|
||||||
|
mx-billbot = pkgs.rustPlatform.buildRustPackage {
|
||||||
|
name = "mx-billbot";
|
||||||
|
src = self;
|
||||||
|
cargoLock.lockFile = ./Cargo.lock;
|
||||||
|
# enables debug builds, if we want: https://github.com/NixOS/nixpkgs/issues/60919.
|
||||||
|
hardeningDisable = [ "fortify" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
defaultPackage = packages.mx-billbot;
|
||||||
|
|
||||||
|
devShells.default = with pkgs; mkShell {
|
||||||
|
# enables debug builds, if we want: https://github.com/NixOS/nixpkgs/issues/60919.
|
||||||
|
hardeningDisable = [ "fortify" ];
|
||||||
|
|
||||||
|
# Allow cargo to download crates.
|
||||||
|
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
|
||||||
|
|
||||||
|
nativeBuildInputs = [ cargo ];
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
3
src/main.rs
Normal file
3
src/main.rs
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fn main() {
|
||||||
|
println!("Hello, world!");
|
||||||
|
}
|
Reference in New Issue
Block a user