diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..a477d01 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1746904237, + "narHash": "sha256-3e+AVBczosP5dCLQmMoMEogM57gmZ2qrVSrmq9aResQ=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "d89fc19e405cb2d55ce7cc114356846a0ee5e956", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "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 +} diff --git a/flake.nix b/flake.nix new file mode 100755 index 0000000..3c06040 --- /dev/null +++ b/flake.nix @@ -0,0 +1,64 @@ +{ + description = "Spacetime DB"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + outputs = + { + self, + nixpkgs, + flake-utils, + ... + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = import nixpkgs { + inherit system; + }; + + stdenv = pkgs.stdenv; + lib = pkgs.lib; + fetchurl = pkgs.fetchurl; + autoPatchelfHook = pkgs.autoPatchelfHook; + libgcc = pkgs.libgcc; + in + { + packages = { + default = stdenv.mkDerivation { + pname = "spacetimedb"; + version = "1.0.1"; + src = fetchurl { + url = "https://github.com/clockworklabs/SpacetimeDB/releases/download/v1.1.0/spacetime-x86_64-unknown-linux-gnu.tar.gz"; + hash = "sha256-t7V4TkPWQfzH8PUkRLq1OMaKhZ4in4EZCLKinc2oSik="; + }; + nativeBuildInputs = [ autoPatchelfHook ]; + + buildInputs = [ + libgcc + stdenv.cc.cc.lib + ]; + + unpackPhase = '' + runHook preUnpack + mkdir -p $out/bin + tar -xvf $src -C $out/bin + runHook postUnpack + ''; + + installPhase = '' + runHook preInstall + runHook postInstall + ''; + }; + }; + devShells = { + default = pkgs.mkShell { + buildInputs = [ self.${system}.packages.default ]; + }; + }; + } + ); +}