From b453062c5755f67dcca2c9c67959b0e63ab1f687 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Tue, 27 May 2025 13:12:18 +0200 Subject: [PATCH] refactor: simplify Nix module inputs and update configurations Simplified input argument structures across multiple Nix modules by removing unnecessary bindings and standardizing formats. Enabled `system.primaryUser` setting and updated PAM configuration for sudo touch ID authentication. Removed deprecated or unused configurations, including user fields in metacfg and outdated options in some modules. --- homes/x86_64-darwin/harald@mpro/default.nix | 7 ++----- homes/x86_64-linux/harald@mx/default.nix | 9 ++++----- homes/x86_64-linux/harald@sgx-azure/default.nix | 7 ++----- modules/darwin/nix/default.nix | 11 ++++------- modules/darwin/services/base/default.nix | 11 +++++------ modules/darwin/services/nix-daemon/default.nix | 15 --------------- modules/darwin/user/default.nix | 13 ++++++------- systems/aarch64-darwin/m4/default.nix | 1 + 8 files changed, 24 insertions(+), 50 deletions(-) delete mode 100644 modules/darwin/services/nix-daemon/default.nix diff --git a/homes/x86_64-darwin/harald@mpro/default.nix b/homes/x86_64-darwin/harald@mpro/default.nix index 247605c..f36ce2b 100644 --- a/homes/x86_64-darwin/harald@mpro/default.nix +++ b/homes/x86_64-darwin/harald@mpro/default.nix @@ -1,8 +1,5 @@ -{ - lib, - pkgs, - config, - ... +{ config +, ... }: { home = { diff --git a/homes/x86_64-linux/harald@mx/default.nix b/homes/x86_64-linux/harald@mx/default.nix index baf012e..c8dcb03 100644 --- a/homes/x86_64-linux/harald@mx/default.nix +++ b/homes/x86_64-linux/harald@mx/default.nix @@ -1,8 +1,7 @@ -{ - lib, - pkgs, - config, - ... +{ lib +, pkgs +, config +, ... }: { home.sessionPath = [ "$HOME/bin" ]; diff --git a/homes/x86_64-linux/harald@sgx-azure/default.nix b/homes/x86_64-linux/harald@sgx-azure/default.nix index 51c4ebc..02652c8 100644 --- a/homes/x86_64-linux/harald@sgx-azure/default.nix +++ b/homes/x86_64-linux/harald@sgx-azure/default.nix @@ -1,8 +1,5 @@ -{ - lib, - pkgs, - config, - ... +{ config +, ... }: { home = { diff --git a/modules/darwin/nix/default.nix b/modules/darwin/nix/default.nix index 1ea29a7..2a0001c 100644 --- a/modules/darwin/nix/default.nix +++ b/modules/darwin/nix/default.nix @@ -1,9 +1,7 @@ -{ - options, - config, - pkgs, - lib, - ... +{ config +, pkgs +, lib +, ... }: with lib; with lib.metacfg; @@ -70,7 +68,6 @@ in Day = 7; }; options = "--delete-older-than 30d"; - user = config.metacfg.user.name; }; # flake-utils-plus diff --git a/modules/darwin/services/base/default.nix b/modules/darwin/services/base/default.nix index 0a8e685..2c942d2 100644 --- a/modules/darwin/services/base/default.nix +++ b/modules/darwin/services/base/default.nix @@ -1,8 +1,7 @@ -{ - config, - lib, - pkgs, - ... +{ config +, lib +, pkgs +, ... }: with lib; with lib.metacfg; @@ -58,7 +57,7 @@ in }; security = { - pam.enableSudoTouchIdAuth = true; + pam.services.sudo_local.touchIdAuth = true; }; }; } diff --git a/modules/darwin/services/nix-daemon/default.nix b/modules/darwin/services/nix-daemon/default.nix deleted file mode 100644 index bcd11b0..0000000 --- a/modules/darwin/services/nix-daemon/default.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ lib, config, ... }: - -let - inherit (lib) types mkIf; - inherit (lib.metacfg) mkOpt enabled; - - cfg = config.metacfg.services.nix-daemon; -in -{ - options.metacfg.services.nix-daemon = { - enable = mkOpt types.bool true "Whether to enable the Nix daemon."; - }; - - config = mkIf cfg.enable { services.nix-daemon = enabled; }; -} diff --git a/modules/darwin/user/default.nix b/modules/darwin/user/default.nix index ffeffb2..07addc6 100644 --- a/modules/darwin/user/default.nix +++ b/modules/darwin/user/default.nix @@ -1,8 +1,6 @@ -{ - lib, - config, - pkgs, - ... +{ lib +, config +, ... }: with lib; with lib.metacfg; @@ -10,8 +8,8 @@ let common = import ../../common.nix { }; cfg = config.metacfg.user; - is-linux = pkgs.stdenv.isLinux; - is-darwin = pkgs.stdenv.isDarwin; + # is-linux = pkgs.stdenv.isLinux; + # is-darwin = pkgs.stdenv.isDarwin; in { options.metacfg.user = with types; { @@ -25,6 +23,7 @@ in }; config = { + system.primaryUser = cfg.name; users.users.${cfg.name} = { # NOTE: Setting the uid here is required for another # module to evaluate successfully since it reads diff --git a/systems/aarch64-darwin/m4/default.nix b/systems/aarch64-darwin/m4/default.nix index f748f8f..79e1b5f 100644 --- a/systems/aarch64-darwin/m4/default.nix +++ b/systems/aarch64-darwin/m4/default.nix @@ -46,5 +46,6 @@ with lib.metacfg; users.users.harald.shell = pkgs.fish; + ids.gids.nixbld = 350; system.stateVersion = 4; }