Skip to content

Instantly share code, notes, and snippets.

if ! nix-shell -p hello --run 'hello' &>/dev/null; then
# The following condition addresses https://github.com/NixOS/nix/issues/2523
if [[ "$(uname -s)" == "Darwin" ]] && [[ "$( grep -E 'nix-daemon.*fork()' /var/log/system.log | wc -l )" -gt 0 ]]; then
>&2 echo ">>> I ran into a Mac-specific bug (https://github.com/NixOS/nix/issues/2523) and I'm applying the workaround automatically for it."
sudo launchctl remove org.nixos.nix-daemon
sed \
-e "s:<key>Program</key>:<key>EnvironmentVariables</key><dict><key>OBJC_DISABLE_INITIALIZE_FORK_SAFETY</key><string>YES</string></dict>&:g" \
/Library/LaunchDaemons/org.nixos.nix-daemon.plist > /tmp/org.nixos.nix-daemon.plist
sudo mv /tmp/org.nixos.nix-daemon.plist /Library/LaunchDaemons/org.nixos.nix-daemon.plist
sudo chown root: /Library/LaunchDaemons/org.nixos.nix-daemon.plist
bazel-watcher
boringssl
cadvisor
cide
cni-plugins
deepin.dbus-factory
deepin.dde-api
deepin.dde-daemon
deepin.deepin-desktop-base
deepin.deepin-desktop-schemas

Keybase proof

I hereby claim:

  • I am kalbasit on github.
  • I am ylcodes (https://keybase.io/ylcodes) on keybase.
  • I have a public key ASAYUIH9miRsfDVHaDMbY6r697SH1Kz-o86NFt-c5oEfXgo

To claim this, I am signing this object:

nix-env -f '<nixpkgs>' -iE '(terraform.withPlugins (ps: [
ps.aws
ps.github
ps.null
ps.template
]))'
@kalbasit
kalbasit / pcscd.log
Created January 24, 2019 05:13
YubiKey 5 issues
Jan 23 21:12:30 hades systemd[1]: Started PCSC-Lite daemon.
Jan 23 21:12:30 hades pcscd[29501]: 00000000 ifdhandler.c:150:CreateChannelByNameOrChannel() failed
Jan 23 21:12:30 hades pcscd[29501]: 00000017 readerfactory.c:1106:RFInitializeReader() Open Port 0x200000 Failed (usb:1050/0406:libudev:0:/dev/bus/usb/001/010)
Jan 23 21:12:30 hades pcscd[29501]: 00000025 readerfactory.c:376:RFAddReader() Yubico Yubikey 4 U2F+CCID init failed.
Jan 23 21:12:30 hades pcscd[29501]: 00128627 ifdhandler.c:150:CreateChannelByNameOrChannel() failed
Jan 23 21:12:30 hades pcscd[29501]: 00000007 readerfactory.c:1106:RFInitializeReader() Open Port 0x200001 Failed (usb:0a5c/5832:libudev:0:/dev/bus/usb/001/004)
Jan 23 21:12:30 hades pcscd[29501]: 00000001 readerfactory.c:376:RFAddReader() Broadcom Corp 5880 [Broadcom USH] (0123456789ABCD) init failed.
resources = {
ec2SecurityGroups = {
ssh-in = {
inherit accessKeyId region;
description = "Allow incoming SSH connection from anywhere";
rules = [
{ fromPort = 22; toPort = 22; protocol = "tcp"; sourceIp = "0.0.0.0/0"; }
# TODO(low): https://github.com/NixOS/nixops/issues/683
# {fromPort = 22; toPort = 22; protocol = "tcp"; sourceIp = "::/0"; }
resources = {
ec2SecurityGroups = rec {
ssh-in = {
inherit accessKeyId region;
description = "Allow incoming SSH connection from anywhere";
rules = [
{ fromPort = 22; toPort = 22; protocol = "tcp"; sourceIp = "0.0.0.0/0"; }
# TODO(low): https://github.com/NixOS/nixops/issues/683
# {fromPort = 22; toPort = 22; protocol = "tcp"; sourceIp = "::/0"; }
@kalbasit
kalbasit / aws.nix
Last active January 16, 2019 04:34
{
resources.ec2SecurityGroups.ssh-in = {
inherit accessKeyId region;
description = "Allow incoming SSH connection from anywhere";
rules = [
{ fromPort = 22; toPort = 22; protocol = "tcp"; sourceIp = "0.0.0.0/0"; }
# TODO(low): https://github.com/NixOS/nixops/issues/683
# {fromPort = 22; toPort = 22; protocol = "tcp"; sourceIp = "::/0"; }
];
};
λ  nix repl
Welcome to Nix version 2.1.3. Type :? for help.
nix-repl> pkgs = import <nixpkgs> {}
nix-repl> transform = with pkgs; with pkgs.lib; let transformType = with types; let list3 = elemType: addCheck (listOf elemType) (l: length l != 3); in uniq (list3 (list3 float)); in mkOption { type = transformType; description = "3×3 matrix of floating point numbers"; default = []; example = [ [ 0.6 0.0 0.0 ] [ 0.0 0.6 0.0 ] [ 0.0 0.0 1.0 ] ]; }
# neither A nor B is working. I don't see this in the activation script or under `result/etc/`
{
# A
system.activationScripts = {
nixpkgsPin = {
text = ''
ln -sfn ${pinnedNixpkgs} /etc/nixpkgs
'';
deps = [];