| 13 Mar 2024 |
accelbread | Though I think I usually pull in like python3 and do python3.buildPythonPackage? Don't remember at the moment and only have python stuff on work laptop ha | 17:05:54 |
accelbread | Though I usually end up needing specific python versions like python311 or python312 | 17:06:45 |
accelbread | Ah its python3.pkgs.buildPythonPackage | 17:08:43 |
cmacrae | ahhh, that's it | 17:08:52 |
cmacrae | thank you! | 17:08:57 |
cmacrae | woo | 17:09:24 |
cmacrae | it worked :) | 17:09:29 |
accelbread | Nice. Python stuff ends up kinda complicated. Nix imo makes it a lot easier but python is still a bit of a mess ha | 17:10:02 |
accelbread | I've had an issue where pytest needs 3.12 and pylsp needs 3.11 but I want both to share a python 🙃 | 17:10:56 |
cmacrae | absolutely - I've joined a company where I'm just seeing these horrible solutions to managing lang & lib versions (python virtualenv, nvm, etc...) and I absolutely have to show them the Nix way, haha | 17:11:44 |
accelbread | For stuff like tests (we write C code with tests usually in python), I usually use a venv; people can just do python -m venv venv and if it doesn't work, I have them do nix run nixpkgs#python312 -- -m venv venv | 17:13:33 |
accelbread | Ideally could just have a package to run, but machnix is deprecated and dream2nix isn't ready to replace it yet | 17:14:11 |
cmacrae | nice, yeah for sure. there's the new python nix stuff that the author/leader of dream2nix just released the other week, right? | 17:15:01 |
cmacrae | did you see that? I haven't dug into it yet | 17:15:12 |
accelbread | Oh, I wasn't aware | 17:15:46 |
accelbread | I'll have to look into that; would be nice to package our tests properly lol | 17:16:05 |
cmacrae | yeah it looked pretty comprehensive when I had a brief read over the site/docs | 17:17:50 |
accelbread | What I need is just a function that takes a locked requirements.txt, and gives me a nix file that I can import to get a python environment matching the requirements.txt | 17:19:32 |
cmacrae | ah yeah, like all the old 2nix tools. as you already mentioned, dream2nix looks very promising | 17:20:25 |
accelbread | hmm still seems like a bit of a hefty dependency. pip2nix is almost perfect except for being quite out-of-date and not working on Mac. Maybe I ought to just fork it and update it one of these days | 17:26:20 |
cmacrae | yeah that's a fair point. I think it has some very lofty goals and is nothing like the smaller converters we're historically used to | 17:32:22 |
accelbread | Yeah, I'm also usually not creating a package, but creating a python environment used by devShell, formatter, and multiple packages | 17:33:09 |
accelbread | Or doing something like creating the python env esp-idf requires, and using the esp-idf build system in my derivation | 17:33:50 |
cmacrae | yeah exactly 👍️ | 17:56:15 |
| 14 Mar 2024 |
| wyndon changed their profile picture. | 11:02:44 |
| NixOS Moderation Botchanged room power levels. | 18:44:30 |
| 15 Mar 2024 |
cmacrae | me again accelbread 👋😅 looking at using flakelight-rust for our company's mono-repo. when using flakelight-rust in a flakelight flake, where I'm importing the flakelightModule, how can I set the fileset option? | 14:51:25 |
cmacrae | also, out of curiosity, maybe you can help me figure out: looks like they're using a top level Cargo.toml in the root of the repo. it uses a large members section to define all its components, of which some are cargo packages. the top level Cargo.toml doesn't have a package section defined, so I added one and called it "<thing>-meta". which in turn seems like it's then instructing to build everything (the desired outcome). do you think this is a good approach for using flakelight-rust? | 14:51:28 |
accelbread | Sounds like its using a cargo workspace; currently flakelight-rust builds the default package if it is set (it can be set to one of the other crates or the workspace itself can have a package section)
If you want to build everything, a meta package seems fine for now with current support.
Would be best if we add support for building all the crates in a workspace as separate packages though; that way nothing special has to be done. | 15:17:38 |
accelbread | fileset is set as a normal flakelight option, like so:
{
inputs.flakelight-rust.url = "github:accelbread/flakelight-rust";
outputs = { flakelight-rust, ... }:
flakelight-rust ./. {
fileset = ./.;
};
}
Above is easy way which gives pacakges access to all files in the repo
| 15:19:32 |