RSSAmplifier

Blog

functor.tokyo blog feed

functor.tokyoRSS feed ↗69 posts

Latest posts

mkAIDerivation

mkAIDerivation 2025-06-14 I just released mkAIDerivation . This is a Nix function that let's you generate a derivation on the fly using an LLM over the network. Here's what it looks like: mkAIDerivation '' Generate a derivation for building `xterm` '' This uses evil-nix to be able to (im)purely do network access without a hash. Check out the mkAIDerivation repo for more information. tags: nixos…

How to Statically-link Haskell Binaries using Nix

How to Statically-link Haskell Binaries using Nix 2024-09-29 I put together an example repository showing how to statically-link x86-64 Linux Haskell binaries using Nix. Check out the README in the repo for more information: https://github.com/cdepillabout/example-static-haskell-nix tags: nixos , haskell Please enable JavaScript to view the comments powered by Disqus. -->

Cloudy: CLI tool for easily spinning up compute instances in the cloud

Cloudy: CLI tool for easily spinning up compute instances in the cloud 2024-09-25 I recently released a new CLI tool, Cloudy . Cloudy makes it easy to spin up one-off compute instances using various cloud providers (like AWS, Scaleway, etc). In practice, it feels similar to tools like docker run or vagrant , but for running temporary compute instances in the cloud, instead of running locally.…

FODONUTs: Fixed-Output Derivations for Operating Network-Utilizing Tests

FODONUTs: Fixed-Output Derivations for Operating Network-Utilizing Tests 2023-07-24 Nix provides two main types of derivations: normal derivations fixed-output derivations (FODs) The big difference is that fixed-output derivations allow you to access the internet from within the Nix build sandbox. However, they require you to give the hash of the derivation output in advance. Aside from some…

evil-nix: download files without requiring a hash

evil-nix: download files without requiring a hash 2023-06-28 I recently released a Nix library called evil-nix . It allows downloading files without requiring a hash on the file. It even works in Nix's pure-eval mode. evil-nix exploits Nix support for unsafe hash functions (like SHA1) in fixed-output derivations. It uses SHA1 hash collisions to sneak data from the internet out of fixed-output…

Bound by a Free-Monad-like Structure

Bound by a Free-Monad-like Structure 2023-05-11 Recently my friend Jonas Carpay has been teaching me about the Haskell package bound , and the fundamental problem it is trying to solve. bound gives a good solution for defining a lambda calculus in Haskell, specifically with how to differentiate between bound and free variables. While playing around with the ideas from bound , I found a neat way of…

binplz: easily curl static binaries

binplz: easily curl static binaries 2023-02-26 Nixery is an interesting service. It dynamically serves Docker images created from arbitrary packages from Nixpkgs. I thought that a similar type of service could be created that serves statically-linked binaries from Nixpkgs. This would be another way for users on any Linux distro to benefit from all the software packaged in Nixpkgs. I explained this…

Building Pandoc with stacklock2nix

Building Pandoc with stacklock2nix 2022-12-26 This is the third and final post in a series about stacklock2nix . The previous post is about building Dhall with stacklock2nix . This post uses stacklock2nix to build Pandoc with Nix. Pandoc is a tool for converting from one markup format to another. It is one of the most widely-used tools written in Haskell. This post explains how to use…

Building Dhall with stacklock2nix

Building Dhall with stacklock2nix 2022-12-20 This is the second post in a series about stacklock2nix . The previous post is about building PureScript with stacklock2nix . The next post is about building Pandoc with stacklock2nix . This post uses stacklock2nix to build Dhall and all its tools with Nix. The Dhall project is a good example for stacklock2nix , since it is comprised of quite a few…

Building the PureScript Compiler with stacklock2nix

Building the PureScript Compiler with stacklock2nix 2022-12-16 This is the first post in a series about stacklock2nix . The next post is about building Dhall with stacklock2nix . This post uses stacklock2nix to build the PureScript compiler with Nix. PureScript is a non-trivial Haskell project, but it is not too complicated. It is good as an initial example of using stacklock2nix . The following…

