When you don't use nixftm-rfc-style, there's one Yusup being sad out there.

This commit is contained in:
Dmitry Voronin 2024-12-18 09:40:11 +03:00
parent 3b6ae8212d
commit 6817451032
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
393 changed files with 13037 additions and 12817 deletions

View file

@ -5,5 +5,9 @@ indent_style = tab
insert_final_newline = true insert_final_newline = true
trim_trailing_whitespace = true trim_trailing_whitespace = true
[*.nix]
indent_style = space
indent_size = 2
[*.md] [*.md]
trim_trailing_whitespace = false trim_trailing_whitespace = false

16
.treefmt.toml Normal file
View file

@ -0,0 +1,16 @@
# SRC: https://github.com/numtide/treefmt
# REF: https://treefmt.com/latest/getting-started/configure/#config-file
walk = "git"
excludes = [
"*.key",
"*.patch",
"*.ogg",
"*.lock",
"License"
]
[formatter.nixfmt-rfc-style]
command = "nixfmt"
options = [ "-s" ]
includes = [ "*.nix" ]

View file

@ -1,4 +1,4 @@
options = --option eval-cache false --fallback --print-build-logs --verbose --extra-experimental-features pipe-operators options = --option eval-cache false --fallback --print-build-logs --verbose --option extra-experimental-features pipe-operators
flake = . flake = .
hostname = $(shell hostname) hostname = $(shell hostname)
@ -16,7 +16,7 @@ boot:
cached: cached:
$(eval options := $(subst eval-cache false,eval-cache true,$(options))) $(eval options := $(subst eval-cache false,eval-cache true,$(options)))
check: check: format
nix flake check --show-trace nix flake check --show-trace
# HACK: Fix ulimit switch issue. Test sometime in the future again. # HACK: Fix ulimit switch issue. Test sometime in the future again.
@ -28,6 +28,9 @@ check:
# fix-unlock: # fix-unlock:
# pkill nixos-rebuild || true # pkill nixos-rebuild || true
format:
treefmt --no-cache --clear-cache
nixconf: nixconf:
mv /etc/nix/nix.conf_ /etc/nix/nix.conf || true mv /etc/nix/nix.conf_ /etc/nix/nix.conf || true

View file

@ -1,16 +1,16 @@
{ {
config, config,
lib, lib,
pkgs, pkgs,
... ...
}: let }:
cfg = config.module.amd.compute; let
in { cfg = config.module.amd.compute;
config = lib.mkIf cfg.enable { in
nixpkgs.config.rocmSupport = true; {
systemd.tmpfiles.rules = [ "L+ /opt/rocm/hip - - - - ${pkgs.rocmPackages.clr}" ]; config = lib.mkIf cfg.enable {
hardware.graphics.extraPackages = with pkgs; [ nixpkgs.config.rocmSupport = true;
rocmPackages.clr.icd systemd.tmpfiles.rules = [ "L+ /opt/rocm/hip - - - - ${pkgs.rocmPackages.clr}" ];
]; hardware.graphics.extraPackages = with pkgs; [ rocmPackages.clr.icd ];
}; };
} }

View file

@ -1,26 +1,24 @@
{ { config, lib, ... }:
config, let
lib, cfg = config.module.amd.cpu;
...
}: let
cfg = config.module.amd.cpu;
controlFile = "/sys/devices/system/cpu/cpufreq/boost"; controlFile = "/sys/devices/system/cpu/cpufreq/boost";
disableCmd = "1"; disableCmd = "1";
enableCmd = "0"; enableCmd = "0";
in { in
config = lib.mkIf cfg.enable (lib.mkMerge [ {
{ config = lib.mkIf cfg.enable (
boot.kernelModules = [ "kvm-amd" ]; lib.mkMerge [
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; {
} boot.kernelModules = [ "kvm-amd" ];
(lib.mkIf cfg.powersave { hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
module.powersave = { }
enable = true; (lib.mkIf cfg.powersave {
cpu.boost = { module.powersave = {
inherit controlFile enableCmd disableCmd; enable = true;
}; cpu.boost = { inherit controlFile enableCmd disableCmd; };
}; };
}) })
]); ]
);
} }

View file

@ -1,29 +1,23 @@
{ config, lib, ... }:
let
cfg = config.module.amd.gpu;
in
{ {
config, config = lib.mkIf cfg.enable {
lib, environment.variables.AMD_VULKAN_ICD = "RADV";
... boot.initrd.kernelModules = [ "amdgpu" ];
}: let services.xserver.videoDrivers = [ "amdgpu" ];
cfg = config.module.amd.gpu; hardware.graphics = {
in { enable = true;
config = lib.mkIf cfg.enable { enable32Bit = true;
environment.variables.AMD_VULKAN_ICD = "RADV"; };
boot.initrd.kernelModules = [
"amdgpu"
];
services.xserver.videoDrivers = [
"amdgpu"
];
hardware.graphics = {
enable = true;
enable32Bit = true;
};
# AMDVLK was broken for me (huge stuttering). So keep it disabled, at least for now. # AMDVLK was broken for me (huge stuttering). So keep it disabled, at least for now.
# hardware.opengl.extraPackages = with pkgs; [ # hardware.opengl.extraPackages = with pkgs; [
# amdvlk # amdvlk
# ]; # ];
# hardware.opengl.extraPackages32 = with pkgs; [ # hardware.opengl.extraPackages32 = with pkgs; [
# driversi686Linux.amdvlk # driversi686Linux.amdvlk
# ]; # ];
}; };
} }

View file

@ -3,68 +3,62 @@
# Unlike system.autoUpgrade, this script also verifies my git signature # Unlike system.autoUpgrade, this script also verifies my git signature
# to prevent unathorized changes to hosts. # to prevent unathorized changes to hosts.
{ {
config, config,
const, const,
lib, lib,
pkgs, pkgs,
secret, secret,
util, util,
... ...
}: let }:
cfg = config.module.autoupdate; let
in { cfg = config.module.autoupdate;
config = lib.mkIf cfg.enable { in
programs.git = { {
enable = true; config = lib.mkIf cfg.enable {
config = { programs.git = {
gpg.ssh.allowedSignersFile = toString secret.crypto.sign.git.allowed; enable = true;
}; config = {
}; gpg.ssh.allowedSignersFile = toString secret.crypto.sign.git.allowed;
};
};
systemd.services.autoupdate = util.mkStaticSystemdService { systemd.services.autoupdate = util.mkStaticSystemdService {
enable = true; enable = true;
description = "Signed system auto-update."; after = [ "network-online.target" ];
serviceConfig = { description = "Signed system auto-update.";
Type = "oneshot"; serviceConfig.Type = "oneshot";
}; wants = [ "network-online.target" ];
path = with pkgs; [ path = with pkgs; [
bash bash
coreutils coreutils
git git
gnumake gnumake
nixos-rebuild nixos-rebuild
openssh openssh
]; ];
script = '' script = ''
pushd /tmp pushd /tmp
rm -rf ./nixos rm -rf ./nixos
git clone --depth=1 --single-branch --branch=main ${const.url} ./nixos git clone --depth=1 --single-branch --branch=main ${const.url} ./nixos
pushd ./nixos pushd ./nixos
git verify-commit HEAD && git fsck || { git verify-commit HEAD && git fsck || {
echo "Verification failed." echo "Verification failed."
exit 1 exit 1
}; };
timeout 55m make switch timeout 55m make switch
''; '';
after = [ };
"network-online.target"
];
wants = [
"network-online.target"
];
};
systemd.timers.autoupdate = { systemd.timers.autoupdate = {
enable = true; enable = true;
timerConfig = { wantedBy = [ "timers.target" ];
OnCalendar = "hourly"; timerConfig = {
Persistent = true; OnCalendar = "hourly";
RandomizedDelaySec = 60; Persistent = true;
Unit = "autoupdate.service"; RandomizedDelaySec = 60;
}; Unit = "autoupdate.service";
wantedBy = [ };
"timers.target" };
]; };
};
};
} }

View file

@ -1,15 +1,13 @@
{ config, lib, ... }:
let
cfg = config.module.bluetooth;
in
{ {
config, config = lib.mkIf cfg.enable {
lib, services.blueman.enable = true;
... hardware.bluetooth = {
}: let enable = true;
cfg = config.module.bluetooth; powerOnBoot = true;
in { };
config = lib.mkIf cfg.enable { };
services.blueman.enable = true;
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
};
};
} }

View file

@ -1,11 +1,7 @@
{ lib, config, ... }:
let
cfg = config.module.brightness;
in
{ {
lib, config = lib.mkIf cfg.enable { programs.light.enable = true; };
config,
...
}: let
cfg = config.module.brightness;
in {
config = lib.mkIf cfg.enable {
programs.light.enable = true;
};
} }

View file

@ -1,42 +1,51 @@
{ lib, config, ... }:
let
cfg = config.module.display;
in
{ {
lib, # REF: https://www.kernel.org/doc/Documentation/fb/fbcon.txt
config, # REF: https://patchwork.kernel.org/project/dri-devel/patch/20191110154101.26486-10-hdegoede@redhat.com/#22993841
... config = lib.mkMerge [
}: let # NOTE: `tty` name is special.
cfg = config.module.display; (lib.mkIf (cfg.rotate != null) {
in { boot.kernelParams = lib.mapAttrsToList (
# REF: https://www.kernel.org/doc/Documentation/fb/fbcon.txt name: rotate:
# REF: https://patchwork.kernel.org/project/dri-devel/patch/20191110154101.26486-10-hdegoede@redhat.com/#22993841 let
config = lib.mkMerge [ # ISSUE: https://github.com/swaywm/sway/issues/8478
# NOTE: `tty` name is special. hint =
(lib.mkIf (cfg.rotate != null) { if rotate == 90 then
boot.kernelParams = lib.mapAttrsToList (name: rotate: "left_side_up"
let else if rotate == 180 then
hint = "upside_down"
if rotate == 90 then "left_side_up" else if rotate == 270 then
else if rotate == 180 then "upside_down" "right_side_up"
else if rotate == 270 then "right_side_up" else
else "normal"; "normal";
value = value =
if rotate == 90 then 1 if rotate == 90 then
else if rotate == 180 then 2 1
else if rotate == 270 then 3 else if rotate == 180 then
else 0; 2
else if rotate == 270 then
3
else
0;
command = if name == "tty" then command =
"fbcon=rotate:${toString value}" if name == "tty" then
else "fbcon=rotate:${toString value}"
"video=${name}:rotate=${toString rotate}"; else
# "video=${name}:panel_orientation=${hint}"; "video=${name}:rotate=${toString rotate}";
# "video=${name}:rotate=${toString rotate},panel_orientation=${hint}"; in
in command # "video=${name}:panel_orientation=${hint}";
) cfg.rotate; # "video=${name}:rotate=${toString rotate},panel_orientation=${hint}";
command
) cfg.rotate;
module.sway.extraConfig = lib.mapAttrsToList (name: rotate: module.sway.extraConfig = lib.mapAttrsToList (
"output ${name} transform ${toString rotate}" name: rotate: "output ${name} transform ${toString rotate}"
) cfg.rotate; ) cfg.rotate;
}) })
]; ];
} }

View file

@ -1,17 +0,0 @@
{
config,
lib,
...
}: let
cfg = config.module.dm;
in {
config = lib.mkIf cfg.enable {
services.xserver = {
enable = true;
xkb = {
layout = config.module.keyboard.layouts;
options = config.module.keyboard.options;
};
};
};
}

View file

@ -1,16 +1,16 @@
{ {
config, config,
lib, lib,
pkgs, pkgs,
... ...
}: let }:
cfg = config.module.distrobox; let
in { cfg = config.module.distrobox;
config = lib.mkIf cfg.enable { in
# Distrobox works best with Podman, so enable it here. {
module.podman.enable = true; config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [ # Distrobox works best with Podman, so enable it here.
distrobox module.podman.enable = true;
]; environment.systemPackages = with pkgs; [ distrobox ];
}; };
} }

View file

@ -1,28 +1,32 @@
{ lib, config, ... }:
let
cfg = config.module.docker;
in
{ {
lib, config = lib.mkIf cfg.enable (
config, lib.mkMerge [
... {
}: let virtualisation.docker.enable = true;
cfg = config.module.docker;
in {
config = lib.mkIf cfg.enable (lib.mkMerge [
{
virtualisation.docker.enable = true;
systemd = if cfg.autostart then { } else { systemd =
sockets.docker.wantedBy = lib.mkForce [ ]; if cfg.autostart then
services = { { }
docker-prune.wantedBy = lib.mkForce [ ]; else
docker.wantedBy = lib.mkForce [ ]; {
}; sockets.docker.wantedBy = lib.mkForce [ ];
}; services = {
} docker-prune.wantedBy = lib.mkForce [ ];
docker.wantedBy = lib.mkForce [ ];
};
};
}
(lib.mkIf cfg.rootless { (lib.mkIf cfg.rootless {
virtualisation.docker.rootless = { virtualisation.docker.rootless = {
enable = true; enable = true;
setSocketVariable = true; setSocketVariable = true;
}; };
}) })
]); ]
);
} }

View file

@ -1,77 +1,81 @@
{ {
config, config,
lib, lib,
pkgs, pkgs,
... ...
}: let }:
cfg = config.module.dpi.bypass; let
cfg = config.module.dpi.bypass;
whitelist = lib.optionalString ( whitelist = lib.optionalString (
(builtins.length cfg.whitelist) != 0 (builtins.length cfg.whitelist) != 0
) "--hostlist ${pkgs.writeText "zapret-whitelist" (lib.concatStringsSep "\n" cfg.whitelist)}"; ) "--hostlist ${pkgs.writeText "zapret-whitelist" (lib.concatStringsSep "\n" cfg.whitelist)}";
blacklist = lib.optionalString ( blacklist =
(builtins.length cfg.blacklist) != 0 lib.optionalString ((builtins.length cfg.blacklist) != 0)
) "--hostlist-exclude ${pkgs.writeText "zapret-blacklist" (lib.concatStringsSep "\n" cfg.blacklist)}"; "--hostlist-exclude ${pkgs.writeText "zapret-blacklist" (lib.concatStringsSep "\n" cfg.blacklist)}";
params = lib.concatStringsSep " " cfg.params; params = lib.concatStringsSep " " cfg.params;
qnum = toString cfg.qnum; qnum = toString cfg.qnum;
in { in
disabledModules = [ "services/networking/zapret.nix" ]; {
# imports = [ "${inputs.nixpkgsMaster}/nixos/modules/services/networking/zapret.nix" ]; disabledModules = [ "services/networking/zapret.nix" ];
# imports = [ "${inputs.nixpkgsMaster}/nixos/modules/services/networking/zapret.nix" ];
config = lib.mkIf cfg.enable (lib.mkMerge [ config = lib.mkIf cfg.enable (
{ lib.mkMerge [
systemd.services.zapret = { {
description = "DPI bypass service"; systemd.services.zapret = {
wantedBy = [ "multi-user.target" ]; description = "DPI bypass service";
after = [ "network.target" ]; wantedBy = [ "multi-user.target" ];
serviceConfig = { after = [ "network.target" ];
ExecStart = "${cfg.package}/bin/nfqws --pidfile=/run/nfqws.pid ${params} ${whitelist} ${blacklist} --qnum=${qnum}"; serviceConfig = {
Type = "simple"; ExecStart = "${cfg.package}/bin/nfqws --pidfile=/run/nfqws.pid ${params} ${whitelist} ${blacklist} --qnum=${qnum}";
PIDFile = "/run/nfqws.pid"; Type = "simple";
Restart = "always"; PIDFile = "/run/nfqws.pid";
RuntimeMaxSec = "1h"; # This service loves to crash silently or cause network slowdowns. It also restarts instantly. Restarting it at least hourly provided the best experience. Restart = "always";
RuntimeMaxSec = "1h"; # This service loves to crash silently or cause network slowdowns. It also restarts instantly. Restarting it at least hourly provided the best experience.
# Hardening. # Hardening.
DevicePolicy = "closed"; DevicePolicy = "closed";
KeyringMode = "private"; KeyringMode = "private";
PrivateTmp = true; PrivateTmp = true;
PrivateMounts = true; PrivateMounts = true;
ProtectHome = true; ProtectHome = true;
ProtectHostname = true; ProtectHostname = true;
ProtectKernelModules = true; ProtectKernelModules = true;
ProtectKernelTunables = true; ProtectKernelTunables = true;
ProtectSystem = "strict"; ProtectSystem = "strict";
ProtectProc = "invisible"; ProtectProc = "invisible";
RemoveIPC = true; RemoveIPC = true;
RestrictNamespaces = true; RestrictNamespaces = true;
RestrictRealtime = true; RestrictRealtime = true;
RestrictSUIDSGID = true; RestrictSUIDSGID = true;
SystemCallArchitectures = "native"; SystemCallArchitectures = "native";
}; };
}; };
} }
# Route system traffic via service for specified ports. # Route system traffic via service for specified ports.
(lib.mkIf cfg.configureFirewall { (lib.mkIf cfg.configureFirewall {
networking.firewall.extraCommands = networking.firewall.extraCommands =
let let
httpParams = lib.optionalString ( httpParams = lib.optionalString (
cfg.httpMode == "first" cfg.httpMode == "first"
) "-m connbytes --connbytes-dir=original --connbytes-mode=packets --connbytes 1:6"; ) "-m connbytes --connbytes-dir=original --connbytes-mode=packets --connbytes 1:6";
udpPorts = lib.concatStringsSep "," cfg.udpPorts; udpPorts = lib.concatStringsSep "," cfg.udpPorts;
in in
'' ''
iptables -t mangle -I POSTROUTING -p tcp --dport 443 -m connbytes --connbytes-dir=original --connbytes-mode=packets --connbytes 1:6 -m mark ! --mark 0x40000000/0x40000000 -j NFQUEUE --queue-num ${qnum} --queue-bypass iptables -t mangle -I POSTROUTING -p tcp --dport 443 -m connbytes --connbytes-dir=original --connbytes-mode=packets --connbytes 1:6 -m mark ! --mark 0x40000000/0x40000000 -j NFQUEUE --queue-num ${qnum} --queue-bypass
'' ''
+ lib.optionalString (cfg.httpSupport) '' + lib.optionalString (cfg.httpSupport) ''
iptables -t mangle -I POSTROUTING -p tcp --dport 80 ${httpParams} -m mark ! --mark 0x40000000/0x40000000 -j NFQUEUE --queue-num ${qnum} --queue-bypass iptables -t mangle -I POSTROUTING -p tcp --dport 80 ${httpParams} -m mark ! --mark 0x40000000/0x40000000 -j NFQUEUE --queue-num ${qnum} --queue-bypass
'' ''
+ lib.optionalString (cfg.udpSupport) '' + lib.optionalString (cfg.udpSupport) ''
iptables -t mangle -A POSTROUTING -p udp -m multiport --dports ${udpPorts} -m mark ! --mark 0x40000000/0x40000000 -j NFQUEUE --queue-num ${qnum} --queue-bypass iptables -t mangle -A POSTROUTING -p udp -m multiport --dports ${udpPorts} -m mark ! --mark 0x40000000/0x40000000 -j NFQUEUE --queue-num ${qnum} --queue-bypass
''; '';
}) })
]); ]
);
} }

View file

@ -1,26 +1,23 @@
{ config, lib, ... }:
let
cfg = config.module.ftpd;
in
{ {
config, config = lib.mkIf cfg.enable {
lib, services.vsftpd = {
util, enable = true;
... allowWriteableChroot = true;
}: let anonymousMkdirEnable = true;
cfg = config.module.ftpd; anonymousUmask = "000";
in { anonymousUploadEnable = true;
config = lib.mkIf cfg.enable { anonymousUser = true;
services.vsftpd = { anonymousUserHome = cfg.storage;
enable = true; anonymousUserNoPassword = true;
allowWriteableChroot = true; localUsers = false;
anonymousMkdirEnable = true; writeEnable = true;
anonymousUmask = "000"; extraConfig = ''
anonymousUploadEnable = true; anon_other_write_enable=YES
anonymousUser = true; '';
anonymousUserHome = cfg.storage; };
anonymousUserNoPassword = true; };
localUsers = false;
writeEnable = true;
extraConfig = util.trimTabs ''
anon_other_write_enable=YES
'';
};
};
} }

View file

@ -1,58 +0,0 @@
# This is pretty much abandoned module. I keep it just in case.
{
config,
lib,
pkgs,
...
}: let
cfg = config.module.gnome;
in {
config = lib.mkIf cfg.enable {
module = {
dm.enable = true;
sound.enable = true;
wayland.enable = true;
};
services.xserver = {
displayManager.gdm.enable = true;
desktopManager.gnome.enable = true;
};
environment.systemPackages = with pkgs; [
gnome.gnome-tweaks # Gnome "hidden" settings.
openssl # It was needed for something, can't remember.
];
# Disable some Gnome apps.
services.gnome.gnome-keyring.enable = lib.mkForce false;
environment.gnome.excludePackages = with pkgs.gnome; [
# baobab # Disk usage analyzer.
# cheese # Photo booth.
# epiphany # Web browser.
# simple-scan # Document scanner.
# totem # Video player.
# yelp # Help viewer.
# file-roller # Archive manager.
# geary # Email client.
# seahorse # Password manager.
# gnome-calculator
# gnome-calendar
# gnome-characters
# gnome-clocks
# gnome-contacts
# gnome-font-viewer
# gnome-keyring
# gnome-logs
# gnome-maps
# gnome-music
# gnome-shell-extensions
gnome-software
# gnome-system-monitor
# gnome-weather
# gnome-disk-utility
# pkgs.gnome-text-editor
];
};
}

View file

