{"id":18980576,"url":"https://github.com/snowfallorg/drift","last_synced_at":"2025-04-19T19:13:53.742Z","repository":{"id":224221038,"uuid":"748871791","full_name":"snowfallorg/drift","owner":"snowfallorg","description":"Update Nix Flake package sources.","archived":false,"fork":false,"pushed_at":"2024-05-25T22:19:47.000Z","size":32,"stargazers_count":40,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-16T15:15:11.016Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/snowfallorg.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,"zenodo":null}},"created_at":"2024-01-26T23:17:33.000Z","updated_at":"2025-03-08T04:36:53.000Z","dependencies_parsed_at":"2025-04-16T12:48:36.121Z","dependency_job_id":"986522cd-abe5-41c0-bb70-f039d9689497","html_url":"https://github.com/snowfallorg/drift","commit_stats":null,"previous_names":["snowfallorg/drift"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowfallorg%2Fdrift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowfallorg%2Fdrift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowfallorg%2Fdrift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowfallorg%2Fdrift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snowfallorg","download_url":"https://codeload.github.com/snowfallorg/drift/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249774516,"owners_count":21323634,"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":"2024-11-08T16:07:10.201Z","updated_at":"2025-04-19T19:13:53.725Z","avatar_url":"https://github.com/snowfallorg.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Snowfall Drift\n\n\u003ca href=\"https://nixos.wiki/wiki/Flakes\" target=\"_blank\"\u003e\n\t\u003cimg alt=\"Nix Flakes Ready\" src=\"https://img.shields.io/static/v1?logo=nixos\u0026logoColor=d8dee9\u0026label=Nix%20Flakes\u0026labelColor=5e81ac\u0026message=Ready\u0026color=d8dee9\u0026style=for-the-badge\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/snowfallorg/lib\" target=\"_blank\"\u003e\n\t\u003cimg alt=\"Built With Snowfall\" src=\"https://img.shields.io/static/v1?label=Built%20With\u0026labelColor=5e81ac\u0026message=Snowfall\u0026color=d8dee9\u0026style=for-the-badge\"\u003e\n\u003c/a\u003e\n\n\u003cp\u003e\n\u003c!--\n\tThis paragraph is not empty, it contains an em space (UTF-8 8195) on the next line in order\n\tto create a gap in the page.\n--\u003e\n  \n\u003c/p\u003e\n\n\u003e Update Nix Flake package sources.\n\n## Installation\n\n### Nix Profile\n\nYou can install this package imperatively with the following command.\n\n```bash\nnix profile install github:snowfallorg/drift\n```\n\n### Nix Configuration\n\nYou can install this package by adding it as an input to your Nix Flake.\n\n```nix\n{\n\tdescription = \"My system flake\";\n\n\tinputs = {\n\t\tnixpkgs.url = \"github:nixos/nixpkgs/nixos-23.05\";\n\t\tunstable.url = \"github:nixos/nixpkgs/nixos-unstable\";\n\n\t\t# Snowfall Lib is not required, but will make configuration easier for you.\n\t\tsnowfall-lib = {\n\t\t\turl = \"github:snowfallorg/lib\";\n\t\t\tinputs.nixpkgs.follows = \"nixpkgs\";\n\t\t};\n\n\t\tsnowfall-drift = {\n\t\t\turl = \"github:snowfallorg/drift\";\n\t\t\tinputs.nixpkgs.follows = \"nixpkgs\";\n\t\t};\n\t};\n\n\toutputs = inputs:\n\t\tinputs.snowfall-lib.mkFlake {\n\t\t\tinherit inputs;\n\t\t\tsrc = ./.;\n\n\t\t\toverlays = with inputs; [\n\t\t\t\t# Use the default overlay provided by this flake.\n\t\t\t\tsnowfall-drift.overlays.default\n\n\t\t\t\t# There is also a named overlay, though the output is the same.\n\t\t\t\tsnowfall-drift.overlays.\"package/drift\"\n\t\t\t];\n\t\t};\n}\n```\n\nIf you've added the overlay from this flake, then in your system configuration you\ncan add the `snowfallorg.drift` package.\n\n```nix\n{ pkgs }:\n\n{\n\tenvironment.systemPackages = with pkgs; [\n\t\tsnowfallorg.drift\n\t];\n}\n```\n\n## Usage\n\n### Add an update script\n\nDrift processes packages that contain an `update` attribute. To add an update script, specify a script\nderivation in the package's `passthru`.\n\n```nix\n# packages/my-package/default.nix\n{ pkgs, ... }:\nlet\n    name = \"my-package\";\n    version = \"1.0.0\";\n    hash = \"sha256-hash-here\";\nin\npkgs.stdenv.mkDerivation {\n    inherit name version;\n\n    src = pkgs.fetchFromGitHub {\n        owner = \"my-org\";\n        repo = \"my-repo\";\n        rev = \"v${version}\";\n        sha256 = hash;\n    };\n\n    passthru.update = pkgs.writeShellScriptBin \"update-my-package\" ''\n        set -euo pipefail\n\n        latest=\"$(${pkgs.curl}/bin/curl -s \"https://api.github.com/repos/my-org/my-repo/releases?per_page=1\" | ${pkgs.jq}/bin/jq -r \".[0].tag_name\" | ${pkgs.gnused}/bin/sed 's/^v//')\"\n\n        drift rewrite --auto-hash --new-version \"$latest\"\n    '';\n}\n```\n\nDrift is made available to update scripts in addition to some environment variables:\n\n| Name                  | Description                                      |\n| --------------------- | ------------------------------------------------ |\n| DRIFT_NAME            | The name of the package.                         |\n| DRIFT_FILE            | The path to the package's Nix file if available. |\n| DRIFT_CURRENT_VERSION | The current version of the package.              |\n| DRIFT_CURRENT_HASH    | The current hash of the package.                 |\n\n### `drift update`\n\n```\nDESCRIPTION\n\n    Update a package.\n\nUSAGE\n\n    $ drift update [...package] [options]\n\nOPTIONS\n\n    --flake, -f               The flake to get package information from\n    --src                     The source attribute to use for hash information\n\n    --help, -h                Show this help message\n    --verbose, -v             Set logging verbosity\n\nEXAMPLE\n\n    $ # Update all packages with update scripts.\n    $ drift update --flake /my/flake/dir\n\n    $ # Update specific packages with update scripts.\n    $ drift update --flake /my/flake/dir my-package my-other-package\n\n    $ # Update using the hash of a specific package attribute.\n    $ drift update --flake /my/flake/dir --src my-upstream-src my-package`\n```\n\n### `drift rewrite`\n\n```\nDESCRIPTION\n\n    Replace a package's source version and hash.\n\nUSAGE\n\n    $ drift rewrite [...package] [options]\n\nOPTIONS\n\n    --file                    The file to rewrite (defaults to package file with Snowfall Lib)\n    --name                    The name of the package output (defaults to current package)\n    --flake                   The flake to get package information from (defaults to current flake)\n    --current-version         The current version of the package (defaults to current version)\n    --new-version             The current version of the package\n    --current-hash            The current hash of the package\n    --new-hash                The current hash of the package\n    --auto-hash               Automatically calculate the new hash\n    --src                     The source attribute to use for hash information\n\n    --help, -h                Show this help message\n    --verbose, -v             Set logging verbosity\n\nEXAMPLE\n\n    \u003e Note: If you are using Snowfall Lib then you do not need to specify \"--file\".\n\n    $ # Update the version of a package.\n    $ drift rewrite --file ./packages/my-package.nix --current-version $DRIFT_CURRENT_VERSION --new-version 10.0.0\n\n    $ # Update the hash of a package.\n    $ drift rewrite --file ./packages/my-package.nix --current-hash $DRIFT_CURRENT_HASH --new-hash my-hash-here\n\n    $ # Automatically update the hash of a package using its new version.\n    $ drift rewrite --file ./packages/my-package.nix --new-version 10.0.0 --auto-hash\n\n    $ # Calculate hashes using a different source attribute.\n    $ drift rewrite --file ./packages/my-package.nix --new-version 10.0.0 --auto-hash --src my-upstream-src\n\n    $ # Update arbitrary text.\n    $ drift rewrite --file ./packages/my-package.nix --from my-text --to my-new-text\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnowfallorg%2Fdrift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnowfallorg%2Fdrift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnowfallorg%2Fdrift/lists"}