Skip to content

Instantly share code, notes, and snippets.

View tfc's full-sized avatar

Jacek Galowicz tfc

View GitHub Profile
{ config, pkgs, lib, ... }:
let
cfg = config.installHello;
in
{
options = {
installHello.enable = lib.mkEnableOption "Some way to install GNU hello";
};
{ pkgs, config, ... }:
{
hardware.deviceTree.overlays = [
{ name = "dwc2"; dtboFile = /nix/store/6fanghkkwfa8wrcq0khhc0fvm7dym2w3-linux-5.10.17-1.20210303/dtbs/overlays/dwc2.dtbo; }
{
name = "dwc2-overlay";
dtsText = ''
/dts-v1/;
/plugin/;
#!/usr/bin/env bash
#productization: don't use <nixpkgs>
IFS='' read -r -d '' expression <<"EOF"
{ inputPath }:
let
pkgs = import <nixpkgs> {};
input = import inputPath;
pathString = builtins.foldl'
@tfc
tfc / Main.hs
Last active March 27, 2021 11:44
module Main where
import Control.Monad.Fix (MonadFix)
import Data.Text (Text)
import Reflex.Dom
data Tool = Tool { toolName :: Text } deriving (Eq, Show)
main :: IO ()
main = mainWidget bodyWidget
@tfc
tfc / generics-example.hs
Created March 19, 2021 21:34
convert ADTs to trees of maps
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MonoLocalBinds #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE UndecidableInstances #-}
nix-repl> :b pkgs.runCommandNoCC "foo" {} "touch $out"
[1 built, 0.0 MiB DL]
this derivation produced the following outputs:
out -> /nix/store/dyw8bl14y7rdp25qx2m7j4bk5rs3lrx0-foo
nix-repl> :b pkgs.runCommandNoCC "foo" { __structuredAttrs = true; } "touch $out"
builder for '/nix/store/hrzdfvwadb4hjazj2l1mlxkwzfis7ajv-foo.drv' failed with exit code 1; last 1 log lines:
/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh: line 1: /setup: No such file or directory
[0 built (1 failed)]
@tfc
tfc / remove_miui_bloatware.sh
Created October 18, 2019 08:08
Remove most bloatware from a new Xiaomi telephone
#!/usr/bin/env bash
declare -a packages=(
com.amazon.appmanager
com.android.browser
com.android.calendar
com.android.chrome
com.android.deskclock
com.android.email
com.android.soundrecorder
Apr 17 09:31:38 jacekpad gnome-session[1173]: gnome-session-binary[1173]: WARNING: Could not get session id for session. Check that logind is properly installed and pam_systemd is getting used at login.
Apr 17 09:31:38 jacekpad gnome-session-binary[1173]: WARNING: Could not get session id for session. Check that logind is properly installed and pam_systemd is getting used at login.
Apr 17 09:31:38 jacekpad kernel: IPv6: ADDRCONF(NETDEV_UP): enp0s25: link is not ready
Apr 17 09:31:38 jacekpad nm-dispatcher[1004]: req:2 'connectivity-change': new request (2 scripts)
Apr 17 09:31:38 jacekpad nm-dispatcher[1004]: req:2 'connectivity-change': start running ordered scripts...
Apr 17 09:31:38 jacekpad kernel: IPv6: ADDRCONF(NETDEV_UP): wlp3s0: link is not ready
Apr 17 09:31:38 jacekpad gnome-session[1173]: gnome-session-binary[1173]: WARNING: Could not parse desktop file orca-autostart.desktop or it references a not found TryExec binary
Apr 17 09:31:38 jacekpad gnome-session-binary[1173]: WARNING: Could not parse de
@tfc
tfc / gist:3ec5f26ce4ea1db87ab0a41d78df183a
Created March 10, 2019 18:42
stack2nix error message on stackage LTS-13.11
$ stack2nix .
Ensuring git version is >= 2 ...
Ensuring cabal version is >= 2 ...
stack2nix: haskell.compiler.ghc864 failed to build via nix
CallStack (from HasCallStack):
error, called at src/Stack2nix/Util.hs:79:22 in stack2nix-0.2.1-9CeCKp69pLe5gkbivlNwUC:Stack2nix.Util
@tfc
tfc / crd.txt
Created February 6, 2019 11:42
Be [base, end) with base and end as unsigned integers,
a half open interval that contains all numbers from
base to end, not including end.
It is possible to divide this range into consecutive
chunks where:
- every chunk's size is a power of 2
- every chunk's base is evenly divisible by its size