Continue porting darwin, make settei module(s) more reusable by others.

This commit is contained in:
Nikodem Rabuliński 2023-10-02 19:30:31 +02:00
parent 823721ac52
commit f4890a5d74
No known key found for this signature in database
GPG key ID: FF629AA9E08138DB
8 changed files with 32 additions and 18 deletions

View file

@ -84,6 +84,7 @@
inputs.home-manager.darwinModules.home-manager
inputs.hercules-ci-agent.darwinModules.agent-service
self.darwinModules.settei
self.darwinModules.common
sharedOptions
defaultOptions
module

View file

@ -0,0 +1,3 @@
{
system.stateVersion = 4;
}

View file

@ -1,5 +1,6 @@
{config, ...}: {
flake.darwinModules = {
settei = import ./settei {inherit (config) perInput;};
common = ./common;
};
}

View file

@ -11,7 +11,5 @@
security.pam.enableSudoTouchIdAuth = true;
users.users.${username}.home = "/Users/${username}";
system.stateVersion = 4;
};
}

View file

@ -31,15 +31,15 @@ with lib; {
configurations = {
nixos = mkOption {
type = types.attrsOf types.deferredModule;
type = types.lazyAttrsOf types.deferredModule;
default = {};
};
darwin = mkOption {
type = types.attrsOf types.deferredModule;
type = types.lazyAttrsOf types.deferredModule;
default = {};
};
home = mkOption {
type = types.attrsOf types.deferredModule;
type = types.lazyAttrsOf types.deferredModule;
default = {};
};
};

View file

@ -2,4 +2,11 @@
imports = [
./hercules.nix
];
config = {
system.stateVersion = "22.05";
# https://github.com/NixOS/nixpkgs/issues/254807
boot.swraid.enable = false;
};
}

View file

@ -6,11 +6,9 @@
...
} @ args: let
cfg = config.settei.sane-defaults;
nmEnabled = config.networking.networkmanager.enable;
in {
config = lib.mkIf cfg.enable {
# https://github.com/NixOS/nixpkgs/issues/254807
boot.swraid.enable = false;
hardware.enableRedistributableFirmware = true;
services.openssh.enable = true;
@ -24,12 +22,10 @@ in {
group = username;
extraGroups = ["wheel"];
openssh.authorizedKeys.keys = let
filteredKeys = let
configName' =
args.configurationName
or (throw "pass configurationName to module arguments or set users.users.${username}.openssh.authorizedKeys yourself");
in
lib.filterAttrs (name: _: name != configName') cfg.allSshKeys;
configName' =
args.configurationName
or (throw "pass configurationName to module arguments or set users.users.${username}.openssh.authorizedKeys yourself");
filteredKeys = lib.filterAttrs (name: _: name != configName') cfg.allSshKeys;
in
lib.mkDefault (lib.attrValues filteredKeys);
};
@ -40,6 +36,15 @@ in {
# be able to use sudo with no password
security.sudo.wheelNeedsPassword = false;
system.stateVersion = "22.05";
# When NetworkManager isn't in use, add tailscale DNS address manually
networking.nameservers = lib.mkIf (!nmEnabled && config.services.tailscale.enable) [
"100.100.100.100"
"1.1.1.1"
"1.0.0.1"
];
# NetworkManager probably means desktop system so we don't want to slow down boot times
systemd.services = lib.mkIf nmEnabled {
NetworkManager-wait-online.enable = false;
};
};
}

View file

@ -1,6 +1,5 @@
# This module is supposed to be a reusable set of options you probably would want to set anyway
#
# Other default options which don't necessairly make sense for other people go into hosts/default.nix
# This module is supposed to be a reusable set of options you probably would want to set anyway.
# For options specific to nixos or darwin go to modules/{nixos,darwin}/settei/sane-defaults.nix
{
config,
pkgs,