Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
leo60228 committed Sep 2, 2024
1 parent 36f08d5 commit 6d35c46
Show file tree
Hide file tree
Showing 6 changed files with 188 additions and 26 deletions.
4 changes: 2 additions & 2 deletions hardware/desktop.nix
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
#'' else "";

#specialisation.amdgpu.configuration = { ... }: {
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.beta;
hardware.nvidia.open = true;
hardware.nvidia.modesetting.enable = true;
services.xserver.videoDrivers = lib.mkForce [ "nvidia" ];
services.xserver.screenSection = ''
Expand Down Expand Up @@ -215,7 +215,7 @@
boot.loader.timeout = null;
boot.loader.systemd-boot.memtest86.enable = true;

virtualisation.docker.enableNvidia = true;
hardware.nvidia-container-toolkit.enable = true;

deployment.tags = [ "workstation" ];
deployment.allowLocalDeployment = true;
Expand Down
1 change: 1 addition & 0 deletions hardware/zephyrus.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
services.power-profiles-daemon.enable = true;

services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia.open = true;
hardware.nvidia.modesetting.enable = true;
hardware.nvidia.prime = {
offload.enable = true;
Expand Down
2 changes: 1 addition & 1 deletion home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@

home.file.".gradle/gradle.properties" = lib.mkIf (!small) {
text = ''
org.gradle.java.installations.paths=${pkgs.adoptopenjdk-hotspot-bin-8}
org.gradle.java.installations.paths=${pkgs.temurin-bin-8}
org.gradle.java.installations.auto-download=false
'';
};
Expand Down
6 changes: 4 additions & 2 deletions modules/base.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
./flakes.nix
./nix-daemon.nix
./cachix.nix

./fcitx5.nix # FIXME: remove after https://github.com/NixOS/nixpkgs/commit/38cabf32f86b756a9c682f2e20fbeca392661dd0
];
disabledModules = [ "i18n/input-method/fcitx5.nix" ];

users.extraUsers.leo60228 = {
isNormalUser = true;
Expand Down Expand Up @@ -57,8 +60,7 @@
nixpkgs.config = {
allowUnfree = true;
permittedInsecurePackages = [
"nodejs-16.20.0" # FIXME: unneeded after https://github.com/NixOS/nixpkgs/commit/b38795a22e1028127a9e2f2be1c8d9b11d31bd26
"openssl-1.1.1t" # FIXME: unneeded after https://github.com/NixOS/nixpkgs/commit/8229ab2435dd53eef8c5eb076c15ccdafd25fec7
"olm-3.2.16" # these vulnerabilities aren't real.
];
};

Expand Down
159 changes: 159 additions & 0 deletions modules/fcitx5.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
{
config,
pkgs,
lib,
...
}:
let
imcfg = config.i18n.inputMethod;
cfg = imcfg.fcitx5;
fcitx5Package =
if cfg.plasma6Support then
pkgs.qt6Packages.fcitx5-with-addons.override { inherit (cfg) addons; }
else
pkgs.libsForQt5.fcitx5-with-addons.override { inherit (cfg) addons; };
settingsFormat = pkgs.formats.ini { };
in
{
options = {
i18n.inputMethod.fcitx5 = {
addons = lib.mkOption {
type = with lib.types; listOf package;
default = [ ];
example = lib.literalExpression "with pkgs; [ fcitx5-rime ]";
description = ''
Enabled Fcitx5 addons.
'';
};
waylandFrontend = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Use the Wayland input method frontend.
See [Using Fcitx 5 on Wayland](https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland).
'';
};
plasma6Support = lib.mkOption {
type = lib.types.bool;
default = config.services.desktopManager.plasma6.enable;
defaultText = lib.literalExpression "config.services.desktopManager.plasma6.enable";
description = ''
Use qt6 versions of fcitx5 packages.
Required for configuring fcitx5 in KDE System Settings.
'';
};
quickPhrase = lib.mkOption {
type = with lib.types; attrsOf str;
default = { };
example = lib.literalExpression ''
{
smile = "(・∀・)";
angry = "( ̄ー ̄)";
}
'';
description = "Quick phrases.";
};
quickPhraseFiles = lib.mkOption {
type = with lib.types; attrsOf path;
default = { };
example = lib.literalExpression ''
{
words = ./words.mb;
numbers = ./numbers.mb;
}
'';
description = "Quick phrase files.";
};
settings = {
globalOptions = lib.mkOption {
type = lib.types.submodule { freeformType = settingsFormat.type; };
default = { };
description = ''
The global options in `config` file in ini format.
'';
};
inputMethod = lib.mkOption {
type = lib.types.submodule { freeformType = settingsFormat.type; };
default = { };
description = ''
The input method configure in `profile` file in ini format.
'';
};
addons = lib.mkOption {
type = with lib.types; (attrsOf anything);
default = { };
description = ''
The addon configures in `conf` folder in ini format with global sections.
Each item is written to the corresponding file.
'';
example = lib.literalExpression "{ pinyin.globalSection.EmojiEnabled = \"True\"; }";
};
};
ignoreUserConfig = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Ignore the user configures. **Warning**: When this is enabled, the
user config files are totally ignored and the user dict can't be saved
and loaded.
'';
};
};
};

