Nix Recipe: Setup Python

This is a nix recipe for building and running python in a virtual nix environment. Create shell.nix with following: let nixpkgs = import (builtins.fetchTarball https://github.com/NixOS/nixpkgs/archive/20.03.tar.gz) { overlays = []; config = {}; }; in with nixpkgs; stdenv.mkDerivation { name = "python-env"; nativeBuildInputs = [ zsh vim python37 python37Packages.pip python37Packages.virtualenv ]; # ENV variables PROJDIR = "${toString ./.}"; # Post Shell Hook shellHook = '' echo "Using ${python37.name}" [ !...

March 9, 2020 · 1 min · wilspi

Nix Recipe: Setup Nodejs

This is a nix recipe for building and running nodejs in a virtual nix environment. In your project folder, create a new file nodejs.nix and add following: { nixpkgs ? import <nixpkgs> {}, version, sha256 }: let inherit (nixpkgs) python37 utillinux stdenv autoPatchelfHook fetchurl binutils-unwrapped patchelf xcbuild; inherit (stdenv) mkDerivation; in mkDerivation { inherit version; name = "nodejs-${version}"; src = fetchurl { url = "https://nodejs.org/dist/v${version}/node-v${version}${if stdenv.isDarwin then "-darwin-x64" else "-linux-x64"}....

March 6, 2020 · 2 min · wilspi

Nix Recipe: Setup Rust

This is a nix recipe for building and running rust in a virtual nix environment. Create a file rust-toolchain with following: 1.43.0 We are specifying rust version to install, here using 1.43.0. If using heroku, rust-toolchain file will determine which version will be used to build the application. Create shell.nix with following: let # Mozilla Overlay moz_overlay = import ( builtins.fetchTarball "https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz" ); nixpkgs = import (builtins....

March 4, 2020 · 2 min · wilspi

Nix Recipe: Setup Postgresql

This is a nix recipe for building and running postgresql-12 in a virtual nix environment. Create your project folder and save the following file as shell.nix let nixpkgs = import (builtins.fetchTarball https://github.com/NixOS/nixpkgs/archive/20.03.tar.gz) { overlays = []; config = {}; }; in with nixpkgs; stdenv.mkDerivation { name = "postgres-env"; buildInputs = []; nativeBuildInputs = [ zsh vim geos gdal nixpkgs-fmt # postgres-12 with postgis support (postgresql_12.withPackages (p: [ p.postgis ])) ]; postgresConf = writeText "postgresql....

March 2, 2020 · 2 min · wilspi