### List Infusion Identity Law Violation Example Source: https://github.com/amjoseph/infuse.nix/blob/trunk/doc/design-notes-on-missing-attributes.md Illustrates a scenario where the functor approach for missing attributes violates the left identity rule for list infusions, as two seemingly identical infusions produce different results. ```nix { y = [ { __init = 7; } ]; } { y = [ [] { __init = 7; } ]; } ``` -------------------------------- ### List Merging with infuse Source: https://github.com/amjoseph/infuse.nix/blob/trunk/README.md Illustrates how infuse processes lists by applying functions sequentially, similar to lib.pipe. ```nix infuse { x = 3; } [ { x = x: x*x; } (fred: fred.x+1) ] == 10 ``` ```nix infuse { bob.fred.x = 3; } { bob.fred = [ { x = x: x*x; } (fred: fred.x+1) ]; } == { bob.fred = 10; } ``` -------------------------------- ### Standard Nix Override vs. infuse Source: https://github.com/amjoseph/infuse.nix/blob/trunk/README.md Compares the verbosity of standard Nix overrides with the conciseness of infuse for modifying package attributes. ```nix final: prev: { python311 = prev.python311.override (previousArgs: previousArgs // { packageOverrides = lib.composeExtensions (previousArgs.packageOverrides or {}) (final: prev: { dnspython = prev.dnspython.overrideAttrs(previousAttrs: { doCheck = false; }); }); }); xrdp = (prev.xrdp.override { systemd = null; }) .overrideAttrs(previousAttrs: { env = previousAttrs.env or {} // { NIX_CFLAGS_COMPILE = (previousAttrs.env.NIX_CFLAGS_COMPILE or "") + " -w"; }; passthru = previousAttrs.passthru or {} // { xorgxrdp = previousAttrs.passthru.xorgxrdp .overrideAttrs (previousAttrs: { configureFlags = (previousAttrs.configureFlags or []) ++ [ "--without-fuse" ]; }); }; }); } ``` ```nix final: prev: infuse prev { python311.__input.packageOverrides.__overlay.dnspython.__output.doCheck.__assign = false; xrdp.__input.systemd.__assign = null; xrdp.__output.env.NIX_CFLAGS_COMPILE.__append = " -w"; xrdp.__output.passthru.xorgxrdp.__output.configureFlags.__append = ["--without-fuse"]; } ``` -------------------------------- ### Attribute Set Merging with infuse Source: https://github.com/amjoseph/infuse.nix/blob/trunk/README.md Demonstrates how infuse merges attribute sets, preserving existing keys by default unless explicitly overridden. ```nix { bob.fred = 3; } // { bob.jill = 4; } == { bob.jill = 4; } ``` ```nix infuse { bob.fred = 3; } { bob.jill = _: 4; } == { bob.fred = 3; bob.jill = 4; } ``` ```nix infuse { bob.fred = 3; } { bob = _: { jill = 4; }; } == { bob.jill = 4; } ``` -------------------------------- ### Custom Sugar Definition and Usage Source: https://github.com/amjoseph/infuse.nix/blob/trunk/README.md Shows how to define and use custom double-underscore ('sugar') attributes for specialized merging operations like string concatenation. ```nix let infuse = import ../default.nix { inherit lib; sugars = infuse.v1.default-sugars ++ lib.attrsToList { __concatStringsSep = path: infusion: target: lib.strings.concatStringsSep infusion target; }; }; in infuse.v1.infuse { fred = [ "woo" "hoo" ]; } { fred.__concatStringsSep = "-"; } == { fred = "woo-hoo"; } ``` -------------------------------- ### Nix Abbreviations for Infuse Diagram Source: https://github.com/amjoseph/infuse.nix/blob/trunk/doc/commutative-diagram.md Defines abbreviations used in the commutative diagram to represent the result of applying 'flip infuse' to Nix values. ```nix let foo' = flip infuse foo bar' = flip infuse bar baz' = flip infuse baz in ``` -------------------------------- ### Functor Representation for Missing Attributes Source: https://github.com/amjoseph/infuse.nix/blob/trunk/doc/design-notes-on-missing-attributes.md Represents functions that can tolerate or are sensitive to a missing previous value using a functor structure. This approach can invalidate eta-expansion and the identity function's role in composition. ```nix { __functor = ... } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.