--- /dev/null
+if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then
+ source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8="
+fi
+use flake
+
+source_env_if_exists .envrc.private
+result
+.direnv/
+.envrc.private
+
# local ansible configuration
ansible/inventory
ansible/passwords/
--- /dev/null
+{ lib, stdenv, rustPlatform, fetchFromGitHub, openssl, postgresql, libiconv
+, Security, protobuf, rustfmt, nixosTests }:
+
+rustPlatform.buildRustPackage rec {
+ version = "0.18.2";
+ pname = "lemmy-server";
+
+ src = ./.;
+
+ preConfigure = ''
+ echo 'pub const VERSION: &str = "${version}";' > crates/utils/src/version.rs
+ '';
+
+ cargoSha256 = "sha256-2HWz6gYRo4YkXQz4V5COY2vpCu/PD8kKxzDG21YjYbo=";
+
+ buildInputs = [ postgresql ]
+ ++ lib.optionals stdenv.isDarwin [ libiconv Security ];
+
+ # Using OPENSSL_NO_VENDOR is not an option on darwin
+ # As of version 0.10.35 rust-openssl looks for openssl on darwin
+ # with a hardcoded path to /usr/lib/libssl.x.x.x.dylib
+ # https://github.com/sfackler/rust-openssl/blob/master/openssl-sys/build/find_normal.rs#L115
+ OPENSSL_LIB_DIR = "${lib.getLib openssl}/lib";
+ OPENSSL_INCLUDE_DIR = "${openssl.dev}/include";
+
+ PROTOC = "${protobuf}/bin/protoc";
+ PROTOC_INCLUDE = "${protobuf}/include";
+ nativeBuildInputs = [ protobuf rustfmt ];
+
+ passthru.tests.lemmy-server = nixosTests.lemmy;
+
+ meta = with lib; {
+ description = "🐀 Building a federated alternative to reddit in rust";
+ homepage = "https://join-lemmy.org/";
+ license = licenses.agpl3Only;
+ maintainers = with maintainers; [ happysalada billewanick ];
+ mainProgram = "lemmy_server";
+ };
+}
--- /dev/null
+{
+ "nodes": {
+ "flake-utils": {
+ "inputs": {
+ "systems": "systems"
+ },
+ "locked": {
+ "lastModified": 1689068808,
+ "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1690031011,
+ "narHash": "sha256-kzK0P4Smt7CL53YCdZCBbt9uBFFhE0iNvCki20etAf4=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "12303c652b881435065a98729eb7278313041e49",
+ "type": "github"
+ },
+ "original": {
+ "id": "nixpkgs",
+ "ref": "nixos-unstable",
+ "type": "indirect"
+ }
+ },
+ "root": {
+ "inputs": {
+ "flake-utils": "flake-utils",
+ "nixpkgs": "nixpkgs"
+ }
+ },
+ "systems": {
+ "locked": {
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
--- /dev/null
+{
+ description = "🐀 Building a federated alternative to reddit in rust";
+
+ inputs = {
+ nixpkgs.url = "nixpkgs/nixos-unstable";
+ flake-utils.url = "github:numtide/flake-utils";
+ };
+
+ outputs = { self, nixpkgs, flake-utils }:
+
+ flake-utils.lib.eachDefaultSystem (system:
+ let pkgs = nixpkgs.legacyPackages.${system};
+ in {
+ packages = {
+ lemmy-server = (pkgs.callPackage ./default.nix {
+ libiconv = null;
+ Security = null;
+ });
+
+ default = self.packages.x86_64-linux.lemmy-server;
+ };
+
+ devShells.default =
+ pkgs.mkShell { buildInputs = [ pkgs.rustc pkgs.cargo ]; };
+ });
+}