Skip to content

Instantly share code, notes, and snippets.

View mbbx6spp's full-sized avatar
:shipit:
emacsclient -nw README.md

Susan Potter mbbx6spp

:shipit:
emacsclient -nw README.md
View GitHub Profile
@mbbx6spp
mbbx6spp / nixos-hydra.org
Created November 29, 2018 16:59
Basic intro to NixOS project's Hydra

Hydra On-boarding

Hydra: What is it?

@mbbx6spp
mbbx6spp / nix-yarn2nix-bundix-packaging.org
Created November 15, 2018 21:41
Quick notes on what worked to package a frontend yarn JS project and how to update gems in an existing Ruby project using bundix for Nix based configuration.

Random Nix Project Packaging (yarn2nix, bundix -l)

Setting up a nodejs project via yarn2nix in Nix for existing project

  • nix-shell -p yarn yarn2nix nodejs
  • copied the Nix skeleton files in place (./z/etc/lib/{version,nixpkgs}.nix ./z/etc/overlays/default.nix)
  • generated package.nix using yarn2nix
  • add these Nix expressions in the root
@mbbx6spp
mbbx6spp / Profunctors.hs
Last active May 12, 2019 18:55
Doodle to help explain Profunctors and Yoneda embedding application.
{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
module Profunctors where
@mbbx6spp
mbbx6spp / .00readme.org
Last active May 26, 2024 22:53
A caching and persistent Nix shell with direnv

Cached and Persistent Nix shell with direnv integration

Problem being solved

  • the default direnv Nix integration from projects loads a Nix shell every new terminal or every time shell.nix and/or default.nix changes. On larger projects with a lot of Nix shell dependencies, that can cause the terminal to take more than 6 seconds to load, which significantly degrades the developer experience (DX).
  • when a developer garbage collects in their Nix store, often the Nix shell dependencies are deleted also which causes a slow start the next time the project’s Nix shell is requested, also degrading developer experience (DX).

Solution outline

  • on first Nix shell load, the Nix shell is evaluated fully such that direnv dumps the environment from the spawn Nix shell process

The following shows that the latest nixos-unstable channel has all the transitive dependencies for haskellPackages.lens available for fetching from the binary cache:

$ nix-env -f https://releases.nixos.org/nixos/unstable/nixos-18.09pre149415.8395f9aa85e/nixexprs.tar.xz \
  -iA haskellPackages.lens --dry-run
(dry run; not doing anything)
installing 'lens-4.16.1'
these paths will be fetched (136.28 MiB download, 1899.17 MiB unpacked):
@mbbx6spp
mbbx6spp / nixos-installer-ideas.org
Last active July 15, 2018 17:04
Some thoughts on improving the NixOS Installation experience

NixOS Installer Ideas

Background

I recently installed NixOS from scratch on a new device and since I haven’t needed to do this in 1.5 years I forgot the sequence needed and made a whole bunch of mistakes.

It would be nice to be able to improve the experience and guide the user. On the other end of the installer UX are assisted installers which often use insecure defaults (e.g. for partitioning, or default passwds, etc).

nixos-help is potentially a valuable tool here but the documentation could use some attention in terms of organization, flow, and ensuring the documentation is updated to the current release of NixOS it is shipped with.

@mbbx6spp
mbbx6spp / tlatoolbox.nix
Last active March 17, 2018 05:21
nixpkgs ships with a tlaplus package which contains some standalone tools like tla2tex and tla2any etc but for the entire IDE I had to come up with my own package. I haven't submitted it upstream yet as the layout of the package dir is entirely wrong so I need to work on that first but it works for far.
{ stdenv, fetchurl, gtk2, xorg, patchelf, unzip, makeWrapper, jre }:
let version = "1.5.6"; in
stdenv.mkDerivation rec {
inherit version;
name = "TLAToolBox-${version}";
src = fetchurl {
url = "https://tla.msr-inria.inria.fr/tlatoolbox/products/TLAToolbox-${version}-linux.gtk.x86_64.zip";
sha256 = "1b5sf4d7sv0x1hg4f1if3q7wzsi09dr8fv71qfagj8m25zrh3lvj";
};
@mbbx6spp
mbbx6spp / config
Created November 22, 2017 16:19
Blocked SSH port, GitHub workaround
# Put in your ~/.ssh/config
### Problem
#
# You are on a public WiFi network that blocks SSH ports but you don't want to switch
# to pushing your Github changes to GH remotes via HTTPS nor do you want to change the
# remote hostname in all your repos.
Host github.com
Hostname ssh.github.com
@mbbx6spp
mbbx6spp / FooBarBaz.hs
Created September 5, 2017 19:19
Exercise about definition of combinator.
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE RankNTypes #-}
module FooBarBaz.Main
( compose3a
, compose3b
, compose3c
, main
) where
{-
@mbbx6spp
mbbx6spp / cors-validation
Last active May 10, 2017 19:48
CORs cURL check
#!/usr/bin/env bash
function usage() {
>&2 echo "Usage: $0 SOURCE_URL PROXY_URL"
}
function main() {
local -r source_url="${1}"
local -r proxy_url="${2}"
curl \