brewery
notashelf /
d272dc589e306e450d57d30218994ecfe45a6bd6

nixir

public

Import-resolving Nix IR plugin

Star0tarball
clone
ssh://git@git.notashelf.dev:33/notashelf/nixir.git
tests/select_or_default.nixNix16 lines384 B
1
# Test selection with 'or' default
2
let
3
  attrs = { a = 1; b = 2; };
4
in {
5
  # Attribute exists - should use value from attrs
6
  has_attr = attrs.a or 999;
7
8
  # Attribute doesn't exist - should use default
9
  missing_attr = attrs.c or 100;
10
11
  # Nested default expression
12
  nested = attrs.d or (attrs.a + attrs.b);
13
14
  # Default with literal
15
  with_string = attrs.name or "default_name";
16
}