This commit is contained in:
PaddiM8 2021-09-24 14:33:36 +02:00
commit 0e05c212a3
6 changed files with 90 additions and 4 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ kalk/Cargo.lock
cli/Cargo.lock cli/Cargo.lock
cli/test cli/test
.vscode/ .vscode/
result*

5
Cargo.lock generated
View File

@ -152,9 +152,8 @@ dependencies = [
[[package]] [[package]]
name = "gmp-mpfr-sys" name = "gmp-mpfr-sys"
version = "1.4.2" version = "1.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://gitlab.com/tspiteri/gmp-mpfr-sys.git#21966f4bfb56c87d407eb14c72e92ef4e55856aa"
checksum = "a57fdb339d49833021b1fded600ed240ae907e33909d5511a61dff884df7f16e"
dependencies = [ dependencies = [
"libc", "libc",
"winapi", "winapi",

View File

@ -1,3 +1,6 @@
[patch.crates-io]
gmp-mpfr-sys = { git = "https://gitlab.com/tspiteri/gmp-mpfr-sys.git" }
[workspace] [workspace]
members = ["kalk", "cli"] members = ["kalk", "cli"]

View File

@ -12,7 +12,7 @@ Kalker (or "kalk") is a calculator program/website that supports user-defined va
* Operators: `+`, `-`, `*`, `/`, `!` * Operators: `+`, `-`, `*`, `/`, `!`
* Groups: `()`, `⌈ceil⌉`, `⌊floor⌋`, `[iverson]` * Groups: `()`, `⌈ceil⌉`, `⌊floor⌋`, `[iverson]`
* [Pre-defined functions and constants](https://github.com/PaddiM8/kalker/blob/master/kalk/src/prelude.rs) * [Pre-defined functions and constants](https://github.com/PaddiM8/kalker/blob/master/kalk/src/prelude/mod.rs)
* User-defined functions and variables. `f(x, y) = xy`, `x = 5` * User-defined functions and variables. `f(x, y) = xy`, `x = 5`
* Derivative of functions (derivatives of noisy functions or of higher order can be a bit inaccurate). `f'(2)`, `sin'(-pi)` * Derivative of functions (derivatives of noisy functions or of higher order can be a bit inaccurate). `f'(2)`, `sin'(-pi)`
* Integration. `∫(0, pi, sin(x) dx)` or `∫(0, π, sin(x) dx)`, maybe sometimes be slightly off * Integration. `∫(0, pi, sin(x) dx)` or `∫(0, π, sin(x) dx)`, maybe sometimes be slightly off

25
flake.lock generated Normal file
View File

@ -0,0 +1,25 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1632255010,
"narHash": "sha256-p/BYR6qhbCtDpOfw9uMYwjwyhuCVKgiSUpKZaV/63UE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "bfc38d3d0d22c528e8abc46c5dd5f3f50fc4554b",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

58
flake.nix Normal file
View File

@ -0,0 +1,58 @@
{
description = "A calculator program/website";
outputs = { self, nixpkgs }:
let
systems =
[ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
nixpkgsFor = forAllSystems (system:
import nixpkgs {
inherit system;
overlays = [ self.overlay ];
});
in {
overlay = final: prev: {
kalker = final.rustPlatform.buildRustPackage {
pname = "kalker";
version = "unstable";
src = self;
outputs = [ "out" "lib" ];
postInstall = ''
moveToOutput "lib" "$lib"
'';
cargoLock = {
lockFile = self + "/Cargo.lock";
outputHashes = {
"gmp-mpfr-sys-1.4.7" =
"sha256-zHpGbEgh3MgAUVdlWrXq4Clj1boybi6DMOcsjgZbAh0=";
};
};
buildInputs = with final; [ gmp mpfr libmpc ];
CARGO_FEATURE_USE_SYSTEM_LIBS = "1";
};
};
packages =
forAllSystems (system: { inherit (nixpkgsFor.${system}) kalker; });
defaultPackage = forAllSystems (system: self.packages.${system}.kalker);
apps = forAllSystems (system: {
kalker = {
type = "app";
program = "${self.packages.${system}.kalker}/bin/kalker";
};
});
defaultApp = forAllSystems (system: self.apps.${system}.kalker);
};
}