diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..7b8f00b --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1751413152, + "narHash": "sha256-Tyw1RjYEsp5scoigs1384gIg6e0GoBVjms4aXFfRssQ=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "77826244401ea9de6e3bac47c2db46005e1f30b5", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1752480373, + "narHash": "sha256-JHQbm+OcGp32wAsXTE/FLYGNpb+4GLi5oTvCxwSoBOA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "62e0f05ede1da0d54515d4ea8ce9c733f12d9f08", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1751159883, + "narHash": "sha256-urW/Ylk9FIfvXfliA1ywh75yszAbiTEVgpPeinFyVZo=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "14a40a1d7fb9afa4739275ac642ed7301a9ba1ab", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..967f08f --- /dev/null +++ b/flake.nix @@ -0,0 +1,61 @@ +{ + description = "Description for the project"; + + inputs = { + flake-parts.url = "github:hercules-ci/flake-parts"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + }; + + outputs = inputs@{ flake-parts, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { + imports = [ + + ]; + systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ]; + perSystem = { config, self', inputs', pkgs, system, ... }: { + packages.default = pkgs.buildGoModule { + pname = "gophertube"; + version = "1.2.1"; + src = pkgs.lib.cleanSource ./.; + vendorHash = "sha256-TBjru54oV2iwAjvqhQcsVr/yQfp6fgukNX/OkZdBWjw="; + + buildInputs = with pkgs; [ + mpv + yt-dlp + ]; + + nativeBuildInputs = with pkgs; [ + go + ]; + nativeCheckInputs = with pkgs; [ + go + ]; + + buildPhase = '' + go build -o gophertube main.go + ''; + + installPhase = '' + mkdir -p $out/bin + cp gophertube $out/bin + mkdir -p $out/share/man/man1 + cp $src/man/gophertube.1 $out/share/man/man1 + mkdir -p $out/config + cp $src/config/gophertube.yaml $out/config/gophertube.yaml.example + ''; + }; + devShells.default = pkgs.mkShell { + nativeBuildInputs = with pkgs; [ + go + ]; + buildInputs = with pkgs; [ + mpv + yt-dlp + ]; + }; + }; + flake = { + + }; + }; +}