@ -1,28 +1,22 @@
# Intel CPU specific configuration. # Intel CPU specific configuration.
{ { config, lib, ... }:
config, let
lib, cfg = config.module.intel.cpu;
...
}: let
cfg = config.module.intel.cpu;
controlFile = "/sys/devices/system/cpu/intel_pstate/no_turbo"; controlFile = "/sys/devices/system/cpu/intel_pstate/no_turbo";
disableCmd = "0"; disableCmd = "0";
enableCmd = "1"; enableCmd = "1";
in { in
config = lib.mkIf cfg.enable (lib.mkMerge [ {
{ config = lib.mkIf cfg.enable (
boot.kernelModules = [ lib.mkMerge [
"kvm-intel" { boot.kernelModules = [ "kvm-intel" ]; }
]; (lib.mkIf cfg.powersave {
} module.powersave = {
(lib.mkIf cfg.powersave { enable = true;
module.powersave = { cpu.boost = { inherit controlFile enableCmd disableCmd; };
enable = true; };
cpu.boost = { })
inherit controlFile enableCmd disableCmd; ]
}; );
};
})
]);
} }

View file

@ -1,62 +1,62 @@
{ {
config, config,
lib, lib,
pkgsUnstable, pkgsUnstable,
... ...
}: let }:
cfg = config.module.kernel; let
in { cfg = config.module.kernel;
config = lib.mkIf cfg.enable (lib.mkMerge [ in
{ {
boot.kernel.sysctl = { config = lib.mkIf cfg.enable (
# Allow sysrq. lib.mkMerge [
"kernel.sysrq" = 1; {
boot.kernel.sysctl = {
# Allow sysrq.
"kernel.sysrq" = 1;
# Increase file watchers. # Increase file watchers.
"fs.inotify.max_user_event" = 9999999; "fs.inotify.max_user_event" = 9999999;
"fs.inotify.max_user_instances" = 9999999; "fs.inotify.max_user_instances" = 9999999;
"fs.inotify.max_user_watches" = 9999999; "fs.inotify.max_user_watches" = 9999999;
# "fs.file-max" = 999999; # "fs.file-max" = 999999;
}; };
} }
(lib.mkIf cfg.hardening { (lib.mkIf cfg.hardening {
boot.kernel.sysctl = { boot.kernel.sysctl = {
# Spoof protection. # Spoof protection.
"net.ipv4.conf.all.rp_filter" = 1; "net.ipv4.conf.all.rp_filter" = 1;
"net.ipv4.conf.default.rp_filter" = 1; "net.ipv4.conf.default.rp_filter" = 1;
# Packet forwarding. # Packet forwarding.
"net.ipv4.ip_forward" = 0; "net.ipv4.ip_forward" = 0;
"net.ipv6.conf.all.forwarding" = 0; "net.ipv6.conf.all.forwarding" = 0;
# MITM protection. # MITM protection.
"net.ipv4.conf.all.accept_redirects" = 0; "net.ipv4.conf.all.accept_redirects" = 0;
"net.ipv6.conf.all.accept_redirects" = 0; "net.ipv6.conf.all.accept_redirects" = 0;
# Do not send ICMP redirects (we are not a router). # Do not send ICMP redirects (we are not a router).
"net.ipv4.conf.all.send_redirects" = 0; "net.ipv4.conf.all.send_redirects" = 0;
# Do not accept IP source route packets (we are not a router). # Do not accept IP source route packets (we are not a router).
"net.ipv4.conf.all.accept_source_route" = 0; "net.ipv4.conf.all.accept_source_route" = 0;
"net.ipv6.conf.all.accept_source_route" = 0; "net.ipv6.conf.all.accept_source_route" = 0;
# Protect filesystem links. # Protect filesystem links.
"fs.protected_hardlinks" = 0; "fs.protected_hardlinks" = 0;
"fs.protected_symlinks" = 0; "fs.protected_symlinks" = 0;
# Lynis config. # Lynis config.
"kernel.core_uses_pid" = 1; "kernel.core_uses_pid" = 1;
"kernel.kptr_restrict" = 2; "kernel.kptr_restrict" = 2;
}; };
}) })
(lib.mkIf cfg.hotspotTtlBypass { (lib.mkIf cfg.hotspotTtlBypass { boot.kernel.sysctl."net.ipv4.ip_default_ttl" = 65; })
boot.kernel.sysctl."net.ipv4.ip_default_ttl" = 65;
})
(lib.mkIf cfg.latest { (lib.mkIf cfg.latest { boot.kernelPackages = pkgsUnstable.linuxPackages_latest; })
boot.kernelPackages = pkgsUnstable.linuxPackages_latest; ]
}) );
]);
} }

View file

@ -1,98 +1,96 @@
{ {
config, config,
lib, lib,
pkgs, pkgs,
... ...
}: let }:
cfg = config.module.keyd; let
in { cfg = config.module.keyd;
config = lib.mkIf cfg.enable { in
environment.systemPackages = with pkgs; [ {
keyd config = lib.mkIf cfg.enable {
]; environment.systemPackages = with pkgs; [ keyd ];
services.keyd = { services.keyd = {
enable = true; enable = true;
keyboards.default = { keyboards.default = {
ids = [ "*" ]; ids = [ "*" ];
settings = { settings = {
# NOTE: Use `wev` to find key names. # NOTE: Use `wev` to find key names.
main = { main = {
backspace = "delete"; # Delete key on backspace. backspace = "delete"; # Delete key on backspace.
capslock = "overload(control, esc)"; # Ctrl/esc combo. capslock = "overload(control, esc)"; # Ctrl/esc combo.
compose = "layer(layer_number)"; # Number input layer. compose = "layer(layer_number)"; # Number input layer.
delete = "backslash"; delete = "backslash";
esc = "print"; # System controls. esc = "print"; # System controls.
leftcontrol = "overload(layer_alternative, leftcontrol)"; # Alternative layer for home, end etc. leftcontrol = "overload(layer_alternative, leftcontrol)"; # Alternative layer for home, end etc.
rightcontrol = "layer(layer_control)"; # Media and other controls. rightcontrol = "layer(layer_control)"; # Media and other controls.
rightshift = "backspace"; # Backspace. rightshift = "backspace"; # Backspace.
}; };
# Alternative navigation. # Alternative navigation.
layer_alternative = { layer_alternative = {
a = "home"; a = "home";
c = "copy"; c = "copy";
d = "end"; d = "end";
h = "left"; h = "left";
j = "down"; j = "down";
k = "up"; k = "up";
l = "right"; l = "right";
s = "pagedown"; s = "pagedown";
v = "paste"; v = "paste";
w = "pageup"; w = "pageup";
x = "cut"; x = "cut";
esc = "esc"; esc = "esc";
rightcontrol = "leftcontrol"; rightcontrol = "leftcontrol";
capslock = "capslock"; capslock = "capslock";
}; };
# Media controls. # Media controls.
layer_control = { layer_control = {
a = "back"; a = "back";
c = "ejectcd"; c = "ejectcd";
d = "forward"; d = "forward";
e = "nextsong"; e = "nextsong";
q = "previoussong"; q = "previoussong";
s = "volumedown"; s = "volumedown";
v = "micmute"; v = "micmute";
w = "volumeup"; w = "volumeup";
x = "stopcd"; x = "stopcd";
z = "mute"; z = "mute";
space = "playpause"; space = "playpause";
}; };
# Number inputs. # Number inputs.
layer_number = { layer_number = {
"1" = "kpequal"; "1" = "kpequal";
"2" = "kpslash"; "2" = "kpslash";
"3" = "kpasterisk"; "3" = "kpasterisk";
"4" = "kpminus"; "4" = "kpminus";
a = "4"; a = "4";
c = "3"; c = "3";
d = "6"; d = "6";
e = "9"; e = "9";
f = "kpenter"; f = "kpenter";
q = "7"; q = "7";
r = "kpplus"; r = "kpplus";
s = "5"; s = "5";
v = "kpcomma"; v = "kpcomma";
w = "8"; w = "8";
x = "2"; x = "2";
z = "1"; z = "1";
shift = "backspace"; shift = "backspace";
space = "0"; space = "0";
}; };
}; };
}; };
}; };
# HACK: Workaround for https://github.com/NixOS/nixpkgs/issues/290161 # HACK: Workaround for https://github.com/NixOS/nixpkgs/issues/290161
users.groups.keyd = { }; users.groups.keyd = { };
systemd.services.keyd.serviceConfig.CapabilityBoundingSet = [ systemd.services.keyd.serviceConfig.CapabilityBoundingSet = [ "CAP_SETGID" ];
"CAP_SETGID"
];
# Debug toggle just in case I need it again. # Debug toggle just in case I need it again.
# systemd.services.keyd.environment.KEYD_DEBUG = "1"; # systemd.services.keyd.environment.KEYD_DEBUG = "1";
}; };
} }

View file

@ -1,54 +1,55 @@
# SRC: https://github.com/ollama/ollama # SRC: https://github.com/ollama/ollama
{ {
pkgsUnstable, pkgsUnstable,
lib, lib,
config, config,
util, ...
... }:
}: let let
cfg = config.module.ollama; cfg = config.module.ollama;
in { in
config = lib.mkIf cfg.enable { {
# Specify default model. config = lib.mkIf cfg.enable {
# environment.variables.OLLAMA_MODEL = cfg.primaryModel; # Specify default model.
# # environment.variables.OLLAMA_MODEL = cfg.primaryModel;
# systemd.services = { #
# # Enable Ollama server. # systemd.services = {
# ollama = { # # Enable Ollama server.
# description = "Ollama LLM server"; # ollama = {
# serviceConfig = { # description = "Ollama LLM server";
# Type = "simple"; # serviceConfig = {
# }; # Type = "simple";
# wantedBy = [ # };
# "multi-user.target" # wantedBy = [
# ]; # "multi-user.target"
# script = '' # ];
# HOME=/root ${lib.getExe pkgsUnstable.ollama} serve # script = ''
# ''; # HOME=/root ${lib.getExe pkgsUnstable.ollama} serve
# }; # '';
# # };
# # Download Ollama models. #
# ollama-pull = { # # Download Ollama models.
# description = "Ollama LLM model"; # ollama-pull = {
# after = [ # description = "Ollama LLM model";
# "NetworkManager-wait-online.service" # after = [
# "ollama.service" # "NetworkManager-wait-online.service"
# ]; # "ollama.service"
# wantedBy = [ # ];
# "multi-user.target" # wantedBy = [
# ]; # "multi-user.target"
# wants = [ # ];
# "NetworkManager-wait-online.service" # wants = [
# "ollama.service" # "NetworkManager-wait-online.service"
# ]; # "ollama.service"
# serviceConfig = { # ];
# Type = "simple"; # serviceConfig = {
# }; # Type = "simple";
# script = util.trimTabs '' # };
# sleep 5 # script = ''
# ${lib.getExe pkgsUnstable.ollama} pull ${lib.concatStringsSep " " cfg.models} # sleep 5
# ''; # ${lib.getExe pkgsUnstable.ollama} pull ${lib.concatStringsSep " " cfg.models}
# }; # '';
# }; # };
}; # };
};
} }

View file

@ -1,92 +1,90 @@
{ {
__findFile, __findFile,
config, config,
lib, lib,
pkgs, pkgs,
... ...
} @args: let }@args:
cfg = config.module.package; let
package = import <package> args; cfg = config.module.package;
in { package = import <package> args;
config = lib.mkMerge [ in
# Core apps. {
(lib.mkIf cfg.core { config = lib.mkMerge [
environment.systemPackages = package.core; # Core apps.
(lib.mkIf cfg.core {
environment.systemPackages = package.core;
programs = { programs = {
adb.enable = true; adb.enable = true;
git.enable = true; git.enable = true;
java = { java = {
enable = true; enable = true;
package = pkgs.corretto21; package = pkgs.corretto21;
}; };
}; };
services = { services = {
udisks2.enable = true; udisks2.enable = true;
}; };
}) })
# Common apps. # Common apps.
(lib.mkIf cfg.common { (lib.mkIf cfg.common {
environment.systemPackages = package.common; environment.systemPackages = package.common;
xdg.mime.defaultApplications = { xdg.mime.defaultApplications = {
# Use `file -i file.txt` to find file mime type. # Use `file -i file.txt` to find file mime type.
# Use `xdg-mime query default "text/plain"` to find default app. # Use `xdg-mime query default "text/plain"` to find default app.
"application/pdf" = "org.gnome.Evince.desktop"; "application/pdf" = "org.gnome.Evince.desktop";
"application/vnd.openxmlformats-officedocument.*" = "onlyoffice-desktopeditors.desktop"; "application/vnd.openxmlformats-officedocument.*" = "onlyoffice-desktopeditors.desktop";
"audio/*" = "mpv.desktop"; "audio/*" = "mpv.desktop";
"image/*" = "org.gnome.Loupe.desktop"; "image/*" = "org.gnome.Loupe.desktop";
"text/*" = "nvim.desktop"; "text/*" = "nvim.desktop";
"video/*" = "mpv.desktop"; "video/*" = "mpv.desktop";
}; };
services.gvfs.enable = true; services.gvfs.enable = true;
# Chromium config. # Chromium config.
environment.etc = let environment.etc =
chromium = import <home/file/chromium> args; let
in { chromium = import <home/file/chromium> args;
"chromium/initial_preferences".source = lib.mkForce chromium.preferences; in
"chromium/policies/managed/extra.json".source = lib.mkForce chromium.policy; {
}; "chromium/initial_preferences".source = lib.mkForce chromium.preferences;
}) "chromium/policies/managed/extra.json".source = lib.mkForce chromium.policy;
};
})
# Desktop apps. # Desktop apps.
(lib.mkIf cfg.desktop { (lib.mkIf cfg.desktop { environment.systemPackages = package.desktop; })
environment.systemPackages = package.desktop;
})
# Gaming. # Gaming.
(lib.mkIf cfg.gaming { (lib.mkIf cfg.gaming {
programs.steam.enable = true; programs.steam.enable = true;
environment.systemPackages = package.gaming; environment.systemPackages = package.gaming;
hardware.graphics = let hardware.graphics =
packages = with pkgs; [ let
dxvk packages = with pkgs; [
gamescope dxvk
pkgs.mangohud gamescope
vkd3d pkgs.mangohud
]; vkd3d
in { ];
extraPackages = packages; in
extraPackages32 = packages; {
}; extraPackages = packages;
}) extraPackages32 = packages;
};
})
# Creativity. # Creativity.
(lib.mkIf cfg.creative { (lib.mkIf cfg.creative { environment.systemPackages = package.creative; })
environment.systemPackages = package.creative;
})
# Development. # Development.
(lib.mkIf cfg.dev { (lib.mkIf cfg.dev { environment.systemPackages = package.dev; })
environment.systemPackages = package.dev;
})
# Extras. # Extras.
(lib.mkIf cfg.extra { (lib.mkIf cfg.extra { environment.systemPackages = package.extra; })
environment.systemPackages = package.extra; ];
})
];
} }

View file

@ -1,20 +1,18 @@
{ lib, config, ... }:
let
cfg = config.module.podman;
in
{ {
lib, config = lib.mkIf cfg.enable {
config, virtualisation.podman = {
... enable = true;
}: let
cfg = config.module.podman;
in {
config = lib.mkIf cfg.enable {
virtualisation.podman = {
enable = true;
# Free the 53 port ffs. # Free the 53 port ffs.
defaultNetwork.settings.dns_enabled = false; defaultNetwork.settings.dns_enabled = false;
# Do not interfere with Docker so we can have both installed at the same time. # Do not interfere with Docker so we can have both installed at the same time.
# Podman can't replace Docker anyway. # Podman can't replace Docker anyway.
dockerCompat = false; dockerCompat = false;
}; };
}; };
} }

View file

@ -1,31 +1,29 @@
# Polkit agent is used by apps to ask for Root password with a popup. # Polkit agent is used by apps to ask for Root password with a popup.
{ {
config, config,
lib, lib,
pkgs, pkgs,
... ...
}: let }:
cfg = config.module.polkit; let
in { cfg = config.module.polkit;
config = lib.mkIf cfg.enable { in
security.polkit.enable = true; {
systemd = { config = lib.mkIf cfg.enable {
packages = with pkgs; [ security.polkit.enable = true;
polkit-kde-agent systemd = {
]; packages = with pkgs; [ polkit-kde-agent ];
user = { user = {
services.plasma-polkit-agent = { services.plasma-polkit-agent = {
environment.PATH = lib.mkForce null; environment.PATH = lib.mkForce null;
serviceConfig = { wantedBy = [ "gui-session.target" ];
Restart = "always"; serviceConfig = {
RestartSec = 2; Restart = "always";
Slice = "session.slice"; RestartSec = 2;
}; Slice = "session.slice";
wantedBy = [ };
"gui-session.target" };
]; };
}; };
}; };
};
};
} }

View file

@ -1,24 +1,24 @@
# Portals are needed for Wayland apps to select files, screen shares etc. # Portals are needed for Wayland apps to select files, screen shares etc.
{ {
config, config,
lib, lib,
pkgs, pkgs,
... ...
}: let }:
cfg = config.module.portal; let
in { cfg = config.module.portal;
config = lib.mkIf cfg.enable { in
xdg.portal = { {
enable = true; config = lib.mkIf cfg.enable {
wlr.enable = true; xdg.portal = {
xdgOpenUsePortal = false; enable = true;
extraPortals = with pkgs; [ wlr.enable = true;
xdg-desktop-portal-gtk xdgOpenUsePortal = false;
]; extraPortals = with pkgs; [ xdg-desktop-portal-gtk ];
config.common.default = [ config.common.default = [
"gtk" "gtk"
"wlr" "wlr"
]; ];
}; };
}; };
} }

View file

@ -1,68 +1,65 @@
# ThinkPad charge limits. # ThinkPad charge limits.
{ {
config, config,
lib, lib,
pkgs, pkgs,
util, ...
... }:
}: let let
cfg = config.module.powerlimit.thinkpad; cfg = config.module.powerlimit.thinkpad;
controlFileMax = "/sys/class/power_supply/BAT0/charge_control_end_threshold"; controlFileMax = "/sys/class/power_supply/BAT0/charge_control_end_threshold";
controlFileMin = "/sys/class/power_supply/BAT0/charge_control_start_threshold"; controlFileMin = "/sys/class/power_supply/BAT0/charge_control_start_threshold";
script = pkgs.writeShellScriptBin "powerlimit" (util.trimTabs '' script = pkgs.writeShellScriptBin "powerlimit" ''
function toggle() { function toggle() {
if status; then if status; then
echo ${toString cfg.offMax} > ${controlFileMax} echo ${toString cfg.offMax} > ${controlFileMax}
echo ${toString cfg.offMin} > ${controlFileMin} echo ${toString cfg.offMin} > ${controlFileMin}
else else
echo ${toString cfg.onMin} > ${controlFileMin} echo ${toString cfg.onMin} > ${controlFileMin}
echo ${toString cfg.onMax} > ${controlFileMax} echo ${toString cfg.onMax} > ${controlFileMax}
fi fi
pkill -RTMIN+6 waybar pkill -RTMIN+6 waybar
true true
} }
function widget() { function widget() {
status && printf '' || printf '' status && printf '' || printf ''
} }
function status() { function status() {
local current=$(cat ${controlFileMax}) local current=$(cat ${controlFileMax})
local enabled="${toString cfg.onMax}" local enabled="${toString cfg.onMax}"
[[ "''${current}" = "''${enabled}" ]] [[ "''${current}" = "''${enabled}" ]]
} }
''${@} ''${@}
''); '';
in { in
config = lib.mkIf cfg.enable { {
environment.systemPackages = [ config = lib.mkIf cfg.enable {
script environment.systemPackages = [ script ];
]; systemd = {
systemd = { services.powerlimit = {
services.powerlimit = { enable = true;
enable = true; description = "Limit battery charge";
description = "Limit battery charge"; wantedBy = [ "multi-user.target" ];
wantedBy = [ serviceConfig = {
"multi-user.target" Type = "simple";
]; RemainAfterExit = "yes";
serviceConfig = { ExecStart = "${lib.getExe pkgs.bash} -c 'echo ${toString cfg.onMin} > ${controlFileMin}; echo ${toString cfg.onMax} > ${controlFileMax};'";
Type = "simple"; ExecStop = "${lib.getExe pkgs.bash} -c 'echo ${toString cfg.offMax} > ${controlFileMax}; echo ${toString cfg.offMin} > ${controlFileMin};'";
RemainAfterExit = "yes"; };
ExecStart = "${lib.getExe pkgs.bash} -c 'echo ${toString cfg.onMin} > ${controlFileMin}; echo ${toString cfg.onMax} > ${controlFileMax};'"; };
ExecStop = "${lib.getExe pkgs.bash} -c 'echo ${toString cfg.offMax} > ${controlFileMax}; echo ${toString cfg.offMin} > ${controlFileMin};'";
};
};
# HACK: Allow user access. # HACK: Allow user access.
tmpfiles.rules = [ tmpfiles.rules = [
"z ${controlFileMax} 0777 - - - -" "z ${controlFileMax} 0777 - - - -"
"z ${controlFileMin} 0777 - - - -" "z ${controlFileMin} 0777 - - - -"
]; ];
}; };
}; };
} }

View file

