{"id":15171853,"url":"https://github.com/numtide/nix-gitignore","last_synced_at":"2025-10-01T06:32:06.402Z","repository":{"id":95407473,"uuid":"91883572","full_name":"numtide/nix-gitignore","owner":"numtide","description":"filterSource using .gitignore (experiment)","archived":true,"fork":false,"pushed_at":"2017-05-20T11:22:16.000Z","size":8,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-01-12T09:36:34.919Z","etag":null,"topics":["nix"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/numtide.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2017-05-20T11:05:11.000Z","updated_at":"2023-03-02T04:15:10.000Z","dependencies_parsed_at":"2023-04-22T17:45:57.028Z","dependency_job_id":null,"html_url":"https://github.com/numtide/nix-gitignore","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtide%2Fnix-gitignore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtide%2Fnix-gitignore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtide%2Fnix-gitignore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtide%2Fnix-gitignore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/numtide","download_url":"https://codeload.github.com/numtide/nix-gitignore/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234837125,"owners_count":18894542,"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":["nix"],"created_at":"2024-09-27T09:20:41.471Z","updated_at":"2025-10-01T06:32:06.102Z","avatar_url":"https://github.com/numtide.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nix-gitignore - filterSource by .gitignore\n\n**status: experimental**\n\nNix v1.11.9 introduced a new builtin called `builtins.exec` which allows to run code during the evaluation phase. This project's goal is to play with it while trying to solve a problem at the same time:\n\nWhen working in a nixified project, it can become quite cumbersome to maintain the filterSource matches. The matching capabilities are quite crude and don't support globbing and so the matches can be quite inexact. When the project changes, the filterSource rules have to be updated as well. What if filterSource could re-use the .gitignore of the project instead?\n\n## Usage\n\nAssuming filterGitignore is part of the top-level:\n\n```nix\n{ stdenv, filterGitignore }:\nstdenv.mkDerivation {\n    name = \"my-package\";\n    src = filterGitignore ./.gitignore ./.;\n    # ...\n}\n```\n\nTo build the package, the `--option allow-unsafe-native-code-during-evaluation true` flag is required.\n\n## About `builtins.exec`\n\nNix v1.11.9 introduced a new builtin called `builtins.exec` which allows to run\ncode during the evaluation phase. The idea is that it allows to do cool things like dynamically calculate the sha256 of a git repo.\n\nBecause this option is quite dangerous, it is hidden behind a flag.\n\n```\n$ nix-repl\nWelcome to Nix version 1.11.9. Type :? for help.\n\nnix-repl\u003e builtins.exec\nerror: attribute ‘exec’ missing, at (string):1:1\n```\n\n```\n$ nix-repl --option allow-unsafe-native-code-during-evaluation true\nWelcome to Nix version 1.11.9. Type :? for help.\n\nnix-repl\u003e builtins.exec\n«primop»\n```\n\n### Usage\n\nThe function takes a list of arguments and parses the returned stdout output. The stderr isn't intercepted.\n\n```\nnix-repl\u003e builtins.exec [\"echo\" \"[1 2 3]\"]\n[ 1 2 3 ]\n```\n\n## TODO\n\n* Example where this project is imported and built with goBuildPackage\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumtide%2Fnix-gitignore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnumtide%2Fnix-gitignore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumtide%2Fnix-gitignore/lists"}