2023-04-21 17:50:45 +03:00
|
|
|
<img src="assets/logo.svg" align="right" height="280">
|
|
|
|
|
2023-01-15 07:41:10 +03:00
|
|
|
# nix-init
|
|
|
|
|
2023-08-27 17:03:55 +03:00
|
|
|
[![matrix](https://img.shields.io/matrix/nix-init:nixos.org?server_fqdn=matrix.org&style=flat-square)](https://matrix.to/#/#nix-init:nixos.org)
|
2023-01-15 07:41:10 +03:00
|
|
|
[![release](https://img.shields.io/github/v/release/nix-community/nix-init?logo=github&style=flat-square)](https://github.com/nix-community/nix-init/releases)
|
|
|
|
[![version](https://img.shields.io/crates/v/nix-init?logo=rust&style=flat-square)](https://crates.io/crates/nix-init)
|
|
|
|
[![license](https://img.shields.io/badge/license-MPL--2.0-blue?style=flat-square)](https://www.mozilla.org/en-US/MPL/2.0)
|
|
|
|
[![ci](https://img.shields.io/github/actions/workflow/status/nix-community/nix-init/ci.yml?label=ci&logo=github-actions&style=flat-square)](https://github.com/nix-community/nix-init/actions?query=workflow:ci)
|
|
|
|
|
2023-01-28 22:46:08 +03:00
|
|
|
Generate Nix packages from URLs
|
2023-01-15 07:41:10 +03:00
|
|
|
|
2024-08-14 07:16:37 +03:00
|
|
|
> Note: It is likely that the generated package will not work without some
|
|
|
|
> tweaks, also remember to double check the license and description even if it
|
|
|
|
> does work
|
2023-01-28 23:11:56 +03:00
|
|
|
|
2024-08-14 07:16:37 +03:00
|
|
|
- Hash prefetching powered by [nurl] with support for `cargoHash` and
|
|
|
|
`vendorHash`
|
2023-07-01 23:12:59 +03:00
|
|
|
- Dependency inference for Rust, Go, and Python projects
|
2023-01-15 07:41:10 +03:00
|
|
|
- Interactive prompts with fuzzy tab completions
|
|
|
|
- License detection
|
|
|
|
|
2023-03-20 00:52:52 +03:00
|
|
|
![](https://user-images.githubusercontent.com/40620903/226211877-2d583d09-4fbc-4869-8248-6166edde21cc.gif)
|
2023-01-28 22:46:08 +03:00
|
|
|
|
2023-02-02 06:06:07 +03:00
|
|
|
## Installation
|
|
|
|
|
2024-08-14 07:16:37 +03:00
|
|
|
The latest release of nix-init is packaged in nixpkgs and kept up to date on the
|
|
|
|
unstable branches
|
2023-02-02 06:06:07 +03:00
|
|
|
|
|
|
|
![](https://repology.org/badge/vertical-allrepos/nix-init.svg)
|
|
|
|
|
2024-08-14 07:16:37 +03:00
|
|
|
If you want to use a more recent snapshot of nix-init, it is also available as a
|
|
|
|
flake. The following command is equivalent to running `nix-init --help`:
|
2023-02-02 06:06:07 +03:00
|
|
|
|
|
|
|
```bash
|
|
|
|
nix run github:nix-community/nix-init -- --help
|
|
|
|
```
|
|
|
|
|
|
|
|
or if you don't have flakes enabled:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
nix run --extra-experimental-features "flakes nix-command" github:nix-community/nix-init -- --help
|
|
|
|
```
|
|
|
|
|
2023-01-15 07:41:10 +03:00
|
|
|
## Usage
|
|
|
|
|
|
|
|
```
|
2023-03-20 00:52:52 +03:00
|
|
|
Usage: nix-init [OPTIONS] [OUTPUT]
|
2023-01-15 07:41:10 +03:00
|
|
|
|
|
|
|
Arguments:
|
2023-03-20 00:52:52 +03:00
|
|
|
[OUTPUT] The path or directory to output the generated file to
|
2023-01-15 07:41:10 +03:00
|
|
|
|
|
|
|
Options:
|
2023-02-06 23:32:09 +03:00
|
|
|
-u, --url <URL> Specify the URL
|
|
|
|
-n, --nixpkgs <NIXPKGS> Path to nixpkgs (in nix)
|
2023-09-08 21:15:06 +03:00
|
|
|
-C, --commit[=<COMMIT>] Commit the changes if the output path is name-based (RFC 140) [possible values: true, false]
|
2023-02-06 23:32:09 +03:00
|
|
|
-c, --config <CONFIG> Specify the config file
|
|
|
|
-h, --help Print help
|
|
|
|
-V, --version Print version
|
2023-01-20 05:07:02 +03:00
|
|
|
```
|
|
|
|
|
2023-02-02 06:06:07 +03:00
|
|
|
### Supported builders
|
|
|
|
|
|
|
|
- `stdenv.mkDerivation`
|
|
|
|
- `buildRustPackage`
|
|
|
|
- `buildPythonApplication` and `buildPythonPackage`
|
|
|
|
- `buildGoModule`
|
|
|
|
|
|
|
|
### Supported fetchers
|
|
|
|
|
|
|
|
- `fetchCrate`
|
|
|
|
- `fetchFromGitHub`
|
|
|
|
- `fetchFromGitLab`
|
|
|
|
- `fetchFromGitea`
|
|
|
|
- `fetchPypi`
|
2024-08-14 07:16:37 +03:00
|
|
|
- All other fetchers supported by [nurl] are also supported, you just have to
|
|
|
|
manually input the tag/revision of the package
|
2023-02-02 06:06:07 +03:00
|
|
|
|
2023-01-20 05:07:02 +03:00
|
|
|
## Configuration
|
|
|
|
|
2024-08-14 07:16:37 +03:00
|
|
|
nix-init will try to find `nix-init/config.toml` under XDG configuration
|
|
|
|
directories
|
2023-01-20 05:07:02 +03:00
|
|
|
|
|
|
|
```toml
|
|
|
|
# ~/.config/nix-init/config.toml
|
|
|
|
|
|
|
|
# maintainers that will get added to the package meta
|
|
|
|
maintainers = ["figsoda"]
|
|
|
|
|
2023-07-13 16:48:58 +03:00
|
|
|
# path to nixpkgs (in nix), equivalent to `--nixpkgs`
|
|
|
|
nixpkgs = "<nixpkgs>" # use the nixpkgs from channels (default)
|
|
|
|
# nixpkgs = 'builtins.getFlake "nixpkgs"' # use the nixpkgs from the flake registry
|
2023-02-06 23:32:09 +03:00
|
|
|
|
2023-09-08 21:15:06 +03:00
|
|
|
# commit the changes if the output path is name-based (RFC 140)
|
|
|
|
# see https://github.com/NixOS/nixpkgs/tree/master/pkgs/by-name for more information
|
|
|
|
commit = true
|
|
|
|
|
2023-01-20 05:07:02 +03:00
|
|
|
# access tokens to access private repositories and avoid rate limits
|
|
|
|
[access-tokens]
|
|
|
|
"github.com" = "ghp_blahblahblah..."
|
|
|
|
"gitlab.com".command = ["secret-tool", "or", "whatever", "you", "use"]
|
|
|
|
"gitlab.gnome.org".file = "/path/to/api/token"
|
2023-01-15 07:41:10 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
## Changelog
|
|
|
|
|
|
|
|
See [CHANGELOG.md](CHANGELOG.md)
|
|
|
|
|
|
|
|
[nurl]: https://github.com/nix-community/nurl
|