@ -1,61 +1,56 @@
{ {
lib, lib,
config, config,
pkgs, pkgs,
util, ...
... }:
}: let let
cfg = config.module.powersave; cfg = config.module.powersave;
script = pkgs.writeShellScriptBin "powersave" (util.trimTabs '' script = pkgs.writeShellScriptBin "powersave" ''
function toggle() { function toggle() {
if status; then if status; then
echo ${cfg.cpu.boost.disableCmd} > ${cfg.cpu.boost.controlFile} echo ${cfg.cpu.boost.disableCmd} > ${cfg.cpu.boost.controlFile}
else else
echo ${cfg.cpu.boost.enableCmd} > ${cfg.cpu.boost.controlFile} echo ${cfg.cpu.boost.enableCmd} > ${cfg.cpu.boost.controlFile}
fi fi
pkill -RTMIN+5 waybar pkill -RTMIN+5 waybar
true true
} }
function widget() { function widget() {
status && printf '' || printf '󰓅' status && printf '' || printf '󰓅'
} }
function status() { function status() {
local current=$(cat ${cfg.cpu.boost.controlFile}) local current=$(cat ${cfg.cpu.boost.controlFile})
local enabled="${cfg.cpu.boost.enableCmd}" local enabled="${cfg.cpu.boost.enableCmd}"
[[ "''${current}" = "''${enabled}" ]] [[ "''${current}" = "''${enabled}" ]]
} }
''${@} ''${@}
''); '';
in { in
config = lib.mkIf cfg.enable { {
environment.systemPackages = [ config = lib.mkIf cfg.enable {
script environment.systemPackages = [ script ];
]; systemd = {
systemd = { services.powersave-cpu = {
services.powersave-cpu = { enable = true;
enable = true; description = "disable CPU Boost";
description = "disable CPU Boost"; wantedBy = [ "multi-user.target" ];
wantedBy = [ serviceConfig = {
"multi-user.target" Type = "simple";
]; RemainAfterExit = "yes";
serviceConfig = { ExecStart = "${lib.getExe pkgs.bash} -c 'echo ${cfg.cpu.boost.enableCmd} > ${cfg.cpu.boost.controlFile}'";
Type = "simple"; ExecStop = "${lib.getExe pkgs.bash} -c 'echo ${cfg.cpu.boost.disableCmd} > ${cfg.cpu.boost.controlFile}'";
RemainAfterExit = "yes"; };
ExecStart = "${lib.getExe pkgs.bash} -c 'echo ${cfg.cpu.boost.enableCmd} > ${cfg.cpu.boost.controlFile}'"; };
ExecStop = "${lib.getExe pkgs.bash} -c 'echo ${cfg.cpu.boost.disableCmd} > ${cfg.cpu.boost.controlFile}'";
};
};
# HACK: Allow user access. # HACK: Allow user access.
tmpfiles.rules = [ tmpfiles.rules = [ "z ${cfg.cpu.boost.controlFile} 0777 - - - -" ];
"z ${cfg.cpu.boost.controlFile} 0777 - - - -" };
]; };
};
};
} }

View file

@ -1,18 +1,15 @@
{ config, lib, ... }:
let
cfg = config.module.print;
in
{ {
config, config = lib.mkIf cfg.enable {
lib, services.printing = {
util, enable = true;
... clientConf = ''
}: let DigestOptions DenyMD5
cfg = config.module.print; ServerName 10.0.0.1
in { '';
config = lib.mkIf cfg.enable { };
services.printing = { };
enable = true;
clientConf = util.trimTabs ''
DigestOptions DenyMD5
ServerName 10.0.0.1
'';
};
};
} }

View file

@ -1,151 +1,146 @@
{ config, lib, ... }:
let
cfg = config.module.purpose;
in
{ {
config, config = lib.mkMerge [
lib, (lib.mkIf cfg.creative {
... module = {
}: let tablet.enable = true;
cfg = config.module.purpose; package.creative = true;
in { };
config = lib.mkMerge [ })
(lib.mkIf cfg.creative {
module = {
tablet.enable = true;
package.creative = true;
};
})
(lib.mkIf cfg.desktop { (lib.mkIf cfg.desktop {
module = { module = {
keyd.enable = true; keyd.enable = true;
sway.enable = true; sway.enable = true;
kernel = { kernel = {
enable = true; enable = true;
latest = true; latest = true;
}; };
package = { package = {
common = true; common = true;
core = true; core = true;
desktop = true; desktop = true;
}; };
}; };
}) })
(lib.mkIf cfg.disown { (lib.mkIf cfg.disown {
module = { module = {
autoupdate.enable = true; autoupdate.enable = true;
kernel = { kernel = {
enable = true; enable = true;
hardening = true; hardening = true;
}; };
}; };
}) })
(lib.mkIf cfg.gaming { (lib.mkIf cfg.gaming { module.package.gaming = true; })
module.package.gaming = true;
})
(lib.mkIf cfg.laptop { (lib.mkIf cfg.laptop {
services.tlp.enable = true; # Automatic powersaving based on Pluged/AC states. services.tlp.enable = true; # Automatic powersaving based on Pluged/AC states.
services.upower.enable = true; services.upower.enable = true;
module = { module = {
keyd.enable = true; keyd.enable = true;
sway.enable = true; sway.enable = true;
kernel = { kernel = {
enable = true; enable = true;
hardening = true; hardening = true;
latest = true; latest = true;
}; };
package = { package = {
common = true; common = true;
core = true; core = true;
desktop = true; desktop = true;
}; };
}; };
}) })
(lib.mkIf cfg.live { (lib.mkIf cfg.live {
module = { module = {
keyd.enable = true; keyd.enable = true;
sway.enable = true; sway.enable = true;
kernel.enable = true; kernel.enable = true;
package = { package = {
common = true; common = true;
core = true; core = true;
creative = true; creative = true;
desktop = true; desktop = true;
dev = true; dev = true;
extra = true; extra = true;
gaming = true; gaming = true;
}; };
}; };
}) })
(lib.mkIf cfg.phone { (lib.mkIf cfg.phone { })
})
(lib.mkIf cfg.router { (lib.mkIf cfg.router {
module = { module = {
kernel = { kernel = {
enable = true; enable = true;
hardening = true; hardening = true;
}; };
package = { package = {
common = true; common = true;
core = true; core = true;
}; };
}; };
# De-harden some stuff. # De-harden some stuff.
boot.kernel.sysctl = { boot.kernel.sysctl = {
# Allow spoofing. # Allow spoofing.
"net.ipv4.conf.all.rp_filter" = lib.mkForce 0; "net.ipv4.conf.all.rp_filter" = lib.mkForce 0;
"net.ipv4.conf.default.rp_filter" = lib.mkForce 0; "net.ipv4.conf.default.rp_filter" = lib.mkForce 0;
# Forward packets. # Forward packets.
"net.ipv4.ip_forward" = lib.mkForce 1; "net.ipv4.ip_forward" = lib.mkForce 1;
"net.ipv6.conf.all.forwarding" = lib.mkForce 1; "net.ipv6.conf.all.forwarding" = lib.mkForce 1;
"net.ipv4.conf.all.src_valid_mark" = lib.mkForce 1; "net.ipv4.conf.all.src_valid_mark" = lib.mkForce 1;
# Allow redirects. # Allow redirects.
"net.ipv4.conf.all.accept_redirects" = lib.mkForce 1; "net.ipv4.conf.all.accept_redirects" = lib.mkForce 1;
"net.ipv6.conf.all.accept_redirects" = lib.mkForce 1; "net.ipv6.conf.all.accept_redirects" = lib.mkForce 1;
# Send ICMP. # Send ICMP.
"net.ipv4.conf.all.send_redirects" = lib.mkForce 1; "net.ipv4.conf.all.send_redirects" = lib.mkForce 1;
# Accept IP source route packets. # Accept IP source route packets.
"net.ipv4.conf.all.accept_source_route" = lib.mkForce 1; "net.ipv4.conf.all.accept_source_route" = lib.mkForce 1;
"net.ipv6.conf.all.accept_source_route" = lib.mkForce 1; "net.ipv6.conf.all.accept_source_route" = lib.mkForce 1;
}; };
}) })
(lib.mkIf cfg.server { (lib.mkIf cfg.server {
module = { module = {
kernel = { kernel = {
enable = true; enable = true;
hardening = true; hardening = true;
}; };
package = { package = {
common = true; common = true;
core = true; core = true;
}; };
}; };
}) })
(lib.mkIf cfg.work { (lib.mkIf cfg.work {
module = { module = {
distrobox.enable = true; distrobox.enable = true;
ollama.enable = true; ollama.enable = true;
package.dev = true; package.dev = true;
virtmanager.enable = true; virtmanager.enable = true;
docker = { docker = {
enable = true; enable = true;
autostart = false; autostart = false;
rootless = false; rootless = false;
}; };
kernel = { kernel = {
enable = true; enable = true;
hardening = true; hardening = true;
}; };
}; };
}) })
]; ];
} }

View file

@ -1,106 +1,96 @@
{ {
config, config,
lib, lib,
pkgs, pkgs,
secret, secret,
... ...
}: let }:
cfg = config.module.builder; let
serverKeyPath = "/root/.nixbuilder"; cfg = config.module.builder;
serverSshPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFqr7zKGOy/2bbAQCD85Ol+NoGGtvdMbSy3jGb98jM+f"; # Use ssh-keyscan. serverKeyPath = "/root/.nixbuilder";
in { serverSshPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFqr7zKGOy/2bbAQCD85Ol+NoGGtvdMbSy3jGb98jM+f"; # Use ssh-keyscan.
config = lib.mkMerge [ in
(lib.mkIf cfg.server.enable { {
# Service that generates new key on boot if not present. config = lib.mkMerge [
# Don't forget to add new public key to secret.ssh.buildKeys. (lib.mkIf cfg.server.enable {
systemd.services.generate-nix-cache-key = { # Service that generates new key on boot if not present.
wantedBy = [ # Don't forget to add new public key to secret.ssh.buildKeys.
"multi-user.target" systemd.services.generate-nix-cache-key = {
]; wantedBy = [ "multi-user.target" ];
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
}; };
path = [ path = [ pkgs.nix ];
pkgs.nix script = ''
]; [[ -f "${serverKeyPath}/private-key" ]] && exit
script = '' mkdir ${serverKeyPath} || true
[[ -f "${serverKeyPath}/private-key" ]] && exit nix-store --generate-binary-cache-key "nixbuilder-1" "${serverKeyPath}/private-key" "${serverKeyPath}/public-key"
mkdir ${serverKeyPath} || true nix store sign --all -k "${serverKeyPath}/private-key"
nix-store --generate-binary-cache-key "nixbuilder-1" "${serverKeyPath}/private-key" "${serverKeyPath}/public-key" '';
nix store sign --all -k "${serverKeyPath}/private-key" };
'';
};
# Add `nixbuilder` restricted user. # Add `nixbuilder` restricted user.
users.groups.nixbuilder = { }; users.groups.nixbuilder = { };
users.users.nixbuilder = { users.users.nixbuilder = {
createHome = lib.mkForce false; createHome = lib.mkForce false;
description = "Nix Remote Builder"; description = "Nix Remote Builder";
group = "nixbuilder"; group = "nixbuilder";
home = "/"; home = "/";
isNormalUser = true; isNormalUser = true;
openssh.authorizedKeys.keys = secret.ssh.buildKeys; openssh.authorizedKeys.keys = secret.ssh.buildKeys;
uid = 1234; uid = 1234;
}; };
# Sign store automatically. # Sign store automatically.
# Sign existing store with: nix store sign --all -k /path/to/secret-key-file # Sign existing store with: nix store sign --all -k /path/to/secret-key-file
nix.settings = { nix.settings = {
trusted-users = [ trusted-users = [ "nixbuilder" ];
"nixbuilder" secret-key-files = [ "${serverKeyPath}/private-key" ];
]; };
secret-key-files = [ })
"${serverKeyPath}/private-key"
];
};
})
(lib.mkIf cfg.client.enable { (lib.mkIf cfg.client.enable {
# NOTE: Requires host public key to be present in secret.ssh.builderKeys. # NOTE: Requires host public key to be present in secret.ssh.builderKeys.
nix = { nix = {
distributedBuilds = true; distributedBuilds = true;
buildMachines = [{ buildMachines = [
hostName = "nixbuilder"; {
maxJobs = 16; hostName = "nixbuilder";
protocol = "ssh-ng"; maxJobs = 16;
speedFactor = 2; protocol = "ssh-ng";
mandatoryFeatures = [ ]; speedFactor = 2;
systems = [ mandatoryFeatures = [ ];
"aarch64-linux" systems = [
"i686-linux" "aarch64-linux"
"x86_64-linux" "i686-linux"
]; "x86_64-linux"
supportedFeatures = [ ];
"benchmark" supportedFeatures = [
"big-parallel" "benchmark"
"kvm" "big-parallel"
"nixos-test" "kvm"
]; "nixos-test"
}]; ];
settings = let }
substituters = [ ];
"ssh-ng://nixbuilder" settings =
]; let
in { substituters = [ "ssh-ng://nixbuilder" ];
builders-use-substitutes = true; in
max-jobs = 0; {
substituters = lib.mkForce substituters; builders-use-substitutes = true;
trusted-substituters = substituters ++ [ max-jobs = 0;
"https://cache.nixos.org/" substituters = lib.mkForce substituters;
]; trusted-substituters = substituters ++ [ "https://cache.nixos.org/" ];
trusted-public-keys = [ trusted-public-keys = [ secret.ssh.builderKey ];
secret.ssh.builderKey # require-sigs = false;
]; # substitute = false;
# require-sigs = false; };
# substitute = false; };
}; services.openssh.knownHosts.nixbuilder = {
}; publicKey = serverSshPublicKey;
services.openssh.knownHosts.nixbuilder = { extraHostNames = [ "[10.0.0.1]:22143" ];
publicKey = serverSshPublicKey; };
extraHostNames = [ })
"[10.0.0.1]:22143" ];
];
};
})
];
} }

View file

@ -1,20 +1,18 @@
{ config, lib, ... }:
let
cfg = config.module.sound;
in
{ {
config, config = lib.mkIf cfg.enable {
lib, hardware.pulseaudio.enable = false;
... security.rtkit.enable = true;
}: let services.pipewire = {
cfg = config.module.sound; enable = true;
in { pulse.enable = true;
config = lib.mkIf cfg.enable { alsa = {
hardware.pulseaudio.enable = false; enable = true;
security.rtkit.enable = true; support32Bit = true;
services.pipewire = { };
enable = true; };
pulse.enable = true; };
alsa = {
enable = true;
support32Bit = true;
};
};
};
} }

View file

@ -1,31 +1,31 @@
{ {
config, config,
lib, lib,
pkgs, pkgs,
... ...
}: let }:
cfg = config.module.sway; let
in { cfg = config.module.sway;
config = lib.mkIf cfg.enable { in
services.gnome.gnome-keyring.enable = lib.mkForce false; {
environment.variables.XDG_CURRENT_DESKTOP = "sway"; config = lib.mkIf cfg.enable {
module = { services.gnome.gnome-keyring.enable = lib.mkForce false;
bluetooth.enable = true; environment.variables.XDG_CURRENT_DESKTOP = "sway";
brightness.enable = true; module = {
portal.enable = true; bluetooth.enable = true;
sound.enable = true; brightness.enable = true;
waybar.enable = true; portal.enable = true;
wayland.enable = true; sound.enable = true;
}; waybar.enable = true;
programs.sway = { wayland.enable = true;
enable = true; };
wrapperFeatures = { programs.sway = {
base = true; enable = true;
gtk = true; extraPackages = with pkgs; [ swaykbdd ];
}; wrapperFeatures = {
extraPackages = with pkgs; [ base = true;
swaykbdd gtk = true;
]; };
}; };
}; };
} }

View file

@ -1,84 +1,110 @@
{ {
config, config,
lib, lib,
pkgs, pkgs,
util, ...
... }:
}: let let
cfg = config.module.syncthing; cfg = config.module.syncthing;
in { in
config = lib.mkIf cfg.enable { {
# CLI tools. config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [ syncthing ]; # CLI tools.
environment.systemPackages = with pkgs; [ syncthing ];
# Access at sync.lan. # Access at sync.lan.
networking.hosts = { "127.0.0.1" = [ "sync.local" ]; }; networking.hosts = {
services.nginx.enable = true; "127.0.0.1" = [ "sync.local" ];
services.nginx.virtualHosts."sync.local".extraConfig = util.trimTabs '' };
location / { services.nginx.enable = true;
allow 127.0.0.1; services.nginx.virtualHosts."sync.local".extraConfig = ''
deny all; location / {
proxy_pass http://127.0.0.1:8384; allow 127.0.0.1;
} deny all;
''; proxy_pass http://127.0.0.1:8384;
}
'';
services.syncthing = { services.syncthing = {
inherit (cfg) enable dataDir user group; inherit (cfg)
openDefaultPorts = false; enable
systemService = true; dataDir
settings = let user
myDevices = { group
"desktop" = { id = "767Z675-SOCY4FL-JNYEBB6-5E2RG5O-XTZR6OP-BGOBZ7G-XVRLMD6-DQEB2AT"; }; ;
"home" = { id = "L5A5IPE-2FPJPHP-RJRV2PV-BLMLC3F-QPHSCUQ-4U3NM2I-AFPOE2A-HOPQZQF"; }; openDefaultPorts = false;
"max" = { id = "3E3N4G4-SZ7LQXE-WQQZX7N-KFXEQKM-7VVN6QP-OMB5356-ICNXUZY-TTLEKAR"; }; systemService = true;
"phone" = { id = "6RO5JXW-2XO4S3E-VCDAHPD-4ADK6LL-HQGMZHU-GD6DE2O-6KNHWXJ-BCSBGQ7"; }; settings =
"work" = { id = "CMG6QMP-WCJJEUG-UQ3KDUI-AHRADRH-666JQ3Z-HYFEPDA-URMAMNP-Z4MSGQT"; }; let
}; myDevices = {
dashaDevices = { "desktop" = {
"dasha" = { id = "VNRA5VH-LWNPVV4-Y2RF7FJ-446FHRQ-PET7Q4R-D3H5RT3-AUNARH5-5XYB3AT"; }; id = "767Z675-SOCY4FL-JNYEBB6-5E2RG5O-XTZR6OP-BGOBZ7G-XVRLMD6-DQEB2AT";
"dashaphone" = { id = "QKGXSZC-HGAA6S5-RJJAT5Z-UPUGDAA-3GXEO6C-WHKMBUD-ESKQPZE-TZFNYA6"; }; };
}; "home" = {
in lib.recursiveUpdate cfg.settings { id = "L5A5IPE-2FPJPHP-RJRV2PV-BLMLC3F-QPHSCUQ-4U3NM2I-AFPOE2A-HOPQZQF";
devices = myDevices // dashaDevices; };
folders = let "max" = {
allMyDevices = lib.mapAttrsToList (n: v: n) myDevices; id = "3E3N4G4-SZ7LQXE-WQQZX7N-KFXEQKM-7VVN6QP-OMB5356-ICNXUZY-TTLEKAR";
allDashaDevices = lib.mapAttrsToList (n: v: n) dashaDevices; };
in lib.filterAttrs (n: v: builtins.elem config.networking.hostName v.devices) { "phone" = {
"save" = { id = "6RO5JXW-2XO4S3E-VCDAHPD-4ADK6LL-HQGMZHU-GD6DE2O-6KNHWXJ-BCSBGQ7";
path = "${cfg.dataDir}/save"; };
devices = [ "work" = {
"desktop" id = "CMG6QMP-WCJJEUG-UQ3KDUI-AHRADRH-666JQ3Z-HYFEPDA-URMAMNP-Z4MSGQT";
"home" };
"max" };
"work" dashaDevices = {
]; "dasha" = {
}; id = "VNRA5VH-LWNPVV4-Y2RF7FJ-446FHRQ-PET7Q4R-D3H5RT3-AUNARH5-5XYB3AT";
"photo" = { };
path = "${cfg.dataDir}/photo"; "dashaphone" = {
devices = [ id = "QKGXSZC-HGAA6S5-RJJAT5Z-UPUGDAA-3GXEO6C-WHKMBUD-ESKQPZE-TZFNYA6";
"dashaphone" };
"home" };
"phone" in
]; lib.recursiveUpdate cfg.settings {
}; devices = myDevices // dashaDevices;
"tmp" = { folders =
path = "${cfg.dataDir}/tmp"; let
devices = allMyDevices; allMyDevices = lib.mapAttrsToList (n: v: n) myDevices;
}; allDashaDevices = lib.mapAttrsToList (n: v: n) dashaDevices;
"document" = { in
path = "${cfg.dataDir}/document"; lib.filterAttrs (n: v: builtins.elem config.networking.hostName v.devices) {
devices = allMyDevices; "save" = {
}; path = "${cfg.dataDir}/save";
"dima" = { devices = [
path = "${cfg.dataDir}/dima"; "desktop"
devices = allMyDevices ++ allDashaDevices; "home"
}; "max"
"dasha" = { "work"
path = "${cfg.dataDir}/dasha"; ];
devices = allDashaDevices; };
}; "photo" = {
}; path = "${cfg.dataDir}/photo";
}; devices = [
}; "dashaphone"
}; "home"
"phone"
];
};
"tmp" = {
path = "${cfg.dataDir}/tmp";
devices = allMyDevices;
};
"document" = {
path = "${cfg.dataDir}/document";
devices = allMyDevices;
};
"dima" = {
path = "${cfg.dataDir}/dima";
devices = allMyDevices ++ allDashaDevices;
};
"dasha" = {
path = "${cfg.dataDir}/dasha";
devices = allDashaDevices;
};
};
};
};
};
} }

View file

@ -1,14 +1,10 @@
{ lib, config, ... }:
let
cfg = config.module.tablet;
in
{ {
lib, config = lib.mkIf cfg.enable {
config, hardware.opentabletdriver.enable = true;
... systemd.user.services.opentabletdriver.wantedBy = [ "default.target" ];
}: let };
cfg = config.module.tablet;
in {
config = lib.mkIf cfg.enable {
hardware.opentabletdriver.enable = true;
systemd.user.services.opentabletdriver.wantedBy = [
"default.target"
];
};
} }

View file

@ -1,20 +1,22 @@
{ {
config, config,
lib, lib,
pkgs, pkgs,
... ...
}: let }:
cfg = config.module.virtmanager; let
in { cfg = config.module.virtmanager;
config = lib.mkIf cfg.enable { in
virtualisation.libvirtd.enable = true; {
programs.virt-manager.enable = true; config = lib.mkIf cfg.enable {
virtualisation.libvirtd.enable = true;
programs.virt-manager.enable = true;
# HACK: Fixes bug: https://www.reddit.com/r/NixOS/comments/1afbjiu/i_get_a_nonetype_error_when_trying_to_launch_a_vm/ # HACK: Fixes bug: https://www.reddit.com/r/NixOS/comments/1afbjiu/i_get_a_nonetype_error_when_trying_to_launch_a_vm/
# May also need to run: `gsettings set org.gnome.desktop.interface cursor-theme "Adwaita"` # May also need to run: `gsettings set org.gnome.desktop.interface cursor-theme "Adwaita"`
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
# glib # glib
adwaita-icon-theme # default gnome cursors, adwaita-icon-theme # default gnome cursors,
]; ];
}; };
} }

View file

