Skip to content

Commit 6389f3f

Browse files
committed
Update readme
1 parent b1ad6a7 commit 6389f3f

File tree

1 file changed

+28
-18
lines changed

1 file changed

+28
-18
lines changed

README.md

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Make creating nix expressions easy. Provide a nice way to create largely boilerp
3838
- [X] Pypi (will need a way to pass pypi pname, as it may differ from installable path)
3939
- [X] Implement shell completion (nix-template completions <SHELL>)
4040

41-
## Current Usage (github and pypi only)
41+
## Current Usage (--from-url, github and pypi only)
4242

4343
```bash
4444
$ nix-template rust -n --from-url github.com/jonringer/nix-template
@@ -51,17 +51,20 @@ Please add the following line to the approriate file in top-level:
5151
The resulting file:
5252
```
5353
# $NIXPKGS_ROOT/pkgs/applications/misc/nix-template/default.nix
54-
{ lib, rustPlatform, fetchFromGitHub }:
54+
{ lib
55+
, rustPlatform
56+
, fetchFromGitHub
57+
}:
5558

5659
rustPlatform.buildRustPackage rec {
5760
pname = "nix-template";
58-
version = "0.1.0";
61+
version = "0.2.0";
5962

6063
src = fetchFromGitHub {
6164
owner = "jonringer";
6265
repo = pname;
6366
rev = "v${version}";
64-
sha256 = "1h6xdvhzg7nb0s82b3r5bsh8bfdb1l5sm7fa24lfwd396xp9yyig";
67+
sha256 = "0iw2ag0mnb373kgi39c8sgi6ij44xmpfl0vs1471aq6ly54n3lch";
6568
};
6669

6770
cargoSha256 = "0000000000000000000000000000000000000000000000000000";
@@ -85,7 +88,7 @@ $ nix-template config name jonringer
8588
$ nix-template config nixpkgs-root /home/jon/projects/nixpkgs
8689

8790
# add a package
88-
$ nix-template python --pname requests -f pypi -l asl20
91+
$ nix-template python --nixpkgs --pname requests -f pypi -l asl20
8992
Creating directory: /home/jon/projects/nixpkgs/pkgs/development/python-modules/requests/
9093
Generating python expression at /home/jon/projects/nixpkgs/pkgs/development/python-modules/requests/default.nix
9194
Please add the following line to the approriate file in top-level:
@@ -94,7 +97,10 @@ Please add the following line to the approriate file in top-level:
9497
```
9598
```nix
9699
# pkgs/development/python-modules/requests/default.nix
97-
{ lib, buildPythonPackage, fetchPypi }:
100+
{ lib
101+
, buildPythonPackage
102+
, fetchPypi
103+
}:
98104

99105
buildPythonPackage rec {
100106
pname = "requests";
@@ -140,55 +146,59 @@ $ cargo install --path .
140146
Installing depedencies on nixpkgs:
141147
```
142148
nix-shell
149+
# or
150+
nix develop
143151
```
144152
145153
Other platforms, you'll need the following dependencies:
146154
- cargo
147155
- rustc
148156
- rust-clippy
149157
150-
## End Goal
158+
## End Goal (Only better nixpkgs support missing)
151159
152160
```bash
153161
# only need to config once per user
154162
$ nix-template config name jonringer
155163
$ nix-template config nixpkgs-root /home/jon/projects/nixpkgs
156164
157165
# add a package
158-
$ nix-template python --pname requests -f pypi -l asl20
159-
Found latest stable release to be 2.24.0 on pypi.com
166+
$ nix-template python --nixpkgs -u https://pypi.org/project/requests/
167+
Determining latest release for requests
160168
Creating directory: /home/jon/projects/nixpkgs/pkgs/development/python-modules/requests/
161169
Generating python expression at /home/jon/projects/nixpkgs/pkgs/development/python-modules/requests/default.nix
162170
For an addition to nixpkgs as a python package, please add the following to pkgs/top-level/python-packages.nix:
163171
164-
requests = callPackage ../development/python-modules/<PNAME> { };
172+
requests = callPackage ../development/python-modules/requests { };
165173
166174
For an addition to nixpkgs as a python application, please add the following to pkgs/top-level/all-packages.nix:
167175
168-
requests = python3Packages.callPackage <PATH_FROM_CLI> { };
176+
requests = with python3Packages; toPythonApplication requests { };
169177
```
170178
```nix
171-
# pkgs/development/python-modules/requests/default.nix
172-
{ lib, buildPythonPackage, fetchPypi }:
179+
{ lib
180+
, buildPythonPackage
181+
, fetchPypi
182+
}:
173183
174184
buildPythonPackage rec {
175185
pname = "requests";
176-
version = "2.24.0";
186+
version = "2.26.0";
177187
178188
src = fetchPypi {
179189
inherit pname version;
180-
sha256 = "b3559a131db72c33ee969480840fff4bb6dd111de7dd27c8ee1f820f4f00231b";
190+
sha256 = "b8aa58f8cf793ffd8782d3d8cb19e66ef36f7aba4353eec859e74678b01b07a7";
181191
};
182192
183193
propagatedBuildInputs = [ ];
184194
185195
pythonImportsCheck = [ "requests" ];
186196
187197
meta = with lib; {
188-
description = "CHANGEME";
189-
homepage = "https://github.com/CHANGEME/requests/";
198+
description = "Python HTTP for Humans";
199+
homepage = "https://requests.readthedocs.io";
190200
license = licenses.asl20;
191-
maintainer = with maintainers; [ jonringer ];
201+
maintainers = with maintainers; [ jonringer ];
192202
};
193203
}
194204
```

0 commit comments

Comments
 (0)