diff --git a/.gitignore b/.gitignore index ad508b3..a124a00 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /target /files -/previews \ No newline at end of file +/previews +result diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..7a66b7c --- /dev/null +++ b/default.nix @@ -0,0 +1,43 @@ +{ lib +, rustPlatform +, pkg-config +, libgit2 +, openssl +, zlib +, stdenv +, darwin +}: + +rustPlatform.buildRustPackage rec { + pname = "remote-text-server"; + version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version; + + src = ./.; + + cargoHash = "sha256-g6QiGH9eqC/mrGzeZOJ5wqm5V5D2xsDm4OOyzmE4sqM="; + + nativeBuildInputs = [ + pkg-config + ]; + + buildInputs = [ + libgit2 + openssl + zlib + ] ++ lib.optionals stdenv.isDarwin [ + darwin.apple_sdk.frameworks.IOKit + darwin.apple_sdk.frameworks.Security + ]; + + env = { + OPENSSL_NO_VENDOR = true; + VERGEN_IDEMPOTENT = true; + }; + + meta = with lib; { + description = "The server-side software for Remote Text"; + homepage = "https://github.com/Remote-Text/remote-text-server"; + license = with licenses; [ ]; + maintainers = with maintainers; [ ]; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..076597c --- /dev/null +++ b/flake.lock @@ -0,0 +1,25 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1690327932, + "narHash": "sha256-Fv7PYZxN4eo0K6zXhHG/vOc+e2iuqQ5ywDrh0yeRjP0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a9b47d85504bdd199e90846622c76aa0bfeabfac", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..91899c5 --- /dev/null +++ b/flake.nix @@ -0,0 +1,12 @@ +{ + description = "The server-side software for Remote Text"; + + outputs = { nixpkgs, ... }: + let + forAllSystems = gen: + nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed + (system: gen nixpkgs.legacyPackages.${system}); + in { + packages = forAllSystems (pkgs: { default = pkgs.callPackage ./. { }; }); + }; +}