Skip to content

Instantly share code, notes, and snippets.

Robert Hensing roberth

View GitHub Profile
@roberth
roberth / FP workshop links.md
Last active December 8, 2016 20:15
Links for a Haskell workshop at Software Circus meetup 2016-12-09 Amsterdam

Keybase proof

I hereby claim:

To claim this, I am signing this object:

Intro

nix-shell is a tool unlike any other for working with project dependencies. However, so much more can be done! A lot of this can already be accomplished with nix-shell, so a simple approach might be to fix the flaws in nix-shell and leave the rest of the effort for the community to figure out. That's very modular, but doesn't improve the situation much beyond the status quo. In fact, solutions like IDEs and docker-compose currently provide better solutions for some of the problems (but are stuck in local optima).

Scope?

  • Build dependencies
  • Merge dependencies (buildEnv)
@roberth
roberth / nix-shell-bash-completion.nix
Last active June 27, 2018 17:10
Bash completion and more in nix-shell
pkgs.mkShell {
buildInputs = [...];
shellHook = ''
nixShellAddXdgDataDirs(){
local dirs="$(find $buildInputs -mindepth 1 -maxdepth 1 -path '*/share' -printf ':%p')"
dirs=''${dirs/:/}
export XDG_DATA_DIRS=''${XDG_DATA_DIRS:-}''${XDG_DATA_DIRS:+''${dirs:+:}}''${dirs}
}
nixShellAddXdgDataDirs
'';
@roberth
roberth / dhall-lenient.hs
Created July 1, 2018 20:39
Allow weird stuff when reading Dhall, like redundant fields
module LambdaCI.CLI.Config where
import Prelude()
import Protolude
import System.Directory
import qualified Data.Text.IO as T
import Dhall hiding (Text)
import Dhall.Pretty(prettyExpr, annToAnsiStyle)
@roberth
roberth / Gather.hs
Last active May 12, 2020 18:39
Parsing unordered things
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Gather where
import Protolude
-- | Fold over the outcomes of a type that has an 'Alternative'.
--
-- @Gather@ embodies two steps.
--
@roberth
roberth / Extras.hs
Created November 12, 2018 16:08
Katip higher order scribes
--| Didn't need this after all, but, at least conceptually, this is kind of nice.
module Katip.Extras where
import Protolude
import Data.IORef
import Katip
ioScribe :: IO Scribe
-> IO () -- ^ Finalizer, see 'scribeFinalizer'
@roberth
roberth / Gate.hs
Created November 26, 2018 17:55
Idea for stopping work gracefully
module Control.Concurrent.Extras.Gate where
import Protolude
import Data.IORef
import Control.Concurrent.STM
import Data.UUID
import qualified Data.UUID.V4 as UUID
import qualified Data.Map as M
-- | State of a multi-task process to help with graceful termination
@roberth
roberth / gist:9699dacf4286afb73f60a792e6ce64c3
Created April 10, 2019 13:03
Rebase with formatting change
git checkout feature-branch
git commit -m 'Buffer' --allow-empty
git rebase -i <origin/master or similar>
# uncomment buffer commit, reorder into
# pick Buffer
# <pick feature-branch commits>
git filter-branch --tree-filter './scripts/format-all' <origin/master or similar>..HEAD
# inspect the new Buffer commit and act accordingly
@roberth
roberth / service-private-nix-daemon.nix
Created May 22, 2019 09:38
arion draft private nix store daemon service
# Import this module from an arion service to enable the nix daemon.
{ pkgs, lib, ... }:
{
# ENABLING THIS WILL MOST LIKELY DAMAGE THE HOST.
# You're probably looking for service.useHostNixDaemon instead of this module.
service.useHostStore = lib.mkForce false; # DID YOU READ THE COMMENT?
nixos.configuration = { pkgs, lib, ...}: {