Skip to content

Instantly share code, notes, and snippets.

View tfc's full-sized avatar

Jacek Galowicz tfc

View GitHub Profile
@tfc
tfc / hydra_no_restrict.patch
Created October 21, 2018 07:58
hydra patch for relaxing the evaluation restriction
diff --git a/src/hydra-eval-jobs/hydra-eval-jobs.cc b/src/hydra-eval-jobs/hydra-eval-jobs.cc
--- a/src/hydra-eval-jobs/hydra-eval-jobs.cc
+++ b/src/hydra-eval-jobs/hydra-eval-jobs.cc
@@ -281,7 +281,7 @@ int main(int argc, char * * argv)
/* Prevent access to paths outside of the Nix search path and
to the environment. */
- evalSettings.restrictEval = true;
+ evalSettings.restrictEval = false;
@tfc
tfc / output.log
Created November 2, 2018 16:18
Output of "nix-build $nixpkgs/nixos/tests/login.nix"
these derivations will be built:
/nix/store/bk9gda8micmmz13i19gf82y7l2ywlz0k-vm-test-run-login.drv
building '/nix/store/bk9gda8micmmz13i19gf82y7l2ywlz0k-vm-test-run-login.drv'...
starting VDE switch for network 1
running the VM test script
machine: waiting for unit ‘multi-user.target’
machine: running command: systemctl --no-pager show "multi-user.target"
machine: waiting for the VM to finish booting
machine: starting vm
machine# Formatting '/tmp/nix-build-vm-test-run-login.drv-0/vm-state-machine/machine.qcow2', fmt=qcow2 size=536870912 cluster_size=65536 lazy_refcounts=off refcount_bits=16
tup = pkgs.tup.overrideAttrs (old: rec {
version = "0.7.8";
src = pkgs.fetchFromGitHub {
owner = "gittup";
repo = "tup";
rev = "v${version}";
sha256 = "07dmz712zbs5kayf98kywp7blssgh0y2gc1623jbsynmqwi77mcb";
};
TUP_SERVER = "ldpreload";
buildPhase = "./build.sh";
#include <iostream>
#include <initializer_list>
#include <string>
template <typename ... Ts>
auto assignment_helper(Ts& ... ts) {
return [&] (const auto& ... xs) {
std::initializer_list<int>{(ts = xs, 0)...};
};
}
@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
@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
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 / 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
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 / 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 #-}