mirror of
https://github.com/nix-community/noogle.git
synced 2024-12-23 00:41:38 +03:00
strictly seperate nix types from data
This commit is contained in:
parent
55cee707db
commit
d4ce8d7f21
@ -18,8 +18,7 @@ import FormControl from "@mui/material/FormControl";
|
||||
import FormLabel from "@mui/material/FormLabel";
|
||||
import ClearIcon from "@mui/icons-material/Clear";
|
||||
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
|
||||
import { nixTypes } from "../../models/nix";
|
||||
import { NixType } from "../../types/nix";
|
||||
import { NixType, nixTypes } from "../../types/nix";
|
||||
|
||||
export type BasicListItem = {
|
||||
item: React.ReactNode;
|
||||
|
@ -8,11 +8,10 @@ import {
|
||||
ListItemText,
|
||||
Typography,
|
||||
} from "@mui/material";
|
||||
import { info } from "console";
|
||||
import { FuncData } from "../../pages";
|
||||
import LocalLibraryIcon from "@mui/icons-material/LocalLibrary";
|
||||
import InputIcon from "@mui/icons-material/Input";
|
||||
import OutputIcon from "@mui/icons-material/Output";
|
||||
import { FuncData } from "../../types/nix";
|
||||
|
||||
interface PreviewProps {
|
||||
func: FuncData;
|
||||
|
349
models/nix.ts
349
models/nix.ts
@ -1,10 +1,341 @@
|
||||
import { NixType } from "../types/nix";
|
||||
import { NixFunctionSet, NixType } from "../types/nix";
|
||||
|
||||
export const nixTypes: NixType[] = [
|
||||
"any",
|
||||
"attrset",
|
||||
"list",
|
||||
"string",
|
||||
"bool",
|
||||
"int",
|
||||
];
|
||||
export const nixFuns: NixFunctionSet = {
|
||||
mapAttrs: {
|
||||
"attr-path": "builtins.mapAttrs",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nix/stable/language/builtins.html#builtins-mapAttrs",
|
||||
source: "builtin",
|
||||
from: "attrset",
|
||||
to: "attrset",
|
||||
},
|
||||
"mapAttrs'": {
|
||||
"attr-path": "lib.mapAttrs'",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-attrset",
|
||||
source: "nixpkgs",
|
||||
from: "attrset",
|
||||
to: "attrset",
|
||||
},
|
||||
genAttrs: {
|
||||
"attr-path": "lib.genAttrs",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-attrset",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "attrset",
|
||||
},
|
||||
forEach: {
|
||||
"attr-path": "lib.forEach",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
foldr: {
|
||||
"attr-path": "lib.foldr",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "any",
|
||||
},
|
||||
foldl: {
|
||||
"attr-path": "lib.foldl",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "any",
|
||||
},
|
||||
"foldl'": {
|
||||
"attr-path": "lib.foldl'",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "any",
|
||||
},
|
||||
imap0: {
|
||||
"attr-path": "lib.imap0",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
imap1: {
|
||||
"attr-path": "lib.imap1",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
concatMap: {
|
||||
"attr-path": "lib.concatMap",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
flatten: {
|
||||
"attr-path": "lib.flatten",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
remove: {
|
||||
"attr-path": "lib.remove",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
findSingle: {
|
||||
"attr-path": "lib.findSingle",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "any",
|
||||
},
|
||||
findFirst: {
|
||||
"attr-path": "lib.findFirst",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "any",
|
||||
},
|
||||
any: {
|
||||
"attr-path": "lib.any",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "bool",
|
||||
},
|
||||
all: {
|
||||
"attr-path": "lib.all",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "bool",
|
||||
},
|
||||
count: {
|
||||
"attr-path": "lib.count",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "int",
|
||||
},
|
||||
optional: {
|
||||
"attr-path": "lib.optional",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "bool",
|
||||
to: "list",
|
||||
},
|
||||
optionals: {
|
||||
"attr-path": "lib.optionals",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "bool",
|
||||
to: "list",
|
||||
},
|
||||
toList: {
|
||||
"attr-path": "lib.toList",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "any",
|
||||
to: "list",
|
||||
},
|
||||
toString: {
|
||||
"attr-path": "builtins.toString'",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nix/stable/language/builtins.html#builtins-toString",
|
||||
source: "builtin",
|
||||
from: "any" as NixType,
|
||||
to: "string" as NixType,
|
||||
},
|
||||
range: {
|
||||
"attr-path": "lib.range",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "int",
|
||||
to: "list",
|
||||
},
|
||||
partition: {
|
||||
"attr-path": "lib.partition",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
"groupBy'": {
|
||||
"attr-path": "lib.groupBy'",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
groupBy: {
|
||||
"attr-path": "lib.groupBy",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
zipListsWith: {
|
||||
"attr-path": "lib.zipListsWith",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
zipLists: {
|
||||
"attr-path": "lib.zipLists",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
reverseList: {
|
||||
"attr-path": "lib.reverseList",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
listDfs: {
|
||||
"attr-path": "lib.listDfs",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "attrset",
|
||||
},
|
||||
toposort: {
|
||||
"attr-path": "lib.toposort",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
sort: {
|
||||
"attr-path": "lib.sort",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
compareLists: {
|
||||
"attr-path": "lib.compareLists",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "int",
|
||||
},
|
||||
naturalSort: {
|
||||
"attr-path": "lib.naturalSort",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
take: {
|
||||
"attr-path": "lib.take",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
sublist: {
|
||||
"attr-path": "lib.sublist",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
last: {
|
||||
"attr-path": "lib.last",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "any",
|
||||
},
|
||||
init: {
|
||||
"attr-path": "lib.init",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
crossLists: {
|
||||
"attr-path": "lib.crossLists",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
unique: {
|
||||
"attr-path": "lib.unique",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
intersectLists: {
|
||||
"attr-path": "lib.intersectLists",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
subtractLists: {
|
||||
"attr-path": "lib.subtractLists",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
mutuallyExclusive: {
|
||||
"attr-path": "lib.mutuallyExclusive",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "bool",
|
||||
},
|
||||
};
|
||||
|
359
pages/index.tsx
359
pages/index.tsx
@ -2,362 +2,11 @@ import { BasicList, BasicListItem } from "../components/basicList";
|
||||
import { useState, useMemo } from "react";
|
||||
import { Box } from "@mui/material";
|
||||
import FunctionItem from "../components/functionItem/functionItem";
|
||||
import { NixType } from "../types/basicDataView";
|
||||
import { NixType, nixTypes, FuncData } from "../types/nix";
|
||||
import { nixFuns } from "../models/nix";
|
||||
import { Preview } from "../components/preview/preview";
|
||||
import { nixTypes } from "../models/nix";
|
||||
|
||||
const libfuns = {
|
||||
mapAttrs: {
|
||||
"attr-path": "builtins.mapAttrs",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nix/stable/language/builtins.html#builtins-mapAttrs",
|
||||
source: "builtin",
|
||||
from: "attrset",
|
||||
to: "attrset",
|
||||
},
|
||||
"mapAttrs'": {
|
||||
"attr-path": "lib.mapAttrs'",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-attrset",
|
||||
source: "nixpkgs",
|
||||
from: "attrset",
|
||||
to: "attrset",
|
||||
},
|
||||
toString: {
|
||||
"attr-path": "builtins.toString'",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nix/stable/language/builtins.html#builtins-toString",
|
||||
source: "builtin",
|
||||
from: "any",
|
||||
to: "string",
|
||||
},
|
||||
genAttrs: {
|
||||
"attr-path": "lib.genAttrs",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-attrset",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "attrset",
|
||||
},
|
||||
|
||||
forEach: {
|
||||
"attr-path": "lib.forEach",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
foldr: {
|
||||
"attr-path": "lib.foldr",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "any",
|
||||
},
|
||||
foldl: {
|
||||
"attr-path": "lib.foldl",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "any",
|
||||
},
|
||||
"foldl'": {
|
||||
"attr-path": "lib.foldl'",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "any",
|
||||
},
|
||||
imap0: {
|
||||
"attr-path": "lib.imap0",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
imap1: {
|
||||
"attr-path": "lib.imap1",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
concatMap: {
|
||||
"attr-path": "lib.concatMap",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
flatten: {
|
||||
"attr-path": "lib.flatten",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
remove: {
|
||||
"attr-path": "lib.remove",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
findSingle: {
|
||||
"attr-path": "lib.findSingle",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "any",
|
||||
},
|
||||
findFirst: {
|
||||
"attr-path": "lib.findFirst",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "any",
|
||||
},
|
||||
any: {
|
||||
"attr-path": "lib.any",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "true",
|
||||
},
|
||||
all: {
|
||||
"attr-path": "lib.all",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "true",
|
||||
},
|
||||
count: {
|
||||
"attr-path": "lib.count",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "int",
|
||||
},
|
||||
optional: {
|
||||
"attr-path": "lib.optional",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "bool",
|
||||
to: "list",
|
||||
},
|
||||
optionals: {
|
||||
"attr-path": "lib.optionals",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "bool",
|
||||
to: "list",
|
||||
},
|
||||
toList: {
|
||||
"attr-path": "lib.toList",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "any",
|
||||
to: "list",
|
||||
},
|
||||
range: {
|
||||
"attr-path": "lib.range",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "int",
|
||||
to: "list",
|
||||
},
|
||||
partition: {
|
||||
"attr-path": "lib.partition",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
"groupBy'": {
|
||||
"attr-path": "lib.groupBy'",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
groupBy: {
|
||||
"attr-path": "lib.groupBy",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
zipListsWith: {
|
||||
"attr-path": "lib.zipListsWith",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
zipLists: {
|
||||
"attr-path": "lib.zipLists",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
reverseList: {
|
||||
"attr-path": "lib.reverseList",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
listDfs: {
|
||||
"attr-path": "lib.listDfs",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "attrset",
|
||||
},
|
||||
toposort: {
|
||||
"attr-path": "lib.toposort",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
sort: {
|
||||
"attr-path": "lib.sort",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
compareLists: {
|
||||
"attr-path": "lib.compareLists",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "int",
|
||||
},
|
||||
naturalSort: {
|
||||
"attr-path": "lib.naturalSort",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
take: {
|
||||
"attr-path": "lib.take",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
sublist: {
|
||||
"attr-path": "lib.sublist",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
last: {
|
||||
"attr-path": "lib.last",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "any",
|
||||
},
|
||||
init: {
|
||||
"attr-path": "lib.init",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
crossLists: {
|
||||
"attr-path": "lib.crossLists",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
unique: {
|
||||
"attr-path": "lib.unique",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
intersectLists: {
|
||||
"attr-path": "lib.intersectLists",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
subtractLists: {
|
||||
"attr-path": "lib.subtractLists",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "list",
|
||||
},
|
||||
mutuallyExclusive: {
|
||||
"attr-path": "lib.mutuallyExclusive",
|
||||
"doc-url":
|
||||
"https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-lists",
|
||||
source: "nixpkgs",
|
||||
from: "list",
|
||||
to: "bool",
|
||||
},
|
||||
};
|
||||
|
||||
export type FuncData = {
|
||||
name: string;
|
||||
info: {
|
||||
"attr-path": string;
|
||||
"doc-url": string;
|
||||
source: string;
|
||||
from: string;
|
||||
to: string;
|
||||
};
|
||||
};
|
||||
|
||||
const mockData: FuncData[] = Object.entries(libfuns).map(([key, value]) => ({
|
||||
const mockData: FuncData[] = Object.entries(nixFuns).map(([key, value]) => ({
|
||||
name: key,
|
||||
info: value,
|
||||
}));
|
||||
@ -378,7 +27,7 @@ const search =
|
||||
});
|
||||
};
|
||||
const filter =
|
||||
(to: NixType, from: NixType) =>
|
||||
(to: NixType[], from: NixType[]) =>
|
||||
(data: FuncData[]): FuncData[] => {
|
||||
return data.filter(
|
||||
({ info }) => from.includes(info.from) && to.includes(info.to)
|
||||
|
25
types/nix.ts
25
types/nix.ts
@ -1 +1,24 @@
|
||||
export type NixType = "attrset" | "list" | "string" | "int" | "bool" | "any";
|
||||
export type NixType = "attrset" | "list" | "string" | "int" | "bool" | "any";
|
||||
export const nixTypes: NixType[] = [
|
||||
"any",
|
||||
"attrset",
|
||||
"list",
|
||||
"string",
|
||||
"bool",
|
||||
"int",
|
||||
];
|
||||
|
||||
export type FuncData = {
|
||||
name: string;
|
||||
info: NixFunctionMeta;
|
||||
};
|
||||
|
||||
export type NixFunctionMeta = {
|
||||
"attr-path": string;
|
||||
"doc-url": string;
|
||||
source: string;
|
||||
from: NixType;
|
||||
to: NixType;
|
||||
}
|
||||
|
||||
export type NixFunctionSet = {[name:string]: NixFunctionMeta}
|
Loading…
Reference in New Issue
Block a user