Nix-template v0.1.4 released!

Release a new version of nix-template, major changes:

- Add nixos module template
- Add nixos test template
- Add flake template
- Add -u,--from-url option
  - Github supported

Biggest improvement is the --from-url with github:

$ ./result/bin/nix-template stdenv -u github.com/openzfs/zfs example.nix
Determining latest release for zfs
Determining sha256 for zfs
Generated a stdenv nix expression at /home/jon/projects/nixpkgs/example.nix
[15:56:12] jon@jon-desktop /home/jon/projects/nixpkgs (bump-nix-template)
$ cat /home/jon/projects/nixpkgs/example.nix
{ lib, stdenv, fetchFromGitHub }:

stdenv.mkDerivation rec {
  pname = "zfs";
  version = "2.1.0";

  src = fetchFromGitHub {
    owner = "openzfs";
    repo = pname;
    rev = "zfs-${version}";
    sha256 = "16l7kva4i3xvzls7n8vi7gpjhxxsgxs37p81fi0n0r2p5d4kimk1";
  };

  buildInputs = [ ];

  meta = with lib; {
    description = "OpenZFS on Linux and FreeBSD";
    homepage = "https://github.com/openzfs/zfs/";
    license = licenses.CHANGE;
    maintainers = with maintainers; [ jonringer ];
  };
}

Old thread: https://discourse.nixos.org/t/nix-template-at-v0-1-0

8 Likes

Pypi support was added in 0.1.2:

nix-template python --stdout -u pypi.org/project/requests
Determining latest release for requests
{ lib, buildPythonPackage, fetchPypi }:

buildPythonPackage rec {
  pname = "requests";
  version = "2.26.0";

  src = fetchPypi {
    inherit pname version;
    sha256 = "b8aa58f8cf793ffd8782d3d8cb19e66ef36f7aba4353eec859e74678b01b07a7";
  };

  propagatedBuildInputs = [ ];

  pythonImportsCheck = [ "requests" ];

  meta = with lib; {
    description = "Python HTTP for Humans";
    homepage = "https://requests.readthedocs.io";
    license = licenses.asl20;
    maintainers = with maintainers; [  ];
  };
}