imports = [
(lib.mkRemovedOptionModule
[
"i18n"
"inputMethod"
"fcitx5"
"enableRimeData"
]
''
RIME data is now included in `fcitx5-rime` by default, and can be customized using `fcitx5-rime.override { rimeDataPkgs = ...; }`
''
)
];

config = lib.mkIf (imcfg.enable && imcfg.type == "fcitx5") {
i18n.inputMethod.package = fcitx5Package;

i18n.inputMethod.fcitx5.addons =
lib.optionals (cfg.quickPhrase != { }) [
(pkgs.writeTextDir "share/fcitx5/data/QuickPhrase.mb" (
lib.concatStringsSep "\n" (lib.mapAttrsToList (name: value: "${name} ${value}") cfg.quickPhrase)
))
]
++ lib.optionals (cfg.quickPhraseFiles != { }) [
(pkgs.linkFarm "quickPhraseFiles" (
lib.mapAttrs' (
name: value: lib.nameValuePair ("share/fcitx5/data/quickphrase.d/${name}.mb") value
) cfg.quickPhraseFiles
))
];
environment.etc =
let
optionalFile =
p: f: v:
lib.optionalAttrs (v != { }) { "xdg/fcitx5/${p}".text = f v; };
in
lib.attrsets.mergeAttrsList [
(optionalFile "config" (lib.generators.toINI { }) cfg.settings.globalOptions)
(optionalFile "profile" (lib.generators.toINI { }) cfg.settings.inputMethod)
(lib.concatMapAttrs (
name: value: optionalFile "conf/${name}.conf" (lib.generators.toINIWithGlobalSection { }) value
) cfg.settings.addons)
];

environment.variables =
{
XMODIFIERS = "@im=fcitx";
QT_PLUGIN_PATH = [ "${fcitx5Package}/${pkgs.qt6.qtbase.qtPluginPrefix}" ];
}
// lib.optionalAttrs (!cfg.waylandFrontend) {
GTK_IM_MODULE = "fcitx";
QT_IM_MODULE = "fcitx";
}
// lib.optionalAttrs cfg.ignoreUserConfig { SKIP_FCITX_USER_PATH = "1"; };
};
}
42 changes: 21 additions & 21 deletions systems/leoservices.nix
Original file line number Diff line number Diff line change
Expand Up @@ -110,27 +110,27 @@ rec {
};
};

services.lemmy = {
enable = true;
database = {
createLocally = true;
uri = "postgres:///lemmy?host=/run/postgresql&user=lemmy";
};
settings = {
email = {
smtp_server = "smtp-relay.gmail.com:587";
smtp_from_address = "Administrator <[email protected]>";
tls_type = "tls";
};
setup = {
admin_username = "vriska";
admin_password = "TeWoK25tBod2*kRz&Hq^";
site_name = "l.60228.dev";
admin_email = "[email protected]";
};
hostname = "l.60228.dev";
};
};
#services.lemmy = {
# enable = true;
# database = {
# createLocally = true;
# uri = "postgres:///lemmy?host=/run/postgresql&user=lemmy";
# };
# settings = {
# email = {
# smtp_server = "smtp-relay.gmail.com:587";
# smtp_from_address = "Administrator <[email protected]>";
# tls_type = "tls";
# };
# setup = {
# admin_username = "vriska";
# admin_password = "TeWoK25tBod2*kRz&Hq^";
# site_name = "l.60228.dev";
# admin_email = "[email protected]";
# };
# hostname = "l.60228.dev";
# };
#};

#systemd.services.ghastly = {
# description = "ghastly";
Expand Down

0 comments on commit 6d35c46

Please sign in to comment.