{"id":22340619,"url":"https://github.com/jonringer/pkgs-modules-proposal","last_synced_at":"2025-07-31T17:10:08.171Z","repository":{"id":258661802,"uuid":"874367348","full_name":"jonringer/pkgs-modules-proposal","owner":"jonringer","description":"Allow for `pkgs.config` to be configured with user supplied modules","archived":false,"fork":false,"pushed_at":"2024-10-17T18:05:19.000Z","size":9,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T14:49:49.682Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc-by-sa-4.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonringer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2024-10-17T17:44:10.000Z","updated_at":"2024-12-29T00:44:44.000Z","dependencies_parsed_at":"2024-10-20T02:39:45.210Z","dependency_job_id":null,"html_url":"https://github.com/jonringer/pkgs-modules-proposal","commit_stats":null,"previous_names":["jonringer/pkgs-modules-proposal"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jonringer/pkgs-modules-proposal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonringer%2Fpkgs-modules-proposal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonringer%2Fpkgs-modules-proposal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonringer%2Fpkgs-modules-proposal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonringer%2Fpkgs-modules-proposal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonringer","download_url":"https://codeload.github.com/jonringer/pkgs-modules-proposal/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonringer%2Fpkgs-modules-proposal/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268075105,"owners_count":24191663,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-31T02:00:08.723Z","response_time":66,"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":[],"created_at":"2024-12-04T07:12:20.881Z","updated_at":"2025-07-31T17:10:08.142Z","avatar_url":"https://github.com/jonringer.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"---\nTitle: Allow for users to pass modules to pkgs.config\nAuthor: jonringer\nDiscussions-To: https://github.com/jonringer/language-specific-config-overlays-proposal\nStatus: Draft\nType: Standards Track\nTopic: Packaging\nCreated: 2024-10-17\n---\n\n# Summary\n\nIn addition to the [language overlay proposal](https://github.com/jonringer/language-specific-config-overlays-proposal),\nthe ability to configure the language overlays should also not be burdensome to compose.\nThe solution here would be to extend the existing `pkgs.config` evaluation to include\nmany modules which can be passed to its creation. The goal is to allow for both\nthe overlays (e.g. `core-pkgs`) to pass modules describing their overlays in addition\nto the overlays supplied by the user.\n\n## Detailed Implementation\n\nThe totality of https://github.com/jonringer/language-specific-config-overlays-proposal:\n\n```diff\n@@ -27,6 +27,9 @@\n , # Allow a configuration attribute set to be passed in as an argument.\n   config ? {}\n\n+, # Allow for users to pass modules for the evaluation of pkgs.config\n+  modules ? []\n+\n , # List of overlays layers used to extend Nixpkgs.\n   overlays ? []\n\n@@ -93,7 +96,7 @@ in let\n         _file = \"nixpkgs.config\";\n         config = config1;\n       })\n-    ];\n+    ] ++ modules;\n     class = \"nixpkgsConfig\";\n   };\n```\n\n## Poly repo example\n\nFor the \"capstone\" pkgs repo, the composition of all sub-overlays would roughtly follow:\n\n\n```nix\n# default.nix in pkgs repo\n\n{ system ? builtins.currentSystem\n, modules ? []\n, ...\n}@args:\n\nlet\n  # pins to language repos and core-pkgs\n  pins = import ./pins.nix;\n\n  # stdenv should rarely change, as pkgs.stdenv is largely created in core-pkgs\n  stdenv = ...;\n\n  filteredAttrs = builtins.remoteAttrs [ \"modules\" \"system\" ] args;\nin\nimport stdenv ({\n  inherit system;\n  modules = let\n    poly-modules = builtins.mapAttrs (_: v: import \"${v}/pkgs-module.nix\") pins;\n  in poly-modules ++ modules;\n} // filteredAttrs)\n```\n\nEach poly-repo would just expose a `/pkgs-module.nix` which would contain all information\nabout the language specific repos to the package set.\n\n## User package example\n\nA general flake exposing a python package could be expressed as:\n\n```nix\n# flake.nix\n\nlet\n  pythonOverlay = final: _: {\n    my-pkg = final.callPackage ./package.nix { };\n  };\n\n  top-level-overlay = final: _: {\n    my-pkg = with final.python3.pkgs; toPythonApplication my-package;\n  };\n\n  pkgs-module = {\n    overlays.pkgs = [ top-level-overlay ];\n    overlays.python = [ pythonOverlay ];\n  };\nin flake-utils.eachDefaultSystem (system: rec {\n\n  legacyPackages = import core-pkgs {\n    inherit system;\n    modules = [ pkgs-module ];\n  };\n\n  packages.default = legacyPackages.my-pkg;\n\n  modules = {\n    pkgs = pkgs-module;\n  };\n})\n```\n\nThe benefit here is that the package is now available for each `pkgs.pythonX` version\nas well as the module is available for downstream flakes/repos to also consume in an easy fashion.\nFor example:\n\n```nix\n# flake.nix\ninputs.foo = \"github:....\";\n\n...\n{\n  legacyPackages = import core-pkgs {\n    inherit system;\n    # This would now apply the python and top-level overlay from foo as well\n    modules = [ foo.modules.pkgs my-repo-module ];\n  };\n}\n```\n\n## Unresolved questions\n\n- To remove ambigiuity with system module eval, should the attr be named `pkgsModules` instead?\n- What to do with legacy `config` option?\n  - Most likely keep for backwards compatibility with people wanting to interop with nixpkgs\n\n## Future work\n\n- Implement `options.overlays.\u003clanguage` for each language repository\n- As part of system mdoule eval, a `nixpkgs.modules` option should be added \n  - `nixpkgs` should be renamed to a more generic term\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonringer%2Fpkgs-modules-proposal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonringer%2Fpkgs-modules-proposal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonringer%2Fpkgs-modules-proposal/lists"}