diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..f62a3db --- /dev/null +++ b/.envrc @@ -0,0 +1,2 @@ +use flake +use flake diff --git a/.gitignore b/.gitignore index 518877a..3da6280 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target /output.cast +.direnv diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..3268989 --- /dev/null +++ b/default.nix @@ -0,0 +1,12 @@ +{ toolchain, makeRustPlatform, pkg-config }: + +let rustPlatform = makeRustPlatform { inherit (toolchain) cargo rustc; }; + +in rustPlatform.buildRustPackage { + name = "asciinema"; + src = ./.; + cargoLock.lockFile = ./Cargo.lock; + + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ ]; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..0c5b225 --- /dev/null +++ b/flake.lock @@ -0,0 +1,79 @@ +{ + "nodes": { + "fenix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1673072488, + "narHash": "sha256-oSlrgIlaZEcBrH9o6ujCtuzvULB7w5MrQl1Xccsl9Is=", + "owner": "nix-community", + "repo": "fenix", + "rev": "2fa6ef94550e2e8b5e47fa3b0655edcacbb65cb6", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "id": "flake-utils", + "type": "indirect" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1667629849, + "narHash": "sha256-P+v+nDOFWicM4wziFK9S/ajF2lc0N2Rg9p6Y35uMoZI=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "3bacde6273b09a21a8ccfba15586fb165078fb62", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "fenix": "fenix", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1673025936, + "narHash": "sha256-Dm2qLfxAEqrfz9CE6w1jlEZdfNLFeAkC/mcb4xwUQQE=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "f1a99014b356c6aa41a69ceecf1f8cc68d901006", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..58bb100 --- /dev/null +++ b/flake.nix @@ -0,0 +1,31 @@ +{ + inputs = { + fenix.url = "github:nix-community/fenix"; + fenix.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = { self, nixpkgs, flake-utils, fenix }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ fenix.overlays.default ]; + }; + + toolchain = pkgs.fenix.default; + + flakePkgs = { + asciinema = pkgs.callPackage ./. { inherit toolchain; }; + }; + in rec { + packages = flake-utils.lib.flattenTree flakePkgs; + defaultPackage = packages.asciinema; + + devShell = pkgs.mkShell { + inputsFrom = with packages; [ asciinema ]; + packages = + (with pkgs; [ cargo-watch cargo-deny cargo-edit sqlx-cli sqlite ]) + ++ (with toolchain; [ cargo rustc ]); + }; + }); +} diff --git a/rustfmt.toml b/rustfmt.toml index 3450fc4..4c1eefa 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,2 +1,2 @@ max_width = 80 -wrap_comments = true +tab_spaces = 2