~kaction/forge-link

e343311ebaa554bee25ce34f1a6470a4c33bb6ae — Dmitry Bogatov 3 years ago 09b4010
Write Nix derivation for package
4 files changed, 22 insertions(+), 0 deletions(-)

A aux/snapshot.nix
A default.nix
M forge-link
A package.nix
A aux/snapshot.nix => aux/snapshot.nix +5 -0
@@ 0,0 1,5 @@
let # NixOS release 19.09
  rev = "d5291756487d70bc336e33512a9baf9fa1788faf";
  sha256 = "0mhqhq21y5vrr1f30qd2bvydv4bbbslvyzclhw0kdxmkgg3z4c92";
in let url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz";
in import (builtins.fetchTarball { inherit url sha256; }) { }

A default.nix => default.nix +2 -0
@@ 0,0 1,2 @@
{ nixpkgs ? import ./aux/snapshot.nix }:
nixpkgs.callPackage ./package.nix { }

M forge-link => forge-link +1 -0
@@ 1,4 1,5 @@
#!/bin/sh
# PATH=@path@
set -eu

if [ $# != 1 ] && [ $# != 2 ]; then

A package.nix => package.nix +14 -0
@@ 0,0 1,14 @@
# passing coreutils = busybox is ok.
{ lib, curl, git, stdenv, coreutils, runCommand }:
stdenv.mkDerivation {
  pname = "forge-link";
  version = "0.1.0";
  dontUnpack = true;
  installPhase = ''
    mkdir -p $out/bin
    substituteAll ${./forge-link} $out/bin/forge-link
    sed -i 's/^# PATH=/PATH=/' $out/bin/forge-link
    chmod +x $out/bin/forge-link
  '';
  path = lib.makeBinPath [ curl git coreutils ];
}