!coeAONBrWyDJnYMbMi:nixos.org

NixOS System Operations

624 Members
About system administration for running NixOS systems in production. Declaratively manage your operations. | Room recommendations: #networking:nixos.org171 Servers

Load older messages


SenderMessageTime
31 Mar 2024
@dclmatrix:matrix.orgblu3 changed their display name from dclmatrix to exet.22:32:51
@technicus:matrix.orgMiles Dyson joined the room.23:04:12
@technicus:matrix.orgMiles DysonHey there, I am a NixOS noob. NisOS has been installed for a few weeks and we are getting to know each other. What are different methods for organizing the config files? I have opted to create the sub directory '/etc/nixos/import'. Within './import' there are additional directories to organize the config files. Is this a common practice, are there any standards? There I created additional sub directories for different configuration types.23:14:03
@raitobezarius:matrix.orgraitobezariusthere's no standards, but plenty of repositories online you can easily find on github which can give you opinions on that23:14:39
@technicus:matrix.orgMiles DysonThe directory structure I have set up looks like this: `[/etc]$ tree -L 3 -d ./nixos ./nixos └── import ├── base ├── development │   ├── editor │   ├── revision │   ├── shell │   └── terminal ├── display ├── engineering ├── game ├── management ├── media │   ├── audio │   ├── graphics │   ├── image │   ├── players-library-downloaders │   └── video ├── network │   ├── communications │   ├── connections │   ├── locale │   ├── server │   ├── tools │   └── wireless ├── office ├── projects │   └── intelligence └── utilites-system 29 directories` Does it seem reasonable?23:15:38
@janik0:matrix.org@janik0:matrix.orgIf you want to look for examples I can highly recommend https://github.com/search?q=lang%3Anix&type=code and then putting in the service, it's quite nice to find examples. 23:16:03
@technicus:matrix.orgMiles DysonAm I going overboard, is there a simpler management arrangement?23:16:14
@janik0:matrix.org@janik0:matrix.org * If you want to look for examples I can highly recommend https://github.com/search?q=lang%3Anix&type=code and then putting in the service, it's quite nice for finding examples. 23:16:20
@raitobezarius:matrix.orgraitobezarius
In reply to @technicus:matrix.org
The directory structure I have set up looks like this:

`[/etc]$ tree -L 3 -d ./nixos
./nixos
└── import
├── base
├── development
│   ├── editor
│   ├── revision
│   ├── shell
│   └── terminal
├── display
├── engineering
├── game
├── management
├── media
│   ├── audio
│   ├── graphics
│   ├── image
│   ├── players-library-downloaders
│   └── video
├── network
│   ├── communications
│   ├── connections
│   ├── locale
│   ├── server
│   ├── tools
│   └── wireless
├── office
├── projects
│   └── intelligence
└── utilites-system

29 directories`

Does it seem reasonable?
probably overboard for a newcomer to nixos
23:16:47
@technicus:matrix.orgMiles DysonI also want to figure out how to automate backup of my configuration.23:16:51
@raitobezarius:matrix.orgraitobezariusautomating backup of your configuration is just taking configuration of text files23:17:05
@raitobezarius:matrix.orgraitobezariusgit, borgbackup, you name it23:17:09
@raitobezarius:matrix.orgraitobezariusthrow a systemd timer or whatever23:17:15
@technicus:matrix.orgMiles DysonIn a server config file I have account credentials, how do I exclude it from backups?23:19:00
@technicus:matrix.orgMiles Dyson
In reply to @raitobezarius:matrix.org
probably overboard for a newcomer to nixos
I am experimenting.
23:19:52
@technicus:matrix.orgMiles Dyson How can I add a mechanism that will backup the directories whenever I do sudo nixos-rebuild switch? 23:20:53
@technicus:matrix.orgMiles Dyson
In reply to @raitobezarius:matrix.org
probably overboard for a newcomer to nixos
What is the disadvantage of having config spread across multiple include files and directories?
23:21:52
@janik0:matrix.org@janik0:matrix.org
In reply to @technicus:matrix.org
In a server config file I have account credentials, how do I exclude it from backups?
don't put them in to your config as plain text, rather use something like https://github.com/Mic92/sops-nix/
23:27:17
@raitobezarius:matrix.orgraitobezarius
In reply to @technicus:matrix.org
What is the disadvantage of having config spread across multiple include files and directories?
too many files just make it tedious
23:27:38
@janik0:matrix.org@janik0:matrix.orgeverything in your nixos config is world-readable on a host. 23:27:38
@janik0:matrix.org@janik0:matrix.org
In reply to @technicus:matrix.org
How can I add a mechanism that will backup the directories whenever I do sudo nixos-rebuild switch?
just overwrite nixos-rebuild with a wrapper script in your path or have your own deployment wrapper (can be as simple as a bash script)
23:28:41
@technicus:matrix.orgMiles Dyson
In reply to @raitobezarius:matrix.org
too many files just make it tedious
What is a method to make it less tedious?
23:30:00
@technicus:matrix.orgMiles Dyson
In reply to @janik0:matrix.org
just overwrite nixos-rebuild with a wrapper script in your path or have your own deployment wrapper (can be as simple as a bash script)
Thanks!
23:30:15
@adam:robins.wtfadamcstephens Make a systemd oneshot without wantedby, and start it on each nixos-rebuild  23:30:17
@adam:robins.wtfadamcstephens Then you can also schedule it with a timer :) 23:30:41
@technicus:matrix.orgMiles Dyson
In reply to @adam:robins.wtf
Make a systemd oneshot without wantedby, and start it on each nixos-rebuild 
I am terrible at making systemd units.
23:31:06
@janik0:matrix.org@janik0:matrix.org
In reply to @technicus:matrix.org
Thanks!
(most people use nixos deployment tools like https://github.com/zhaofengli/colmena but that only makes sense if you start managing more then one device)
23:31:43
@raitobezarius:matrix.orgraitobezarius
In reply to @technicus:matrix.org
What is a method to make it less tedious?
group more stuff together?
23:32:17
@janik0:matrix.org@janik0:matrix.org
In reply to @technicus:matrix.org
I am terrible at making systemd units.
just track your config in git and play around until you figure it out, this is one of NixOS strengths when it comes to learning stuff.
23:32:38
@janik0:matrix.org@janik0:matrix.org
In reply to @technicus:matrix.org
I am terrible at making systemd units.
* just track your config in git and play around until you figure it out, this is one of NixOS strengths when it comes to learning stuff (because worst case roll back is really simple compared to other systems)
23:33:06

Show newer messages


Back to Room ListRoom Version: 10