Skip to content

Instantly share code, notes, and snippets.

{ projectRoot ? projectArgs.src
, materializedRelative ? "nix/materialized"
, systems
, projectArgs ? null
, projectArgsBySystem ? _: projectArgs
, lib ? pkgs.lib
, pkgsBySystem ? system:
if system == pkgs.pkgsBuildBuild.system
then pkgs
else import pkgs.path {
@duairc
duairc / net.nix
Last active April 16, 2024 00:28
IP address arithmetic and validation in Nix
{ lib ? null, ... }:
let
net = {
ip = {
# add :: (ip | mac | integer) -> ip -> ip
#
# Examples:
@edolstra
edolstra / nix-lang.md
Last active May 2, 2024 23:39
Nix language changes

This document contains some ideas for additions to the Nix language.

Motivation

The Nix package manager, Nixpkgs and NixOS currently have several problems:

  • Poor discoverability of package options. Package functions have function arguments like enableFoo, but there is no way for the Nix UI to discover them, let alone to provide programmatic ways to
@ChristianSiegert
ChristianSiegert / challenge-2012-03-23.go
Created June 17, 2012 11:24
Solution written in Go for challenge 2012-03-23 on ProgrammingPraxis.com
// Exercise from: http://programmingpraxis.com/2012/03/23/base-26-arithmetic/
// Exercise: Write a function that takes two base-26 numbers in which digits are represented by letters with A=0, B=1, … Z=25 and returns their product using the same notation. As an example, CSGHJ × CBA = FNEUZJA.
package main
import (
"fmt"
"math"
)