Loading lib/attrsets.nix +1 −1 Original line number Diff line number Diff line Loading @@ -201,7 +201,7 @@ rec { # Type ``` attrsets.longestValidPathPrefix :: [String] -> Value -> [String] longestValidPathPrefix :: [String] -> Value -> [String] ``` # Examples Loading lib/debug.nix +79 −2 Original line number Diff line number Diff line Loading @@ -167,7 +167,7 @@ rec { ```nix trace { a.b.c = 3; } null trace: { a = <CODE>; } trace: { a = <thunk>; } => null traceSeq { a.b.c = 3; } null trace: { a = { b = { c = 3; }; }; } Loading Loading @@ -257,6 +257,23 @@ rec { `v` : Value to trace # Type ``` traceValSeqFn :: (a -> b) -> a -> a ``` # Examples :::{.example} ## `lib.debug.traceValSeqFn` usage example ```nix traceValSeqFn (v: v // { d = "foo";}) { a.b.c = 3; } trace: { a = { b = { c = 3; }; }; d = "foo"; } => { a = { ... }; } ::: */ traceValSeqFn = f: v: traceValFn f (builtins.deepSeq v v); Loading @@ -268,6 +285,24 @@ rec { `v` : Value to trace # Type ``` traceValSeq :: a -> a ``` # Examples :::{.example} ## `lib.debug.traceValSeq` usage example ```nix traceValSeq { a.b.c = 3; } trace: { a = { b = { c = 3; }; }; } => { a = { ... }; } ``` ::: */ traceValSeq = traceValSeqFn id; Loading @@ -288,6 +323,24 @@ rec { `v` : Value to trace # Type ``` traceValSeqNFn :: (a -> b) -> int -> a -> a ``` # Examples :::{.example} ## `lib.debug.traceValSeqNFn` usage example ```nix traceValSeqNFn (v: v // { d = "foo";}) 2 { a.b.c = 3; } trace: { a = { b = {…}; }; d = "foo"; } => { a = { ... }; } ``` ::: */ traceValSeqNFn = f: depth: v: Loading @@ -305,6 +358,24 @@ rec { `v` : Value to trace # Type ``` traceValSeqN :: int -> a -> a ``` # Examples :::{.example} ## `lib.debug.traceValSeqN` usage example ```nix traceValSeqN 2 { a.b.c = 3; } trace: { a = { b = {…}; }; } => { a = { ... }; } ``` ::: */ traceValSeqN = traceValSeqNFn id; Loading Loading @@ -333,6 +404,12 @@ rec { : 4\. Function argument # Type ``` traceFnSeqN :: int -> string -> (a -> b) -> a -> b ``` # Examples :::{.example} ## `lib.debug.traceFnSeqN` usage example Loading @@ -340,7 +417,7 @@ rec { ```nix traceFnSeqN 2 "id" (x: x) { a.b.c = 3; } trace: { fn = "id"; from = { a.b = {…}; }; to = { a.b = {…}; }; } => { a.b.c = 3; } => { a = { ... }; } ``` ::: Loading lib/derivations.nix +6 −0 Original line number Diff line number Diff line Loading @@ -233,6 +233,12 @@ in `drv` : The derivation to wrap. # Type ``` warnOnInstantiate :: string -> Derivation -> Derivation ``` # Examples :::{.example} ## `lib.derivations.warnOnInstantiate` usage example Loading lib/filesystem.nix +16 −16 Original line number Diff line number Diff line Loading @@ -302,16 +302,6 @@ in - Other files are ignored, including symbolic links to directories and to regular `.nix` files; this is because nixlang code cannot distinguish the type of a link's target. # Type ``` packagesFromDirectoryRecursive :: { callPackage :: Path -> {} -> a, newScope? :: AttrSet -> scope, directory :: Path, } -> AttrSet ``` # Inputs `callPackage` Loading @@ -326,6 +316,16 @@ in `directory` : The directory to read package files from. # Type ``` packagesFromDirectoryRecursive :: { callPackage :: Path -> {} -> a, newScope? :: AttrSet -> scope, directory :: Path, } -> AttrSet ``` # Examples :::{.example} ## Basic use of `lib.packagesFromDirectoryRecursive` Loading Loading @@ -450,12 +450,6 @@ in /** Append `/default.nix` if the passed path is a directory. # Type ``` resolveDefaultNix :: (Path | String) -> (Path | String) ``` # Inputs A single argument which can be a [path](https://nix.dev/manual/nix/stable/language/types#type-path) value or a string containing an absolute path. Loading @@ -466,6 +460,12 @@ in Furthermore, if the input is a string that ends with `/`, `default.nix` is appended to it. Otherwise, the input is returned unchanged. # Type ``` resolveDefaultNix :: (Path | String) -> (Path | String) ``` # Examples :::{.example} ## `lib.filesystem.resolveDefaultNix` usage example Loading lib/fixed-points.nix +6 −0 Original line number Diff line number Diff line Loading @@ -108,6 +108,12 @@ rec { `f` : 1\. Function argument # Type ``` fix' :: (a -> a) -> a ``` */ fix' = f: Loading Loading
lib/attrsets.nix +1 −1 Original line number Diff line number Diff line Loading @@ -201,7 +201,7 @@ rec { # Type ``` attrsets.longestValidPathPrefix :: [String] -> Value -> [String] longestValidPathPrefix :: [String] -> Value -> [String] ``` # Examples Loading
lib/debug.nix +79 −2 Original line number Diff line number Diff line Loading @@ -167,7 +167,7 @@ rec { ```nix trace { a.b.c = 3; } null trace: { a = <CODE>; } trace: { a = <thunk>; } => null traceSeq { a.b.c = 3; } null trace: { a = { b = { c = 3; }; }; } Loading Loading @@ -257,6 +257,23 @@ rec { `v` : Value to trace # Type ``` traceValSeqFn :: (a -> b) -> a -> a ``` # Examples :::{.example} ## `lib.debug.traceValSeqFn` usage example ```nix traceValSeqFn (v: v // { d = "foo";}) { a.b.c = 3; } trace: { a = { b = { c = 3; }; }; d = "foo"; } => { a = { ... }; } ::: */ traceValSeqFn = f: v: traceValFn f (builtins.deepSeq v v); Loading @@ -268,6 +285,24 @@ rec { `v` : Value to trace # Type ``` traceValSeq :: a -> a ``` # Examples :::{.example} ## `lib.debug.traceValSeq` usage example ```nix traceValSeq { a.b.c = 3; } trace: { a = { b = { c = 3; }; }; } => { a = { ... }; } ``` ::: */ traceValSeq = traceValSeqFn id; Loading @@ -288,6 +323,24 @@ rec { `v` : Value to trace # Type ``` traceValSeqNFn :: (a -> b) -> int -> a -> a ``` # Examples :::{.example} ## `lib.debug.traceValSeqNFn` usage example ```nix traceValSeqNFn (v: v // { d = "foo";}) 2 { a.b.c = 3; } trace: { a = { b = {…}; }; d = "foo"; } => { a = { ... }; } ``` ::: */ traceValSeqNFn = f: depth: v: Loading @@ -305,6 +358,24 @@ rec { `v` : Value to trace # Type ``` traceValSeqN :: int -> a -> a ``` # Examples :::{.example} ## `lib.debug.traceValSeqN` usage example ```nix traceValSeqN 2 { a.b.c = 3; } trace: { a = { b = {…}; }; } => { a = { ... }; } ``` ::: */ traceValSeqN = traceValSeqNFn id; Loading Loading @@ -333,6 +404,12 @@ rec { : 4\. Function argument # Type ``` traceFnSeqN :: int -> string -> (a -> b) -> a -> b ``` # Examples :::{.example} ## `lib.debug.traceFnSeqN` usage example Loading @@ -340,7 +417,7 @@ rec { ```nix traceFnSeqN 2 "id" (x: x) { a.b.c = 3; } trace: { fn = "id"; from = { a.b = {…}; }; to = { a.b = {…}; }; } => { a.b.c = 3; } => { a = { ... }; } ``` ::: Loading
lib/derivations.nix +6 −0 Original line number Diff line number Diff line Loading @@ -233,6 +233,12 @@ in `drv` : The derivation to wrap. # Type ``` warnOnInstantiate :: string -> Derivation -> Derivation ``` # Examples :::{.example} ## `lib.derivations.warnOnInstantiate` usage example Loading
lib/filesystem.nix +16 −16 Original line number Diff line number Diff line Loading @@ -302,16 +302,6 @@ in - Other files are ignored, including symbolic links to directories and to regular `.nix` files; this is because nixlang code cannot distinguish the type of a link's target. # Type ``` packagesFromDirectoryRecursive :: { callPackage :: Path -> {} -> a, newScope? :: AttrSet -> scope, directory :: Path, } -> AttrSet ``` # Inputs `callPackage` Loading @@ -326,6 +316,16 @@ in `directory` : The directory to read package files from. # Type ``` packagesFromDirectoryRecursive :: { callPackage :: Path -> {} -> a, newScope? :: AttrSet -> scope, directory :: Path, } -> AttrSet ``` # Examples :::{.example} ## Basic use of `lib.packagesFromDirectoryRecursive` Loading Loading @@ -450,12 +450,6 @@ in /** Append `/default.nix` if the passed path is a directory. # Type ``` resolveDefaultNix :: (Path | String) -> (Path | String) ``` # Inputs A single argument which can be a [path](https://nix.dev/manual/nix/stable/language/types#type-path) value or a string containing an absolute path. Loading @@ -466,6 +460,12 @@ in Furthermore, if the input is a string that ends with `/`, `default.nix` is appended to it. Otherwise, the input is returned unchanged. # Type ``` resolveDefaultNix :: (Path | String) -> (Path | String) ``` # Examples :::{.example} ## `lib.filesystem.resolveDefaultNix` usage example Loading
lib/fixed-points.nix +6 −0 Original line number Diff line number Diff line Loading @@ -108,6 +108,12 @@ rec { `f` : 1\. Function argument # Type ``` fix' :: (a -> a) -> a ``` */ fix' = f: Loading