stacklock2nix

stacklock2nix 2022-12-15 For a while now I've wanted a way to use Nix to build a Haskell package that has a stack.yaml file. The go-to method in the Haskell community is to use haskell.nix , but haskell.nix has a few downsides 1 : Evaluation can take quite a while, and building your project without using the IOHK cache can take a very long time. haskell.nix is quite complicated. It can be hard to…

Get Involved with Nixpkgs Haskell

Get Involved with Nixpkgs Haskell 2022-11-16 This post explains how you can get started with contributing to the Haskell subsystem of Nixpkgs. This will mainly be helpful for people who are happily using Haskell binaries and Haskell libraries from Nixpkgs, but want to start contributing additional fixes, or helping the Haskell subsystem in Nixpkgs advance faster. This post lists a few different…

How to Setup LXD on NixOS

How to Setup LXD on NixOS 2022-09-10 I put together an explanation of how to setup LXD on a NixOS host with a NixOS guest that uses a unmanaged bridge for networking: https://discourse.nixos.org/t/howto-setup-lxd-on-nixos-with-nixos-guest-using-unmanaged-bridge-network-interface/21591?u=cdepillabout This is an explanation of how to create and use an LXC image on NixOS. Many of the above steps are…

Why PureNix?

Why PureNix? 2022-01-10 This post is the third post in a series about PureNix . The previous post is about who would find PureNix easy to use . PureNix started out half as a joke. This post explains why we started working on PureNix, and how it moved from a joke to something we are excited about. The Idea This all started during @adisbladis 's Summer of Nix 2021 presentation about poetry2nix .…

Who Would Find PureNix Easy to Use?

Who Would Find PureNix Easy to Use? 2022-01-05 This post is the second post in a series about PureNix . The previous post is about getting started with PureNix . The next post is about why we started writing PureNix . PureNix will be easy to get started with for developers that have a good understanding of both Haskell-like languages and Nix. Developers without this background will have some…

Getting Started with PureNix

Getting Started with PureNix 2022-01-04 This post is the first post in a series about PureNix . The next post is about who would find PureNix easy to use . PureNix is a Nix backend for PureScript . PureNix allows you to write PureScript code and transpile it to Nix code. This post gives an overview of PureScript and PureNix. It then explains how to get started using PureNix. PureScript PureScript…

PureNix

PureNix 2022-01-03 My friend Jonas Carpay ( @jonascarpay ) and I recently released PureNix . PureNix is a Nix backend for PureScript . PureNix allows you to write PureScript code and transpile it to Nix code. This can be helpful when trying to write large or tricky code in Nix. This blog post series is all about PureNix. It explains how to get started with PureNix, why we wrote PureNix, when you…

Git no_push

Git no_push 2021-12-15 This is a trick I learned while working in Nixpkgs . It is possible to add a Git remote repository and set it up so you can't easily push to it. After cloning the repository, run the following command: $ git remote set-url --push origin no_push This makes it so that Git will fail if you try to push to origin . Here's what the git remote output looks like, using Nixpkgs as an…

The Road to purescript2nix

The Road to purescript2nix 2021-12-10 I recently put together a tool called purescript2nix . This is a Nix function that lets you easily build a PureScript project with Nix. There were a couple steps along the way, and this blog post series details all the steps. If you're only interested in using purescript2nix , jump directly to the last post. dhallDirectoryToNix This post explains the…

purescript2nix

purescript2nix 2021-12-10 This post is part of a series called The Road to purescript2nix . Update 2023-02-15: Viktor Kronvall ( @considerate ) took purescript2nix and fixed it up to be able to use the new PureScript Registry . During this process, purescript2nix has been renamed to purifix , and moved to its own GitHub Organization . Links to the purescript2nix repo in this blog post should all…

