Add nix flake

This commit is contained in:
GDWR 2023-10-20 19:25:28 +01:00
parent 694cd08f63
commit 161b5f949b
3 changed files with 57 additions and 0 deletions

3
.gitignore vendored
View File

@ -18,3 +18,6 @@
# Ignore Vim temporary and swap files.
*.sw?
*~
# Ignore nix build output
result

27
flake.lock Normal file
View File

@ -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
}

27
flake.nix Normal file
View File

@ -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";
};
};
}