Commit b01fdd93a2
Unsigned
Layout: unified · split
flake.nix +48 −33
| @@ -6,47 +6,62 @@ | |||
| 6 | }; | 6 | }; |
| 7 | 7 | ||
| 8 | outputs = { | 8 | outputs = { |
| 9 | self, | ||
| 10 | nixpkgs, | 9 | nixpkgs, |
| 11 | flake-utils, | 10 | flake-utils, |
| 12 | rust-overlay, | 11 | rust-overlay, |
| 13 | ... | 12 | ... |
| 14 | }: | 13 | }: |
| 15 | flake-utils.lib.eachDefaultSystem (system: let | 14 | flake-utils.lib.eachDefaultSystem (system: |
| 16 | overlays = [(import rust-overlay)]; | 15 | let |
| 17 | pkgs = import nixpkgs {inherit system overlays;}; | 16 | overlays = [(import rust-overlay)]; |
| 18 | rustVersion = pkgs.rust-bin.stable.latest.default; | 17 | pkgs = import nixpkgs {inherit system overlays;}; |
| 19 | toml = builtins.fromTOML (builtins.readFile ./Cargo.toml); | 18 | rustVersion = pkgs.rust-bin.stable.latest.default; |
| 19 | toml = builtins.fromTOML (builtins.readFile ./Cargo.toml); | ||
| 20 | 20 | ||
| 21 | rustPlatform = pkgs.makeRustPlatform { | 21 | rustPlatform = pkgs.makeRustPlatform { |
| 22 | cargo = rustVersion; | 22 | cargo = rustVersion; |
| 23 | rustc = rustVersion; | 23 | rustc = rustVersion; |
| 24 | }; | 24 | }; |
| 25 | 25 | ||
| 26 | youtube-tui = rustPlatform.buildRustPackage { | 26 | youtube-tui = rustPlatform.buildRustPackage { |
| 27 | pname = | 27 | pname = |
| 28 | toml.package.name; # make this what ever your cargo.toml package.name is | 28 | toml.package.name; # make this what ever your cargo.toml package.name is |
| 29 | version = "v${toml.package.version}"; | 29 | version = "v${toml.package.version}"; |
| 30 | src = ./.; # the folder with the cargo.toml | 30 | src = ./.; # the folder with the cargo.toml |
| 31 | 31 | ||
| 32 | cargoLock.lockFile = ./Cargo.lock; | 32 | cargoLock.lockFile = ./Cargo.lock; |
| 33 | 33 | ||
| 34 | buildInputs = with pkgs; [ | 34 | nativeBuildInputs = with pkgs; [ |
| 35 | openssl | 35 | pkg-config |
| 36 | xorg.libxcb | 36 | python3 |
| 37 | libsixel | 37 | makeWrapper |
| 38 | mpv | 38 | ]; |
| 39 | ]; | ||
| 40 | 39 | ||
| 41 | nativeBuildInputs = with pkgs; [ | 40 | buildInputs = with pkgs; [ |
| 42 | pkg-config | 41 | openssl |
| 43 | python3 | 42 | xorg.libxcb |
| 44 | ]; | 43 | mpv |
| 45 | }; | 44 | libsixel |
| 46 | in { | 45 | ]; |
| 47 | defaultPackage = youtube-tui; | 46 | |
| 48 | devShell = pkgs.mkShell { | 47 | postInstall = '' |
| 49 | buildInputs = [(rustVersion.override {extensions = ["rust-src"];})]; | 48 | wrapProgram $out/bin/youtube-tui \ |
| 50 | }; | 49 | --prefix PATH : ${nixpkgs.lib.makeBinPath [ pkgs.mpv pkgs.libsixel ]} |
| 51 | }); | 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 | ); | ||
| 52 | } | 67 | } |