Modularize nix config

This commit is contained in:
Julien Hémono 2025-11-23 12:53:18 +01:00
parent f2e34e4c77
commit d0b1495ede
4 changed files with 28 additions and 24 deletions

8
hosts/common/default.nix Normal file
View file

@ -0,0 +1,8 @@
{ ... }:
{
imports = [
./nix.nix
];
}

18
hosts/common/nix.nix Normal file
View file

@ -0,0 +1,18 @@
{ config, pkgs, ... }:
{
nix = {
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
settings = {
experimental-features = [ "nix-command" "flakes" ];
auto-optimise-store = true;
trusted-users = [ "jhemono" ];
};
channel.enable = false;
};
}

View file

@ -8,6 +8,7 @@
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
../common
./home.nix
# Services
./btrbk.nix
@ -87,21 +88,6 @@
environment.variables.EDITOR = "vim";
# Nix configuration
nix = {
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
settings = {
experimental-features = [ "nix-command" "flakes" ];
auto-optimise-store = true;
trusted-users = [ "jhemono" ];
};
channel.enable = false;
};
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;

View file

@ -8,6 +8,7 @@
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
../common
# Supporting
./buckets.nix
./nginx.nix
@ -69,15 +70,6 @@
environment.variables.EDITOR = "vim";
# Nix configuration
nix.settings.experimental-features = [ "nix-command" "flakes" ];
nix.gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
nix.settings.auto-optimise-store = true;
# OpenSSH
services.openssh = {
enable = true;