diff --git a/.gitignore b/.gitignore index 7b54cc44..c2e317a1 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,6 @@ # Ignore Vim temporary and swap files. *.sw? *~ + +# Ignore nix build output +result diff --git a/book/src/guide/installation.md b/book/src/guide/installation.md index ba9b8c1b..d4447a56 100644 --- a/book/src/guide/installation.md +++ b/book/src/guide/installation.md @@ -1,5 +1,7 @@ # Installation +## Cargo + After [installing Rust](https://www.rust-lang.org/tools/install), use the following command to install twitch-tui: ```sh @@ -13,3 +15,11 @@ Installing a version such as `2.0.0-alpha.1` would be `cargo install twitch-tui (PPT and AUR repos coming soon) To uninstall, run the command `cargo uninstall twitch-tui`. + +## Nix + +twitch-tui is also a [Nix Flake](https://nixos.wiki/wiki/Flakes)! You can build and run it on nix using: + +```sh +nix run github:Xithrius/twitch-tui +``` diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..2289bd9e --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1697456312, + "narHash": "sha256-roiSnrqb5r+ehnKCauPLugoU8S36KgmWraHgRqVYndo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ca012a02bf8327be9e488546faecae5e05d7d749", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..59fb79f0 --- /dev/null +++ b/flake.nix @@ -0,0 +1,27 @@ +{ + description = "Twitch chat in the terminal."; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + outputs = { self, nixpkgs }: + let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + manifest = (pkgs.lib.importTOML ./Cargo.toml).package; + in { + packages.${system}.default = pkgs.rustPlatform.buildRustPackage { + pname = manifest.name; + version = manifest.version; + + buildInputs = [pkgs.openssl.dev]; + nativeBuildInputs = [pkgs.pkg-config]; + + src = pkgs.lib.cleanSource ./.; + cargoLock.lockFile = ./Cargo.lock; + }; + + apps.${system}.default = { + type = "app"; + program = "${self.packages.${system}.default}/bin/twt"; + }; + }; +}