summaryrefslogtreecommitdiff
path: root/modules/nixos
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2023-12-03 02:52:28 +0300
committerAzat Bahawi <azat@bahawi.net>2023-12-03 02:52:28 +0300
commitcec9f7acd5e5e365563212c5144394f71dd90b27 (patch)
tree667b308a7241ab2e8f3fa4e2b53cc7888e876c68 /modules/nixos
parent3c5d840e8d92aee25aa411fc2ab7f8881cfdfede (diff)
2023-12-03
Diffstat (limited to 'modules/nixos')
-rw-r--r--modules/nixos/common/locale.nix25
-rw-r--r--modules/nixos/default.nix1
-rw-r--r--modules/nixos/dwm.nix66
-rw-r--r--modules/nixos/emacs.nix24
-rw-r--r--modules/nixos/firefox/addons.nix6
-rw-r--r--modules/nixos/fonts.nix8
-rw-r--r--modules/nixos/kde.nix1
-rw-r--r--modules/nixos/loki.nix4
-rw-r--r--modules/nixos/profiles/headful.nix3
-rw-r--r--modules/nixos/soju.nix30
-rw-r--r--modules/nixos/syncthing.nix28
-rw-r--r--modules/nixos/wayland.nix19
-rw-r--r--modules/nixos/x11.nix7
13 files changed, 141 insertions, 81 deletions
diff --git a/modules/nixos/common/locale.nix b/modules/nixos/common/locale.nix
index 09e0686..9d73af4 100644
--- a/modules/nixos/common/locale.nix
+++ b/modules/nixos/common/locale.nix
@@ -23,6 +23,31 @@ with lib; {
};
};
+ hm.xdg.configFile."fcitx5/profile".text = generators.toINI {} {
+ "Groups/0" = {
+ Name = "Default";
+ DefaultIM = "mozc";
+ "Default Layout" = "us";
+ };
+
+ "Groups/0/Items/0" = {
+ Name = "keyboard-us";
+ Layout = "";
+ };
+
+ "Groups/0/Items/1" = {
+ Name = "mozc";
+ Layout = "us";
+ };
+
+ "Groups/0/Items/2" = {
+ Name = "keyboard-ru-phonetic";
+ Layout = "";
+ };
+
+ GroupOrder."0" = "Default";
+ };
+
services.xserver = {
layout = "us";
xkbOptions = concatStringsSep "," [
diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix
index 35694f4..ee63ba1 100644
--- a/modules/nixos/default.nix
+++ b/modules/nixos/default.nix
@@ -66,6 +66,7 @@ _: {
./unbound.nix
./vaultwarden.nix
./vim
+ ./wayland.nix
./wireguard.nix
./x11.nix
./xmonad.nix
diff --git a/modules/nixos/dwm.nix b/modules/nixos/dwm.nix
index 459aae5..9c5e283 100644
--- a/modules/nixos/dwm.nix
+++ b/modules/nixos/dwm.nix
@@ -94,28 +94,28 @@ in {
};
static const Key keys[] = {
- { MODKEY, XK_x, spawn, {.v = dmenucmd } },
- { MODKEY, XK_Return, spawn, {.v = termcmd } },
- { MODKEY, XK_b, togglebar, {0} },
- { MODKEY, XK_j, focusstack, {.i = +1 } },
- { MODKEY, XK_k, focusstack, {.i = -1 } },
- { MODKEY|ShiftMask, XK_k, incnmaster, {.i = +1 } },
- { MODKEY|ShiftMask, XK_j, incnmaster, {.i = -1 } },
- { MODKEY, XK_comma, setmfact, {.f = -0.05} },
- { MODKEY, XK_period, setmfact, {.f = +0.05} },
- { MODKEY, XK_p, zoom, {0} },
- { MODKEY, XK_Tab, view, {0} },
- { MODKEY, XK_d, killclient, {0} },
- { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
- { MODKEY, XK_m, setlayout, {.v = &layouts[1]} },
- { MODKEY, XK_f, setlayout, {.v = &layouts[2]} },
- { MODKEY, XK_o, togglefloating, {0} },
- { MODKEY, XK_0, view, {.ui = ~0 } },
- { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
- { MODKEY, XK_h, focusmon, {.i = -1 } },
- { MODKEY, XK_l, focusmon, {.i = +1 } },
- { MODKEY|ShiftMask, XK_h, tagmon, {.i = -1 } },
- { MODKEY|ShiftMask, XK_l, tagmon, {.i = +1 } },
+ { MODKEY, XK_x, spawn, {.v = dmenucmd} },
+ { MODKEY, XK_Return, spawn, {.v = termcmd} },
+ { MODKEY, XK_b, togglebar, {0} },
+ { MODKEY, XK_j, focusstack, {.i = +1} },
+ { MODKEY, XK_k, focusstack, {.i = -1} },
+ { MODKEY|ShiftMask, XK_k, incnmaster, {.i = +1} },
+ { MODKEY|ShiftMask, XK_j, incnmaster, {.i = -1} },
+ { MODKEY, XK_comma, setmfact, {.f = -0.05} },
+ { MODKEY, XK_period, setmfact, {.f = +0.05} },
+ { MODKEY, XK_p, zoom, {0} },
+ { MODKEY, XK_Tab, view, {0} },
+ { MODKEY, XK_d, killclient, {0} },
+ { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
+ { MODKEY, XK_m, setlayout, {.v = &layouts[1]} },
+ { MODKEY, XK_f, setlayout, {.v = &layouts[2]} },
+ { MODKEY, XK_o, togglefloating, {0} },
+ { MODKEY, XK_0, view, {.ui = ~0} },
+ { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0} },
+ { MODKEY, XK_h, focusmon, {.i = -1} },
+ { MODKEY, XK_l, focusmon, {.i = +1} },
+ { MODKEY|ShiftMask, XK_h, tagmon, {.i = -1} },
+ { MODKEY|ShiftMask, XK_l, tagmon, {.i = +1} },
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
@@ -125,21 +125,21 @@ in {
TAGKEYS( XK_7, 6)
TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8)
- { MODKEY|ShiftMask, XK_q, quit, {0} },
+ { MODKEY|ShiftMask, XK_q, quit, {0} },
};
static const Button buttons[] = {
- { ClkLtSymbol, 0, Button1, setlayout, {0} },
+ { ClkLtSymbol, 0, Button1, setlayout, {0} },
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
- { ClkWinTitle, 0, Button2, zoom, {0} },
- { ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
- { ClkClientWin, MODKEY, Button1, movemouse, {0} },
- { ClkClientWin, MODKEY, Button2, togglefloating, {0} },
- { ClkClientWin, MODKEY, Button3, resizemouse, {0} },
- { ClkTagBar, 0, Button1, view, {0} },
- { ClkTagBar, 0, Button3, toggleview, {0} },
- { ClkTagBar, MODKEY, Button1, tag, {0} },
- { ClkTagBar, MODKEY, Button3, toggletag, {0} },
+ { ClkWinTitle, 0, Button2, zoom, {0} },
+ { ClkStatusText, 0, Button2, spawn, {.v = termcmd} },
+ { ClkClientWin, MODKEY, Button1, movemouse, {0} },
+ { ClkClientWin, MODKEY, Button2, togglefloating, {0} },
+ { ClkClientWin, MODKEY, Button3, resizemouse, {0} },
+ { ClkTagBar, 0, Button1, view, {0} },
+ { ClkTagBar, 0, Button3, toggleview, {0} },
+ { ClkTagBar, MODKEY, Button1, tag, {0} },
+ { ClkTagBar, MODKEY, Button3, toggletag, {0} },
};
'';
};
diff --git a/modules/nixos/emacs.nix b/modules/nixos/emacs.nix
index c851389..7d2112b 100644
--- a/modules/nixos/emacs.nix
+++ b/modules/nixos/emacs.nix
@@ -7,19 +7,15 @@ with lib; let
cfg = config.nixfiles.modules.emacs;
in {
config = mkIf cfg.enable {
- nixfiles.modules = {
- common.xdg.defaultApplications.emacs = [
- "application/atom+xml"
- "application/json"
- "application/rss+xml"
- "application/schema+json"
- "application/xhtml+xml"
- "application/xml"
- "text/csv"
- "text/plain"
- ];
-
- x11.enable = true;
- };
+ nixfiles.modules.common.xdg.defaultApplications.emacs = [
+ "application/atom+xml"
+ "application/json"
+ "application/rss+xml"
+ "application/schema+json"
+ "application/xhtml+xml"
+ "application/xml"
+ "text/csv"
+ "text/plain"
+ ];
};
}
diff --git a/modules/nixos/firefox/addons.nix b/modules/nixos/firefox/addons.nix
index fc4d51b..544b5cd 100644
--- a/modules/nixos/firefox/addons.nix
+++ b/modules/nixos/firefox/addons.nix
@@ -892,10 +892,10 @@
};
"rikaichamp" = buildFirefoxXpiAddon {
pname = "rikaichamp";
- version = "1.15.1";
+ version = "1.16.0";
addonId = "{59812185-ea92-4cca-8ab7-cfcacee81281}";
- url = "https://addons.mozilla.org/firefox/downloads/file/4162143/10ten_ja_reader-1.15.1.xpi";
- sha256 = "cf638be78da479ccd54fe6ace7990a5ba7757562ec48b2a177e24c86d2ee235c";
+ url = "https://addons.mozilla.org/firefox/downloads/file/4200662/10ten_ja_reader-1.16.0.xpi";
+ sha256 = "ac91a5aee5c6a018c397257eb090eaa640feb0a17aa2e0f91248bad7d1a3e6c1";
meta = with lib; {
homepage = "https://github.com/birchill/10ten-ja-reader/";
description = "Quickly translate Japanese by hovering over words. Formerly released as Rikaichamp.";
diff --git a/modules/nixos/fonts.nix b/modules/nixos/fonts.nix
index f9624ec..a333cb3 100644
--- a/modules/nixos/fonts.nix
+++ b/modules/nixos/fonts.nix
@@ -12,7 +12,13 @@ in {
nixfiles.modules.common.nix.allowedUnfreePackages = ["symbola"];
hm.fonts.fontconfig.enable = true;
fonts = {
- packages = cfg.packages ++ [pkgs.symbola];
+ packages =
+ cfg.packages
+ ++ (with pkgs; [
+ noto-fonts-emoji
+ twitter-color-emoji
+ symbola
+ ]);
fontconfig = {
enable = true;
diff --git a/modules/nixos/kde.nix b/modules/nixos/kde.nix
index 1a02d9d..adec490 100644
--- a/modules/nixos/kde.nix
+++ b/modules/nixos/kde.nix
@@ -15,7 +15,6 @@ in {
gnupg.pinentry = "qt";
sound.enable = true;
- x11.enable = true;
};
hm = {
diff --git a/modules/nixos/loki.nix b/modules/nixos/loki.nix
index 0a92fbd..6794ba9 100644
--- a/modules/nixos/loki.nix
+++ b/modules/nixos/loki.nix
@@ -87,10 +87,6 @@ in {
retention_period = "720h";
};
- cache_config = {
- enable_fifocache = false;
- };
-
schema_config.configs = [
{
from = "2020-01-01";
diff --git a/modules/nixos/profiles/headful.nix b/modules/nixos/profiles/headful.nix
index 938b711..a168d0a 100644
--- a/modules/nixos/profiles/headful.nix
+++ b/modules/nixos/profiles/headful.nix
@@ -19,6 +19,9 @@ in {
dwm.enable = mkDefault false;
kde.enable = mkDefault true;
xmonad.enable = mkDefault false;
+
+ # Potentially remove in favor of Wayland in the future.
+ x11.enable = mkDefault true;
};
hm = {
diff --git a/modules/nixos/soju.nix b/modules/nixos/soju.nix
index b43fbdc..ea95bb3 100644
--- a/modules/nixos/soju.nix
+++ b/modules/nixos/soju.nix
@@ -11,12 +11,6 @@ in {
options.nixfiles.modules.soju = {
enable = mkEnableOption "soju";
- protocol = mkOption {
- description = "Port.";
- type = with types; enum ["ircs" "irc+insecure"];
- default = "irc+insecure";
- };
-
address = mkOption {
description = "Address.";
type = with types; str;
@@ -26,7 +20,7 @@ in {
port = mkOption {
description = "Port.";
type = with types; port;
- default = 6667;
+ default = 6697;
};
domain = mkOption {
@@ -50,13 +44,17 @@ in {
db = "soju";
in
mkIf cfg.enable {
- nixfiles.modules.postgresql = {
- enable = true;
- extraPostStart = [
- ''
- $PSQL "${db}" -tAc 'GRANT ALL ON SCHEMA "public" TO "${db}"'
- ''
- ];
+ nixfiles.modules = {
+ acme.enable = true;
+ nginx.enable = true;
+ postgresql = {
+ enable = true;
+ extraPostStart = [
+ ''
+ $PSQL "${db}" -tAc 'GRANT ALL ON SCHEMA "public" TO "${db}"'
+ ''
+ ];
+ };
};
services.postgresql = {
@@ -77,7 +75,8 @@ in {
ExecStart = let
# https://soju.im/doc/soju.1.html
configFile = pkgs.writeText "soju.conf" ''
- listen ${cfg.protocol}://${cfg.address}:${toString cfg.port}
+ listen ircs://${cfg.address}:${toString cfg.port}
+ tls ${with config.certs.${cfg.domain}; "${directory}/fullchain.pem ${directory}/key.pem"}
${
with cfg.prometheus;
optionalString enable
@@ -100,6 +99,7 @@ in {
"-config ${configFile}"
];
DynamicUser = true;
+ SupplementaryGroups = [config.services.nginx.group];
AmbientCapabilities = [""];
CapabilityBoundingSet = [""];
UMask = "0077";
diff --git a/modules/nixos/syncthing.nix b/modules/nixos/syncthing.nix
index 39579f8..ecc983f 100644
--- a/modules/nixos/syncthing.nix
+++ b/modules/nixos/syncthing.nix
@@ -12,6 +12,12 @@ in {
options.nixfiles.modules.syncthing = {
enable = mkEnableOption "Syncthing";
+ port = mkOption {
+ description = "Port.";
+ type = with types; port;
+ default = 8384;
+ };
+
domain = mkOption {
description = "Domain name sans protocol scheme.";
type = with types; str;
@@ -41,15 +47,16 @@ in {
user = my.username;
inherit (config.my) group;
- dataDir = config.my.home;
+ dataDir = "${config.dirs.config}/syncthing";
+ configDir = config.services.syncthing.dataDir;
- guiAddress = "127.0.0.1:8384";
+ guiAddress = "127.0.0.1:${toString cfg.port}";
cert = config.secrets."syncthing-cert-${this.hostname}".path;
key = config.secrets."syncthing-key-${this.hostname}".path;
- overrideDevices = true;
- overrideFolders = true;
+ overrideDevices = false;
+ overrideFolders = false;
settings = {
options = {
@@ -70,8 +77,11 @@ in {
devices = mapAttrs (name: attr:
mkIf (attr.syncthing.id != null && hasAttr "wireguard" attr) {
inherit (attr.syncthing) id;
- addresses = ["tcp://${name}.${config.networking.domain}:22000"];
- introducer = this.isHeadless;
+ compression = "metadata";
+ introducer = false;
+ address = "tcp://${name}.${config.networking.domain}:22000";
+ autoAcceptFolders = true;
+ untrusted = false;
})
my.configurations;
@@ -107,17 +117,17 @@ in {
versioning = trashcan;
};
org = {
- path = "${documents}/org"; # Configured by Emacs.
+ path = "${documents}/org";
devices = all;
versioning = simple;
};
roam = {
- path = "${documents}/roam"; # Configured by Emacs.
+ path = "${documents}/roam";
devices = notOther;
versioning = simple;
};
elfeed = {
- path = "${config.my.home}/.elfeed"; # Configured by Emacs.
+ path = "${config.my.home}/.elfeed";
devices = notOther;
versioning = trashcan;
};
diff --git a/modules/nixos/wayland.nix b/modules/nixos/wayland.nix
new file mode 100644
index 0000000..5068c25
--- /dev/null
+++ b/modules/nixos/wayland.nix
@@ -0,0 +1,19 @@
+{
+ config,
+ lib,
+ ...
+}:
+with lib; let
+ cfg = config.nixfiles.modules.wayland;
+in {
+ options.nixfiles.modules.wayland.enable = mkEnableOption "Wayland";
+
+ config = mkIf cfg.enable {
+ assertions = [
+ {
+ assertion = !config.nixfiles.modules.x11.enable;
+ message = "Pick only one!";
+ }
+ ];
+ };
+}
diff --git a/modules/nixos/x11.nix b/modules/nixos/x11.nix
index b1bca8f..b629aeb 100644
--- a/modules/nixos/x11.nix
+++ b/modules/nixos/x11.nix
@@ -10,7 +10,12 @@ in {
options.nixfiles.modules.x11.enable = mkEnableOption "X11";
config = mkIf cfg.enable {
- nixfiles.modules.fonts.enable = true;
+ assertions = [
+ {
+ assertion = !config.nixfiles.modules.wayland.enable;
+ message = "Pick only one!";
+ }
+ ];
hm = {
home.sessionVariables = {