- Notifications
You must be signed in to change notification settings - Fork0
asdf2nix is a tool that translates an asdf .tool-versions file into a flake or execute a nix shell
License
brokenpip3/asdf2nix
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
asdf2nix is a tool that converts anasdf.tool-versions
file into a Nix flake or run a nix shell, simplifying the process of transitioning from asdf to Nix.
To useasdf2nix, run the following command in your project root where the.tool-versions
file is located:
nix run github:brokenpip3/asdf2nix --<command>
You can also specify the file location as an argument if it's in a different directory.
Note: Make sure Nix is installed on your system and that flakes are enabled before using this tool.
nix run github:brokenpip3/asdf2nix -- flake
This command generates a flake based on the packages listed in the.tool-versions
file:
$ cat .tool-versionsterraform 1.5.2nodejs 16.15.0$ nix run github:brokenpip3/asdf2nix -- flake{ description ="A flake with devshell generated from .tools-version"; inputs = { nixpkgs.url ="github:NixOS/nixpkgs/nixos-unstable"; flake-utils.url ="github:numtide/flake-utils"; terraform_1_5_2.url = github:NixOS/nixpkgs/0b9be173860cd1d107169df87f1c7af0d5fac4aa; nodejs_16_15_0.url = github:NixOS/nixpkgs/7b7fe29819c714bb2209c971452506e78e1d1bbd; }; outputs = { self, nixpkgs, flake-utils, ... }@inputs: flake-utils.lib.eachDefaultSystem (system:let pkgs = nixpkgs.legacyPackages.${system}; terraform = inputs.terraform_1_5_2.legacyPackages.${system}.terraform; nodejs = inputs.nodejs_16_15_0.legacyPackages.${system}.nodejs;in { devShells.default = pkgs.mkShell { packages = [ terraform nodejs ]; }; } );}
nix run github:brokenpip3/asdf2nix -- shell
This command generates and executes a Nix shell based on the packages specified in the.tool-versions
file.
$ cat .tool-versionsterraform 1.5.2nodejs 16.15.0$ nix run github:brokenpip3/asdf2nix -- shellGenerating shell from .tool-versions: nix shell nixpkgs/0b9be173860cd1d107169df87f1c7af0d5fac4aa#terraform nixpkgs/7b7fe29819c714bb2209c971452506e78e1d1bbd#nodejs$ terraform versionTerraform v1.5.2on linux_amd64...
Due to the fact that not all patch versions are present, a slight change between patch versions is tolerated (e.g.,3.4.1
vs3.4.3
), while a change in minor/major versions will not be considered.
Special thanks to
RikudouSage
for the versionsdatabase.This repository was initialized with:
nix flake init -t github:brokenpip3/my-flake-templates#python-poetry
About
asdf2nix is a tool that translates an asdf .tool-versions file into a flake or execute a nix shell