treewide: use lib.singleton

This commit is contained in:
Guanran Wang 2024-08-30 02:17:30 +08:00
parent d0e82dc230
commit 08653a609a
Signed by: nyancat
GPG key ID: 91F97D9ED12639CF
6 changed files with 51 additions and 64 deletions

View file

@ -36,15 +36,13 @@
config = { config = {
### Visuals ### Visuals
output."*".bg = "${inputs.self.legacyPackages.${pkgs.stdenv.hostPlatform.system}.background} fill"; output."*".bg = "${inputs.self.legacyPackages.${pkgs.stdenv.hostPlatform.system}.background} fill";
bars = [ bars = lib.singleton {
{ statusCommand = "${lib.getExe pkgs.i3status-rust} $HOME/.config/i3status-rust/config-default.toml";
statusCommand = "${lib.getExe pkgs.i3status-rust} $HOME/.config/i3status-rust/config-default.toml"; position = "top";
position = "top"; extraConfig = ''
extraConfig = '' icon_theme ${config.gtk.iconTheme.name}
icon_theme ${config.gtk.iconTheme.name} '';
''; };
}
];
### Inputs ### Inputs
input = { input = {

View file

@ -1,4 +1,5 @@
{ {
lib,
inputs, inputs,
config, config,
... ...
@ -43,7 +44,5 @@
fsType = "vfat"; fsType = "vfat";
}; };
}; };
swapDevices = [ swapDevices = lib.singleton { device = "/dev/disk/by-uuid/8a2e90a9-5cc2-40fc-82fe-69ef3cd88e29"; };
{ device = "/dev/disk/by-uuid/8a2e90a9-5cc2-40fc-82fe-69ef3cd88e29"; }
];
} }

View file

@ -1,4 +1,4 @@
{ config, ... }: { lib, config, ... }:
{ {
services.matrix-synapse = { services.matrix-synapse = {
enable = true; enable = true;
@ -13,15 +13,13 @@
{ {
path = "/run/matrix-synapse/synapse.sock"; path = "/run/matrix-synapse/synapse.sock";
type = "http"; type = "http";
resources = [ resources = lib.singleton {
{ names = [
names = [ "client"
"client" "federation"
"federation" ];
]; compress = true;
compress = true; };
}
];
} }
]; ];
@ -32,25 +30,23 @@
}; };
# https://element-hq.github.io/synapse/latest/openid.html#keycloak # https://element-hq.github.io/synapse/latest/openid.html#keycloak
oidc_providers = [ oidc_providers = lib.singleton {
{ idp_id = "keycloak";
idp_id = "keycloak"; idp_name = "id.ny4.dev";
idp_name = "id.ny4.dev"; issuer = "https://id.ny4.dev/realms/ny4";
issuer = "https://id.ny4.dev/realms/ny4"; client_id = "synapse";
client_id = "synapse"; client_secret_path = config.sops.secrets."synapse/oidc".path;
client_secret_path = config.sops.secrets."synapse/oidc".path; scopes = [
scopes = [ "openid"
"openid" "profile"
"profile" ];
]; user_mapping_provider.config = {
user_mapping_provider.config = { localpart_template = "{{ user.preferred_username }}";
localpart_template = "{{ user.preferred_username }}"; display_name_template = "{{ user.name }}";
display_name_template = "{{ user.name }}"; };
}; backchannel_logout_enabled = true;
backchannel_logout_enabled = true; allow_existing_users = true;
allow_existing_users = true; };
}
];
}; };
}; };

View file

@ -25,12 +25,10 @@
boot.loader.grub.device = lib.mkForce "/dev/nvme0n1"; boot.loader.grub.device = lib.mkForce "/dev/nvme0n1";
system.stateVersion = "24.05"; system.stateVersion = "24.05";
swapDevices = [ swapDevices = lib.singleton {
{ device = "/var/lib/swapfile";
device = "/var/lib/swapfile"; size = 4 * 1024; # 4 GiB
size = 4 * 1024; # 4 GiB };
}
];
# WORKAROUND: # WORKAROUND:
systemd.services."print-host-key".enable = false; systemd.services."print-host-key".enable = false;

View file

@ -1,4 +1,4 @@
{ config, ... }: { lib, config, ... }:
{ {
networking.firewall.allowedTCPPorts = [ networking.firewall.allowedTCPPorts = [
27253 27253
@ -30,12 +30,10 @@
} }
]; ];
outbounds = [ outbounds = lib.singleton {
{ type = "direct";
type = "direct"; tag = "direct";
tag = "direct"; };
}
];
route = { route = {
final = "direct"; final = "direct";

View file

@ -12,16 +12,14 @@
level = "info"; level = "info";
}; };
inbounds = [ inbounds = lib.singleton {
{ type = "http";
type = "http"; tag = "inbound";
tag = "inbound"; listen = "127.0.0.1";
listen = "127.0.0.1"; listen_port = 1080;
listen_port = 1080; sniff = true;
sniff = true; sniff_override_destination = true;
sniff_override_destination = true; };
}
];
outbounds = [ outbounds = [
{ {