{"id":25129822,"url":"https://github.com/lightquantumarchive/nix-template","last_synced_at":"2025-07-08T02:41:34.533Z","repository":{"id":103066654,"uuid":"549261037","full_name":"LightQuantumArchive/nix-template","owner":"LightQuantumArchive","description":"A minimal template engine for deterministic nix configurations.","archived":false,"fork":false,"pushed_at":"2023-11-14T18:33:11.000Z","size":37,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-06T22:29:46.233Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/LightQuantumArchive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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-10-10T23:29:20.000Z","updated_at":"2025-01-13T23:18:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"a79a1db8-ccd4-4831-bbed-1aa84ef4414d","html_url":"https://github.com/LightQuantumArchive/nix-template","commit_stats":null,"previous_names":["lightquantumarchive/nix-template"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/LightQuantumArchive/nix-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LightQuantumArchive%2Fnix-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LightQuantumArchive%2Fnix-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LightQuantumArchive%2Fnix-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LightQuantumArchive%2Fnix-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LightQuantumArchive","download_url":"https://codeload.github.com/LightQuantumArchive/nix-template/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LightQuantumArchive%2Fnix-template/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264183316,"owners_count":23569685,"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":[],"created_at":"2025-02-08T12:25:41.929Z","updated_at":"2025-07-08T02:41:34.412Z","avatar_url":"https://github.com/LightQuantumArchive.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nix Template\n\nA minimal template engine for deterministic nix configurations.\n\nAll files with `.tmpl.nix` suffix are processed by the template engine.\nUse minijinja format to write your templates.\n\n## Get Started\n\n```shell\n# Use binary cache\n$ nix run nixpkgs#cachix use lightquantum\n# Instantiate templates\n$ nix run github:PhotonQuantum/nix-template\n# Update lock file\n$ nix run github:PhotonQuantum/nix-template update\n```\n\nThis package is also available in [my NUR repository](https://github.com/PhotonQuantum/nur-packages)\n\n## Why should I use this?\n\nConsider the following example:\n\n```nix\nprogram.zsh = {\n    enable = true;\n    plugins = [\n        {\n          name = \"input\";\n          file = \"init.zsh\";\n          src = pkgs.fetchFromGitHub {\n            owner = \"zimfw\";\n            repo = \"input\";\n            rev = \"master\"; # but I want a specific commit!\n            # ... and I need to update sha256 manually\n            sha256 = \"sha256-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=\"; \n          };\n        }\n    ];\n}\n```\n\nThis configuration is not deterministic. If upstream pushes a new commit, the build changes, and you need to update the\nsha256 hash manually.\n\nWith nix-template, you can write the following:\n\n```nix\nprogram.zsh = {\n    enable = true;\n    plugins = [\n        {\n          name = \"input\";\n          file = \"init.zsh\";\n          src = pkgs.fetchFromGitHub {\n            owner = \"zimfw\";\n            repo = \"input\";\n            # track master, but only when lock file is updated\n            rev = \"{{ commit_of_github('zimfw', 'input', 'master') }}\";\n            # no need to update sha256 manually\n            sha256 = \"{{ hash_from_github('zimfw', 'input', 'master') }}\";\n          };\n        }\n    ];\n}\n```\n\nNow the non-deterministic part is isolated in the lock file. You can update the lock file by\nrunning `nix-template update`.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightquantumarchive%2Fnix-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flightquantumarchive%2Fnix-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightquantumarchive%2Fnix-template/lists"}