@ -1,14 +1,12 @@
{ {
config, config,
lib, lib,
pkgs, pkgs,
... ...
}: let }:
cfg = config.module.waybar; let
in { cfg = config.module.waybar;
config = lib.mkIf cfg.enable { in
environment.systemPackages = with pkgs; [ {
waybar config = lib.mkIf cfg.enable { environment.systemPackages = with pkgs; [ waybar ]; };
];
};
} }

View file

@ -1,28 +1,26 @@
{ config, pkgs, ... }:
let
cfg = config.module.wayland;
in
{ {
config, config = {
pkgs, programs.xwayland.enable = true;
... environment = {
}: let systemPackages = with pkgs; [
cfg = config.module.wayland; wl-clipboard # CLI clipboard support.
in { ];
config = { variables = {
programs.xwayland.enable = true; # Compatibility variables.
environment = { ECORE_EVAS_ENGINE = "wayland_egl";
systemPackages = with pkgs; [ ELM_ENGINE = "wayland_egl";
wl-clipboard # CLI clipboard support. GDK_BACKEND = "wayland";
]; MOZ_ENABLE_WAYLAND = "1";
variables = { QT_QPA_PLATFORM = "wayland-egl;wayland;xcb";
# Compatibility variables. QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
ECORE_EVAS_ENGINE = "wayland_egl"; SAL_USE_VCLPLUGIN = "gtk3";
ELM_ENGINE = "wayland_egl"; SDL_VIDEODRIVER = "wayland"; # NOTE: Can cause issues with games.
GDK_BACKEND = "wayland"; _JAVA_AWT_WM_NONREPARENTING = "1";
MOZ_ENABLE_WAYLAND = "1"; };
QT_QPA_PLATFORM = "wayland-egl;wayland;xcb"; };
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; };
SAL_USE_VCLPLUGIN = "gtk3";
SDL_VIDEODRIVER = "wayland"; # NOTE: Can cause issues with games.
_JAVA_AWT_WM_NONREPARENTING = "1";
};
};
};
} }

398
flake.nix
View file

@ -1,177 +1,267 @@
{ {
inputs = { inputs = {
# SOURCE: https://github.com/NixOS/nixpkgs # SOURCE: https://github.com/NixOS/nixpkgs
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11"; nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
nixpkgsUnstable.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgsUnstable.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgsMaster.url = "github:nixos/nixpkgs/master"; nixpkgsMaster.url = "github:nixos/nixpkgs/master";
# SOURCE: https://github.com/nix-community/home-manager # SOURCE: https://github.com/nix-community/home-manager
home-manager = { home-manager = {
url = "github:nix-community/home-manager/release-24.11"; url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
# SOURCE: https://github.com/nix-community/nix-on-droid # SOURCE: https://github.com/nix-community/nix-on-droid
nix-on-droid = { nix-on-droid = {
url = "github:t184256/nix-on-droid/release-24.05"; url = "github:t184256/nix-on-droid/release-24.05";
inputs = { inputs = {
home-manager.follows = "home-manager"; home-manager.follows = "home-manager";
nixpkgs.follows = "nixpkgs"; nixpkgs.follows = "nixpkgs";
}; };
}; };
# SOURCE: https://github.com/LilleAila/nix-cursors # SOURCE: https://github.com/LilleAila/nix-cursors
nix-cursors = { nix-cursors = {
url = "github:LilleAila/nix-cursors"; url = "github:LilleAila/nix-cursors";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
# SOURCE: https://github.com/danth/stylix # SOURCE: https://github.com/danth/stylix
stylix = { stylix = {
url = "github:danth/stylix/release-24.05"; url = "github:danth/stylix/release-24.05";
inputs = { inputs = {
home-manager.follows = "home-manager"; home-manager.follows = "home-manager";
nixpkgs.follows = "nixpkgs"; nixpkgs.follows = "nixpkgs";
}; };
}; };
nixpkgsJobber.url = "github:nixos/nixpkgs/051f920625ab5aabe37c920346e3e69d7d34400e"; nixpkgsJobber.url = "github:nixos/nixpkgs/051f920625ab5aabe37c920346e3e69d7d34400e";
poetry2nixJobber.url = "github:nix-community/poetry2nix/304f8235fb0729fd48567af34fcd1b58d18f9b95"; poetry2nixJobber.url = "github:nix-community/poetry2nix/304f8235fb0729fd48567af34fcd1b58d18f9b95";
nvimAlign = { flake = false; url = "github:echasnovski/mini.align"; }; nvimAlign = {
nvimAutoclose = { flake = false; url = "github:m4xshen/autoclose.nvim"; }; flake = false;
nvimBufferline = { flake = false; url = "github:akinsho/bufferline.nvim"; }; url = "github:echasnovski/mini.align";
nvimCloseBuffers = { flake = false; url = "github:kazhala/close-buffers.nvim"; }; };
nvimColorizer = { flake = false; url = "github:brenoprata10/nvim-highlight-colors"; }; nvimAutoclose = {
nvimDevicons = { flake = false; url = "github:nvim-tree/nvim-web-devicons"; }; flake = false;
nvimDressing = { flake = false; url = "github:stevearc/dressing.nvim"; }; url = "github:m4xshen/autoclose.nvim";
nvimGen = { flake = false; url = "github:David-Kunz/gen.nvim"; }; };
nvimGitsigns = { flake = false; url = "github:lewis6991/gitsigns.nvim"; }; nvimBufferline = {
nvimGruvboxMaterial = { flake = false; url = "github:sainnhe/gruvbox-material"; }; flake = false;
nvimIndentoMatic = { flake = false; url = "github:Darazaki/indent-o-matic"; }; url = "github:akinsho/bufferline.nvim";
nvimLspconfig = { flake = false; url = "github:neovim/nvim-lspconfig"; }; };
nvimPlenary = { flake = false; url = "github:nvim-lua/plenary.nvim"; }; nvimCloseBuffers = {
nvimTelescope = { flake = false; url = "github:nvim-telescope/telescope.nvim"; }; flake = false;
nvimTodo = { flake = false; url = "github:folke/todo-comments.nvim"; }; url = "github:kazhala/close-buffers.nvim";
nvimTree = { flake = false; url = "github:nvim-tree/nvim-tree.lua"; }; };
nvimTreesitter = { flake = false; url = "github:nvim-treesitter/nvim-treesitter"; }; nvimColorizer = {
nvimTrouble = { flake = false; url = "github:folke/trouble.nvim"; }; flake = false;
}; url = "github:brenoprata10/nvim-highlight-colors";
};
nvimDevicons = {
flake = false;
url = "github:nvim-tree/nvim-web-devicons";
};
nvimDressing = {
flake = false;
url = "github:stevearc/dressing.nvim";
};
nvimGen = {
flake = false;
url = "github:David-Kunz/gen.nvim";
};
nvimGitsigns = {
flake = false;
url = "github:lewis6991/gitsigns.nvim";
};
nvimGruvboxMaterial = {
flake = false;
url = "github:sainnhe/gruvbox-material";
};
nvimIndentoMatic = {
flake = false;
url = "github:Darazaki/indent-o-matic";
};
nvimLspconfig = {
flake = false;
url = "github:neovim/nvim-lspconfig";
};
nvimPlenary = {
flake = false;
url = "github:nvim-lua/plenary.nvim";
};
nvimTelescope = {
flake = false;
url = "github:nvim-telescope/telescope.nvim";
};
nvimTodo = {
flake = false;
url = "github:folke/todo-comments.nvim";
};
nvimTree = {
flake = false;
url = "github:nvim-tree/nvim-tree.lua";
};
nvimTreesitter = {
flake = false;
url = "github:nvim-treesitter/nvim-treesitter";
};
nvimTrouble = {
flake = false;
url = "github:folke/trouble.nvim";
};
};
outputs = { outputs =
home-manager, {
nix-on-droid, home-manager,
nixpkgs, nix-on-droid,
nixpkgsJobber, nixpkgs,
nixpkgsMaster, nixpkgsJobber,
nixpkgsUnstable, nixpkgsMaster,
poetry2nixJobber, nixpkgsUnstable,
self, poetry2nixJobber,
stylix, self,
... stylix,
} @inputs: let ...
lib = nixpkgs.lib; }@inputs:
let
lib = nixpkgs.lib;
const = { const = {
droidStateVersion = "24.05"; droidStateVersion = "24.05";
stateVersion = "24.11"; stateVersion = "24.11";
timeZone = "Europe/Moscow"; timeZone = "Europe/Moscow";
url = "https://git.voronind.com/voronind/nix.git"; url = "https://git.voronind.com/voronind/nix.git";
}; };
__findFile = _: p: ./${p}; __findFile = _: p: ./${p};
ls = path: map (f: "${path}/${f}") ( ls =
builtins.filter (i: builtins.readFileType "${path}/${i}" == "regular") ( path:
builtins.attrNames (builtins.readDir path) map (f: "${path}/${f}") (
) builtins.filter (i: builtins.readFileType "${path}/${i}" == "regular") (
); builtins.attrNames (builtins.readDir path)
in { )
devShells = let );
pkgs = nixpkgs.legacyPackages.${system}; in
system = "x86_64-linux"; {
in { devShells =
${system}.default = pkgs.mkShell { let
nativeBuildInputs = with pkgs; [ pkgs = nixpkgs.legacyPackages.${system};
nixd system = "x86_64-linux";
]; in
# buildInputs = with pkgs; [ ]; {
${system}.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
nixd
nixfmt-rfc-style
treefmt
];
# buildInputs = with pkgs; [ ];
# LD_LIBRARY_PATH = "${lib.makeLibraryPath buildInputs}"; # LD_LIBRARY_PATH = "${lib.makeLibraryPath buildInputs}";
# SOURCE_DATE_EPOCH = "${toString self.lastModified}"; # SOURCE_DATE_EPOCH = "${toString self.lastModified}";
}; };
}; };
nixosConfigurations = let nixosConfigurations =
mkHost = { system, hostname }: lib.nixosSystem { let
inherit system; mkHost =
modules = [ { system, hostname }:
# Make a device hostname match the one from this config. lib.nixosSystem {
{ networking.hostName = hostname; } inherit system;
modules =
[
# Make a device hostname match the one from this config.
{ networking.hostName = hostname; }
# Specify current release version. # Specify current release version.
{ system.stateVersion = const.stateVersion; } { system.stateVersion = const.stateVersion; }
# Add Home Manager module. # Add Home Manager module.
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
# Add Stylix module. # Add Stylix module.
stylix.nixosModules.stylix stylix.nixosModules.stylix
# HM config. # HM config.
./home/NixOs.nix ./home/NixOs.nix
] ]
++ (ls ./host/${system}/${hostname}) ++ (ls ./host/${system}/${hostname})
++ (ls ./option) ++ (ls ./option)
++ (ls ./config) ++ (ls ./config)
++ (ls ./overlay) ++ (ls ./overlay)
++ (ls ./system) ++ (ls ./system);
; specialArgs =
specialArgs = let let
util = import ./lib/Util.nix { inherit lib; }; util = import ./lib/Util.nix { inherit lib; };
in { in
inherit const __findFile inputs self poetry2nixJobber util; {
pkgsJobber = nixpkgsJobber.legacyPackages.${system}.pkgs; inherit
pkgsMaster = nixpkgsMaster.legacyPackages.${system}.pkgs; const
pkgsUnstable = nixpkgsUnstable.legacyPackages.${system}.pkgs; __findFile
secret = import ./secret { }; inputs
}; self
}; poetry2nixJobber
util
;
pkgsJobber = nixpkgsJobber.legacyPackages.${system}.pkgs;
pkgsMaster = nixpkgsMaster.legacyPackages.${system}.pkgs;
pkgsUnstable = nixpkgsUnstable.legacyPackages.${system}.pkgs;
secret = import ./secret { };
};
};
mkSystem = system: hostname: { "${hostname}" = mkHost { inherit system hostname; }; }; mkSystem = system: hostname: { "${hostname}" = mkHost { inherit system hostname; }; };
systems = builtins.attrNames (builtins.readDir ./host) |> map (system: { systems =
inherit system; builtins.attrNames (builtins.readDir ./host)
hosts = builtins.attrNames (builtins.readDir ./host/${system}); |> map (system: {
}); inherit system;
hosts = builtins.attrNames (builtins.readDir ./host/${system});
});
hosts = map (system: hosts =
map (host: { inherit host; inherit (system) system; }) system.hosts map (
) systems |> lib.foldl' (acc: h: acc ++ h) []; system:
map (host: {
inherit host;
inherit (system) system;
}) system.hosts
) systems
|> lib.foldl' (acc: h: acc ++ h) [ ];
configurations = map (cfg: mkSystem cfg.system cfg.host) hosts; configurations = map (cfg: mkSystem cfg.system cfg.host) hosts;
in in
lib.foldl' (result: cfg: result // cfg) {} configurations; lib.foldl' (result: cfg: result // cfg) { } configurations;
nixOnDroidConfigurations.default = let nixOnDroidConfigurations.default =
pkgs = nixpkgs.legacyPackages.${system}.pkgs; let
pkgsMaster = nixpkgsMaster.legacyPackages.${system}.pkgs; pkgs = nixpkgs.legacyPackages.${system}.pkgs;
pkgsUnstable = nixpkgsUnstable.legacyPackages.${system}.pkgs; pkgsMaster = nixpkgsMaster.legacyPackages.${system}.pkgs;
system = "aarch64-linux"; pkgsUnstable = nixpkgsUnstable.legacyPackages.${system}.pkgs;
in nix-on-droid.lib.nixOnDroidConfiguration { system = "aarch64-linux";
inherit pkgs; in
modules = [ nix-on-droid.lib.nixOnDroidConfiguration {
{ home.android.enable = true; } inherit pkgs;
{ home-manager.config.stylix.autoEnable = lib.mkForce false; } modules = [
./home/Android.nix { home.android.enable = true; }
] { home-manager.config.stylix.autoEnable = lib.mkForce false; }
++ (ls ./option) ./home/Android.nix
; ] ++ (ls ./option);
extraSpecialArgs = { extraSpecialArgs = {
inherit inputs self pkgsMaster pkgsUnstable const __findFile; inherit
secret = import ./secret { }; inputs
util = import ./lib/Util.nix { inherit lib; }; self
}; pkgsMaster
}; pkgsUnstable
}; const
__findFile
;
secret = import ./secret { };
util = import ./lib/Util.nix { inherit lib; };
};
};
};
} }

View file

@ -1,46 +1,44 @@
# This is a common user configuration. # This is a common user configuration.
{ {
__findFile, __findFile,
config, config,
const, const,
inputs, inputs,
lib, lib,
pkgs, pkgs,
pkgsMaster, pkgsMaster,
pkgsUnstable, pkgsUnstable,
self, self,
... ...
} @args: let }@args:
cfg = config.home.android; let
android = import ./android args; cfg = config.home.android;
env = import ./env args; android = import ./android args;
file = import ./file args; env = import ./env args;
package = import <package> args; file = import ./file args;
programs = import ./program args; package = import <package> args;
stylix = import <system/Stylix.nix> args; programs = import ./program args;
in { stylix = import <system/Stylix.nix> args;
options.home.android = { in
enable = lib.mkEnableOption "the Android HM config."; {
}; options.home.android = {
enable = lib.mkEnableOption "the Android HM config.";
};
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
environment.packages = package.core; environment.packages = package.core;
nix.extraOptions = "experimental-features = nix-command flakes"; nix.extraOptions = "experimental-features = nix-command flakes";
system.stateVersion = const.droidStateVersion; system.stateVersion = const.droidStateVersion;
time.timeZone = const.timeZone; time.timeZone = const.timeZone;
terminal = { terminal = { inherit (android) font colors; };
inherit (android) font colors; home-manager.config = stylix // {
}; programs = with programs; core;
home-manager.config = stylix // { imports = [ inputs.stylix.homeManagerModules.stylix ];
programs = with programs; core; home = {
imports = [ inherit (env) sessionVariables;
inputs.stylix.homeManagerModules.stylix inherit file;
]; stateVersion = const.droidStateVersion;
home = { };
inherit (env) sessionVariables; };
inherit file; };
stateVersion = const.droidStateVersion;
};
};
};
} }

View file

@ -1,49 +1,55 @@
# This is a common user configuration. # This is a common user configuration.
{ {
__findFile, __findFile,
config, config,
const, const,
lib, lib,
pkgs, pkgs,
util, util,
... ...
} @args: let }@args:
cfg = config.home.nixos; let
env = import ./env args; cfg = config.home.nixos;
file = import ./file args; env = import ./env args;
programs = import ./program args; file = import ./file args;
in { programs = import ./program args;
imports = (util.ls <user>); in
{
imports = (util.ls <user>);
options.home.nixos = { options.home.nixos = {
enable = lib.mkEnableOption "the NixOS user setup."; enable = lib.mkEnableOption "the NixOS user setup.";
users = lib.mkOption { users = lib.mkOption {
default = [ ]; default = [ ];
type = with lib.types; listOf attrs; type = with lib.types; listOf attrs;
}; };
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home-manager = { home-manager = {
backupFileExtension = "backup-" + pkgs.lib.readFile "${pkgs.runCommand "timestamp" { } "echo -n date '+%Y%m%d%H%M%S' > $out"}"; backupFileExtension =
users = builtins.foldl' (acc: user: "backup-"
acc // { + pkgs.lib.readFile "${pkgs.runCommand "timestamp" { } "echo -n date '+%Y%m%d%H%M%S' > $out"}";
${user.username} = { users = builtins.foldl' (
home = { acc: user:
inherit (const) stateVersion; acc
inherit (env) sessionVariables; // {
inherit (user) username homeDirectory; ${user.username} = {
inherit file; home = {
inherit (const) stateVersion;
inherit (env) sessionVariables;
inherit (user) username homeDirectory;
inherit file;
# ISSUE: https://github.com/nix-community/home-manager/issues/5589 # ISSUE: https://github.com/nix-community/home-manager/issues/5589
extraActivationPath = with pkgs; [ openssh ]; extraActivationPath = with pkgs; [ openssh ];
}; };
xdg = import ./xdg { inherit (user) homeDirectory; }; xdg = import ./xdg { inherit (user) homeDirectory; };
programs = with programs; core // desktop; programs = with programs; core // desktop;
dconf.settings = util.catSet (util.ls ./file/dconf) args; dconf.settings = util.catSet (util.ls ./file/dconf) args;
}; };
} }
) { } cfg.users; ) { } cfg.users;
}; };
}; };
} }

View file

@ -1,15 +1,14 @@
{ config, pkgs, ... }:
{ {
config, font = pkgs.runCommandNoCC "font" { } ''
pkgs, cp ${
... pkgs.nerdfonts.override { fonts = [ "Terminus" ]; }
}: { }/share/fonts/truetype/NerdFonts/TerminessNerdFontMono-Regular.ttf $out
font = pkgs.runCommandNoCC "font" { } '' '';
cp ${pkgs.nerdfonts.override { fonts = [ "Terminus" ]; }}/share/fonts/truetype/NerdFonts/TerminessNerdFontMono-Regular.ttf $out
'';
colors = with config.module.style.color; { colors = with config.module.style.color; {
background = "#${bg.dark}"; background = "#${bg.dark}";
cursor = "#${fg.light}"; cursor = "#${fg.light}";
foreground = "#${fg.light}"; foreground = "#${fg.light}";
}; };
} }

22
home/env/Variable.nix vendored
View file

@ -1,14 +1,12 @@
{ pkgs, ... }:
{ {
pkgs, EDITOR = "nvim"; # Default text editor.
... GTK_CSD = 0; # GTK apps compat.
}: { MANGOHUD = "1"; # Enable Mangohud by default.
EDITOR = "nvim"; # Default text editor. MANPAGER = "nvim +Man!"; # App to use for man pages.
GTK_CSD = 0; # GTK apps compat. MOZ_LEGACY_PROFILES = "1"; # Disable Firefox profile switching on rebuild.
MANGOHUD = "1"; # Enable Mangohud by default. NIXPKGS_ALLOW_UNFREE = "1"; # Allow unfree packages in shell.
MANPAGER = "nvim +Man!"; # App to use for man pages. NIX_CURRENT_SYSTEM = "${pkgs.stdenv.system}"; # Current system architecture.
MOZ_LEGACY_PROFILES = "1"; # Disable Firefox profile switching on rebuild. TERM = "xterm-256color"; # Terminal settings.
NIXPKGS_ALLOW_UNFREE = "1"; # Allow unfree packages in shell. WINEFSYNC = "1"; # Use fsync for Wine.
NIX_CURRENT_SYSTEM = "${pkgs.stdenv.system}"; # Current system architecture.
TERM = "xterm-256color"; # Terminal settings.
WINEFSYNC = "1"; # Use fsync for Wine.
} }

View file

@ -1,6 +1,4 @@
{ pkgs, ... }@args:
{ {
pkgs, sessionVariables = import ./Variable.nix args;
...
} @args: {
sessionVariables = import ./Variable.nix args;
} }

View file

