diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000000..082400c3cc --- /dev/null +++ b/flake.lock @@ -0,0 +1,74 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1653893745, + "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "naersk": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1654608517, + "narHash": "sha256-KIxHjDDJYhoiLanLjpeAk5AuZsfip8M62JhkuloEGb0=", + "owner": "nix-community", + "repo": "naersk", + "rev": "14997a79cd78fe34ad6390f18a327ee0593e5eec", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "naersk", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1654665288, + "narHash": "sha256-7blJpfoZEu7GKb84uh3io/5eSJNdaagXD9d15P9iQMs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "43ecbe7840d155fa933ee8a500fb00dbbc651fc8", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1654665288, + "narHash": "sha256-7blJpfoZEu7GKb84uh3io/5eSJNdaagXD9d15P9iQMs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "43ecbe7840d155fa933ee8a500fb00dbbc651fc8", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "naersk": "naersk", + "nixpkgs": "nixpkgs_2" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000000..c5020682ba --- /dev/null +++ b/flake.nix @@ -0,0 +1,34 @@ +{ + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + naersk.url = "github:nix-community/naersk"; + }; + + outputs = { self, nixpkgs, flake-utils, naersk }: + flake-utils.lib.eachDefaultSystem ( + system: let + pkgs = nixpkgs.legacyPackages."${system}"; + naersk-lib = naersk.lib."${system}"; + in + rec { + # `nix build` + packages.ord = naersk-lib.buildPackage { + pname = "ord"; + root = ./.; + nativeBuildInputs = with pkgs; [ rustc cargo openssl pkg-config ]; + }; + defaultPackage = packages.ord; + + # `nix run` + apps.ord = flake-utils.lib.mkApp { + drv = packages.ord; + }; + defaultApp = apps.ord; + + # `nix develop` + devShell = pkgs.mkShell { + nativeBuildInputs = with pkgs; [ rustc cargo openssl pkg-config ]; + }; + } + ); +}