Skip to content

Instantly share code, notes, and snippets.

let
cross = {
config = "arm-none-eabi";
libc = null;
};
pkgs = import <nixpkgs> { crossSystem = cross; };
in pkgs.buildEnv {
name = "arm-baremetal";
paths = [ pkgs.binutilsCross pkgs.gccCrossStageStatic ];
}
@joepie91
joepie91 / .md
Last active August 11, 2022 18:27
Nix package development notes

Some notes for tricky things I've run into while packaging things for Nix...

Searching through package expressions in the master branch of nixpkgs

There is a code search available here. It's considerably more useful and accurate than GitHub's search.

Creating your own package 'repository'

This article explains that.

@edolstra
edolstra / nix-ui.md
Last active February 2, 2024 23:31
Nix UI

General notes

  • nix-channel and ~/.nix-defexpr are gone. We'll use $NIX_PATH (or user environment specific overrides configured via nix set-path) to look up packages. Since $NIX_PATH supports URLs nowadays, this removes the need for channels: you can just set $NIX_PATH to e.g. https://nixos.org/channels/nixos-15.09/nixexprs.tar.xz and stay up to date automatically.

  • By default, packages are selected by attribute name, rather than the name attribute. Thus nix install hello is basically equivalent to nix-env -iA hello. The attribute name is recorded in the user environment manifest and used in upgrades. Thus (at least by default) hello won't be upgraded to helloVariant.

    @vcunat suggested making this an arbitrary Nix expression rather than an attrpath, e.g. firefox.override { enableFoo = true; }. However, such an expression would not have a key in the user environment, unlike an attrpath. Better to require an explicit flag for this.

TBD: How to deal with search path clashes.

@zimbatm
zimbatm / ssh-access.sh
Last active March 23, 2016 01:18
Use github to get authorized keys and start ssh
#!/bin/sh
#
# Fetches SSH keys from a github user and starts openssh
#
if [ -z "$user" ]; then
user=zimbatm
fi
mkdir -m 0700 -p "$HOME/.ssh"
@provegard
provegard / ssdp-test.py
Created December 5, 2011 21:52
Small SSDP server/client test in Python
#!/usr/bin/python
# Python program that can send out M-SEARCH messages using SSDP (in server
# mode), or listen for SSDP messages (in client mode).
import sys
from twisted.internet import reactor, task
from twisted.internet.protocol import DatagramProtocol
SSDP_ADDR = '239.255.255.250'