first
This commit is contained in:
85
templates/package/default.nix
Normal file
85
templates/package/default.nix
Normal file
@@ -0,0 +1,85 @@
|
||||
# Package Template
|
||||
# This is a template for creating new packages in m3ta-nixpkgs
|
||||
# Copy this template and modify it for your specific package
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
# Add build dependencies here
|
||||
# pkg-config,
|
||||
# cmake,
|
||||
# rustPlatform,
|
||||
# python3,
|
||||
# nodejs,
|
||||
# Add runtime dependencies here
|
||||
# openssl,
|
||||
# libxml2,
|
||||
}:
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "package-name"; # Replace with your package name
|
||||
version = "0.1.0"; # Replace with actual version
|
||||
|
||||
# Source fetching - choose one method:
|
||||
|
||||
# Method 1: From GitHub
|
||||
src = fetchFromGitHub {
|
||||
owner = "owner-name";
|
||||
repo = "repo-name";
|
||||
rev = "v${version}"; # or use a specific commit hash
|
||||
hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
||||
# To get the correct hash, first set it to lib.fakeHash, then run:
|
||||
# nix build .#package-name
|
||||
# The error message will show the correct hash
|
||||
};
|
||||
|
||||
# Method 2: From URL
|
||||
# src = fetchurl {
|
||||
# url = "https://example.com/package-${version}.tar.gz";
|
||||
# hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
||||
# };
|
||||
|
||||
# Build-time dependencies (tools needed to build the package)
|
||||
nativeBuildInputs = [
|
||||
# pkg-config
|
||||
# cmake
|
||||
# makeWrapper
|
||||
];
|
||||
|
||||
# Runtime dependencies (libraries needed at runtime)
|
||||
buildInputs = [
|
||||
# openssl
|
||||
# libxml2
|
||||
];
|
||||
|
||||
# Build phase (optional, only if you need custom build steps)
|
||||
# buildPhase = ''
|
||||
# make
|
||||
# '';
|
||||
|
||||
# Install phase (optional, only if you need custom install steps)
|
||||
# installPhase = ''
|
||||
# mkdir -p $out/bin
|
||||
# cp binary $out/bin/
|
||||
# '';
|
||||
|
||||
# Post-install hook (optional, for wrapping binaries, etc.)
|
||||
# postInstall = ''
|
||||
# wrapProgram $out/bin/program \
|
||||
# --prefix PATH : ${lib.makeBinPath [ dependency ]}
|
||||
# '';
|
||||
|
||||
# Metadata - REQUIRED
|
||||
meta = with lib; {
|
||||
description = "A short description of the package";
|
||||
longDescription = ''
|
||||
A longer, more detailed description of what the package does.
|
||||
This can span multiple lines.
|
||||
'';
|
||||
homepage = "https://github.com/owner/repo";
|
||||
changelog = "https://github.com/owner/repo/releases/tag/v${version}";
|
||||
license = licenses.mit; # Change to appropriate license
|
||||
maintainers = with maintainers; []; # Add your name if you're in nixpkgs
|
||||
platforms = platforms.linux; # or platforms.unix, platforms.all, etc.
|
||||
mainProgram = "program-name"; # The main executable name
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user