[Snek] Here is my nix derivation (updated for Snek 1.9)

Anthony Carrico acarrico at memebeam.org
Thu Jan 25 09:45:59 PST 2024


Below is my bare bones nix derivation, updated for Snek 1.9.

What is this? It makes it easy to access to the Snek development 
environment under NixOS, or any other Linux distribution with Nix installed.

It just uses Keith's binary distribution, but does add a "snek-docs" 
command which gets you into the distribution directory where the docs 
and examples are stored.

I'll send more details in a follow up message. Store this derivation in 
a file called snekde/default.nix:

{ stdenv, fetchurl, unzip, python3 }:

let docs = out: ''
   #!/bin/sh
   # echo $out/snek/
   cd $out/snek/
   \$SHELL
''; in

stdenv.mkDerivation rec {
   pname = "snekde";
   version = "1.9";
   snek_src = fetchurl {
     # nix-prefetch-url
     url = "https://sneklang.org/dist/snek-1.9.zip";
     sha256 = "0p66c2pwhlc7gpda71996xxxjmgqwh6fpq85jzjxy6mxcxp1w70n";
   };
   src = ./. ;
   nativeBuildInputs = [ unzip ];
   buildInputs = [ (python3.withPackages (ps: [ps.pyserial])) ];

   buildPhase = "";

   installPhase = ''
     mkdir -p $out
     unzip $snek_src -d $out
     mkdir -p $out/bin
     ln -s $out/snek/snekde $out/bin
     echo "${docs "$out"}" > $out/bin/snek-docs
     chmod a+x $out/bin/snek-docs
   '';

   meta = with stdenv.lib; {
     description = "Snek Development Environment";
   };
}

-- 
Anthony Carrico


More information about the Snek mailing list