Nix Flakes | 880 Members | |
| 175 Servers |
| Sender | Message | Time |
|---|---|---|
| 31 Oct 2023 | ||
| Hey everyone. Flake novice here. I used a flake to create a reproducible development shell for one of my python applications. So far, so good. Then I wanted to integrate my application into my configuration.nix and run it as a recurring service via systemd. To this end, (after browsing github for inspiration), in my nix config repo I created a pkgs/app/default.nix, which points to the github repo of my application, and a modules/app/default.nix, which defines settings and applies those appropriately. My configuration.nix imports the app's module and enables it. Although it took me a while cause I'm new to Nix, I got that setup working after a while. Now I'd like to turn the second part (module, pkg definitions) into a flake, and have some questions about that. Because there's so many open questions, I'll just post them in the order that makes sense to me. Any help/pointers would be greatly appreciated:
| 08:28:51 | |
| the main difference between having a flake in the same repo vs a separate one is that if it's in the same repo, the whole repository ends up in the closure—which is fine most of the time, but sometimes you e.g. want to filter something out, because it isn't necessary for your builds | 08:53:53 | |
| I'd say that when possible, it makes sense to have the flake in the same repo | 08:54:09 | |
| I wouldn't want to have a devshell in a repository separate from the app—but I don't know if there is a general practice | 08:54:53 | |
| for what it's worth, my encounters with flakes so far are mostly in repos that package themselves, in the same repo | 08:55:20 | |
I don't entirely get the last point. pkgs.callPackage ./pkgs/app/default.nix {} will probably do what you want for packages, import ./modules/app/default.nix will do that for modules | 08:56:36 | |
as in, outputs.nixosModules.app = import ./modules/app/default.nix; | 08:57:07 | |
| thanks mewp. can I bother you to share one or two of those repos with flakes that package themselves in the same repo? that would really help a lot. | 09:12:52 | |
| https://gitlab.com/eobuwie-foss/imaginator/ ← that's one of mine | 09:14:07 | |
| most of my other repos are unfortunately private, but I'll try to find a public example | 09:14:51 | |
| oh, right, https://github.com/helix-editor/helix | 09:15:43 | |
| but also see https://github.com/NixOS/flake-registry/blob/master/flake-registry.json | 09:15:50 | |
| I'll try to figure out a theme from those that I can apply to my problem. thanks, mewp! | 09:18:29 | |
| don't hesitate to ask more | 09:18:44 | |
| 14:29:10 | ||
| 1 Nov 2023 | ||
| 14:06:45 | ||
| 2 Nov 2023 | ||
| 01:28:42 | ||
| 05:22:21 | ||
| I finally got around to adding the To use the flake for my app, I added it as input to the flake for my host configuration, and passed it as input to my | 10:01:53 | |
| * I finally got around to adding the To use the flake for my app, I added it as input to the flake for my host configuration, and passed it as input to my | 10:02:47 | |
| * I finally got around to adding the To use the flake for my app, I added it as input to the flake for my host configuration, and passed it as input to my | 10:03:10 | |
| * I finally got around to adding the To use the flake for my app, I added it as input to the flake for my host configuration, and passed it as input to my | 10:03:30 | |
| Redacted or Malformed Event | 11:02:33 | |
virtu: There is no application attribute, and what you're seeing is the correct output. The systems are generated by flake-utils | 11:04:37 | |
* virtu: There is no application attribute, and what you're seeing is the correct (well, more like expected) output. The systems are generated by flake-utils | 11:05:04 | |
| But nixosModules shouldn't be architecture-specific | 11:05:54 | |
Maybe have a look at https://ayats.org/blog/no-flake-utils/#when-things-go-wrong for why you might not need flake-utils (especially if you want to define a nixosModule) | 11:07:01 | |
CRTified: yeah, I just realized I had the nixosModules in the wrong place. I figured out a way to fix it in the mean time, but thanks for clarifying and providing some background information. I didn't use flake-utils in my most recent version, but I updated my flake's inputs this morning, switched to out-of-tree poetry2nix because it is no longer in unstable, and started from scratch with a flake template from poetry2nix (which uses flake-utils). I'll do some reading and try to figure out the best approach. thanks! | 11:14:03 | |
| 20:09:29 | ||
| 22:43:56 | ||