Skip to content

Instantly share code, notes, and snippets.

View infinisil's full-sized avatar

Silvan Mosberger infinisil

  • Tweag
  • Switzerland
View GitHub Profile
@infinisil
infinisil / shards.nix
Created May 11, 2023 20:12
Distribution of shards in Nixpkgs for RFC 140
{
system ? builtins.currentSystem,
nixpkgs ? fetchTarball {
url = "https://github.com/NixOS/nixpkgs/tarball/6948ef4deff7a72ebe5242244bd3730e8542b925";
sha256 = "1fw8vlbcxr3kw96rrjlw94zhbjs3a32dcnvav19cvniwlbhf2jsh";
},
}:
let
pkgs = import nixpkgs {
inherit system;
@infinisil
infinisil / count.nix
Last active May 11, 2023 18:55
The number of attributes in Nixpkgs that are affected by RFC 140
{
system ? builtins.currentSystem,
nixpkgs ? fetchTarball {
url = "https://github.com/NixOS/nixpkgs/tarball/6948ef4deff7a72ebe5242244bd3730e8542b925";
sha256 = "1fw8vlbcxr3kw96rrjlw94zhbjs3a32dcnvav19cvniwlbhf2jsh";
},
}:
let
pkgs = import nixpkgs {
inherit system;
Warning: File "./pkgs/servers/polaris/node-composition.nix" on line 3 refers to Nix search path, ignoring it: "<nixpkgs>"
Warning: File "./pkgs/data/fonts/iosevka/node-composition.nix" on line 3 refers to Nix search path, ignoring it: "<nixpkgs>"
Warning: File "./nixos/release.nix" on line 13 refers to an ignored path, ignoring it: "../.version"
Warning: File "./pkgs/development/tools/poetry2nix/poetry2nix/overrides/default.nix" on line 1 refers to Nix search path, ignoring it: "<nixpkgs>"
Warning: File "./nixos/tests/cassandra.nix" on line 7 refers to non-existent path, ignoring it "./cassandra-jmx-roles"
Warning: File "./pkgs/applications/editors/jupyter-kernels/clojupyter/deps.nix" on line 2 refers to Nix search path, ignoring it: "<nixpkgs>"
Warning: File "./pkgs/applications/emulators/wine/sources.nix" on line 1 refers to Nix search path, ignoring it: "<nixpkgs>"
Warning: File "./pkgs/build-support/icon-conv-tools/default.nix" on line 7 refers to a directory that doesn't contain a default.nix file, ignor
❯ binwalk /run/current-system/initrd
DECIMAL HEXADECIMAL DESCRIPTION
--------------------------------------------------------------------------------
0 0x0 ASCII cpio archive (SVR4 with no CRC), file name: "kernel/x86/microcode/GenuineIntel.bin", file name length: "0x00000026", file size: "0x004e7c00"
5143700 0x4E7C94 ASCII cpio archive (SVR4 with no CRC), file name: "TRAILER!!!", file name length: "0x0000000b", file size: "0x00000000"
5155914 0x4EAC4A xz compressed data
5298545 0x50D971 ASCII cpio archive (SVR4 with no CRC), file name: "nix/store/gwgzkx31yng8fji52a49rm1kg6bvck7r-linux-5.18.19-modules-shrunk/lib/firmware/i915/adls_dmc_ver2_01.bin.xz", file name length: "0x00000072", file size: "0x000010bc"
5303053 0x50EB0D ASCII cpio archive (SVR4 with no CRC), file name: "nix/store/gwgzkx31yng8fji52a49rm1kg6bvck7r-linux-5.18.19-modules-shrunk/lib/firmware/i915/bxt_dmc_ver1_07.bin.xz", file name length: "0x00000071", file s
❯ dd if=/run/current-system/initrd skip=0 | cpio -t
kernel/x86/microcode/GenuineIntel.bin
10047 blocks
❯ dd if=/run/current-system/initrd skip=10047 | cpio -t
cpio: Malformed number (/`,
cpio: Malformed number /`,
cpio: Malformed number /`,
cpio: Malformed number `,
cpio: Malformed number `,
l: 1547
s: 1305
g: 1219
p: 1174
c: 1166
m: 976
a: 808
t: 739
d: 668
f: 635
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE EmptyCase #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeOperators #-}
module Main where
with import <nixpkgs/lib>;
let
# toHex :: Word4 -> String
toHex = elemAt (stringToCharacters "0123456789abcdef");
bytes = builtins.readFile ./bytes;
# Mapping from bytes to their values
mapping = listToAttrs (map (number: {
name = substring (number - 1) 1 bytes;
value = number;

Nixpkgs Pivots

We have a number of problems that currently require full rebuilds of nixpkgs:

  • glibc needs to find third-party nss modules
  • cacerts needs to contain custom CA's from enterprises
  • tzdata just changed frequently
  • locales

Interestingly, Nix's deep pinning of cacerts and tzdata gets in the way of Nix's promise of packages working over the long term in an archival sense:

Dec 07 22:17:18 vario systemd[1]: Stopping Flox...
Dec 07 22:17:19 vario floxd[1056]: level=info msg="received SIGTERM"
Dec 07 22:17:19 vario floxd[1056]: level=info msg=exiting
Dec 07 22:17:19 vario floxd[1011]: 22:17:19.157 icfs.fuse: caught signo=15 (SIGTERM), code=0 (SI_USER), pid=2442, uid=0 (root)
Dec 07 22:17:19 vario floxd[1011]: 22:17:19.193 icfs.util: notify: pthread_kill: [Errno 3] No such process: (140697732802304, 10)
Dec 07 22:17:19 vario floxadm[2401]: floxadm stop complete
Dec 07 22:17:19 vario systemd[1]: flox.service: Succeeded.
Dec 07 22:17:19 vario systemd[1]: Stopped Flox.
Dec 07 22:17:19 vario systemd[1]: flox.service: Consumed 568ms CPU time, received 795B IP traffic, sent 976B IP traffic.
Dec 07 22:17:20 vario systemd[1]: flox.service: Unit cannot be reloaded because it is inactive.