flake.nix
67 lines · 1765 bytes
1{
2 inputs = {
3 nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
4 flake-utils.url = "github:numtide/flake-utils";
5 rust-overlay.url = "github:oxalica/rust-overlay";
6 };
7
8 outputs = {
9 nixpkgs,
10 flake-utils,
11 rust-overlay,
12 ...
13 }:
14 flake-utils.lib.eachDefaultSystem (system:
15 let
16 overlays = [(import rust-overlay)];
17 pkgs = import nixpkgs {inherit system overlays;};
18 rustVersion = pkgs.rust-bin.stable.latest.default;
19 toml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
20
21 rustPlatform = pkgs.makeRustPlatform {
22 cargo = rustVersion;
23 rustc = rustVersion;
24 };
25
26 youtube-tui = rustPlatform.buildRustPackage {
27 pname =
28 toml.package.name; # make this what ever your cargo.toml package.name is
29 version = "v${toml.package.version}";
30 src = ./.; # the folder with the cargo.toml
31
32 cargoLock.lockFile = ./Cargo.lock;
33
34 nativeBuildInputs = with pkgs; [
35 pkg-config
36 python3
37 makeWrapper
38 ];
39
40 buildInputs = with pkgs; [
41 openssl
42 xorg.libxcb
43 mpv
44 libsixel
45 ];
46
47 postInstall = ''
48 wrapProgram $out/bin/youtube-tui \
49 --prefix PATH : ${nixpkgs.lib.makeBinPath [ pkgs.mpv ]}
50 '';
51 };
52 in {
53 defaultPackage = youtube-tui;
54 devShell = pkgs.mkShell {
55 buildInputs = [
56 (rustVersion.override {extensions = ["rust-src"];})
57 pkgs.pkg-config
58 pkgs.python3
59 pkgs.openssl
60 pkgs.mpv
61 pkgs.libsixel
62 pkgs.xorg.libxcb
63 ];
64 };
65 }
66 );
67}