@ -1,100 +1,101 @@
{ { pkgs, lib, ... }:
pkgs, let
lib, config = {
... background_update = true;
}: let base_10_sizes = true;
config = { check_temp = true;
background_update = true; clock_format = "%X";
base_10_sizes = true; color_theme = "/usr/share/btop/themes/gruvbox_material_dark.theme";
check_temp = true; cpu_bottom = false;
clock_format = "%X"; cpu_core_map = "";
color_theme = "/usr/share/btop/themes/gruvbox_material_dark.theme"; cpu_graph_lower = "total";
cpu_bottom = false; cpu_graph_upper = "total";
cpu_core_map = ""; cpu_invert_lower = true;
cpu_graph_lower = "total"; cpu_sensor = "Auto";
cpu_graph_upper = "total"; cpu_single_graph = false;
cpu_invert_lower = true; custom_cpu_name = "";
cpu_sensor = "Auto"; custom_gpu_name0 = "";
cpu_single_graph = false; custom_gpu_name1 = "";
custom_cpu_name = ""; custom_gpu_name2 = "";
custom_gpu_name0 = ""; custom_gpu_name3 = "";
custom_gpu_name1 = ""; custom_gpu_name4 = "";
custom_gpu_name2 = ""; custom_gpu_name5 = "";
custom_gpu_name3 = ""; disk_free_priv = false;
custom_gpu_name4 = ""; disks_filter = "exclude = /boot /boot/efi";
custom_gpu_name5 = ""; force_tty = false;
disk_free_priv = false; gpu_mirror_graph = true;
disks_filter = "exclude = /boot /boot/efi"; graph_symbol = "braille";
force_tty = false; graph_symbol_cpu = "default";
gpu_mirror_graph = true; graph_symbol_gpu = "default";
graph_symbol = "braille"; graph_symbol_mem = "default";
graph_symbol_cpu = "default"; graph_symbol_net = "default";
graph_symbol_gpu = "default"; graph_symbol_proc = "default";
graph_symbol_mem = "default"; io_graph_combined = false;
graph_symbol_net = "default"; io_graph_speeds = "";
graph_symbol_proc = "default"; io_mode = false;
io_graph_combined = false; log_level = "WARNING";
io_graph_speeds = ""; mem_below_net = false;
io_mode = false; mem_graphs = true;
log_level = "WARNING"; net_auto = true;
mem_below_net = false; net_download = 100;
mem_graphs = true; net_iface = "";
net_auto = true; net_sync = true;
net_download = 100; net_upload = 100;
net_iface = ""; nvml_measure_pcie_speeds = true;
net_sync = true; only_physical = true;
net_upload = 100; presets = "";
nvml_measure_pcie_speeds = true; proc_aggregate = true;
only_physical = true; proc_colors = true;
presets = ""; proc_cpu_graphs = true;
proc_aggregate = true; proc_filter_kernel = true;
proc_colors = true; proc_gradient = false;
proc_cpu_graphs = true; proc_info_smaps = false;
proc_filter_kernel = true; proc_left = true;
proc_gradient = false; proc_mem_bytes = true;
proc_info_smaps = false; proc_per_core = true;
proc_left = true; proc_reversed = false;
proc_mem_bytes = true; proc_sorting = "memory";
proc_per_core = true; proc_tree = false;
proc_reversed = false; rounded_corners = true;
proc_sorting = "memory"; selected_battery = "Auto";
proc_tree = false; show_battery = true;
rounded_corners = true; show_coretemp = true;
selected_battery = "Auto"; show_cpu_freq = true;
show_battery = true; show_disks = true;
show_coretemp = true; show_gpu_info = "Auto";
show_cpu_freq = true; show_io_stat = true;
show_disks = true; show_swap = true;
show_gpu_info = "Auto"; show_uptime = true;
show_io_stat = true; shown_boxes = "cpu mem net proc";
show_swap = true; swap_disk = false;
show_uptime = true; temp_scale = "celsius";
shown_boxes = "cpu mem net proc"; theme_background = false;
swap_disk = false; truecolor = true;
temp_scale = "celsius"; update_ms = 2000;
theme_background = false; use_fstab = true;
truecolor = true; vim_keys = true;
update_ms = 2000; zfs_arc_cached = true;
use_fstab = true; zfs_hide_datasets = false;
vim_keys = true; };
zfs_arc_cached = true;
zfs_hide_datasets = false;
};
mkOption = k: v: lib.generators.mkKeyValueDefault { } " = " k v; mkOption = k: v: lib.generators.mkKeyValueDefault { } " = " k v;
in { in
file = pkgs.writeText "BtopConfig" ( {
builtins.foldl' (acc: line: acc + "${line}\n") "" ( file = pkgs.writeText "BtopConfig" (
lib.mapAttrsToList (k: v: let builtins.foldl' (acc: line: acc + "${line}\n") "" (
value = if builtins.isString v then lib.mapAttrsToList (
"\"${v}\"" k: v:
else if builtins.isBool v then let
if v then "True" else "False" value =
else if builtins.isString v then
v "\"${v}\""
; else if builtins.isBool v then
in mkOption k value if v then "True" else "False"
) config else
) v;
); in
mkOption k value
) config
)
);
} }

View file

@ -1,98 +1,93 @@
{ pkgs, config, ... }:
{ {
pkgs, preferences = (pkgs.formats.json { }).generate "ChromiumConfig" {
config, name = "Work";
... bookmark_bar.show_on_all_tabs = false;
}: { browser.show_home_button = false;
preferences = (pkgs.formats.json { }).generate "ChromiumConfig" { default_apps_install_state = 2;
name = "Work"; download.prompt_for_download = false;
bookmark_bar.show_on_all_tabs = false; download_bubble.partial_view_enabled = false;
browser.show_home_button = false; intl.selected_languages = "en-US,en";
default_apps_install_state = 2; session.restore_on_startup = 1;
download.prompt_for_download = false; side_panel.is_right_aligned = false;
download_bubble.partial_view_enabled = false; default_search_provider = {
intl.selected_languages = "en-US,en"; guid = "5761b040-db50-4f8e-9d00-c9ad985779a4";
session.restore_on_startup = 1; synced_guid = "5761b040-db50-4f8e-9d00-c9ad985779a4";
side_panel.is_right_aligned = false; };
default_search_provider = { default_search_provider_data = {
guid = "5761b040-db50-4f8e-9d00-c9ad985779a4"; template_url_data = {
synced_guid = "5761b040-db50-4f8e-9d00-c9ad985779a4"; id = 11;
}; is_active = 1;
default_search_provider_data = { keyword = "s";
template_url_data = { short_name = "SearX";
id = 11; synced_guid = "5761b040-db50-4f8e-9d00-c9ad985779a4";
is_active = 1; url = "https://search.voronind.com/search?q={searchTerms}";
keyword = "s"; };
short_name = "SearX"; };
synced_guid = "5761b040-db50-4f8e-9d00-c9ad985779a4"; extensions = {
url = "https://search.voronind.com/search?q={searchTerms}"; alerts.initialized = false;
}; commands = {
}; "linux:Alt+Shift+L" = {
extensions = { command_name = "addSite";
alerts.initialized = false; extension = "eimadpbcbfnmbkopoojfekhnkhdbieeh";
commands = { global = false;
"linux:Alt+Shift+L" = { };
command_name = "addSite"; "linux:Alt+Shift+B" = {
extension = "eimadpbcbfnmbkopoojfekhnkhdbieeh"; command_name = "_execute_browser_action";
global = false; extension = "cgbcahbpdhpcegmbfconppldiemgcoii";
}; global = false;
"linux:Alt+Shift+B" = { };
command_name = "_execute_browser_action"; "linux:Alt+Shift+K" = {
extension = "cgbcahbpdhpcegmbfconppldiemgcoii"; command_name = "launch-element-zapper";
global = false; extension = "cgbcahbpdhpcegmbfconppldiemgcoii";
}; global = false;
"linux:Alt+Shift+K" = { };
command_name = "launch-element-zapper"; "linux:Alt+Shift+J" = {
extension = "cgbcahbpdhpcegmbfconppldiemgcoii"; command_name = "toggle-javascript";
global = false; extension = "cgbcahbpdhpcegmbfconppldiemgcoii";
}; global = false;
"linux:Alt+Shift+J" = { };
command_name = "toggle-javascript"; "linux:Alt+Shift+P" = {
extension = "cgbcahbpdhpcegmbfconppldiemgcoii"; command_name = "_execute_action";
global = false; extension = "gcknhkkoolaabfmlnjonogaaifnjlfnp";
}; global = false;
"linux:Alt+Shift+P" = { };
command_name = "_execute_action"; };
extension = "gcknhkkoolaabfmlnjonogaaifnjlfnp"; };
global = false; password_manager = {
}; autofillable_credentials_account_store_login_database = false;
}; autofillable_credentials_profile_store_login_database = false;
}; };
password_manager = { webkit = {
autofillable_credentials_account_store_login_database = false; webprefs = {
autofillable_credentials_profile_store_login_database = false; default_fixed_font_size = 14;
}; default_font_size = 17;
webkit = { minimum_font_size = 16;
webprefs = { fonts =
default_fixed_font_size = 14; let
default_font_size = 17; mono = config.module.style.font.monospace.name;
minimum_font_size = 16; sans = config.module.style.font.sansSerif.name;
fonts = let in
mono = config.module.style.font.monospace.name; {
sans = config.module.style.font.sansSerif.name; fixed.Zyyy = mono;
in { sansserif.Zyyy = sans;
fixed.Zyyy = mono; serif.Zyyy = sans;
sansserif.Zyyy = sans; standard.Zyyy = sans;
serif.Zyyy = sans; };
standard.Zyyy = sans; };
}; };
}; };
};
};
localState = (pkgs.formats.json { }).generate "ChromiumLocalState" { localState = (pkgs.formats.json { }).generate "ChromiumLocalState" {
browser = { browser = {
first_run_finished = true; first_run_finished = true;
enabled_labs_experiments = [ enabled_labs_experiments = [ "smooth-scrolling@2" ];
"smooth-scrolling@2" };
]; };
};
};
# REF: https://chromeenterprise.google/intl/en_us/policies/ # REF: https://chromeenterprise.google/intl/en_us/policies/
policy = (pkgs.formats.json { }).generate "ChromiumPolicy" { policy = (pkgs.formats.json { }).generate "ChromiumPolicy" {
DefaultBrowserSettingEnabled = false; DefaultBrowserSettingEnabled = false;
URLBlocklist = [ URLBlocklist = [ "darkreader.org" ];
"darkreader.org" };
];
};
} }

View file

@ -1,5 +1,6 @@
{ ... }: { { ... }:
"org/gnome/desktop/a11y" = { {
always-show-universal-access-status = true; "org/gnome/desktop/a11y" = {
}; always-show-universal-access-status = true;
};
} }

View file

@ -1,27 +1,28 @@
{ ... }: { { ... }:
"org/gtk/gtk4/settings/file-chooser" = { {
date-format = "regular"; "org/gtk/gtk4/settings/file-chooser" = {
location-mode = "path-bar"; date-format = "regular";
show-hidden = false; location-mode = "path-bar";
show-size-column = true; show-hidden = false;
show-type-column = true; show-size-column = true;
sidebar-width = "166"; show-type-column = true;
sort-column = "modified"; sidebar-width = "166";
sort-directories-first = true; sort-column = "modified";
sort-order = "descending"; sort-directories-first = true;
type-format = "category"; sort-order = "descending";
view-type = "list"; type-format = "category";
}; view-type = "list";
};
"org/gtk/settings/file-chooser" = { "org/gtk/settings/file-chooser" = {
date-format = "regular"; date-format = "regular";
location-mode = "path-bar"; location-mode = "path-bar";
show-hidden = false; show-hidden = false;
show-size-column = true; show-size-column = true;
show-type-column = true; show-type-column = true;
sort-column = "modified"; sort-column = "modified";
sort-directories-first = true; sort-directories-first = true;
sort-order = "descending"; sort-order = "descending";
type-format = "category"; type-format = "category";
}; };
} }

View file

@ -1,32 +1,36 @@
{ lib, config, ... }:
{ {
lib, "org/gnome/desktop/input-sources" =
config, with lib.gvariant;
... let
}: { sources = [
"org/gnome/desktop/input-sources" = with lib.gvariant; let (mkTuple [
sources = [ "xkb"
(mkTuple [ "xkb" "us" ]) "us"
(mkTuple [ "xkb" "ru" ]) ])
]; (mkTuple [
in { "xkb"
inherit sources; "ru"
current = mkUint32 0; ])
mru-sources = sources; ];
per-window = false; in
show-all-sources = true; {
xkb-options = [ inherit sources;
config.module.keyboard.options current = mkUint32 0;
]; mru-sources = sources;
}; per-window = false;
show-all-sources = true;
xkb-options = [ config.module.keyboard.options ];
};
"org/gnome/desktop/peripherals/mouse" = { "org/gnome/desktop/peripherals/mouse" = {
accel-profile = "flat"; accel-profile = "flat";
natural-scroll = true; natural-scroll = true;
speed = "0.0"; speed = "0.0";
}; };
"org/gnome/desktop/peripherals/touchpad" = { "org/gnome/desktop/peripherals/touchpad" = {
tap-to-click = true; tap-to-click = true;
two-finger-scrolling-enabled = true; two-finger-scrolling-enabled = true;
}; };
} }

View file

@ -1,12 +1,12 @@
{ ... }: { ... }:
{ {
"org/gnome/desktop/interface" = { "org/gnome/desktop/interface" = {
clock-show-date = true; clock-show-date = true;
clock-show-weekday = true; clock-show-weekday = true;
color-scheme = "prefer-dark"; color-scheme = "prefer-dark";
enable-animations = false; enable-animations = false;
enable-hot-corners = false; enable-hot-corners = false;
gtk-enable-primary-paste = false; gtk-enable-primary-paste = false;
show-battery-percentage = false; show-battery-percentage = false;
}; };
} }

View file

@ -1,132 +1,134 @@
{ ... }: let { ... }:
mod = "<Super>"; let
in { mod = "<Super>";
"org/gnome/desktop/wm/keybindings" = { in
activate-window-menu = [ "" ]; {
begin-move = [ "" ]; "org/gnome/desktop/wm/keybindings" = {
begin-resize = [ "${mod}r" ]; activate-window-menu = [ "" ];
close = [ "${mod}x" ]; begin-move = [ "" ];
cycle-group = [ "" ]; begin-resize = [ "${mod}r" ];
cycle-group-backward = [ "" ]; close = [ "${mod}x" ];
cycle-panels = [ "" ]; cycle-group = [ "" ];
cycle-panels-backward = [ "" ]; cycle-group-backward = [ "" ];
cycle-windows = [ "" ]; cycle-panels = [ "" ];
cycle-windows-backward = [ "" ]; cycle-panels-backward = [ "" ];
maximize = [ "" ]; cycle-windows = [ "" ];
maximize-horizontally = [ "" ]; cycle-windows-backward = [ "" ];
minimize = [ "${mod}s" ]; maximize = [ "" ];
move-to-monitor-down = [ "" ]; maximize-horizontally = [ "" ];
move-to-monitor-left = [ "" ]; minimize = [ "${mod}s" ];
move-to-monitor-right = [ "" ]; move-to-monitor-down = [ "" ];
move-to-monitor-up = [ "" ]; move-to-monitor-left = [ "" ];
move-to-workspace-1 = [ "" ]; move-to-monitor-right = [ "" ];
move-to-workspace-2 = [ "" ]; move-to-monitor-up = [ "" ];
move-to-workspace-3 = [ "" ]; move-to-workspace-1 = [ "" ];
move-to-workspace-4 = [ "" ]; move-to-workspace-2 = [ "" ];
move-to-workspace-last = [ "" ]; move-to-workspace-3 = [ "" ];
move-to-workspace-left = [ "<Shift>${mod}q" ]; move-to-workspace-4 = [ "" ];
move-to-workspace-right = [ "<Shift>${mod}e" ]; move-to-workspace-last = [ "" ];
panel-run-dialog = [ "${mod}space" ]; move-to-workspace-left = [ "<Shift>${mod}q" ];
show-desktop = [ "${mod}c" ]; move-to-workspace-right = [ "<Shift>${mod}e" ];
switch-applications = [ "${mod}Tab" ]; panel-run-dialog = [ "${mod}space" ];
switch-applications-backward = [ "<Shift>${mod}Tab" ]; show-desktop = [ "${mod}c" ];
switch-group = [ "<Alt>Tab" ]; switch-applications = [ "${mod}Tab" ];
switch-group-backward = [ "<Shift><Alt>Tab" ]; switch-applications-backward = [ "<Shift>${mod}Tab" ];
switch-input-source = [ "" ]; switch-group = [ "<Alt>Tab" ];
switch-input-source-backward = [ "" ]; switch-group-backward = [ "<Shift><Alt>Tab" ];
switch-panels = [ "" ]; switch-input-source = [ "" ];
switch-panels-backward = [ "" ]; switch-input-source-backward = [ "" ];
switch-to-workspace-1 = [ "" ]; switch-panels = [ "" ];
switch-to-workspace-2 = [ "" ]; switch-panels-backward = [ "" ];
switch-to-workspace-3 = [ "" ]; switch-to-workspace-1 = [ "" ];
switch-to-workspace-4 = [ "" ]; switch-to-workspace-2 = [ "" ];
switch-to-workspace-last = [ "" ]; switch-to-workspace-3 = [ "" ];
switch-to-workspace-left = [ "${mod}q" ]; switch-to-workspace-4 = [ "" ];
switch-to-workspace-right = [ "${mod}e" ]; switch-to-workspace-last = [ "" ];
switch-windows = [ "" ]; switch-to-workspace-left = [ "${mod}q" ];
switch-windows-backward = [ "" ]; switch-to-workspace-right = [ "${mod}e" ];
toggle-fullscreen = [ "${mod}f" ]; switch-windows = [ "" ];
toggle-maximized = [ "${mod}w" ]; switch-windows-backward = [ "" ];
unmaximize = [ "" ]; toggle-fullscreen = [ "${mod}f" ];
}; toggle-maximized = [ "${mod}w" ];
unmaximize = [ "" ];
};
"org/gnome/mutter/keybindings" = { "org/gnome/mutter/keybindings" = {
toggle-tiled-left = [ "${mod}a" ]; toggle-tiled-left = [ "${mod}a" ];
toggle-tiled-right = [ "${mod}d" ]; toggle-tiled-right = [ "${mod}d" ];
}; };
"org/gnome/mutter/wayland/keybindings" = { "org/gnome/mutter/wayland/keybindings" = {
restore-shortcuts = [ "" ]; restore-shortcuts = [ "" ];
}; };
"org/gnome/settings-daemon/plugins/media-keys" = { "org/gnome/settings-daemon/plugins/media-keys" = {
custom-keybindings = [ custom-keybindings = [
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/" "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/"
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/" "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/"
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/" "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/"
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom3/" "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom3/"
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom4/" "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom4/"
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom5/" "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom5/"
]; ];
magnifier = [ "" ]; magnifier = [ "" ];
magnifier-zoom-in = [ "" ]; magnifier-zoom-in = [ "" ];
magnifier-zoom-out = [ "" ]; magnifier-zoom-out = [ "" ];
screenreader = [ "" ]; screenreader = [ "" ];
screensaver = [ "${mod}z" ]; screensaver = [ "${mod}z" ];
}; };
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = { "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = {
binding = "${mod}Escape"; binding = "${mod}Escape";
command = "kgx -e bash -c 'tmux new-session -A -s main; bash'"; command = "kgx -e bash -c 'tmux new-session -A -s main; bash'";
name = "gnome-terminal"; name = "gnome-terminal";
}; };
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1" = { "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1" = {
binding = "printz"; binding = "printz";
command = "systemctl suspend -i"; command = "systemctl suspend -i";
name = "System Sleep"; name = "System Sleep";
}; };
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2" = { "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2" = {
binding = "printx"; binding = "printx";
command = "systemctl poweroff -i"; command = "systemctl poweroff -i";
name = "System Poweroff"; name = "System Poweroff";
}; };
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom3" = { "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom3" = {
binding = "printc"; binding = "printc";
command = "systemctl reboot -i"; command = "systemctl reboot -i";
name = "System Reboot"; name = "System Reboot";
}; };
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom4" = { "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom4" = {
binding = "printp"; binding = "printp";
command = "powersave toggle"; command = "powersave toggle";
name = "Toggle Powersave"; name = "Toggle Powersave";
}; };
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom5" = { "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom5" = {
binding = "printl"; binding = "printl";
command = "powerlimit toggle"; command = "powerlimit toggle";
name = "Toggle Powerlimit"; name = "Toggle Powerlimit";
}; };
"org/gnome/shell/keybindings" = { "org/gnome/shell/keybindings" = {
focus-active-notification = [ "" ]; focus-active-notification = [ "" ];
open-application-menu = [ "" ]; open-application-menu = [ "" ];
show-screenshot-ui = [ "${mod}v" ]; show-screenshot-ui = [ "${mod}v" ];
switch-to-application-1 = [ "" ]; switch-to-application-1 = [ "" ];
switch-to-application-2 = [ "" ]; switch-to-application-2 = [ "" ];
switch-to-application-3 = [ "" ]; switch-to-application-3 = [ "" ];
switch-to-application-4 = [ "" ]; switch-to-application-4 = [ "" ];
switch-to-application-5 = [ "" ]; switch-to-application-5 = [ "" ];
switch-to-application-6 = [ "" ]; switch-to-application-6 = [ "" ];
switch-to-application-7 = [ "" ]; switch-to-application-7 = [ "" ];
switch-to-application-8 = [ "" ]; switch-to-application-8 = [ "" ];
switch-to-application-9 = [ "" ]; switch-to-application-9 = [ "" ];
toggle-application-view = [ "" ]; toggle-application-view = [ "" ];
toggle-message-tray = [ "" ]; toggle-message-tray = [ "" ];
toggle-overview = [ "" ]; toggle-overview = [ "" ];
toggle-quick-settings = [ "" ]; toggle-quick-settings = [ "" ];
}; };
} }

View file

@ -1,7 +1,8 @@
{ ... }: { { ... }:
"org/gnome/desktop/media-handling" = { {
automount = false; "org/gnome/desktop/media-handling" = {
automount-open = false; automount = false;
autorun-never = true; automount-open = false;
}; autorun-never = true;
};
} }

View file

@ -1,21 +1,22 @@
{ ... }: { { ... }:
"org/gnome/nautilus/icon-view" = { {
default-zoom-level = "larger"; "org/gnome/nautilus/icon-view" = {
}; default-zoom-level = "larger";
};
"org/gnome/nautilus/list-view" = { "org/gnome/nautilus/list-view" = {
default-zoom-level = "small"; default-zoom-level = "small";
use-tree-view = false; use-tree-view = false;
}; };
"org/gnome/nautilus/preferences" = { "org/gnome/nautilus/preferences" = {
click-policy = "single"; click-policy = "single";
default-folder-viewer = "list-view"; default-folder-viewer = "list-view";
default-sort-in-reverse-order = false; default-sort-in-reverse-order = false;
default-sort-order = "name"; default-sort-order = "name";
migrated-gtk-settings = true; migrated-gtk-settings = true;
search-filter-time-type = "last_modified"; search-filter-time-type = "last_modified";
search-view = "list-view"; search-view = "list-view";
show-image-thumbnails = "local-only"; show-image-thumbnails = "local-only";
}; };
} }

