citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

default.nix (908B)


      1 { pkgs ? import <nixpkgs> {}, stdenv ? pkgs.stdenv, fetchurl ? pkgs.fetchurl, 
      2   bash ? pkgs.bash, less ? pkgs.less, sdcv ? pkgs.sdcv, gnutar ? pkgs.gnutar, 
      3   writeScript ? pkgs.writeScript }:
      4 let
      5   dictd = stdenv.mkDerivation rec {
      6     pname = "define-dict";
      7     version = "0.1";
      8 
      9     src = fetchurl {
     10       url = "https://jb55.com/files/dict.tar";
     11       sha256 = "fcaf90833b777a1fd9e62282deb245ad62f6ce536f78c6ef503c2d78c3084ab3";
     12     };
     13 
     14     installPhase = ''
     15       mkdir -p $out/share
     16       ${gnutar}/bin/tar xvf $src -C $out/share
     17     '';
     18   };
     19 in
     20 stdenv.mkDerivation rec {
     21   pname = "define";
     22   version = "0.1";
     23 
     24   src = writeScript "define" ''
     25     #!${bash}/bin/bash
     26     export LESS="$LESS --quit-if-one-screen"
     27     ${sdcv}/bin/sdcv -n --data-dir=${dictd}/share "$@" | ${less}/bin/less
     28   '';
     29 
     30   phases = ["installPhase"];
     31 
     32   installPhase = ''
     33     mkdir -p $out/bin
     34     cp $src $out/bin/define
     35   '';
     36 }