From 08c09aaa055c05228855eed8cded9fdfe4939c0f Mon Sep 17 00:00:00 2001 From: Vika Date: Tue, 4 May 2021 17:05:51 +0300 Subject: Initial commit Working features: - Sending posts from the database - Reading posts from the database - Responding with MF2-JSON (only in debug mode!) - Not locking the database when not needed - All database actions are atomic (except for a small race where UIDs can clash, but that's not gonna happen often) TODOs: - Send webmentions - Send syndication requests - Send WebSub notifications - Make tombstones for deleted posts (update adding dt-deleted) - Rich reply contexts (possibly on the frontend part?) - Frontend? - Fix UID race Code maintenance TODOs: - Split the database module - Finish implementing the in-memory test database - Make RedisDatabase unit tests launch their own Redis instances (see redis-rs/tests/support/mod.rs for more info) - Write more unit-tests!!! --- flake.nix | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 flake.nix (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..9eb296e --- /dev/null +++ b/flake.nix @@ -0,0 +1,66 @@ +{ + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + rust = { + type = "github"; + owner = "oxalica"; + repo = "rust-overlay"; + ref = "master"; + inputs.flake-utils.follows = "flake-utils"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + outputs = { self, nixpkgs, rust, flake-utils }: let + supportedSystems = ["aarch64-linux" "x86_64-linux"]; + forAllSystems = f: flake-utils.lib.eachSystem supportedSystems f; + in forAllSystems (system: let + pkgs = import nixpkgs { + localSystem.system = system; + overlays = [ rust.overlay ]; + }; + rust-bin = pkgs.rust-bin.stable.latest; + packages = { + kittybox-micropub = { stdenv, lib, openssl, pkg-config, redis, rustPlatform }: + rustPlatform.buildRustPackage { + name = "kittybox-micropub"; + version = "0.1.0"; + + src = ./.; + + #cargoSha256 = nixpkgs.lib.fakeSha256; + cargoHash = "sha256-DnPwAuzXWLJdyDf0dvfXUic0oQPVCpsnCyFdLSlsSs0="; + + buildInputs = [ openssl ]; + nativeBuildInputs = [ pkg-config ]; + checkInputs = [ redis ]; + doCheck = stdenv.hostPlatform == stdenv.targetPlatform; + + meta = with lib.meta; { + maintainers = with maintainers; [ vika_nezrimaya ]; + platforms = supportedSystems; + mainProgram = "kittybox_micropub"; + }; + }; + }; + in { + packages = let + rustPlatform = pkgs.makeRustPlatform { + rustc = rust-bin.minimal; + cargo = rust-bin.minimal; + }; + in { + kittybox-micropub = pkgs.callPackage packages.kittybox-micropub { inherit rustPlatform; }; + }; + defaultPackage = self.packages.${system}.kittybox-micropub; + + devShell = pkgs.mkShell { + name = "rust-dev-shell"; + buildInputs = with pkgs; [ openssl ]; + nativeBuildInputs = with pkgs; [ + pkg-config lld + rust-bin.default + rust-bin.rls + ]; + }; + }); +} -- cgit 1.4.1