{"id":49813296,"url":"https://github.com/denful/with-inputs","last_synced_at":"2026-05-13T02:18:26.158Z","repository":{"id":341152363,"uuid":"1168107238","full_name":"denful/with-inputs","owner":"denful","description":"A flake-inputs adapter for Nix projects that don't use `flake.nix`.","archived":false,"fork":false,"pushed_at":"2026-05-09T09:45:34.000Z","size":48,"stargazers_count":10,"open_issues_count":2,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-09T11:37:21.874Z","etag":null,"topics":["dendritic","flake","flake-inputs","nix","no-flakes","npins","stable-nix","unflake"],"latest_commit_sha":null,"homepage":"https://denful.dev/ecosystem/with-inputs/","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/denful.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["vic"],"patreon":null,"open_collective":null,"ko_fi":"oeiuwq","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":null,"custom":null}},"created_at":"2026-02-27T02:43:23.000Z","updated_at":"2026-05-09T09:15:28.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/denful/with-inputs","commit_stats":null,"previous_names":["vic/with-inputs","denful/with-inputs"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/denful/with-inputs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denful%2Fwith-inputs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denful%2Fwith-inputs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denful%2Fwith-inputs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denful%2Fwith-inputs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/denful","download_url":"https://codeload.github.com/denful/with-inputs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denful%2Fwith-inputs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32964563,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-12T23:30:32.555Z","status":"online","status_checked_at":"2026-05-13T02:00:07.132Z","response_time":115,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dendritic","flake","flake-inputs","nix","no-flakes","npins","stable-nix","unflake"],"created_at":"2026-05-13T02:18:25.360Z","updated_at":"2026-05-13T02:18:26.153Z","avatar_url":"https://github.com/denful.png","language":"Nix","funding_links":["https://github.com/sponsors/vic","https://ko-fi.com/oeiuwq"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"right\"\u003e\n  \u003ca href=\"https://dendritic.oeiuwq.com/sponsor\"\u003e\u003cimg src=\"https://img.shields.io/badge/sponsor-vic-white?logo=githubsponsors\u0026logoColor=white\u0026labelColor=%23FF0000\" alt=\"Sponsor Vic\"/\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/vic/with-inputs/releases\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/vic/with-inputs?style=plastic\u0026logo=github\u0026color=purple\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://dendritic.oeiuwq.com\"\u003e \u003cimg src=\"https://img.shields.io/badge/Dendritic-Nix-informational?logo=nixos\u0026logoColor=white\" alt=\"Dendritic Nix\"/\u003e \u003c/a\u003e\n  \u003ca href=\"LICENSE\"\u003e \u003cimg src=\"https://img.shields.io/github/license/vic/with-inputs\" alt=\"License\"/\u003e \u003c/a\u003e\n  \u003ca href=\"https://github.com/vic/with-inputs/actions\"\u003e\n  \u003cimg src=\"https://github.com/vic/with-inputs/actions/workflows/test.yml/badge.svg\" alt=\"CI Status\"/\u003e \u003c/a\u003e\n\u003c/p\u003e\n\n# with-inputs - A flake-inputs adapter for Nix projects that don't use `flake.nix`.\n\n\u003e with-inputs and [vic](https://bsky.app/profile/oeiuwq.bsky.social)'s [dendritic libs](https://dendritic.oeiuwq.com) made for you with Love++ and AI--. If you like my work, consider [sponsoring](https://dendritic.oeiuwq.com/sponsor)\n\n# with-inputs.nix\n\n\nProvides exactly the same inputs resolution experience as real Nix flakes —\n`follows`, nested `follows`, per-sub-input overrides, `inputs.self`, and\ndependency introspection — using pre-fetched sources from npins,\nlocal checkouts, or any other source.\n\n\u003e This library is not an inputs lock mechanism nor an inputs fetcher, for\n\u003e those we have plenty of options: npins, niv, lon, unflake, nixlock, nixtamal.\n\n## API\n\n```nix\nwith-inputs sources follows outputs\n```\n\nThe `with-inputs` function takes three arguments:\n\n1. already fetched `\u003cname\u003e.outPath` attrs.\n2. a function `inputs: specs` for custom follows, input shims or sources overrides.\n3. a function `inputs: outputs` like in flakes.\n\nwith-inputs does automatic input follows -- having `x.inputs.y` will automatically lookup for a\ntop-level `y` input. You only need to specify follows for uncommon input names.\n\n\n## Testimonials \n\n\u003e Amazing! I just transitioned my main flake to using your with-inputs and npins. It cut my eval times down from 20s to 6s!  \n\u003e -- [@theutz](https://github.com/theutz) - [Den](https://github.com/denful/den) core contributor.\n\n\u003e I am very happy to recommend this project. great work @vic!  \n\u003e -- [@aanderse](https://github.com/aanderse) - author of [trix](https://github.com/aanderse/trix)\n\n\n## Examples with different Nix pinning tools\n\nThis repo provides several templates using different Nix pinning tools.\n\nEach template has exactly the same code, except for `with-inputs.nix` that\nis used to bootstrap from each particular pinning tool.\n\n- [npins](./templates/npins) -- Loads from `./npins`\n- [niv](./templates/niv) -- Loads from `nix/sources.nix`\n- [lon](./templates/lon) -- Loads from `lon.nix`\n- [unflake](./templates/unflake) -- Loads from `unflake.nix`\n- [nixtamal](./templates/nixtamal) -- Loads from `nix/tamal`\n- [flake](./templates/flake) -- Loads from `flake.lock`\n\n\n## Usage\n\nDownload our `default.nix` into your project `./with-inputs.nix`.\n\n```nix\ncurl https://raw.githubusercontent.com/vic/with-inputs/refs/heads/main/default.nix -o with-inputs.nix\n```\n\nOr use npins or `builtins.fetchTarball` with a fixed revision of it. [^output-trick]\n\n```shell\nnpins add github vic with-inputs\n```\n\n```nix\n# default.nix\nlet\n   sources = import ./npins; # example with npins. use any other sources.\n   with-inputs = import sources.with-inputs sources {\n     # keep reading for follows and local inputs\n   };\n\n   outputs = inputs: { }; # your flake-like outputs function\nin \nwith-inputs outputs\n```\n\n[^output-trick]: To use the experimental `nix` cli commands, create a `flake.nix` containing only\n    ```nix\n    { outputs = _: import ./.; }\n    ```\n\n### Follows and local checkout overrides\n\nThe second argument to `with-inputs` is an attribute set that \ncan be used to drive input resolution, for example to use local\ncheckout or to specify flake-like follows.\n\nSee [tests.nix](./tests.nix) and [vic/vix:follows.nix](https://github.com/vic/vix/tree/unflake/follows.nix) for usage examples.\n\n```nix\n{\n    # Local checkout — loaded as a flake if a flake.nix is present\n    mylib.outPath = ./mylib;\n\n    # Local checkout with sub-input overrides applied when loading its flake.nix\n    someLib = { outPath = ./someLib; inputs.nixpkgs.follows = \"nixpkgs\"; };\n\n    # Direct import — value used as-is (function, module result, attrset, etc)\n    systems = import ./systems.nix;\n\n    # Top-level follows: alias one input to another\n    nixpkgs-stable.follows = \"nixpkgs\";\n\n    # Nested follows: traverse sub-inputs\n    something.follows = \"a/b/c\";  # → allInputs.a.inputs.b.inputs.c\n\n    # Empty follows: intentionally disconnect an input\n    unwanted.follows = \"\";\n\n    # Per-sub-input follows (mirrors flake.nix `inputs.foo.inputs.bar.follows`)\n    home-manager.inputs.nixpkgs.follows = \"nixpkgs\";\n    disko.inputs.nixpkgs.follows = \"nixpkgs\";\n\n    # Combined: keep the source, override some of its sub-inputs\n    someFlake = {\n        inputs.nixpkgs.follows = \"nixpkgs\";\n        inputs.utils.follows   = \"flake-utils\";\n    };\n\n    # Takes the original sources.otherFlake and avoids flake call\n    otherFlake = source: source // { flake = false; };\n}\n```\n\nThis second argument can also be a function `resolvedInputs -\u003e flakeInputs`, this is\nuseful for example to shim dependencies like `systems` or  `flake-utils` [`[example]`](https://github.com/vic/vix/blob/unflake/follows.nix).\n\n\n## `self` shape\n\nAll standard `inputs.self.*` patterns work:\n\n```nix\ninputs.self                    # the assembled self\ninputs.self.inputs             # resolved inputs\ninputs.self.inputs.self        # circular, lazy-safe\ninputs.self.inputs.nixpkgs     # any resolved input\ninputs.self.outputs            # raw outputs attrset\ninputs.self.nixosConfigurations  # shorthand for inputs.self.outputs.nixosConfigurations\n```\n\n## Resolved flake input shape\n\nEvery source with a `flake.nix` is fully resolved into the standard flake shape:\n\n```nix\ninputs.nixpkgs.outPath     # store / local path\ninputs.nixpkgs.sourceInfo  # raw sourceInfo from sources\ninputs.nixpkgs._type       # \"flake\"\ninputs.nixpkgs.inputs      # nixpkgs' own resolved sub-inputs\ninputs.nixpkgs.outputs     # nixpkgs' outputs attrset (explicit)\ninputs.nixpkgs.lib         # shorthand — same as inputs.nixpkgs.outputs.lib\n```\n\nDependency introspection works just like in flake-parts:\n\n```nix\ninputs.someFlake.inputs.nixpkgs          # someFlake's resolved nixpkgs\ninputs.someFlake.inputs.nixpkgs.lib      # and its lib, etc.\n```\n\n## Unresolvable follows\n\nWhen a follows target doesn't exist in resolved inputs, the entry becomes\n`null`. Sub-flakes that declare that input as required will have their outputs\ncall skipped (outputs stays `{}`), preventing evaluation errors — exactly like\nreal flakes when a dependency is absent.\n\n## Input declaration quick reference\n\n| Input declaration | Meaning |\n|---|---|\n| `foo.outPath = ./path;` | Local checkout, loaded as flake if `flake.nix` present |\n| `foo = { outPath = ./path; inputs.dep.follows = \"x\"; };` | Local checkout with sub-input overrides |\n| `foo = import ./path;` | Direct value, used as-is |\n| `foo = pinned-source;` | Direct value from npins or similar |\n| `b.follows = \"a\";` | Alias to `allInputs.a` |\n| `b.follows = \"a/x/y\";` | Nested alias via `.inputs.` chain |\n| `b.follows = \"\";` | Empty — resolves to `{}` |\n| `a.inputs.b.follows = \"x\";` | Override sub-input `b` of source `a` |\n| `a.inputs.b.follows = \"x/y\";` | Override with nested follows |\n| `a = { inputs.b.follows = \"x\"; inputs.c.follows = \"y\"; };` | Meta-spec: keep source, override several sub-inputs |\n\nA value is treated as a **spec** (not a direct value) when its only keys are\n`follows` and/or `inputs`, and every `inputs.*` value is a `{ follows = …; }`.\nAnything with `outPath`, `lib`, `packages`, `_type`, etc. is a direct value.\n\n## Contributing\n\nPR are welcome, make sure to run tests:\n\n```\nnix-unit tests.nix\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenful%2Fwith-inputs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdenful%2Fwith-inputs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenful%2Fwith-inputs/lists"}