!avYyleMexqjFHoqrME:nixos.org

Nix Documentation

420 Members
Discussion about documentation improvements around the Nix ecosystem86 Servers

Load older messages


SenderMessageTime
18 Aug 2022
@paul.tiplady:matrix.orgPaul Tiplady

The comment "The -I flag pins the Nixpkgs revision to an exact Git revision, leaving no doubt about which exact version of Nix packages will be used." makes my eyes glaze over. How do I get that git revision? Is a user really expected to do this? In practice I don't think I'd use a shell one-liner this way, I'd use a shell.nix, right?

I think this example is bringing in immutability a bit too early, even though it's a defining feature.

03:34:40
@tpw_rules:matrix.orgtpw_rules Sandro 🐧: nix-env -qaP is definitely a thing to take out in your "sync with best practices" PR 03:36:56
@tpw_rules:matrix.orgtpw_rulesdo you feel familiar with git and github?03:37:52
@paul.tiplady:matrix.orgPaul Tiplady

The next bit https://nixos.org/guides/towards-reproducibility-pinning-nixpkgs.html#pinning-nixpkgs talks more about this, and feels like the good stuff. But it abandons the python example from before, and so I can't figure out how to use niv.

I want to say something like niv add 'python38.withPackages (packages: [ packages.django ])' to continue building on the previous example of installing Django, but that doesn't work. Even niv add python38 doesn't work.

  FATAL: One or more packages failed to update:
  python38.withPackages (packages: [ packages.django ]): Update failed: Key could not be found: url_template
  CallStack (from HasCallStack):
    error, called at src/Niv/Update.hs:80:25 in niv-0.2.21-K4hQ3qL7WtG6yW48qVS1p3:Niv.Update
ERROR: ExitFailure 1

Not a friendly error message, and I feel like the doc is missing a chance to continue to build on the previous page.

03:38:28
@paul.tiplady:matrix.orgPaul Tiplady

Now that I think of it, python38.withPackages isn't explained in terms of the nix-env -qaP command; teach me how to fish and figure out what package names I should use? nix-env just gives me:


nixpkgs.python        python-2.7.18
nixpkgs.python2       python-2.7.18
nixpkgs.python27Full  python-2.7.18
nixpkgs.python2Full   python-2.7.18
nixpkgs.pythonFull    python-2.7.18

-- where is the python38 coming from? (By which I mean, how does a new user figure out what python3* exist to use?)

One thing the Rust docs (and ecosystem more generally) do is liberally link between different sources of information, so if there is a doc repository hosting the python38 and explaining the withPackages args, linking it so that I can learn about that source of package information would be useful.

03:42:31
@paul.tiplady:matrix.orgPaul Tiplady

Final note -- I feel like this brushes over some core concepts: "You can use the generated nix/sources.nix with a top-level default.nix"

Before you tell me to do a default.nix, maybe explain that and shell.nix and why they are awesome (AIUI these are some of the very cool bits of the nix plumbing).

