refactor: limit use of with lib

This commit is contained in:
matt1432 2024-01-22 11:09:37 -05:00
parent 7fd12f5b04
commit 20dac8791e
16 changed files with 74 additions and 50 deletions
devices

View file

@ -1,5 +1,12 @@
{config, ...}: let
inherit (config.vars) mainUser hostName;
tailscaleNameservers =
config
.services
.headscale
.settings
.dns_config
.nameservers;
in {
imports = [
./hardware-configuration.nix
@ -37,7 +44,7 @@ in {
networking = {
inherit hostName;
resolvconf.enable = true;
nameservers = config.services.headscale.settings.dns_config.nameservers ++ ["1.0.0.1"];
nameservers = tailscaleNameservers ++ ["1.0.0.1"];
firewall.enable = false;
};

View file

@ -5,6 +5,7 @@
pkgs,
...
}: let
inherit (builtins) readFile;
inherit (config.vars) mainUser;
headscale-flake = headscale.packages.${pkgs.system}.headscale;
in {
@ -12,7 +13,7 @@ in {
users.users.${mainUser}.extraGroups = ["headscale"];
home-manager.users.${mainUser}
.programs.bash.bashrcExtra = lib.mkAfter (builtins.readFile ./completion.bash);
.programs.bash.bashrcExtra = lib.mkAfter (readFile ./completion.bash);
services.headscale = {
enable = true;

View file

@ -13,7 +13,8 @@ in {
IdentitiesOnly yes
IdentityFile ${config.sops.secrets.nixremote.path}
# The weakly privileged user on the remote builder if not set, 'root' is used which will hopefully fail
# The weakly privileged user on the remote builder if not set,
# 'root' is used which will hopefully fail
User nixremote
'';
};

View file

@ -5,10 +5,24 @@
pkgs,
self,
...
} @ inputs:
with lib;
with builtins; let
} @ inputs: let
inherit
(lib)
filter
hasSuffix
filesystem
hasAttr
mapAttrs
filterAttrs
listToAttrs
elemAt
match
removePrefix
optionalAttrs
mkForce
;
inherit (config.vars) mainUser hostName;
configPath = "/var/lib/arion";
in {
imports = [arion.nixosModules.arion];

View file

@ -3,8 +3,9 @@
lib,
pkgs,
...
}:
with lib; let
}: let
inherit (lib) filterAttrs mapAttrs mkDefault mkOption types;
cfg = config.services.borgbackup;
secrets = config.sops.secrets;
in {