Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nix flake #56

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
description = "A tool to download private videos on vimeo";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-24.05-darwin";

outputs = { self, nixpkgs }:
let

# to work with older version of flakes
lastModifiedDate = self.lastModifiedDate or self.lastModified or "19700101";

# Generate a user-friendly version number.
version = builtins.substring 0 8 lastModifiedDate;

# System types to support.
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];

# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;

# Nixpkgs instantiated for supported system types.
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });

in
{
packages = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
in
{
default = pkgs.buildGoModule rec {
pname = "vimeo-dl";
inherit version;
src = ./.;
vendorHash = "sha256-hocnLCzWN8srQcO3BMNkd2lt0m54Qe7sqAhUxVZlz1k=";
nativeBuildInputs = with pkgs; [ makeWrapper ];
postInstall = ''
wrapProgram $out/bin/${pname} \
--prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.ffmpeg ]}
'';
};
});
};
}