diff --git a/.gitignore b/.gitignore index fcd7bbc..c06fdc7 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,7 @@ Cargo.lock # These are backup files generated by rustfmt **/*.rs.bk -.vscode \ No newline at end of file +.vscode + +# Nix output +result diff --git a/Cargo.toml b/Cargo.toml index 22c0639..5e33d43 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,4 +23,10 @@ git2 = "0.13" dialoguer = "0.6.2" clap = "2.33" console = "0.11" -dotenv = "0.15" \ No newline at end of file +dotenv = "0.15" + +[package.metadata.nix] +app = true +build = true +library = true +systems = ["x86_64-linux"] # TODO: add more \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..26f0421 --- /dev/null +++ b/flake.lock @@ -0,0 +1,113 @@ +{ + "nodes": { + "crane": { + "inputs": { + "flake-compat": "flake-compat", + "nix-std": "nix-std", + "nixpkgs": [ + "nixpkgs" + ], + "utils": "utils" + }, + "locked": { + "lastModified": 1646176024, + "narHash": "sha256-tmLycxj6Acq91XFPJYzlTI3JK4HWX05K8SpMO7kwCdI=", + "owner": "ipetkov", + "repo": "crane", + "rev": "39305b3828b976cac90bcb2cc5bdf5cfbcafce33", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1641205782, + "narHash": "sha256-4jY7RCWUoZ9cKD8co0/4tFARpWB+57+r1bLLvXNJliY=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "b7547d3eed6f32d06102ead8991ec52ab0a4f1a7", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1649676176, + "narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nix-std": { + "locked": { + "lastModified": 1624642189, + "narHash": "sha256-tIt3p1k0PsYeIxK2xO9Z8k2Ggq2nH4auqj3RbVAiRrg=", + "owner": "chessai", + "repo": "nix-std", + "rev": "9ef1cf73948bfad05d370165c7f3011b82c4d679", + "type": "github" + }, + "original": { + "owner": "chessai", + "repo": "nix-std", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1650615268, + "narHash": "sha256-me/SHGhP3uLHJr28tOhtgCOjLfjM0o3sYeEWE8i+OXY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ca087b7e4f67fd9d08313d241ba398201a604e9c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "crane": "crane", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "utils": { + "locked": { + "lastModified": 1644229661, + "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..81e65df --- /dev/null +++ b/flake.nix @@ -0,0 +1,19 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + crane.url = "github:ipetkov/crane"; + crane.inputs.nixpkgs.follows = "nixpkgs"; + flake-utils.url = "github:numtide/flake-utils"; + flake-utils.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = { self, nixpkgs, crane, flake-utils, ... }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = import nixpkgs { inherit system; }; in + { + defaultPackage = crane.lib.${system}.buildPackage { + src = ./.; + nativeBuildInputs = with pkgs; [ pkg-config openssl ]; + }; + }); +}