PureScript Package Sets with Hashes

PureScript Package Sets with Hashes 2021-12-10 This post is part of a series called The Road to purescript2nix . The PureScript package sets are Dhall files that specify a group of PureScript packages that are known to all compile together. If you're coming from Haskell, this is similar to a Stackage resolver . Package sets make development quite easy, since you have a large number of libraries…

dhallDirectoryToNix

dhallDirectoryToNix 2021-12-10 This post is part of a series called The Road to purescript2nix . I recently sent a few PRs to Dhall and Nixpkgs that add functionality for easily reading in a directory of Dhall files into Nix. This even works for Dhall files that contain remote imports. This blog post explains this new functionality, and gives pointers to the PRs that implemented this. The final PR…

Cross-compiling and Static-linking with Nix

Cross-compiling and Static-linking with Nix 2021-10-20 I was having a problem at work with an ARM64 Linux edge device. I have an ARM64 binary on the edge device, and I wanted to look at which dynamic libraries it is linked to with the readelf program. Unfortunately, readelf is not installed on the device. I was unable to figure out how to use the device's package manager. I was able to build a…

Xephyr for GUI over SSH X-Forwarding

Xephyr for GUI over SSH X-Forwarding 2021-05-07 X-Forwarding over SSH is a convenient way to run GUI programs on a remote machine while having them shown on your local desktop. This works well for many programs, but there are a few that do not support X-Forwarding over SSH. The programs that do not support this are generally using X Server extensions that are not supported over SSH X-Forwarding.…

How to Make Sure Nixpkgs Can Evaluate

How to Make Sure Nixpkgs Can Evaluate 2020-06-02 When sending pull requests to Nixpkgs, sometimes the ofborg CI will display evaluation errors. This blog post explains how to reproduce these errors locally for debugging. Example Error Here is an example PR where ofborg reports an evaluation error. Here is the evaluation error that ofborg is reporting: nix-env failed: warning: ignoring the…

Announcing password-2.0

Announcing password-2.0 2020-05-18 I recently helped with the release of the password-2.0 library. This 2.0 release corresponds to a big rewrite of the password library, spearheaded entirely by Felix Paulusma . The biggest improvement in 2.0 is the addition of a few new options for hashing algorithms, including Argon2 , Bcrypt , and PBKDF2 . What is the password library? The password library was…

How Long Does It Take to Learn to Juggle?

How Long Does It Take to Learn to Juggle? 2020-03-15 365 minutes. Just over 6 hours. I recently taught my girlfriend how to juggle. I was interested in how long it would take her to learn, so I kept good notes of exactly how long she practiced everyday. This blog post contains the data, as well as some commentary. First, I explain the setup for the experiment. I then give the data, along with some…

Announcing termonad-2.0.0.0

Announcing termonad-2.0.0.0 2019-09-13 Termonad is a terminal emulator written in Haskell. It is similar to other terminal emulators like Gnome Terminal, Terminator, Sakura, or ROXTerm. However, unlike these other terminal emulators, Termonad is fully configurable in Haskell. It aims to be the XMonad of terminal emulators . 1 A few weeks ago I released termonad-2.0.0.0 . It has been a while since…

Announcing pretty-simple-3.0.0.0

Announcing pretty-simple-3.0.0.0 2019-08-15 A few weeks ago I released pretty-simple-3.0.0.0 . I haven't done a release announcement in a while, so I wanted to list some of the new features that have been implemented in the last few releases. This post gives a short introduction to pretty-simple , explains the new features, and lists some outstanding issues I'd like help with. Introduction to…

Open Sum Types in Haskell with world-peace

Open Sum Types in Haskell with world-peace 2019-07-11 I recently released the Haskell library world-peace-1.0.0.0 . This library provides open sum types. world-peace is not as fast as some other libraries providing open sum types, but it does have much better documentation than other libraries. In this article I answer the following questions: What are open sum types? When would you want to use…