03:45:30
@tpw_rules:matrix.orgtpw_rulescan i ask what brought you to nix?03:45:31
@tpw_rules:matrix.orgtpw_rulesand do you have any particular goals in using it? if you are trying to get set up with django i imagine you are a python programmer03:47:43
@tpw_rules:matrix.orgtpw_rules(also that previous q about: do you feel familiar with git and github?)03:48:54
@paul.tiplady:matrix.orgPaul TipladyI hear a lot of people preaching on HN about how nice it is, and I see the appeal of setting up developer environments and CI/CD pipelines. I found that on MacOS at least, every 6 months my "new developer" guide for my team broke because of some library/OS change, and I am interested to see if doing things immutably, the Nix way, would be better. Currently my dev env stack is (MacOS): pyenv, pyenv-virtualenv, poetry (would switch if other packaging systems integrated better), PyCharm. I use yarn and webpack for JS stuff. And everything goes into a Docker container and gets deployed to Kubernetes. While I'm mostly writing Python I just followed the example in the docs. I have Docker as my "blessed environment" for builds and CI/CD, but it's annoying to ask developers to use Docker for their local dev loop. So we have two different env setups, one for local dev, and one for CI/CD build and prod deploy.03:51:54
@paul.tiplady:matrix.orgPaul TipladyI'm familiar with the git toolchain.03:52:28
@tpw_rules:matrix.orgtpw_rulesand presumably some form of git hosting service?03:54:53
@paul.tiplady:matrix.orgPaul TipladyYes, I've run projects on Github and Gitlab in the past03:55:08
@tpw_rules:matrix.orgtpw_rulesone last random sounding question: do you use apple silicon macs?03:56:00
@tpw_rules:matrix.orgtpw_rules * one last random sounding question: do you use apple silicon macs? (and is that where you ran your niv command)?03:56:09
@paul.tiplady:matrix.orgPaul TipladyNope, I'm currently on an old (Circa 2014) MBP.03:58:13
@tpw_rules:matrix.orgtpw_rulesokay, thank you very much for coming here to share your experience. i did want to do some further opining on how i use nix, but this isn't really the place. do you want to join the main channel https://matrix.to/#/#nix:nixos.org or PM me?04:02:28
@paul.tiplady:matrix.orgPaul TipladyI have to sign off for the eve -- I'll check back in here if I get further with this. And thanks for the offer -- I'll ping you.04:06:46
@tpw_rules:matrix.orgtpw_rules okay, good luck. my first piece of advice is don't use nix-env -qaP for a variety of reasons. use this: https://search.nixos.org/packages 04:07:48
@sandro:supersandro.deSandro 🐧
In reply to @tpw_rules:matrix.org
Sandro 🐧: nix-env -qaP is definitely a thing to take out in your "sync with best practices" PR
Then I would need to replace those parts and I am not fast at waiting documentation.
11:38:59
19 Aug 2022
@rapenne-s:tchncs.deSolène Rapenne (she/her) that's cool, someone wrote https://nixos.wiki/wiki/Specialisation after my tweag blog post. I added this section because it's a very useful use case but totally impossible to figure out (infinisil found how to do that). Could someone tell me if it's understandable? https://nixos.wiki/wiki/Specialisation#Special_case:_the_default_non-specialised_entry 20:10:50
@jtojnar:matrix.orgJan Tojnar
In reply to @rapenne-s:tchncs.de
that's cool, someone wrote https://nixos.wiki/wiki/Specialisation after my tweag blog post. I added this section because it's a very useful use case but totally impossible to figure out (infinisil found how to do that). Could someone tell me if it's understandable? https://nixos.wiki/wiki/Specialisation#Special_case:_the_default_non-specialised_entry
It reads okay to me. Though does it need to be a new file? I would expect including the expression inline into the imports, or just anywhere using mkIf to work fine.
21:17:09
@jtojnar:matrix.orgJan TojnarAlso the config will also apply to specializations containing specializations (not sure if that is a thing).21:18:22
@rapenne-s:tchncs.deSolène Rapenne (she/her) Jan Tojnar yes this can be inline within the imports but I find it very not practical 21:54:52
@rapenne-s:tchncs.deSolène Rapenne (she/her)I dunno if it could be possible to cover specialisation in man configuration.nix ?22:05:18
@me:linj.techlinj
In reply to @rapenne-s:tchncs.de
that's cool, someone wrote https://nixos.wiki/wiki/Specialisation after my tweag blog post. I added this section because it's a very useful use case but totally impossible to figure out (infinisil found how to do that). Could someone tell me if it's understandable? https://nixos.wiki/wiki/Specialisation#Special_case:_the_default_non-specialised_entry
cool, config.specialisation != {} is a clever hack! I used to use mkRemove to remove items from a list in specialisation.
22:16:44
@jtojnar:matrix.orgJan Tojnar
In reply to @rapenne-s:tchncs.de
Jan Tojnar yes this can be inline within the imports but I find it very not practical
I am somewhat worried about perpetuating the misconception that files are something special (I have seen newcomers confused by this) but I am not how to formulate it better without it becoming too clumsy or more confusing
22:43:07
@rapenne-s:tchncs.deSolène Rapenne (she/her)I still don't understand why the code can't be put into configuration.nix ^^' so I used a file to keep things clean instead of a big chunk into imports22:43:56
20 Aug 2022
@b-eric-d:matrix.orgb-eric-d joined the room.02:33:32
@kayla.fire:matrix.orgkayla (she/they) joined the room.17:25:18

There are no newer messages yet.


Back to Room ListRoom Version: 6