{"id":13687977,"url":"https://github.com/srid/flake-root","last_synced_at":"2025-03-16T14:31:22.737Z","repository":{"id":66668389,"uuid":"579408970","full_name":"srid/flake-root","owner":"srid","description":"A `flake-parts` module for finding your way to the project root directory","archived":false,"fork":false,"pushed_at":"2024-08-14T02:53:37.000Z","size":11,"stargazers_count":45,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-16T03:22:23.063Z","etag":null,"topics":["flake-parts","nix"],"latest_commit_sha":null,"homepage":"","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/srid.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":"2022-12-17T15:48:38.000Z","updated_at":"2025-03-14T05:42:39.000Z","dependencies_parsed_at":"2024-08-14T04:28:15.922Z","dependency_job_id":null,"html_url":"https://github.com/srid/flake-root","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srid%2Fflake-root","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srid%2Fflake-root/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srid%2Fflake-root/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srid%2Fflake-root/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/srid","download_url":"https://codeload.github.com/srid/flake-root/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243882512,"owners_count":20363151,"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","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":["flake-parts","nix"],"created_at":"2024-08-02T15:01:04.400Z","updated_at":"2025-03-16T14:31:22.360Z","avatar_url":"https://github.com/srid.png","language":"Nix","readme":"# flake-root\n\nA `flake-parts` module for finding your way to the project root directory\n\n## Why?\n\nBecause Nix itself doesn't provide it:\n\n- https://github.com/NixOS/nix/issues/8034\n- https://github.com/NixOS/nix/issues/6241\n\n## Usage\n\n```nix\n{\n  inputs = {\n    flake-root.url = \"github:srid/flake-root\";\n    ...\n  };\n  outputs = inputs@{ self, nixpkgs, flake-parts, ... }:\n    flake-parts.lib.mkFlake { inherit self; } {\n      imports = [\n        inputs.flake-root.flakeModule\n      ];\n      perSystem = { pkgs, lib, config, ... }: {\n        flake-root.projectRootFile = \"flake.nix\";  # Not necessary, as flake.nix is the default\n        devShells.default = pkgs.mkShell {\n          inputsFrom = [ config.flake-root.devShell ];  # Provides $FLAKE_ROOT in dev shell\n        };\n      };\n    };\n}\n```\n\nNow you have access to the program that returns the absolute path to the project root via `${lib.getExe config.flake-root.package}`. There is also `config.flake-root.devShell` which exposes a `shellHook` providing the `$FLAKE_ROOT` environment variable.\n\n## Examples\n\n- This module is in turn used by the following `flake-parts` modules:\n  - https://github.com/Platonic-Systems/mission-control\n  - https://github.com/srid/proc-flake\n\n## Credit\n\nThe bash script is originally based on [numtide/treefmt](https://github.com/numtide/treefmt/blob/66959743ba9e955819a16960319a09d152acff9a/module-options.nix#L98-L109).\n","funding_links":[],"categories":["Nix","Flake Modules"],"sub_categories":["Community Modules"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrid%2Fflake-root","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsrid%2Fflake-root","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrid%2Fflake-root/lists"}