treewide: remove with lib (#6512)

* nixos: remove with lib
* nix-darwin: remove with lib
* home-manager: remove with lib
* modules/accounts: remove with lib
* modules/config: remove with lib
* modules/i18n: remove with lib
* modules/misc: remove with lib
* modules: remove with lib
* modules/targets: remove with lib
* tests/modules/firefox: remove with lib
* tests/modules/services: remove with lib
This commit is contained in:
Austin Horstman
2025-03-07 14:16:46 -06:00
committed by GitHub
parent 83f4629364
commit 95711f9266
62 changed files with 618 additions and 666 deletions

View File

@@ -1,18 +1,16 @@
{ config, lib, pkgs, ... }:
with lib;
{ config, lib, ... }:
let
cfg = config.pam;
in {
meta.maintainers = with maintainers; [ rycee veehaitch ];
meta.maintainers = with lib.maintainers; [ rycee veehaitch ];
options = {
pam.sessionVariables = mkOption {
pam.sessionVariables = lib.mkOption {
default = { };
type = types.attrs;
type = lib.types.attrs;
example = { EDITOR = "vim"; };
description = ''
Environment variables that will be set for the PAM session.
@@ -25,10 +23,10 @@ in {
};
pam.yubico.authorizedYubiKeys = {
ids = mkOption {
type = with types;
ids = lib.mkOption {
type = with lib.types;
let
yubiKeyId = addCheck str (s: stringLength s == 12) // {
yubiKeyId = addCheck str (s: lib.stringLength s == 12) // {
name = "yubiKeyId";
description = "string of length 12";
};
@@ -41,8 +39,8 @@ in {
'';
};
path = mkOption {
type = types.str;
path = lib.mkOption {
type = lib.types.str;
default = ".yubico/authorized_yubikeys";
description = ''
File path to write the authorized YubiKeys,
@@ -52,16 +50,16 @@ in {
};
};
config = mkMerge [
(mkIf (cfg.sessionVariables != { }) {
home.file.".pam_environment".text = concatStringsSep "\n"
(mapAttrsToList (n: v: ''${n} OVERRIDE="${toString v}"'')
config = lib.mkMerge [
(lib.mkIf (cfg.sessionVariables != { }) {
home.file.".pam_environment".text = lib.concatStringsSep "\n"
(lib.mapAttrsToList (n: v: ''${n} OVERRIDE="${toString v}"'')
cfg.sessionVariables) + "\n";
})
(mkIf (cfg.yubico.authorizedYubiKeys.ids != [ ]) {
(lib.mkIf (cfg.yubico.authorizedYubiKeys.ids != [ ]) {
home.file.${cfg.yubico.authorizedYubiKeys.path}.text =
concatStringsSep ":"
lib.concatStringsSep ":"
([ config.home.username ] ++ cfg.yubico.authorizedYubiKeys.ids);
})
];