summaryrefslogtreecommitdiff
path: root/misc/nixos/pkgs/os-specific/linux/vtcol/default.nix
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2021-11-25 20:17:27 +0100
committerPhilipp Gesang <phg@phi-gamma.net>2021-11-25 22:29:23 +0100
commitcd4de50188af8836b8450c15d5b60332e1f2174b (patch)
tree891a8e223d97cf0166c26480c13aed53072092d8 /misc/nixos/pkgs/os-specific/linux/vtcol/default.nix
parente943f3a8c967d95cb9d57367a57db78e79972d74 (diff)
downloadvtcol-cd4de50188af8836b8450c15d5b60332e1f2174b.tar.gz
misc: add nix derivation
Diffstat (limited to 'misc/nixos/pkgs/os-specific/linux/vtcol/default.nix')
-rw-r--r--misc/nixos/pkgs/os-specific/linux/vtcol/default.nix57
1 files changed, 57 insertions, 0 deletions
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
+ <<<usr/bin/${pname} cpio -ov -H ustar >${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";
+ };
+}