View file

@ -1,10 +1,11 @@
{ ... }: { { ... }:
"org/gnome/settings-daemon/plugins/power" = { {
ambient-enabled = false; "org/gnome/settings-daemon/plugins/power" = {
idle-dim = false; ambient-enabled = false;
power-button-action = "nothing"; idle-dim = false;
sleep-inactive-ac-timeout = "0"; power-button-action = "nothing";
sleep-inactive-ac-type = "nothing"; sleep-inactive-ac-timeout = "0";
sleep-inactive-battery-type = "nothing"; sleep-inactive-ac-type = "nothing";
}; sleep-inactive-battery-type = "nothing";
};
} }

View file

@ -1,18 +1,16 @@
{ lib, ... }:
{ {
lib, "org/gnome/desktop/privacy" = with lib.gvariant; {
... disable-camera = false;
}: { disable-microphone = false;
"org/gnome/desktop/privacy" = with lib.gvariant; { old-files-age = mkUint32 30;
disable-camera = false; recent-files-max-age = mkUint32 30;
disable-microphone = false; remove-old-temp-files = true;
old-files-age = mkUint32 30; remove-old-trash-files = true;
recent-files-max-age = mkUint32 30; report-technical-problems = true;
remove-old-temp-files = true; };
remove-old-trash-files = true;
report-technical-problems = true;
};
"org/gnome/system/location" = { "org/gnome/system/location" = {
enabled = false; enabled = false;
}; };
} }

View file

@ -1,8 +1,6 @@
{ lib, ... }:
{ {
lib, "org/gnome/desktop/session" = with lib.gvariant; {
... idle-delay = mkUint32 0;
}: { };
"org/gnome/desktop/session" = with lib.gvariant; {
idle-delay = mkUint32 0;
};
} }

View file

@ -1,14 +1,15 @@
{ ... }: { { ... }:
"org/gnome/shell" = { {
disable-extension-version-validation = true; "org/gnome/shell" = {
disable-user-extensions = false; disable-extension-version-validation = true;
favorite-apps = [ "" ]; disable-user-extensions = false;
had-bluetooth-devices-setup = true; favorite-apps = [ "" ];
last-selected-power-profile = "power-saver"; had-bluetooth-devices-setup = true;
remember-mount-password = false; last-selected-power-profile = "power-saver";
}; remember-mount-password = false;
};
"system/proxy" = { "system/proxy" = {
mode = "none"; mode = "none";
}; };
} }

View file

@ -1,8 +1,9 @@
{ ... }: { { ... }:
"org/gnome/software" = { {
download-updates = false; "org/gnome/software" = {
download-updates-notify = false; download-updates = false;
first-run = false; download-updates-notify = false;
show-nonfree-prompt = false; first-run = false;
}; show-nonfree-prompt = false;
};
} }

View file

@ -1,7 +1,8 @@
{ ... }: { { ... }:
"org/gnome/desktop/sound" = { {
allow-volume-above-100-percent = false; "org/gnome/desktop/sound" = {
event-sounds = false; allow-volume-above-100-percent = false;
theme-name = "freedesktop"; event-sounds = false;
}; theme-name = "freedesktop";
};
} }

View file

@ -1,35 +1,33 @@
{ lib, ... }:
{ {
lib, "org/gnome/desktop/wm/preferences" = {
... action-middle-click-titlebar = "minimize";
}: { action-right-click-titlebar = "menu";
"org/gnome/desktop/wm/preferences" = { button-layout = "appmenu:close";
action-middle-click-titlebar = "minimize"; focus-mode = "click"; # `click` or `sloppy`.
action-right-click-titlebar = "menu"; };
button-layout = "appmenu:close";
focus-mode = "click"; # `click` or `sloppy`.
};
"org/gnome/mutter" = { "org/gnome/mutter" = {
attach-modal-dialogs = true; attach-modal-dialogs = true;
center-new-windows = true; center-new-windows = true;
dynamic-workspaces = true; dynamic-workspaces = true;
edge-tiling = true; edge-tiling = true;
workspaces-only-on-primary = true; workspaces-only-on-primary = true;
}; };
"org/gnome/settings-daemon/plugins/color" = with lib.gvariant; { "org/gnome/settings-daemon/plugins/color" = with lib.gvariant; {
night-light-enabled = false; night-light-enabled = false;
night-light-schedule-automatic = false; night-light-schedule-automatic = false;
night-light-schedule-from = "0.0"; night-light-schedule-from = "0.0";
night-light-schedule-to = "0.0"; night-light-schedule-to = "0.0";
night-light-temperature = mkUint32 3700; night-light-temperature = mkUint32 3700;
}; };
"org/gnome/shell/app-switcher" = { "org/gnome/shell/app-switcher" = {
current-workspace-only = true; current-workspace-only = true;
}; };
"org/gnome/shell/overrides" = { "org/gnome/shell/overrides" = {
edge-tiling = false; edge-tiling = false;
}; };
} }

View file

@ -1,57 +1,59 @@
{ {
config, config,
inputs, inputs,
self, self,
... ...
} @args: let }@args:
btop = import ./btop args; let
chromium = import ./chromium args; btop = import ./btop args;
editor = import ./editorconfig args; chromium = import ./chromium args;
foot = import ./foot args; editor = import ./editorconfig args;
fuzzel = import ./fuzzel args; foot = import ./foot args;
git = import ./git args; fuzzel = import ./fuzzel args;
jetbrains = import ./jetbrains args; git = import ./git args;
keyd = import ./keyd args; jetbrains = import ./jetbrains args;
mako = import ./mako args; keyd = import ./keyd args;
mangohud = import ./mangohud args; mako = import ./mako args;
nvim = import ./nvim args; mangohud = import ./mangohud args;
ssh = import ./ssh args; nvim = import ./nvim args;
swappy = import ./swappy args; ssh = import ./ssh args;
sway = import ./sway args; swappy = import ./swappy args;
tmux = import ./tmux args; sway = import ./sway args;
waybar = import ./waybar args; tmux = import ./tmux args;
yazi = import ./yazi args; waybar = import ./waybar args;
in { yazi = import ./yazi args;
".Wallpaper".source = config.module.wallpaper.path; in
".config/MangoHud/MangoHud.conf".source = mangohud.config; {
".config/MangoHud/presets.conf".source = mangohud.presets; ".Wallpaper".source = config.module.wallpaper.path;
".config/autostart".text = ""; ".config/MangoHud/MangoHud.conf".source = mangohud.config;
".config/btop/btop.conf".source = btop.file; ".config/MangoHud/presets.conf".source = mangohud.presets;
".config/chromium/Default/Preferences".source = chromium.preferences; ".config/autostart".text = "";
".config/chromium/Local State".source = chromium.localState; ".config/btop/btop.conf".source = btop.file;
".config/foot/foot.ini".source = foot.file; ".config/chromium/Default/Preferences".source = chromium.preferences;
".config/fuzzel/fuzzel.ini".source = fuzzel.file; ".config/chromium/Local State".source = chromium.localState;
".config/keyd/app.conf".text = keyd.text; ".config/foot/foot.ini".source = foot.file;
".config/mako/config".source = mako.file; ".config/fuzzel/fuzzel.ini".source = fuzzel.file;
".config/nvim/init.vim".text = nvim.text; ".config/keyd/app.conf".text = keyd.text;
".config/swappy/config".source = swappy.config; ".config/mako/config".source = mako.file;
".config/sway/config".text = sway.text; ".config/nvim/init.vim".text = nvim.text;
".config/tmux/tmux.conf".text = tmux.text; ".config/swappy/config".source = swappy.config;
".config/waybar/config".source = waybar.config; ".config/sway/config".text = sway.text;
".config/waybar/style.css".source = waybar.style; ".config/tmux/tmux.conf".text = tmux.text;
".config/yazi/init.lua".source = yazi.init; ".config/waybar/config".source = waybar.config;
".config/yazi/keymap.toml".source = yazi.keymap; ".config/waybar/style.css".source = waybar.style;
".config/yazi/theme.toml".source = yazi.theme; ".config/yazi/init.lua".source = yazi.init;
".config/yazi/yazi.toml".source = yazi.yazi; ".config/yazi/keymap.toml".source = yazi.keymap;
".editorconfig".source = editor.file; ".config/yazi/theme.toml".source = yazi.theme;
".gitconfig".source = git.file; ".config/yazi/yazi.toml".source = yazi.yazi;
".ideavimrc".text = jetbrains.ideavimrc; ".editorconfig".source = editor.file;
".nix".source = self; ".gitconfig".source = git.file;
".nixpkgs".source = inputs.nixpkgs; ".ideavimrc".text = jetbrains.ideavimrc;
".parallel/will-cite".text = ""; ".nix".source = self;
".ssh/config".text = ssh.text; ".nixpkgs".source = inputs.nixpkgs;
".template".source = ./template; ".parallel/will-cite".text = "";
# ".nixpkgs_master".source = inputs.nixpkgs; ".ssh/config".text = ssh.text;
# ".nixpkgs_unstable".source = inputs.nixpkgs; ".template".source = ./template;
# TODO: Add after migrating to stable. # ".nixpkgs_master".source = inputs.nixpkgs;
# ".nixpkgs_unstable".source = inputs.nixpkgs;
# TODO: Add after migrating to stable.
} }

View file

@ -1,29 +1,28 @@
{ pkgs, ... }:
{ {
pkgs, file = (pkgs.formats.iniWithGlobalSection { }).generate "EditorconfigConfig" {
... globalSection = {
}: { root = true;
file = (pkgs.formats.iniWithGlobalSection { }).generate "EditorconfigConfig" { };
globalSection = { sections = {
root = true; "*" = {
}; charset = "utf-8";
sections = { end_of_line = "lf";
"*" = { indent_size = 8;
charset = "utf-8"; indent_style = "tab";
end_of_line = "lf"; insert_final_newline = false;
indent_size = 8; trim_trailing_whitespace = true;
indent_style = "tab"; };
insert_final_newline = false; "*.nix" = {
trim_trailing_whitespace = true; indent_style = "space";
}; indent_size = 2;
"*.nix" = { };
indent_size = 2; "*.{lua,kt,kts,rs,py}" = {
}; indent_size = 4;
"*.{lua,kt,kts,rs,py}" = { };
indent_size = 4; "*.md" = {
}; trim_trailing_whitespace = false;
"*.md" = { };
trim_trailing_whitespace = false; };
}; };
};
};
} }

View file

@ -1,31 +1,29 @@
{ config, pkgs, ... }:
let
borderSize = toString config.module.style.window.border;
dpiAware = if config.module.display.dpiAware then "yes" else "no";
fontStep = 1;
in
{ {
config, file = (pkgs.formats.iniWithGlobalSection { }).generate "FootConfig" {
pkgs, globalSection = {
... dpi-aware = dpiAware;
}: let font = "${config.module.style.font.monospace.name}:size=${toString config.module.style.font.size.terminal}";
borderSize = toString config.module.style.window.border; # font-bold = "${config.module.style.font.monospace.name}:size=${toString config.module.style.font.size.terminal}";
dpiAware = if config.module.display.dpiAware then "yes" else "no"; font-bold-italic = "${config.module.style.font.monospace.name}:size=${toString config.module.style.font.size.terminal}";
fontStep = 1; font-italic = "${config.module.style.font.monospace.name}:size=${toString config.module.style.font.size.terminal}";
in { font-size-adjustment = fontStep;
file = (pkgs.formats.iniWithGlobalSection { }).generate "FootConfig" { pad = "${borderSize}x${borderSize} center";
globalSection = { };
dpi-aware = dpiAware; sections = {
font = "${config.module.style.font.monospace.name}:size=${toString config.module.style.font.size.terminal}"; colors = {
# font-bold = "${config.module.style.font.monospace.name}:size=${toString config.module.style.font.size.terminal}"; alpha = config.module.style.opacity.terminal;
font-bold-italic = "${config.module.style.font.monospace.name}:size=${toString config.module.style.font.size.terminal}"; background = config.module.style.color.bg.dark;
font-italic = "${config.module.style.font.monospace.name}:size=${toString config.module.style.font.size.terminal}"; foreground = config.module.style.color.fg.light;
font-size-adjustment = fontStep; };
pad = "${borderSize}x${borderSize} center"; key-bindings = {
}; show-urls-launch = "Mod1+o";
sections = { };
colors = { };
alpha = config.module.style.opacity.terminal; };
background = config.module.style.color.bg.dark;
foreground = config.module.style.color.fg.light;
};
key-bindings = {
show-urls-launch = "Mod1+o";
};
};
};
} }

View file

@ -1,38 +1,38 @@
{ pkgs, config, ... }:
let
dpiAware = if config.module.display.dpiAware then "yes" else "no";
in
{ {
pkgs, file = (pkgs.formats.ini { }).generate "FuzzelConfig" {
config, main = {
... dpi-aware = dpiAware;
}: let font = "Minecraftia:size=${toString config.module.style.font.size.popup}";
dpiAware = if config.module.display.dpiAware then "yes" else "no"; lines = 20;
in { prompt = "\"\"";
file = (pkgs.formats.ini { }).generate "FuzzelConfig" { show-actions = "yes";
main = { terminal = "foot";
dpi-aware = dpiAware; width = 40;
font = "Minecraftia:size=${toString config.module.style.font.size.popup}"; };
lines = 20; border = {
prompt = "\"\""; radius = 0;
show-actions = "yes"; width = 1;
terminal = "foot"; };
width = 40; colors =
}; let
border = { defaultOpacity = "ff";
radius = 0; in
width = 1; {
}; background = config.module.style.color.bg.dark + config.module.style.opacity.hex;
colors = let border = config.module.style.color.border + config.module.style.opacity.hex;
defaultOpacity = "ff"; counter = config.module.style.color.bg.regular + defaultOpacity;
in { input = config.module.style.color.fg.light + defaultOpacity;
background = config.module.style.color.bg.dark + config.module.style.opacity.hex; match = config.module.style.color.fg.light + defaultOpacity;
border = config.module.style.color.border + config.module.style.opacity.hex; placeholder = config.module.style.color.bg.regular + defaultOpacity;
counter = config.module.style.color.bg.regular + defaultOpacity; prompt = config.module.style.color.fg.light + defaultOpacity;
input = config.module.style.color.fg.light + defaultOpacity; selection = config.module.style.color.bg.regular + defaultOpacity;
match = config.module.style.color.fg.light + defaultOpacity; selection-match = config.module.style.color.accent + defaultOpacity;
placeholder = config.module.style.color.bg.regular + defaultOpacity; selection-text = config.module.style.color.fg.light + defaultOpacity;
prompt = config.module.style.color.fg.light + defaultOpacity; text = config.module.style.color.fg.light + defaultOpacity;
selection = config.module.style.color.bg.regular + defaultOpacity; };
selection-match = config.module.style.color.accent + defaultOpacity; };
selection-text = config.module.style.color.fg.light + defaultOpacity;
text = config.module.style.color.fg.light + defaultOpacity;
};
};
} }

View file

@ -1,17 +1,14 @@
{ secret, pkgs, ... }:
{ {
secret, file = (pkgs.formats.gitIni { listsAsDuplicateKeys = true; }).generate "GitConfig" {
pkgs, gpg.format = secret.crypto.sign.git.format;
... gpg.ssh.allowedSignersFile = toString secret.crypto.sign.git.allowed;
}: { init.defaultBranch = "main";
file = (pkgs.formats.gitIni { listsAsDuplicateKeys = true; }).generate "GitConfig" { pull.rebase = true;
gpg.format = secret.crypto.sign.git.format; push.autoSetupRemote = true;
gpg.ssh.allowedSignersFile = toString secret.crypto.sign.git.allowed; rebase.autoStash = true;
init.defaultBranch = "main"; safe.directory = "*";
pull.rebase = true; user.signingkey = builtins.readFile secret.crypto.sign.git.key;
push.autoSetupRemote = true; diff.algorithm = "histogram";
rebase.autoStash = true; };
safe.directory = "*";
user.signingkey = builtins.readFile secret.crypto.sign.git.key;
diff.algorithm = "histogram";
};
} }

View file

@ -1,29 +1,27 @@
{ ... }:
{ {
util, ideavimrc = ''
... " Plugins.
}: { Plug 'tpope/vim-commentary'
ideavimrc = util.trimTabs '' Plug 'machakann/vim-highlightedyank'
" Plugins. " Plug 'junegunn/vim-easy-align'
Plug 'tpope/vim-commentary'
Plug 'machakann/vim-highlightedyank'
" Plug 'junegunn/vim-easy-align'
" General config. " General config.
set scrolloff=4 set scrolloff=4
set incsearch set incsearch
set hlsearch set hlsearch
set clipboard=unnamedplus set clipboard=unnamedplus
set relativenumber set relativenumber
set number set number
" Space as a leader. " Space as a leader.
nnoremap <SPACE> <Nop> nnoremap <SPACE> <Nop>
let mapleader=" " let mapleader=" "
" Align. ISSUE: Broken. " Align. ISSUE: Broken.
" vmap <Leader>a <Plug>(EasyAlign) " vmap <Leader>a <Plug>(EasyAlign)
" Sort. " Sort.
vmap <Leader>A :sort<cr> vmap <Leader>A :sort<cr>
''; '';
} }

View file

@ -1,6 +1,4 @@
{ util, ... }@args:
{ {
util, text = util.catFile (util.ls ./module) args;
...
} @args: {
text = util.catFile (util.ls ./module) args;
} }

View file

