nixos-config/flake/nixos.nix

84 lines
2.1 KiB
Nix
Raw Normal View History

2024-11-28 01:14:34 +08:00
# Portions of this file are sourced from
# https://github.com/linyinfeng/dotfiles/blob/b618b0fd16fb9c79ab7199ed51c4c0f98a392cea/flake/hosts.nix
{
inputs,
lib,
...
}:
let
inherit (inputs.rebmit.lib.path) buildModuleList rakeLeaves;
buildSuites = profiles: f: lib.mapAttrs (_: lib.flatten) (lib.fix (f profiles));
nixosModules = buildModuleList ../nixos/modules;
nixosProfiles = rakeLeaves ../nixos/profiles;
nixosSuites = buildSuites nixosProfiles (
profiles: suites: {
baseline = with profiles; [
# keep-sorted start
programs.tools.common
security.polkit
security.sudo
services.btrfs-auto-scrub
2024-11-28 01:14:34 +08:00
services.dbus
services.journald
services.logrotate
services.nscd
2024-11-28 01:14:34 +08:00
services.openssh
services.zram-generator
system.boot.kernel.latest
system.boot.systemd-initrd
system.common
system.nix.gc
system.nix.registry
system.nix.settings
system.nix.version
2025-01-11 19:20:33 +08:00
system.perlless
system.preservation
2024-11-28 01:14:34 +08:00
users.root
# keep-sorted end
];
network = with profiles; [
# keep-sorted start
programs.tools.network
services.firewall
services.networkd
services.resolved
2024-12-16 20:28:28 +08:00
services.vnstat
2024-11-28 01:14:34 +08:00
system.boot.sysctl.tcp-bbr
system.boot.sysctl.udp-buffer-size
2024-11-28 01:14:34 +08:00
# keep-sorted end
];
desktop = with profiles; [
# keep-sorted start
programs.dconf
programs.tools.system
security.rtkit
services.gnome-keyring
services.greetd
services.pipewire
# keep-sorted end
];
2024-12-14 01:55:51 +08:00
backup = with profiles; [
services.restic
];
monitoring = with profiles; [
services.prometheus.node-exporter
services.prometheus.ping-exporter
];
2024-12-14 01:55:51 +08:00
workstation = suites.baseline ++ suites.network ++ suites.desktop ++ suites.backup;
2024-11-28 01:14:34 +08:00
server = suites.baseline ++ suites.network ++ suites.backup ++ suites.monitoring;
2024-11-28 01:14:34 +08:00
}
);
in
{
passthru = {
inherit nixosModules nixosProfiles nixosSuites;
};
}