diff --git a/.gitignore b/.gitignore index 1a10908..f4582b5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /target *.iml .idea +result diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..c926341 --- /dev/null +++ b/flake.lock @@ -0,0 +1,100 @@ +{ + "nodes": { + "fenix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1700979662, + "narHash": "sha256-AlS2tefQT6fBxWGKKkQNXh1HAyzlwBQ8P6AUMmI1mxw=", + "owner": "nix-community", + "repo": "fenix", + "rev": "6f824c3d294716db51fbf8d555af8b9514cdbec4", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1701005726, + "narHash": "sha256-Tt9KdHlNIKjcWKYcb6HRrdnypB2N1zKdVcls1Bd7NFU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ef571730af586df603e236558dd5ea09f8fe1a76", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "release-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "fenix": "fenix", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1700937652, + "narHash": "sha256-sHczfsDUYH1CXPqNztnWH0gFo7xU0AuqQD96qSVC2HI=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "79ec2c584b990a533f7fde685a51d45d2a896103", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, + "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 100644 index 0000000..4a1f7b6 --- /dev/null +++ b/flake.nix @@ -0,0 +1,41 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/release-23.05"; + flake-utils.url = "github:numtide/flake-utils"; + + fenix = { + url = "github:nix-community/fenix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, flake-utils, fenix }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = (import nixpkgs) { + inherit system; + }; + in + rec { + packages = { + zia-client = let manifest = (pkgs.lib.importTOML ./zia-client/Cargo.toml).package; in pkgs.rustPlatform.buildRustPackage { + pname = manifest.name; + version = manifest.version; + cargoLock.lockFile = ./Cargo.lock; + src = pkgs.lib.cleanSource ./.; + cargoBuildFlags = "-p ${manifest.name}"; + nativeBuildInputs = [ fenix.packages.${system}.stable.toolchain ]; + }; + + zia-server = let manifest = (pkgs.lib.importTOML ./zia-server/Cargo.toml).package; in pkgs.rustPlatform.buildRustPackage { + pname = manifest.name; + version = manifest.version; + cargoLock.lockFile = ./Cargo.lock; + src = pkgs.lib.cleanSource ./.; + cargoBuildFlags = "-p ${manifest.name}"; + nativeBuildInputs = [ fenix.packages.${system}.stable.toolchain ]; + }; + }; + } + ); +}