diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index 4264ecb..b4aa851 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ cargo-remote .vscode youmubot.db youmubot.db-* +/result +/.direnv diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..025c709 --- /dev/null +++ b/flake.lock @@ -0,0 +1,74 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1634851050, + "narHash": "sha256-N83GlSGPJJdcqhUxSCS/WwW5pksYf3VP1M13cDRTSVA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c91f3de5adaf1de973b797ef7485e441a65b8935", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "naersk": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1635777496, + "narHash": "sha256-8y2gyBTD0CMYbiTlmpLNEtvC7c/Al4qIToHTXN0L4kU=", + "owner": "nix-community", + "repo": "naersk", + "rev": "5bed2dbf074d95627a9c35bf262eb577ade97bb9", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "naersk", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1635956637, + "narHash": "sha256-65J/mVWr0M1y/59QOGSq6jOqiYYo6zoURJqdc0EzSZA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e01b7650cc3e2240021f2b094d31c2ff8815b926", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1635956637, + "narHash": "sha256-65J/mVWr0M1y/59QOGSq6jOqiYYo6zoURJqdc0EzSZA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e01b7650cc3e2240021f2b094d31c2ff8815b926", + "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 0000000..acc6680 --- /dev/null +++ b/flake.nix @@ -0,0 +1,35 @@ +{ + description = "A discord bot for Dự Tuyển Tổng Hợp server"; + inputs = { + naersk.url = "github:nix-community/naersk"; + flake-utils.url = "github:numtide/flake-utils"; + }; + outputs = { self, nixpkgs, naersk, flake-utils }: flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages."${system}"; + naersk-lib = naersk.lib."${system}"; + in + rec { + packages.youmubot = naersk-lib.buildPackage { + name = "youmubot"; + version = "0.1.0"; + + root = ./.; + cargoBuildOptions = opts: opts ++ [ "--package youmubot" ]; + }; + + defaultPackage = packages.youmubot; + + # `nix run` + apps.youmubot = flake-utils.lib.mkApp { + drv = packages.youmubot; + exePath = "/bin/youmubot"; + }; + defaultApp = apps.youmubot; + + # `nix develop` + devShell = pkgs.mkShell { + nativeBuildInputs = with pkgs; [ rustc cargo ]; + }; + }); +}