@ -1,31 +1,29 @@
{ pkgs, ... }:
{ {
pkgs, file = (pkgs.formats.ini { }).generate "KeydChromiumConfig" {
... "chromium-browser" = {
}: { "alt.capslock" = "C-t"; # New tab.
file = (pkgs.formats.ini { }).generate "KeydChromiumConfig" { "alt.x" = "C-w"; # Close tab.
"chromium-browser" = { "alt.u" = "C-S-t"; # Restore closed tab.
"alt.capslock" = "C-t"; # New tab. "alt.q" = "C-pageup"; # Prev tab.
"alt.x" = "C-w"; # Close tab. "alt.e" = "C-pagedown"; # Next tab.
"alt.u" = "C-S-t"; # Restore closed tab. "alt.Q" = "C-S-pageup"; # Move tab left.
"alt.q" = "C-pageup"; # Prev tab. "alt.E" = "C-S-pagedown"; # Move tab right.
"alt.e" = "C-pagedown"; # Next tab. "alt.a" = "A-left"; # Go back.
"alt.Q" = "C-S-pageup"; # Move tab left. "alt.d" = "A-right"; # Go forward.
"alt.E" = "C-S-pagedown"; # Move tab right. "alt.s" = "down"; # Scroll down.
"alt.a" = "A-left"; # Go back. "alt.w" = "up"; # Scroll up.
"alt.d" = "A-right"; # Go forward. "alt.f" = "C-f"; # Find text.
"alt.s" = "down"; # Scroll down. "alt.N" = "S-f3"; # Find prev.
"alt.w" = "up"; # Scroll up. "alt.n" = "f3"; # Find next.
"alt.f" = "C-f"; # Find text. "alt.space" = "f6"; # Focus address bar.
"alt.N" = "S-f3"; # Find prev. "alt.r" = "C-f5"; # Full refresh.
"alt.n" = "f3"; # Find next. "alt.l" = "A-S-l"; # Toggle dark mode.
"alt.space" = "f6"; # Focus address bar. "alt.enter" = "C-S-l"; # Fill password.
"alt.r" = "C-f5"; # Full refresh. "alt.p" = "A-S-p"; # Toggle proxy.
"alt.l" = "A-S-l"; # Toggle dark mode. "alt.j" = "A-S-j"; # Toggle js.
"alt.enter" = "C-S-l"; # Fill password. "alt.k" = "A-S-k"; # Block element.
"alt.p" = "A-S-p"; # Toggle proxy. "alt.b" = "A-S-b"; # Show uBlock.
"alt.j" = "A-S-j"; # Toggle js. };
"alt.k" = "A-S-k"; # Block element. };
"alt.b" = "A-S-b"; # Show uBlock.
};
};
} }

View file

@ -1,35 +1,37 @@
{ pkgs, ... }:
{ {
pkgs, file = (pkgs.formats.ini { }).generate "KeydDrgConfig" {
... steam-app-548430 = {
}: { "alt.1" =
file = (pkgs.formats.ini { }).generate "KeydDrgConfig" { "macro(enter 10ms L e t ' s 10ms space d o 10ms space t h i s 10ms space T e x a s 10ms space s t y l e ! 10ms enter)";
steam-app-548430 = { "alt.2" = "macro(enter 10ms H e c k space y e s ! enter)";
"alt.1" = "macro(enter 10ms L e t ' s 10ms space d o 10ms space t h i s 10ms space T e x a s 10ms space s t y l e ! 10ms enter)"; "alt.3" =
"alt.2" = "macro(enter 10ms H e c k space y e s ! enter)"; "macro(enter 10ms J u s t space a space s i d e - j o b space w h i l e 10ms space w a i t i n g space f o r space a space s e x space u p d a t e . enter)";
"alt.3" = "macro(enter 10ms J u s t space a space s i d e - j o b space w h i l e 10ms space w a i t i n g space f o r space a space s e x space u p d a t e . enter)"; "alt.4" = "macro(enter 10ms < 3 enter)";
"alt.4" = "macro(enter 10ms < 3 enter)"; "alt.[" =
"alt.[" = "macro(enter 10ms W h a t space i s space c r u n c h y 10ms space o n space t h e space o u t s i d e , 10ms space g o o e y space o n space 10ms t h e space i n s i d e ? enter)"; "macro(enter 10ms W h a t space i s space c r u n c h y 10ms space o n space t h e space o u t s i d e , 10ms space g o o e y space o n space 10ms t h e space i n s i d e ? enter)";
"alt.]" = "macro(enter 10ms Q ' r o n a r space S h e l l b a c k ! enter)"; "alt.]" = "macro(enter 10ms Q ' r o n a r space S h e l l b a c k ! enter)";
"alt.a" = "macro(enter 10ms Y e s enter)"; "alt.a" = "macro(enter 10ms Y e s enter)";
"alt.b" = "macro(enter 10ms I ' m space b a c k enter)"; "alt.b" = "macro(enter 10ms I ' m space b a c k enter)";
"alt.c" = "macro(enter 10ms > space R i g h t enter)"; "alt.c" = "macro(enter 10ms > space R i g h t enter)";
"alt.d" = "macro(enter 10ms N o enter)"; "alt.d" = "macro(enter 10ms N o enter)";
"alt.e" = "macro(enter 10ms S o r r y ! enter)"; "alt.e" = "macro(enter 10ms S o r r y ! enter)";
"alt.f" = "macro(enter 10ms I space n e e d space h e l p ! enter)"; "alt.f" = "macro(enter 10ms I space n e e d space h e l p ! enter)";
"alt.g" = "macro(enter 10ms g g enter)"; "alt.g" = "macro(enter 10ms g g enter)";
"alt.j" = "macro(enter 10ms G o o d space j o b enter)"; "alt.j" = "macro(enter 10ms G o o d space j o b enter)";
"alt.k" = "macro(enter 10ms O k a y enter)"; "alt.k" = "macro(enter 10ms O k a y enter)";
"alt.l" = "macro(enter 10ms L e a f space l o v e r enter)"; "alt.l" = "macro(enter 10ms L e a f space l o v e r enter)";
"alt.m" = "macro(enter 10ms I space r e p l y space u s i n g space m a c r o s . 10ms space U s e space s o f t w a r e space l i k e space k e y d , 10ms space o r space b u y space a space Q M K space k e y b o a r d . enter)"; "alt.m" =
"alt.q" = "macro(enter 10ms T h a n k s ! enter)"; "macro(enter 10ms I space r e p l y space u s i n g space m a c r o s . 10ms space U s e space s o f t w a r e space l i k e space k e y d , 10ms space o r space b u y space a space Q M K space k e y b o a r d . enter)";
"alt.r" = "macro(enter 10ms N e e d space m o r e space a m m o enter)"; "alt.q" = "macro(enter 10ms T h a n k s ! enter)";
"alt.s" = "macro(enter 10ms W a i t enter)"; "alt.r" = "macro(enter 10ms N e e d space m o r e space a m m o enter)";
"alt.t" = "macro(enter 10ms M a y space I space t a k e space e x t r a ? enter)"; "alt.s" = "macro(enter 10ms W a i t enter)";
"alt.v" = "macro(enter 10ms A F K enter)"; "alt.t" = "macro(enter 10ms M a y space I space t a k e space e x t r a ? enter)";
"alt.w" = "macro(enter 10ms r enter)"; "alt.v" = "macro(enter 10ms A F K enter)";
"alt.x" = "macro(enter 10ms > space H e r e space < enter)"; "alt.w" = "macro(enter 10ms r enter)";
"alt.z" = "macro(enter 10ms < space L e f t enter)"; "alt.x" = "macro(enter 10ms > space H e r e space < enter)";
leftshift = "timeout(leftcontrol, 150, leftshift)"; "alt.z" = "macro(enter 10ms < space L e f t enter)";
}; leftshift = "timeout(leftcontrol, 150, leftshift)";
}; };
};
} }

View file

@ -1,29 +1,29 @@
{ pkgs, ... }:
let
apps = [
"gimp"
"gimp-*"
"steam-proton"
"steam-app-*"
];
keys = [
"escape"
"leftcontrol"
];
in
{ {
pkgs, file =
... let
}: let keySets = builtins.map (key: {
apps = [ name = key;
"gimp" value = key;
"gimp-*" }) keys;
"steam-proton"
"steam-app-*"
];
keys = [ appSets = builtins.map (app: {
"escape" name = app;
"leftcontrol" value = builtins.listToAttrs keySets;
]; }) apps;
in { in
file = let (pkgs.formats.ini { }).generate "KeydDisableConfig" (builtins.listToAttrs appSets);
keySets = builtins.map (key: {
name = key;
value = key;
}) keys;
appSets = builtins.map (app: {
name = app;
value = builtins.listToAttrs keySets;
}) apps;
in
(pkgs.formats.ini { }).generate "KeydDisableConfig" (builtins.listToAttrs appSets);
} }

View file

@ -1,28 +1,26 @@
{ pkgs, ... }:
{ {
pkgs, file = (pkgs.formats.ini { }).generate "KeydFirefoxConfig" {
... "firefox-esr" = {
}: { "alt.capslock" = "C-t"; # New tab.
file = (pkgs.formats.ini { }).generate "KeydFirefoxConfig" { "alt.x" = "C-w"; # Close tab.
"firefox-esr" = { "alt.u" = "C-S-t"; # Restore closed tab.
"alt.capslock" = "C-t"; # New tab. "alt.q" = "C-pageup"; # Prev tab.
"alt.x" = "C-w"; # Close tab. "alt.e" = "C-pagedown"; # Next tab.
"alt.u" = "C-S-t"; # Restore closed tab. "alt.Q" = "C-S-pageup"; # Move tab left.
"alt.q" = "C-pageup"; # Prev tab. "alt.E" = "C-S-pagedown"; # Move tab right.
"alt.e" = "C-pagedown"; # Next tab. "alt.a" = "A-left"; # Go back.
"alt.Q" = "C-S-pageup"; # Move tab left. "alt.d" = "A-right"; # Go forward.
"alt.E" = "C-S-pagedown"; # Move tab right. "alt.s" = "down"; # Scroll down.
"alt.a" = "A-left"; # Go back. "alt.w" = "up"; # Scroll up.
"alt.d" = "A-right"; # Go forward. "alt.f" = "C-f"; # Find text.
"alt.s" = "down"; # Scroll down. "alt.N" = "S-f3"; # Find prev.
"alt.w" = "up"; # Scroll up. "alt.n" = "f3"; # Find next.
"alt.f" = "C-f"; # Find text. "alt.space" = "f6"; # Focus address bar.
"alt.N" = "S-f3"; # Find prev. "alt.r" = "C-f5"; # Full refresh.
"alt.n" = "f3"; # Find next. "alt.l" = "A-S-a"; # Toggle dark mode.
"alt.space" = "f6"; # Focus address bar. "alt.m" = "C-m"; # Toggle tab mute.
"alt.r" = "C-f5"; # Full refresh. "alt.enter" = "C-S-l"; # Fill password.
"alt.l" = "A-S-a"; # Toggle dark mode. };
"alt.m" = "C-m"; # Toggle tab mute. };
"alt.enter" = "C-S-l"; # Fill password.
};
};
} }

View file

@ -1,30 +1,28 @@
{ pkgs, ... }:
{ {
pkgs, file = (pkgs.formats.ini { }).generate "KeydJetbrainsConfig" {
... "jetbrains-*" = {
}: { "alt.b" = "C-f8"; # Toggle line breakpoint.
file = (pkgs.formats.ini { }).generate "KeydJetbrainsConfig" { "alt.equal" = "C-A-l"; # Reformat.
"jetbrains-*" = { "alt.c" = "S-escape"; # Close panel.
"alt.b" = "C-f8"; # Toggle line breakpoint. "alt.capslock" = "C-A-S-insert"; # New scratch file.
"alt.equal" = "C-A-l"; # Reformat. "alt.q" = "A-left"; # Prev tab.
"alt.c" = "S-escape"; # Close panel. "alt.e" = "A-right"; # Next tab.
"alt.capslock" = "C-A-S-insert"; # New scratch file. "alt.x" = "C-f4"; # Close tab.
"alt.q" = "A-left"; # Prev tab. "alt.f" = "C-S-f"; # Find text.
"alt.e" = "A-right"; # Next tab. "alt.n" = "C-A-n"; # Find next.
"alt.x" = "C-f4"; # Close tab. "alt.g" = "macro(gd)"; # Go to definition.
"alt.f" = "C-S-f"; # Find text. "alt.i" = "C-i"; # Implement.
"alt.n" = "C-A-n"; # Find next. "alt.o" = "C-o"; # Override.
"alt.g" = "macro(gd)"; # Go to definition. "alt.r" = "S-f10"; # Run.
"alt.i" = "C-i"; # Implement. "alt.z" = "C-f2"; # Stop app.
"alt.o" = "C-o"; # Override. "alt.d" = "S-f9"; # Run debugger.
"alt.r" = "S-f10"; # Run. "alt.a" = "C-A-5"; # Attach debugger.
"alt.z" = "C-f2"; # Stop app. "alt.m" = "C-A-s"; # Settings.
"alt.d" = "S-f9"; # Run debugger. "alt.v" = "C-q"; # Show doc under cursor.
"alt.a" = "C-A-5"; # Attach debugger. "alt.s" = "C-S-A-t"; # Refactor selection.
"alt.m" = "C-A-s"; # Settings.
"alt.v" = "C-q"; # Show doc under cursor.
"alt.s" = "C-S-A-t"; # Refactor selection.
"alt.tab" = "timeout(f8, 150, macro2(0, 0, f7))"; # Tap to step over, hold to step into. "alt.tab" = "timeout(f8, 150, macro2(0, 0, f7))"; # Tap to step over, hold to step into.
}; };
}; };
} }

View file

@ -1,35 +1,37 @@
{ {
__findFile, __findFile,
config, config,
pkgs, pkgs,
... ...
} @args: let }@args:
swayscript = pkgs.callPackage <package/swayscript> args; let
alpha = config.module.style.opacity.hex; swayscript = pkgs.callPackage <package/swayscript> args;
color = config.module.style.color; alpha = config.module.style.opacity.hex;
max = 2; color = config.module.style.color;
in { max = 2;
file = (pkgs.formats.iniWithGlobalSection { }).generate "MakoConfig" { in
globalSection = { {
anchor = "top-center"; file = (pkgs.formats.iniWithGlobalSection { }).generate "MakoConfig" {
background-color = "#${color.highlight}${alpha}"; globalSection = {
border-color = "#${color.border}${alpha}"; anchor = "top-center";
default-timeout = 10000; background-color = "#${color.highlight}${alpha}";
font = "${config.module.style.font.serif.name} ${toString config.module.style.font.size.popup}"; border-color = "#${color.border}${alpha}";
height = 120; default-timeout = 10000;
icons = 0; font = "${config.module.style.font.serif.name} ${toString config.module.style.font.size.popup}";
margin = 32; height = 120;
max-history = max; icons = 0;
max-visible = max; margin = 32;
on-notify = "exec ${swayscript}/bin/swayscript notify"; max-history = max;
text-color = "#${config.module.style.color.bg.dark}"; max-visible = max;
width = 480; on-notify = "exec ${swayscript}/bin/swayscript notify";
}; text-color = "#${config.module.style.color.bg.dark}";
sections = { width = 480;
"mode=dnd" = { };
invisible = 1; sections = {
on-notify = "exec ${pkgs.coreutils}/bin/true"; "mode=dnd" = {
}; invisible = 1;
}; on-notify = "exec ${pkgs.coreutils}/bin/true";
}; };
};
};
} }

View file

@ -1,45 +1,43 @@
{ pkgs, ... }:
{ {
pkgs, config = (pkgs.formats.iniWithGlobalSection { }).generate "MangoConfig" {
... globalSection = {
}: { blacklist = "example";
config = (pkgs.formats.iniWithGlobalSection { }).generate "MangoConfig" { fps_sampling_period = 1000;
globalSection = { frame_timing = 0;
blacklist = "example"; preset = "0,1,2";
fps_sampling_period = 1000; toggle_logging = "F2";
frame_timing = 0; toggle_preset = "F1";
preset = "0,1,2"; };
toggle_logging = "F2"; };
toggle_preset = "F1";
};
};
presets = (pkgs.formats.ini { }).generate "MangoPresets" { presets = (pkgs.formats.ini { }).generate "MangoPresets" {
"preset 0" = { "preset 0" = {
no_display = 1; no_display = 1;
}; };
"preset 1" = { "preset 1" = {
alpha = 1.0; alpha = 1.0;
arch = 0; arch = 0;
background_alpha = 0.5; background_alpha = 0.5;
battery = 1; battery = 1;
battery_time = 1; battery_time = 1;
benchmark_percentiles = 0; benchmark_percentiles = 0;
cpu_temp = 1; cpu_temp = 1;
device_battery = "gamepad,mouse"; device_battery = "gamepad,mouse";
font_size = 12; font_size = 12;
fps_sampling_period = 1000; fps_sampling_period = 1000;
gpu_junction_temp = 0; gpu_junction_temp = 0;
gpu_mem_temp = 1; gpu_mem_temp = 1;
gpu_temp = 1; gpu_temp = 1;
hud_no_margin = 1; hud_no_margin = 1;
ram = 1; ram = 1;
swap = 1; swap = 1;
throttling_status = 1; throttling_status = 1;
time = 1; time = 1;
vram = 1; vram = 1;
}; };
"preset 2" = { "preset 2" = {
full = 1; full = 1;
}; };
}; };
} }

View file

@ -1,91 +1,93 @@
{ {
inputs, inputs,
pkgs, pkgs,
util, util,
... ...
} @args: let }@args:
nvimRc = { runtimes, configs }: let let
# Plugin paths to install. nvimRc =
runtimeRc = builtins.foldl' (acc: r: { runtimes, configs }:
acc + "set runtimepath+=${r}\n" let
) "" runtimes; # Plugin paths to install.
runtimeRc = builtins.foldl' (acc: r: acc + "set runtimepath+=${r}\n") "" runtimes;
# My configuration files combined into one big file. # My configuration files combined into one big file.
config = pkgs.writeText "nvimRc" (util.catText configs args); config = pkgs.writeText "nvimRc" (util.catText configs args);
# Tell Neovim to load this file. # Tell Neovim to load this file.
configRc = "lua dofile(\"${config}\")"; configRc = "lua dofile(\"${config}\")";
in in
runtimeRc + configRc; runtimeRc + configRc;
in { in
text = nvimRc { {
runtimes = [ text = nvimRc {
"~/.cache/nvim" runtimes = [
"~/.cache/nvim/treesitter" "~/.cache/nvim"
"${inputs.nvimAlign}" "~/.cache/nvim/treesitter"
"${inputs.nvimAutoclose}" "${inputs.nvimAlign}"
"${inputs.nvimBufferline}" "${inputs.nvimAutoclose}"
"${inputs.nvimCloseBuffers}" "${inputs.nvimBufferline}"
"${inputs.nvimColorizer}" "${inputs.nvimCloseBuffers}"
"${inputs.nvimDevicons}" "${inputs.nvimColorizer}"
"${inputs.nvimDressing}" "${inputs.nvimDevicons}"
"${inputs.nvimGen}" "${inputs.nvimDressing}"
"${inputs.nvimGitsigns}" "${inputs.nvimGen}"
"${inputs.nvimGruvboxMaterial}" "${inputs.nvimGitsigns}"
"${inputs.nvimIndentoMatic}" "${inputs.nvimGruvboxMaterial}"
"${inputs.nvimLspconfig}" "${inputs.nvimIndentoMatic}"
"${inputs.nvimPlenary}" "${inputs.nvimLspconfig}"
"${inputs.nvimTelescope}" "${inputs.nvimPlenary}"
"${inputs.nvimTodo}" "${inputs.nvimTelescope}"
"${inputs.nvimTreesitter}" "${inputs.nvimTodo}"
"${inputs.nvimTree}" "${inputs.nvimTreesitter}"
"${inputs.nvimTrouble}" "${inputs.nvimTree}"
]; "${inputs.nvimTrouble}"
];
configs = [ configs = [
./module/key/Rekey.nix ./module/key/Rekey.nix
./module/key/Leader.nix ./module/key/Leader.nix
./module/config/Autoread.nix ./module/config/Autoread.nix
./module/config/Etc.nix ./module/config/Etc.nix
./module/config/Search.nix ./module/config/Search.nix
./module/config/Tab.nix ./module/config/Tab.nix
./module/config/Highlight.nix ./module/config/Highlight.nix
./module/plugin/Filetree.nix ./module/plugin/Filetree.nix
./module/plugin/Gruvbox.nix ./module/plugin/Gruvbox.nix
./module/plugin/Bufferline.nix ./module/plugin/Bufferline.nix
./module/plugin/Autoclose.nix ./module/plugin/Autoclose.nix
./module/plugin/Gitsigns.nix ./module/plugin/Gitsigns.nix
./module/plugin/Trouble.nix ./module/plugin/Trouble.nix
./module/plugin/Closebuffers.nix ./module/plugin/Closebuffers.nix
./module/plugin/Telescope.nix ./module/plugin/Telescope.nix
./module/plugin/Todo.nix ./module/plugin/Todo.nix
./module/plugin/Indent.nix ./module/plugin/Indent.nix
./module/plugin/Align.nix ./module/plugin/Align.nix
./module/plugin/Treesitter.nix ./module/plugin/Treesitter.nix
./module/plugin/Fold.nix ./module/plugin/Fold.nix
./module/plugin/Gen.nix ./module/plugin/Gen.nix
./module/plugin/Colorizer.nix ./module/plugin/Colorizer.nix
./module/plugin/Dressing.nix ./module/plugin/Dressing.nix
./module/plugin/lsp/Go.nix ./module/plugin/lsp/Go.nix
./module/plugin/lsp/Haskell.nix ./module/plugin/lsp/Haskell.nix
./module/plugin/lsp/Lua.nix ./module/plugin/lsp/Lua.nix
./module/plugin/lsp/Nix.nix ./module/plugin/lsp/Nix.nix
./module/plugin/lsp/Rust.nix ./module/plugin/lsp/Rust.nix
./module/plugin/lsp/Tex.nix ./module/plugin/lsp/Tex.nix
./module/key/Autocomplete.nix ./module/key/Autocomplete.nix
./module/key/Buffer.nix ./module/key/Buffer.nix
./module/key/Cmd.nix ./module/key/Cmd.nix
./module/key/Colorscheme.nix ./module/key/Colorscheme.nix
./module/key/Filetree.nix ./module/key/Filetree.nix
./module/key/Gitsigns.nix ./module/key/Gitsigns.nix
./module/key/Navigation.nix ./module/key/Navigation.nix
./module/key/Prompt.nix ./module/key/Prompt.nix
./module/key/Save.nix ./module/key/Save.nix
./module/key/Sort.nix ./module/key/Sort.nix
./module/key/TabWidth.nix ./module/key/TabWidth.nix
./module/key/Telescope.nix ./module/key/Telescope.nix
./module/key/Terminal.nix ./module/key/Terminal.nix
./module/key/Trouble.nix ./module/key/Trouble.nix
]; ];
}; };
} }

View file

@ -1,9 +1,10 @@
{ ... }: { { ... }:
text = '' {
vim.o.autoread = true text = ''
vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "CursorHoldI", "FocusGained" }, { vim.o.autoread = true
command = "if mode() != 'c' | checktime | endif", vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "CursorHoldI", "FocusGained" }, {
pattern = { "*" }, command = "if mode() != 'c' | checktime | endif",
}) pattern = { "*" },
''; })
'';
} }

View file

@ -1,36 +1,37 @@
{ ... }: { { ... }:
text = '' {
-- TODO: Add comments and separate files. text = ''
vim.opt.clipboard = "unnamedplus" -- TODO: Add comments and separate files.
vim.opt.cursorline = false vim.opt.clipboard = "unnamedplus"
vim.opt.fixeol = false vim.opt.cursorline = false
vim.opt.incsearch = true vim.opt.fixeol = false
vim.opt.number = true vim.opt.incsearch = true
vim.opt.scrolloff = 4 vim.opt.number = true
vim.opt.splitbelow = true vim.opt.scrolloff = 4
vim.opt.splitright = true vim.opt.splitbelow = true
vim.opt.termguicolors = true vim.opt.splitright = true
vim.opt.ttyfast = true vim.opt.termguicolors = true
vim.opt.wildmode = "longest,list" vim.opt.ttyfast = true
-- vim.opt.completeopt = "menuone,noselect" vim.opt.wildmode = "longest,list"
-- vim.opt.completeopt = "menuone,noselect"
-- Disable continuing comments on newline. -- Disable continuing comments on newline.
vim.cmd("autocmd BufEnter * set fo-=c fo-=r fo-=o") vim.cmd("autocmd BufEnter * set fo-=c fo-=r fo-=o")
-- Disable mouse. -- Disable mouse.
vim.cmd("set mouse=") vim.cmd("set mouse=")
-- Disable signs for diagnostics. -- Disable signs for diagnostics.
vim.diagnostic.config({ signs = false }) vim.diagnostic.config({ signs = false })
-- Display invisible characters. -- Display invisible characters.
-- vim.cmd("set list listchars=tab:>\\ ,trail:-,eol:,lead:.") -- vim.cmd("set list listchars=tab:>\\ ,trail:-,eol:,lead:.")
vim.cmd("set list listchars=tab:>\\ ,trail:-,lead:·") vim.cmd("set list listchars=tab:>\\ ,trail:-,lead:·")
-- Relative line numbers. -- Relative line numbers.
vim.wo.relativenumber = true vim.wo.relativenumber = true
-- Disable swap files. -- Disable swap files.
vim.opt.swapfile = false vim.opt.swapfile = false
''; '';
} }

View file

