806
submitted 1 month ago by turnipjs@lemmy.ml to c/linuxmemes@lemmy.world
you are viewing a single comment's thread
view the rest of the comments
[-] tux7350@lemmy.world 1 points 1 month ago

Hey this is a great web server example! Instead of commenting it out to enable or disable you can actually turn it into a full module. Check out this example of a nix module. Basically, you can take your code you pasted and put it under the config set. Then create an option to enable that set of code. Now you can always have this nix file imported, but enable the option only when you need it with another declaration. Really, that's how all the declarations work you're just getting the nix files from github and nixpkgs.

[-] Laser@feddit.org 1 points 1 month ago

Thanks for the answer; I do have at least one module in my config, but usually, I don't enable or disable services like that, it was more of an example of how the configuration is split up and what the advantage of that is. In the end, if the only option is to enable the module, you're not gaining that much if you need to import and enable it instead of just importing the configuration straight is my opinion.

this post was submitted on 28 Jul 2024
806 points (97.7% liked)

linuxmemes

20779 readers
943 users here now

I use Arch btw


Sister communities:

Community rules

  1. Follow the site-wide rules and code of conduct
  2. Be civil
  3. Post Linux-related content
  4. No recent reposts

Please report posts and comments that break these rules!

founded 1 year ago
MODERATORS