ghcid for Web App Development

ghcid for Web App Development 2019-04-07 One of the downsides of developing web applications in Haskell is the long recompilation cycle. While working on code, it is convenient to have an editor open in one window and a browser open in another. When making changes to your Haskell code, it is nice to be able to immediately flip to your browser and interact with the updated web application. However,…

Nix Derivation for fast.ai Course

Nix Derivation for fast.ai Course 2019-03-16 I have created a Nix derivation for a Jupyter environment for the fast.ai Practical Deep Learning for Coders v3 course . This provides a Python environment from within Jupyter with the necessary libraries to go through the fast.ai course, including fastai, pytorch, numpy, matplotlib, etc. It is also setup to use CUDA. I won't reproduce the Nix…

PlayStation 3/4 Controller Over Bluetooth on NixOS

PlayStation 3/4 Controller Over Bluetooth on NixOS 2018-12-20 This blog post explains how to setup a PlayStation 3 or PlayStation 4 controller so it can be used over Bluetooth on NixOS. This uses a NixOS package called bluezFull . Intro I wanted to use my PlayStation 3 controllers over Bluetooth to play games on NixOS. NixOS's bluez package originally didn't have support for the PlayStation 3 and…

Termonad: A Terminal Emulator Configurable in Haskell

Termonad: A Terminal Emulator Configurable in Haskell 2018-11-15 Over the last couple months I've been working on a terminal emulator configurable in Haskell: Termonad . Termonad is similar to other popular terminal emulators, but it is completely configurable in Haskell. It aims to be the "XMonad of terminal emulators". Termonad is aimed at Haskellers who want a highly configurable terminal…

Japanese on NixOS

Japanese on NixOS 2018-10-01 Setting up NixOS to use Japanese isn't as straight-forward as it is on other distros. In this blog post I describe the settings needed to get everything to work smoothly. First, I explain the options that need to be added to your /etc/nixos/configuration.nix file. After that, I list a few other necessary system settings. If you follow these instructions, you should…

How to get into Machine Learning for a Haskeller

How to get into Machine Learning for a Haskeller 2018-08-21 I've been interested in Haskell for about 5 years now. I've been using it professionally for about 3 years. Most of the work I've done so far has been web-related. A large part has been writing web application backends in Haskell. I really enjoy using Haskell as a programming language, but I would like to expand my skill set. When looking…

Install VirtualBox Oracle Extension Pack on NixOS

Install VirtualBox Oracle Extension Pack on NixOS 2018-08-19 A couple months ago I posted an article about how to install VirtualBox on NixOS 18.03. I recently sent a PR fixing the situation with installing the VirtualBox Oracle Extension Pack. The instructions for using the Extension Pack will be slightly different for the next version of NixOS (which should be 18.09). Enabling VirtualBox will be…

Steps for Releasing a Haskell Package to Hackage

Steps for Releasing a Haskell Package to Hackage 2018-07-16 Releasing a new version of a Haskell package to Hackage requires quite a few steps. I wanted to make a list of the steps here on my blog so that it is easy for people to refer to them when trying make a new release of a package. It is better to have a simple checklist to follow than to have to remember all the steps each time. 1 The steps…

Functional Sapporo

Functional Sapporo 2018-06-25 I am planning on holding a functional programming meetup in Sapporo, Japan. It will be on Saturday, June 30th from 1:00 PM to 5:00 PM. Click here to find out the location, as well as sign-up. If you're interested in functional programming, but can't make this event, I'm hoping to hold a similar event once a month, so feel free to sign-up to the Functional Sapporo…

CLI Program for Pretty-Printing Haskell Datatypes

CLI Program for Pretty-Printing Haskell Datatypes 2018-03-02 About a year ago I released the pretty-simple Haskell library. pretty-simple gives an easy way to pretty-print Haskell datatypes. It is easier to use and has more features than other pretty-printing libraries. One drawback of pretty-simple is that if you forget to use it, you're basically out of luck. You need to go back and re-print the…

