From cd4de50188af8836b8450c15d5b60332e1f2174b Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Thu, 25 Nov 2021 20:17:27 +0100 Subject: misc: add nix derivation --- .../nixos/pkgs/os-specific/linux/vtcol/default.nix | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 misc/nixos/pkgs/os-specific/linux/vtcol/default.nix (limited to 'misc/nixos/pkgs/os-specific/linux/vtcol/default.nix') diff --git a/misc/nixos/pkgs/os-specific/linux/vtcol/default.nix b/misc/nixos/pkgs/os-specific/linux/vtcol/default.nix new file mode 100644 index 0000000..dec074b --- /dev/null +++ b/misc/nixos/pkgs/os-specific/linux/vtcol/default.nix @@ -0,0 +1,57 @@ +{ lib, stdenv +, cpio +, docutils +, rust +, installShellFiles +, fetchFromGitLab +, rustPlatform +}: + +rustPlatform.buildRustPackage rec { + pname = "vtcol"; + version = "0.42.5"; + + src = fetchFromGitLab { + domain = "gitlab.com"; + owner = "phgsng"; + repo = pname; + rev = "d6e8a37767644b50001e14ebbab594e799a94db7"; + sha256 = "sha256-fHWxiuCFO+N+ubPCS/Is64V2pLzh7xozDcRo7pQLMBg="; + }; + + cargoSha256 = "sha256-NSwn3vavrsPr+qn6oQY6kO5d9TKrxwcnqO7a3qpBphs=="; + + nativeBuildInputs = [ docutils cpio installShellFiles ]; + + buildFeatures = [ "vtcol-bin" ]; + + cargoPatches = [ ./cargo-lock.patch ]; + + target = rust.toRustTargetSpec stdenv.hostPlatform; + + # building the manpage requires docutils/rst2man + postInstall = '' + echo "create and install manpage" + make man + installManPage doc/vtcol.1.gz + + echo "create cpio archive for initrd" + binout="target/${target}/release/${pname}" + ls "$binout" + mkdir -p -- tmp/usr/bin + ls + ls tmp + cp -f -- "$binout" tmp/usr/bin + pushd tmp + <<${pname}.cpio + + install -D -m644 ${pname}.cpio $out/share/vtcol/${pname}.cpio + ''; + + meta = with lib; { + description = "Color schemes for the Linux console"; + homepage = "https://gitlab.com/phgsng/vtcol"; + license = licenses.gpl3; + mainProgram = "vtcol"; + }; +} -- cgit v1.2.3