!pbdtvoHxUGLhcEvnlu:nixos.org

Exotic Nix Targets

341 Members
106 Servers

Load older messages


SenderMessageTime
10 Mar 2026
@amaan:amaanq.comamaan i was thinking exposing just "pageSize" would be less of a cognitive burden on users 06:05:11
@amaan:amaanq.comamaanand just adding a simple mapping06:05:23
@opna2608:matrix.orgPunashould be fine as well06:08:11
@amaan:amaanq.comamaancool, just updated the pr06:14:34
@opna2608:matrix.orgPuna

if we reject non-int values for pageSizeKiB with an assert + informative message, then supplying an unsupported number actually displays the supported options on my end (Lix)

       error: attribute '"32"' missing
       at /home/puna/Development/nixpkgs/pkgs/by-name/je/jemalloc/package.nix:76:10:
           75|         }
           76|         ."${toString pageSizeKiB}"
             |          ^
           77|     }"

       note: trace involved the following derivations:
       derivation 'jemalloc-5.3.0-unstable-2025-09-12'

       Did you mean one of 16, 4 or 64?

maybe useful, prolly overkill. thoughts?

06:26:57
@opna2608:matrix.orgPuna *

if we reject non-int values for pageSizeKiB with an assert + informative message at the start, then supplying an unsupported number actually displays the supported options on my end (Lix)

       error: attribute '"32"' missing
       at /home/puna/Development/nixpkgs/pkgs/by-name/je/jemalloc/package.nix:76:10:
           75|         }
           76|         ."${toString pageSizeKiB}"
             |          ^
           77|     }"

       note: trace involved the following derivations:
       derivation 'jemalloc-5.3.0-unstable-2025-09-12'

       Did you mean one of 16, 4 or 64?

maybe useful, prolly overkill. thoughts?

06:27:06
@amaan:amaanq.comamaanhuh i already get that w/o an assert though06:29:50
@amaan:amaanq.comamaan if i pass in 32, for example:

error:
       … while evaluating list element at index 2

       … while calling the 'toString' builtin
         at /home/amaanq/projects/nix/nixpkgs/pkgs/by-name/je/jemalloc/package.nix:70:7:
           69|     "--with-lg-page=${
           70|       toString
             |       ^
           71|         {

       error: attribute '"32"' missing
       at /home/amaanq/projects/nix/nixpkgs/pkgs/by-name/je/jemalloc/package.nix:71:9:
           70|       toString
           71|         {
             |         ^
           72|           "4" = 12;
       Did you mean one of 16, 4 or 64?
06:30:14
@opna2608:matrix.orgPunayes, but if you pass i.e. "bla", it doesn't provide any suggestions anymore06:31:12
@amaan:amaanq.comamaanoh yeah, that's a good point06:31:27
@opna2608:matrix.orgPuna

oh, way to go is prolly

let
  pageSizeMap = { 
    "4" = 12; 
    "16" = 14; 
    "64" = 16; 
  };  
in
assert lib.asserts.assertOneOf "pageSizeKiB" (toString pageSizeKiB) (
  builtins.attrNames pageSizeMap
);
06:32:23
@amaan:amaanq.comamaan i guess this works?

assert lib.asserts.assertMsg (builtins.isInt pageSizeKiB)
  "jemalloc: pageSizeKiB must be an integer (one of 4, 16, or 64), got: ${toString pageSizeKiB}";
06:32:41
@amaan:amaanq.comamaan i guess this works?

assert lib.asserts.assertMsg (builtins.isInt pageSizeKiB)
  "jemalloc: pageSizeKiB must be an integer (one of 4, 16, or 64), got: ${toString pageSizeKiB}";
06:32:45
@amaan:amaanq.comamaantho maybe yours is better06:32:54
@opna2608:matrix.orgPuna
       error: pageSizeKiB must be one of [
         "16"
         "4"
         "64"
       ], but is: "bla"
06:33:02
@amaan:amaanq.comamaanyea that is nice06:33:11
@amaan:amaanq.comamaan though, not a fan of how it renders the list on multiple lines in this case 06:35:27
@amaan:amaanq.comamaan
let
  pageSizeMap = {
    "4" = 12;
    "16" = 14;
    "64" = 16;
  };
in
assert lib.asserts.assertMsg
  (builtins.hasAttr (toString pageSizeKiB) pageSizeMap)
  "jemalloc: pageSizeKiB must be one of 4, 16, or 64, but is: ${toString pageSizeKiB}";

error: jemalloc: pageSizeKiB must be one of 4, 16, or 64, but is: bla

thoughts on this?
06:36:20
@opna2608:matrix.orgPunarequires manual updates of the supported values in the string06:37:16
@opna2608:matrix.orgPuna(if another supported size is ever added, that is)06:37:49
@amaan:amaanq.comamaan yeah true;

let
  pageSizeMap = {
    "4" = 12;
    "16" = 14;
    "64" = 16;
  };
in
assert lib.asserts.assertMsg (builtins.hasAttr (toString pageSizeKiB) pageSizeMap)
  "jemalloc: pageSizeKiB must be one of ${lib.concatStringsSep ", " (builtins.attrNames pageSizeMap)}, but is: ${toString pageSizeKiB}";

is a bit better then
06:38:14
@opna2608:matrix.orgPuna i think at that point you're just reinventing assertOneOf, but without the multi-line printing 😅 06:39:14
@amaan:amaanq.comamaantrue...then that's fine06:39:24
@amaan:amaanq.comamaan(i do like the presentation a little bit more but it's nbd)06:40:02
@amaan:amaanq.comamaanok, just pushed that06:41:54
@opna2608:matrix.orgPuna seems fine to me, but it's not my package. maybe someone else here who has an opinion on exposing jemalloc's page size setting like this?
https://github.com/NixOS/nixpkgs/pull/498442
07:54:27
@qyliss:fairydust.spaceAlyssa RossIMO we should always use the highest possible page size for jemalloc11:08:36
@qyliss:fairydust.spaceAlyssa Rossso this is a good change11:08:41
@opna2608:matrix.orgPuna kernel apparently also has a setting for 256k page size, CONFIG_PPC_256K_PAGES for POWER. says it needs patched binutils though. 11:27:53
@opna2608:matrix.orgPunanot something i wanna test 😅11:28:07

Show newer messages


Back to Room ListRoom Version: 6