Skip to content

Instantly share code, notes, and snippets.

#! zsh
NIX_EXECUTING_SHELL=$(readlink /proc/nope/exe)
echo \"$NIX_EXECUTING_SHELL\"
if [[ -z "$NIX_EXECUTING_SHELL" ]] && command -v lsof &> /dev/null
then
echo "no proc"
NIX_EXECUTING_SHELL=$(lsof -p $$ | awk '$4=="txt" {print $9}' | head -n 1)
fi
echo $NIX_EXECUTING_SHELL
@chisui
chisui / Some.hs
Last active June 23, 2021 11:09
user-specified instance
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE ConstraintKinds #-}
module Some where
import Data.Typeable
@chisui
chisui / log
Created May 3, 2021 21:04
home-manager thunderbird error
error: while evaluating the attribute 'shellHook' of the derivation 'nmt-run-thunderbird-message-filters' at /nix/store/md67ik7cjybdlnn7rsjzbyvckq50q5q7-nixpkgs-21.05pre283554.d9448c95c5d/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:197:11:
while evaluating 'reportResult' at /nix/store/ajjl6wcdgcd8syidyhqvvqc4i7fqqpn9-source/default.nix:43:18, called from /nix/store/ajjl6wcdgcd8syidyhqvvqc4i7fqqpn9-source/default.nix:55:34:
while evaluating the attribute 'success' at undefined position:
while evaluating 'g' at /nix/store/md67ik7cjybdlnn7rsjzbyvckq50q5q7-nixpkgs-21.05pre283554.d9448c95c5d/nixpkgs/lib/attrsets.nix:294:19, called from undefined position:
while evaluating anonymous function at /nix/store/md67ik7cjybdlnn7rsjzbyvckq50q5q7-nixpkgs-21.05pre283554.d9448c95c5d/nixpkgs/lib/modules.nix:139:72, called from /nix/store/md67ik7cjybdlnn7rsjzbyvckq50q5q7-nixpkgs-21.05pre283554.d9448c95c5d/nixpkgs/lib/attrsets.nix:297:20:
while evaluating the attribute 'value' at /nix/store/md67ik7cjybdlnn7rsjzbyvckq50q5q7-n
@chisui
chisui / .ghci
Created December 19, 2020 16:20
:set prompt "\ESC[44m\ESC[1;37m λ \ESC[m\ESC[34m\ESC[m "
:set prompt-cont " | "
:set -XDataKinds
:set -XFlexibleContexts
:set -XGADTs
:set -XLambdaCase
:set -XPolyKinds
:set -XRankNTypes
:set -XScopedTypeVariables
@chisui
chisui / .gitignore
Last active October 24, 2019 17:11
mk-pandoc issue-02
result
@chisui
chisui / example.nix
Last active October 16, 2018 10:45
nix file that provides a way to inject zsh dotfiles inside of a `shellHook`
{ pkgs ? import <nixpkgs> {}
, zdotdir ? import (builtins.fetchurl {
url = "https://gist.githubusercontent.com/chisui/bba90fccc930f614743dc259fbadae6d/raw/4108222addc1d646c1b0a6d12130083e2219ad28/zdotdir.nix";
}) { inherit pkgs; }
}:
pkgs.stdenv.mkDerivation {
name = "withZshEnv";
shellHook = zdotdir {
zshenv = ''
alias taco=echo\ "tacos!";
@chisui
chisui / nix-watch
Last active August 30, 2018 09:48
watch script for nix
#! /bin/sh
SRC=$(nix-instantiate --eval $@ -A src)
echo "watching $SRC"
ack -f $SRC | entr nix-build $@
@chisui
chisui / loading.ahk
Last active July 9, 2018 13:44
Hipchat autohotkey loading bar
#SingleInstance force
^+l::
SetKeyDelay ,-1
Send /me is thinking 00`% [░░░░░░░░░░]
Sleep 2
Send {Enter}
sleep, 250
Loop, 100 {
Tail := % 11 - (A_Index / 10)
Head := % Ceil(A_Index / 10) - 1
@chisui
chisui / agnoster-nix.zsh-theme
Last active January 11, 2023 01:51
zsh agonoster theme with nix-shell
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
# Make sure you have a recent version: the code points that Powerline