nixosModules/clanCore: support nix-darwin

This commit is contained in:
Michael Hoang
2025-04-12 17:11:34 +02:00
parent 2bbf4b168a
commit a575894a83
13 changed files with 173 additions and 133 deletions

View File

@@ -1,10 +1,27 @@
{
_class,
lib,
config,
pkgs,
...
}:
{
imports = lib.optional (_class == "nixos") (
lib.mkIf config.clan.core.enableRecommendedDefaults {
# Use systemd during boot as well except:
# - systems with raids as this currently require manual configuration: https://github.com/NixOS/nixpkgs/issues/210210
# - for containers we currently rely on the `stage-2` init script that sets up our /etc
boot.initrd.systemd.enable = lib.mkDefault (!config.boot.swraid.enable && !config.boot.isContainer);
# Don't install the /lib/ld-linux.so.2 stub. This saves one instance of nixpkgs.
environment.ldso32 = null;
environment.systemPackages = [
pkgs.nixos-facter # for `clan machines update-hardware-config --backend nixos-facter`
];
}
);
options.clan.core.enableRecommendedDefaults = lib.mkOption {
type = lib.types.bool;
description = ''
@@ -20,11 +37,6 @@
};
config = lib.mkIf config.clan.core.enableRecommendedDefaults {
# Use systemd during boot as well except:
# - systems with raids as this currently require manual configuration: https://github.com/NixOS/nixpkgs/issues/210210
# - for containers we currently rely on the `stage-2` init script that sets up our /etc
boot.initrd.systemd.enable = lib.mkDefault (!config.boot.swraid.enable && !config.boot.isContainer);
# This disables the HTML manual and `nixos-help` command but leaves
# `man configuration.nix`
documentation.doc.enable = lib.mkDefault false;
@@ -32,9 +44,6 @@
# Work around for https://github.com/NixOS/nixpkgs/issues/124215
documentation.info.enable = lib.mkDefault false;
# Don't install the /lib/ld-linux.so.2 stub. This saves one instance of nixpkgs.
environment.ldso32 = null;
environment.systemPackages = [
# essential debugging tools for networked services
pkgs.dnsutils
@@ -43,8 +52,6 @@
pkgs.jq
pkgs.htop
pkgs.nixos-facter # for `clan machines update-hardware-config --backend nixos-facter`
pkgs.gitMinimal
];
};