Install VirtualBox on NixOS

Install VirtualBox on NixOS 2018-02-24 I use VirtualBox to do almost all of my development. I rarely install programming environments on my host machine. I have recently switched to using NixOS, so I needed to figure out how to install VirtualBox on NixOS. Installing VirtualBox is relatively straight-forward on NixOS, but there are a few things to watch out for if you want to use the Oracle…

Show all packages installed in NixOS

Show all packages installed in NixOS 2018-02-20 I recently came across a great answer on Stack Overflow explaining how to show all packages installed on your system in NixOS. In this article I will add a little more explanation to the different commands used. Showing installed packages The difficulty of showing all installed packages on NixOS is that there are multiple ways to install packages:…

Use packages from nixos-unstable in configuration.nix without nix-channel

Use packages from nixos-unstable in configuration.nix without nix-channel 2018-02-18 I recently installed NixOS on one of my laptops. One of the packages I wanted to install, k2pdfopt , was not available in the nixos-stable 1 channel. I needed to install it from nixos-unstable . When looking up how to install packages from nixos-unstable in /etc/nixos/configuration.nix , most instructions…

XMonad and Taffybar on NixOS using Stack

XMonad and Taffybar on NixOS using Stack 2018-02-16 I recently installed NixOS on one of my laptops. I setup XMonad and Taffybar , using stack to compile them. This is somewhat unconventional on NixOS, so I wanted to write a blog post detailing how I did it. These steps are aimed for people using NixOS, but they should work for any Linux distro with slight modification. XMonad on NixOS the normal…

servant-rawm

servant-rawm 2017-10-15 I have recently released a new Haskell package called servant-rawm . It allows embedding a raw WAI Application inside a Servant API. How does it work? Below I will give a simple example of how servant-rawm can be used. Imagine we have an API that looks like the following: import Servant ((:>)) import Servant.RawM ( RawM ) type Api = "serve-directory-example" :> RawM This…

GHC Warnings You Should Use in Addition to -Wall

GHC Warnings You Should Use in Addition to -Wall 2017-07-28 Update : The following article recommends using the -Wincomplete-uni-patterns and -Wincomplete-record-updates warning flags in addition to -Wall . However, a recent GHC Proposal was accepted that adds these flags into -Wall ! This blog post is credited in the proposal! In future versions of GHC, you won't have to worry about adding…

k2pdfopt for Reading Academic Papers on a Kindle

k2pdfopt for Reading Academic Papers on a Kindle 2017-07-21 Kindles are very nice e-readers because of the e-ink technology. There is less eye-strain than with a normal tablet. Kindles are nice for reading books specifically formatted for smaller screens, but they do not handle larger PDFs like research papers very well. The small screen size makes it awkward. However, there is an application…

highlight CLI application

highlight CLI application 2017-07-01 I created a command line application for highlighting parts of a file that match a given regex. Imagine the following file file-cats exists: \ The highlight command can be used to highlight the regex cat : \ When highlighting matches from multiple files, the filenames will be colored and striped: \ There is also an additional command hrep that acts exactly like…

Type Signatures in Instances in PureScript

Type Signatures in Instances in PureScript 2017-06-05 Recently I sent a pull request to the PureScript compiler enabling type signatures on methods in instances. This is similar to the functionality enabled by the InstanceSigs extension in Haskell. This functionality should be available in the next version of the PureScript compiler, 0.11.5. This article is for PureScripters who may not be…

servant-checked-exceptions

servant-checked-exceptions 2017-05-10 I have been using Servant for about two years now. I really like it. It's easy to use and type-safe. If I need to write a JSON API in Haskell, Servant is almost always my first choice. However, one thing I have always wanted is an easy way to handle errors in my server handlers. The ideal solution would have the following features: Specify not only success…