@ -1,49 +1,54 @@
{ config, lib, ... }:
let
color = config.module.style.color;
mkHighlight =
name: value:
''vim.api.nvim_set_hl(0, "${name}", ${
lib.generators.toLua {
multiline = false;
asBindings = false;
} value
})'';
bg = {
bg = "#${color.bg.regular}";
};
selection = {
bg = "#${color.selection}";
bold = true;
fg = "#${color.fg.dark}";
};
transparent = {
bg = lib.generators.mkLuaInline "clear";
};
border = {
bg = lib.generators.mkLuaInline "clear";
fg = "#${color.accent}";
};
in
{ {
config, text = ''
lib, vim.api.nvim_create_autocmd({"ColorScheme", "VimEnter"}, {
... group = vim.api.nvim_create_augroup('Color', {}),
}: let pattern = "*",
color = config.module.style.color; callback = function ()
mkHighlight = name: value: ''vim.api.nvim_set_hl(0, "${name}", ${lib.generators.toLua { multiline = false; asBindings = false; } value})''; -- Background.
bg = { ${mkHighlight "CursorLine" bg}
bg = "#${color.bg.regular}"; ${mkHighlight "Pmenu" bg}
}; ${mkHighlight "PmenuExtra" bg}
selection = { ${mkHighlight "TelescopeSelection" bg}
bg = "#${color.selection}";
bold = true;
fg = "#${color.fg.dark}";
};
transparent = {
bg = lib.generators.mkLuaInline "clear";
};
border = {
bg = lib.generators.mkLuaInline "clear";
fg = "#${color.accent}";
};
in {
text = ''
vim.api.nvim_create_autocmd({"ColorScheme", "VimEnter"}, {
group = vim.api.nvim_create_augroup('Color', {}),
pattern = "*",
callback = function ()
-- Background.
${mkHighlight "CursorLine" bg}
${mkHighlight "Pmenu" bg}
${mkHighlight "PmenuExtra" bg}
${mkHighlight "TelescopeSelection" bg}
-- Selection. -- Selection.
${mkHighlight "Visual" selection} ${mkHighlight "Visual" selection}
${mkHighlight "PmenuSel" selection} ${mkHighlight "PmenuSel" selection}
-- Transparent. -- Transparent.
${mkHighlight "NormalFloat" transparent} ${mkHighlight "NormalFloat" transparent}
-- Border. -- Border.
${mkHighlight "FloatBorder" border} ${mkHighlight "FloatBorder" border}
${mkHighlight "FloatTitle" border} ${mkHighlight "FloatTitle" border}
${mkHighlight "TelescopeBorder" border} ${mkHighlight "TelescopeBorder" border}
end end
}) })
''; '';
} }

View file

@ -1,9 +1,10 @@
{ ... }: { { ... }:
text = '' {
vim.opt.hlsearch = true text = ''
vim.opt.ignorecase = true vim.opt.hlsearch = true
vim.opt.incsearch = true vim.opt.ignorecase = true
vim.opt.showmatch = true vim.opt.incsearch = true
vim.opt.smartcase = true vim.opt.showmatch = true
''; vim.opt.smartcase = true
'';
} }

View file

@ -1,15 +1,17 @@
{ ... }: let { ... }:
indentDefault = 2; let
in { indentDefault = 2;
text = '' in
vim.opt.autoindent = true {
vim.opt.expandtab = false text = ''
-- vim.opt.smartindent = true vim.opt.autoindent = true
vim.opt.shiftwidth = ${toString indentDefault} vim.opt.expandtab = false
vim.opt.softtabstop = ${toString indentDefault} -- vim.opt.smartindent = true
vim.opt.tabstop = ${toString indentDefault} vim.opt.shiftwidth = ${toString indentDefault}
vim.opt.softtabstop = ${toString indentDefault}
vim.opt.tabstop = ${toString indentDefault}
-- Disable Markdown forced formatting. -- Disable Markdown forced formatting.
vim.g.markdown_recommended_style = 0 vim.g.markdown_recommended_style = 0
''; '';
} }

View file

@ -1,9 +1,10 @@
{ ... }: { { ... }:
text = '' {
-- Autocomplete. text = ''
rekey_input("<C-space>", "<C-n>") -- Autocomplete.
rekey_input("<C-space>", "<C-n>")
-- LSP autocomplete. -- LSP autocomplete.
rekey_normal("<C-space>", "<cmd>lua vim.lsp.buf.code_action()<cr>") rekey_normal("<C-space>", "<cmd>lua vim.lsp.buf.code_action()<cr>")
''; '';
} }

View file

@ -1,16 +1,17 @@
{ ... }: { { ... }:
text = '' {
-- New empty buffer. text = ''
remap_normal("<Leader>n", "<cmd>enew<cr>") -- New empty buffer.
remap_normal("<Leader>n", "<cmd>enew<cr>")
-- Close buffer. -- Close buffer.
function _buf_close() function _buf_close()
pcall(vim.cmd, "w") pcall(vim.cmd, "w")
vim.cmd[[bp|sp|bn|bd!]] vim.cmd[[bp|sp|bn|bd!]]
end end
rekey_normal("<Leader>x", "<cmd>lua _buf_close()<cr>") rekey_normal("<Leader>x", "<cmd>lua _buf_close()<cr>")
-- Close all hidden buffers. -- Close all hidden buffers.
rekey_normal("<Leader>X", "<cmd>BDelete hidden<cr><C-l>") rekey_normal("<Leader>X", "<cmd>BDelete hidden<cr><C-l>")
''; '';
} }

View file

@ -1,11 +1,12 @@
{ ... }: { { ... }:
text = '' {
-- Remap ; to :. text = ''
rekey_normal(";", ":") -- Remap ; to :.
rekey_visual(";", ":") rekey_normal(";", ":")
rekey_visual(";", ":")
-- Repeat previous command. -- Repeat previous command.
rekey_normal("<Leader>.", "@:") rekey_normal("<Leader>.", "@:")
rekey_visual("<Leader>.", "@:") rekey_visual("<Leader>.", "@:")
''; '';
} }

View file

@ -1,26 +1,27 @@
{ ... }: { { ... }:
text = '' {
function toggle_contrast() text = ''
if vim.g.gruvbox_material_background == "light" then function toggle_contrast()
vim.g.gruvbox_material_background = "medium" if vim.g.gruvbox_material_background == "light" then
elseif vim.g.gruvbox_material_background == "medium" then vim.g.gruvbox_material_background = "medium"
vim.g.gruvbox_material_background = "hard" elseif vim.g.gruvbox_material_background == "medium" then
elseif vim.g.gruvbox_material_background == "hard" then vim.g.gruvbox_material_background = "hard"
vim.g.gruvbox_material_background = "light" elseif vim.g.gruvbox_material_background == "hard" then
end vim.g.gruvbox_material_background = "light"
vim.cmd("colorscheme gruvbox-material") end
end vim.cmd("colorscheme gruvbox-material")
end
function toggle_light() function toggle_light()
if vim.o.background == "light" then if vim.o.background == "light" then
vim.o.background = "dark" vim.o.background = "dark"
elseif vim.o.background == "dark" then elseif vim.o.background == "dark" then
vim.o.background = "light" vim.o.background = "light"
end end
-- require("lualine").setup() -- require("lualine").setup()
end end
rekey_normal("<Leader>[", "<cmd>lua toggle_contrast()<cr>") rekey_normal("<Leader>[", "<cmd>lua toggle_contrast()<cr>")
rekey_normal("<Leader>]", "<cmd>lua toggle_light()<cr>") rekey_normal("<Leader>]", "<cmd>lua toggle_light()<cr>")
''; '';
} }

View file

@ -1,6 +1,7 @@
{ ... }: { { ... }:
text = '' {
-- Toggle file tree. text = ''
rekey_normal("<Leader>1", "<cmd>NvimTreeToggle<cr>") -- Toggle file tree.
''; rekey_normal("<Leader>1", "<cmd>NvimTreeToggle<cr>")
'';
} }

View file

@ -1,6 +1,7 @@
{ ... }: { { ... }:
text = '' {
-- Toggle Git inspection mode. text = ''
rekey_normal("<Leader>g", "<cmd>Gitsigns toggle_current_line_blame<cr><cmd>Gitsigns toggle_word_diff<cr><cmd>Gitsigns toggle_linehl<cr>") -- Toggle Git inspection mode.
''; rekey_normal("<Leader>g", "<cmd>Gitsigns toggle_current_line_blame<cr><cmd>Gitsigns toggle_word_diff<cr><cmd>Gitsigns toggle_linehl<cr>")
'';
} }

View file

@ -1,11 +1,12 @@
{ ... }: { { ... }:
text = '' {
leader = " " text = ''
leader = " "
vim.g.mapleader = leader vim.g.mapleader = leader
vim.g.maplocalleader = leader vim.g.maplocalleader = leader
-- Disable key press timeout. -- Disable key press timeout.
vim.cmd("set notimeout nottimeout") vim.cmd("set notimeout nottimeout")
''; '';
} }

View file

@ -1,36 +1,38 @@
{ ... }: let { ... }:
stepHorizontal = 4; let
stepVertical = 2; stepHorizontal = 4;
in { stepVertical = 2;
text = '' in
-- Switch windows. {
rekey_normal("<Leader>a", "<C-w>h") text = ''
rekey_normal("<Leader>d", "<C-w>l") -- Switch windows.
rekey_normal("<Leader>s", "<C-w>j") rekey_normal("<Leader>a", "<C-w>h")
rekey_normal("<Leader>w", "<C-w>k") rekey_normal("<Leader>d", "<C-w>l")
rekey_normal("<Leader>s", "<C-w>j")
rekey_normal("<Leader>w", "<C-w>k")
-- Switch buffers. -- Switch buffers.
rekey_normal("<Leader>E", "<cmd>BufferLineMoveNext<cr>") rekey_normal("<Leader>E", "<cmd>BufferLineMoveNext<cr>")
rekey_normal("<Leader>Q", "<cmd>BufferLineMovePrev<cr>") rekey_normal("<Leader>Q", "<cmd>BufferLineMovePrev<cr>")
rekey_normal("<Leader>e", "<cmd>BufferLineCycleNext<cr>") rekey_normal("<Leader>e", "<cmd>BufferLineCycleNext<cr>")
rekey_normal("<Leader>q", "<cmd>BufferLineCyclePrev<cr>") rekey_normal("<Leader>q", "<cmd>BufferLineCyclePrev<cr>")
-- Splits. -- Splits.
rekey_normal("<Leader>\\", "<cmd>vsplit<cr>") rekey_normal("<Leader>\\", "<cmd>vsplit<cr>")
rekey_normal("<Leader>-", "<cmd>split<cr>") rekey_normal("<Leader>-", "<cmd>split<cr>")
rekey_normal("<Leader>=", "<C-w>=") -- Equalize split sizes. rekey_normal("<Leader>=", "<C-w>=") -- Equalize split sizes.
rekey_normal("<Leader>c", "<C-w>q") -- Close split. rekey_normal("<Leader>c", "<C-w>q") -- Close split.
-- Resize splits. -- Resize splits.
rekey_normal("<Leader>h", "${toString stepHorizontal}<C-w><") rekey_normal("<Leader>h", "${toString stepHorizontal}<C-w><")
rekey_normal("<Leader>l", "${toString stepHorizontal}<C-w>>") rekey_normal("<Leader>l", "${toString stepHorizontal}<C-w>>")
rekey_normal("<Leader>j", "${toString stepVertical}<C-w>+") rekey_normal("<Leader>j", "${toString stepVertical}<C-w>+")
rekey_normal("<Leader>k", "${toString stepVertical}<C-w>-") rekey_normal("<Leader>k", "${toString stepVertical}<C-w>-")
-- Move splits. -- Move splits.
rekey_normal("<Leader>A", "<C-w>A") rekey_normal("<Leader>A", "<C-w>A")
rekey_normal("<Leader>D", "<C-w>D") rekey_normal("<Leader>D", "<C-w>D")
rekey_normal("<Leader>S", "<C-w>S") rekey_normal("<Leader>S", "<C-w>S")
rekey_normal("<Leader>W", "<C-w>W") rekey_normal("<Leader>W", "<C-w>W")
''; '';
} }

View file

@ -1,6 +1,7 @@
{ ... }: { { ... }:
text = '' {
rekey_normal("<Leader>p", ":Gen<cr>") text = ''
rekey_visual("<Leader>p", ":Gen<cr>") rekey_normal("<Leader>p", ":Gen<cr>")
''; rekey_visual("<Leader>p", ":Gen<cr>")
'';
} }

View file

@ -1,53 +1,54 @@
{ ... }: { { ... }:
text = '' {
-- Base rekey function. text = ''
local function rekey(t, key, command) -- Base rekey function.
vim.api.nvim_set_keymap(t, key, command, { noremap = true }) local function rekey(t, key, command)
end vim.api.nvim_set_keymap(t, key, command, { noremap = true })
end
-- Base remap function. -- Base remap function.
local function remap(t, key, command) local function remap(t, key, command)
vim.api.nvim_set_keymap(t, key, command, { noremap = false }) vim.api.nvim_set_keymap(t, key, command, { noremap = false })
end end
-- Rekey in normal mode. -- Rekey in normal mode.
function rekey_normal(key, command) function rekey_normal(key, command)
rekey("n", key, command) rekey("n", key, command)
end end
-- Rekey in input mode. -- Rekey in input mode.
function rekey_input(key, command) function rekey_input(key, command)
rekey("i", key, command) rekey("i", key, command)
end end
-- Rekey in visual mode. -- Rekey in visual mode.
function rekey_visual(key, command) function rekey_visual(key, command)
rekey("v", key, command) rekey("v", key, command)
end end
-- Rekey in terminal mode. -- Rekey in terminal mode.
function rekey_terminal(key, command) function rekey_terminal(key, command)
rekey("t", key, command) rekey("t", key, command)
end end
-- Remap in normal mode. -- Remap in normal mode.
function remap_normal(key, command) function remap_normal(key, command)
remap("n", key, command) remap("n", key, command)
end end
-- Remap in input mode. -- Remap in input mode.
function remap_input(key, command) function remap_input(key, command)
remap("i", key, command) remap("i", key, command)
end end
-- Remap in visual mode. -- Remap in visual mode.
function remap_visual(key, command) function remap_visual(key, command)
remap("v", key, command) remap("v", key, command)
end end
-- Remap in terminal mode. -- Remap in terminal mode.
function remap_terminal(key, command) function remap_terminal(key, command)
remap("t", key, command) remap("t", key, command)
end end
''; '';
} }

View file

@ -1,19 +1,20 @@
{ ... }: { { ... }:
text = '' {
-- Write all we can and exit. Created this to drop non-writable stuff when piping to nvim. text = ''
function bye() -- Write all we can and exit. Created this to drop non-writable stuff when piping to nvim.
pcall(vim.cmd, "wa") function bye()
vim.cmd[[qa!]] pcall(vim.cmd, "wa")
end vim.cmd[[qa!]]
end
-- Save everything. -- Save everything.
rekey_normal("<C-s>", "<cmd>wa!<cr>") rekey_normal("<C-s>", "<cmd>wa!<cr>")
rekey_input("<C-s>", "<cmd>wa!<cr>") rekey_input("<C-s>", "<cmd>wa!<cr>")
-- Save all we can and leave. -- Save all we can and leave.
rekey_normal("<Leader>z", "<cmd>lua bye()<cr>") rekey_normal("<Leader>z", "<cmd>lua bye()<cr>")
-- Just leave, no saves. -- Just leave, no saves.
rekey_normal("<Leader>Z", "<cmd>qa!<cr>") rekey_normal("<Leader>Z", "<cmd>qa!<cr>")
''; '';
} }

View file

@ -1,6 +1,7 @@
{ ... }: { { ... }:
text = '' {
-- Sort visual selection alphabetically. text = ''
rekey_visual("<Leader>A", ":'<,'>sort<cr>") -- Sort visual selection alphabetically.
''; rekey_visual("<Leader>A", ":'<,'>sort<cr>")
'';
} }

View file

@ -1,21 +1,22 @@
{ ... }: { { ... }:
text = '' {
function toggle_tab_width() text = ''
if vim.bo.shiftwidth == 2 then function toggle_tab_width()
vim.bo.shiftwidth = 4 if vim.bo.shiftwidth == 2 then
vim.bo.tabstop = 4 vim.bo.shiftwidth = 4
vim.bo.softtabstop = 4 vim.bo.tabstop = 4
elseif vim.bo.shiftwidth == 4 then vim.bo.softtabstop = 4
vim.bo.shiftwidth = 8 elseif vim.bo.shiftwidth == 4 then
vim.bo.tabstop = 8 vim.bo.shiftwidth = 8
vim.bo.softtabstop = 8 vim.bo.tabstop = 8
elseif vim.bo.shiftwidth == 8 then vim.bo.softtabstop = 8
vim.bo.shiftwidth = 2 elseif vim.bo.shiftwidth == 8 then
vim.bo.tabstop = 2 vim.bo.shiftwidth = 2
vim.bo.softtabstop = 2 vim.bo.tabstop = 2
end vim.bo.softtabstop = 2
end end
end
rekey_normal("<Leader><Tab>", "<cmd>lua toggle_tab_width()<cr>") rekey_normal("<Leader><Tab>", "<cmd>lua toggle_tab_width()<cr>")
''; '';
} }

View file

@ -1,12 +1,14 @@
{ ... }: let { ... }:
mod = "f"; let
in { mod = "f";
text = '' in
rekey_normal("<Leader>${mod}a", "<cmd>Telescope<cr>") {
rekey_normal("<Leader>${mod}b", "<cmd>lua require('telescope.builtin').buffers()<cr>") text = ''
rekey_normal("<Leader>${mod}f", "<cmd>lua require('telescope.builtin').find_files()<cr>") rekey_normal("<Leader>${mod}a", "<cmd>Telescope<cr>")
rekey_normal("<Leader>${mod}g", "<cmd>lua require('telescope.builtin').live_grep()<cr>") rekey_normal("<Leader>${mod}b", "<cmd>lua require('telescope.builtin').buffers()<cr>")
rekey_normal("<Leader>${mod}h", "<cmd>lua require('telescope.builtin').help_tags()<cr>") rekey_normal("<Leader>${mod}f", "<cmd>lua require('telescope.builtin').find_files()<cr>")
rekey_normal("<Leader>${mod}t", "<cmd>Telescope treesitter<cr>") rekey_normal("<Leader>${mod}g", "<cmd>lua require('telescope.builtin').live_grep()<cr>")
''; rekey_normal("<Leader>${mod}h", "<cmd>lua require('telescope.builtin').help_tags()<cr>")
rekey_normal("<Leader>${mod}t", "<cmd>Telescope treesitter<cr>")
'';
} }

View file

@ -1,9 +1,10 @@
{ ... }: { { ... }:
text = '' {
-- Open terminal window. text = ''
rekey_normal("<Leader>4", "<cmd>terminal<cr>") -- Open terminal window.
rekey_normal("<Leader>4", "<cmd>terminal<cr>")
-- Detach from terminal with Esc key. -- Detach from terminal with Esc key.
rekey_terminal("<Esc>", "<C-\\><C-n>") rekey_terminal("<Esc>", "<C-\\><C-n>")
''; '';
} }

View file

@ -1,11 +1,13 @@
{ ... }: let { ... }:
focus = true; let
in { focus = true;
text = '' in
-- Toggle diagnostics window. {
rekey_normal("<Leader>2", "<cmd>Trouble diagnostics toggle focus=${toString focus}<cr>") text = ''
-- Toggle diagnostics window.
rekey_normal("<Leader>2", "<cmd>Trouble diagnostics toggle focus=${toString focus}<cr>")
-- Toggle To-do window. -- Toggle To-do window.
rekey_normal("<Leader>3", "<cmd>Trouble todo toggle focus=${toString focus}<cr>") rekey_normal("<Leader>3", "<cmd>Trouble todo toggle focus=${toString focus}<cr>")
''; '';
} }

View file

@ -1,10 +1,11 @@
{ ... }: { { ... }:
text = '' {
require("mini.align").setup { text = ''
mappings = { require("mini.align").setup {
start = "<Leader>a", mappings = {
-- start_with_preview = '<Leader>A', start = "<Leader>a",
}, -- start_with_preview = '<Leader>A',
} },
''; }
'';
} }

View file

@ -1,17 +1,18 @@
{ ... }: { { ... }:
text = '' {
require("autoclose").setup({ text = ''
keys = { require("autoclose").setup({
["'"] = { escape = false, close = false, pair = "''''''", disabled_filetypes = {} }, keys = {
["("] = { escape = true, close = true, pair = "()", disabled_filetypes = {} }, ["'"] = { escape = false, close = false, pair = "''''''", disabled_filetypes = {} },
["<"] = { escape = true, close = true, pair = "<>", disabled_filetypes = {} }, ["("] = { escape = true, close = true, pair = "()", disabled_filetypes = {} },
["\""] = { escape = true, close = true, pair = "\"\"", disabled_filetypes = {} }, ["<"] = { escape = true, close = true, pair = "<>", disabled_filetypes = {} },
["`"] = { escape = true, close = true, pair = "``", disabled_filetypes = {} }, ["\""] = { escape = true, close = true, pair = "\"\"", disabled_filetypes = {} },
["{"] = { escape = true, close = true, pair = "{}", disabled_filetypes = {} }, ["`"] = { escape = true, close = true, pair = "``", disabled_filetypes = {} },
}, ["{"] = { escape = true, close = true, pair = "{}", disabled_filetypes = {} },
-- options = { },
-- disabled_filetypes = { "text", "markdown" }, -- options = {
-- } -- disabled_filetypes = { "text", "markdown" },
}) -- }
''; })
'';
} }

View file

@ -1,5 +1,6 @@
{ ... }: { { ... }:
text = '' {
require("bufferline").setup() text = ''
''; require("bufferline").setup()
'';
} }

View file

@ -1,11 +1,12 @@
{ ... }: { { ... }:
text = '' {
require("close_buffers").setup({ text = ''
file_glob_ignore = {}, require("close_buffers").setup({
file_regex_ignore = {}, file_glob_ignore = {},
filetype_ignore = {}, file_regex_ignore = {},
next_buffer_cmd = nil, filetype_ignore = {},
preserve_window_layout = { "this", "nameless" }, next_buffer_cmd = nil,
}) preserve_window_layout = { "this", "nameless" },
''; })
'';
} }

View file

@ -1,8 +1,9 @@
{ ... }: { { ... }:
text = '' {
-- Ensure termguicolors is enabled if not already text = ''
vim.opt.termguicolors = true -- Ensure termguicolors is enabled if not already
vim.opt.termguicolors = true
require('nvim-highlight-colors').setup({}) require('nvim-highlight-colors').setup({})
''; '';
} }

View file

@ -1,5 +1,6 @@
{ ... }: { { ... }:
text = '' {
require("dressing").setup({ }) text = ''
''; require("dressing").setup({ })
'';
} }

Some files were not shown because too many files have changed in this diff Show more