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
trim_trailing_whitespace = true
[*.nix]
indent_style = space
indent_size = 2
[*.md]
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 = .
hostname = $(shell hostname)
@ -16,7 +16,7 @@ boot:
cached:
$(eval options := $(subst eval-cache false,eval-cache true,$(options)))
check:
check: format
nix flake check --show-trace
# HACK: Fix ulimit switch issue. Test sometime in the future again.
@ -28,6 +28,9 @@ check:
# fix-unlock:
# pkill nixos-rebuild || true
format:
treefmt --no-cache --clear-cache
nixconf:
mv /etc/nix/nix.conf_ /etc/nix/nix.conf || true

View file

@ -1,16 +1,16 @@
{
config,
lib,
pkgs,
...
}: let
cfg = config.module.amd.compute;
in {
config = lib.mkIf cfg.enable {
nixpkgs.config.rocmSupport = true;
systemd.tmpfiles.rules = [ "L+ /opt/rocm/hip - - - - ${pkgs.rocmPackages.clr}" ];
hardware.graphics.extraPackages = with pkgs; [
rocmPackages.clr.icd
];
};
config,
lib,
pkgs,
...
}:
let
cfg = config.module.amd.compute;
in
{
config = lib.mkIf cfg.enable {
nixpkgs.config.rocmSupport = true;
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,
...
}: let
cfg = config.module.amd.cpu;
{ config, lib, ... }:
let
cfg = config.module.amd.cpu;
controlFile = "/sys/devices/system/cpu/cpufreq/boost";
disableCmd = "1";
enableCmd = "0";
in {
config = lib.mkIf cfg.enable (lib.mkMerge [
{
boot.kernelModules = [ "kvm-amd" ];
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
(lib.mkIf cfg.powersave {
module.powersave = {
enable = true;
cpu.boost = {
inherit controlFile enableCmd disableCmd;
};
};
})
]);
controlFile = "/sys/devices/system/cpu/cpufreq/boost";
disableCmd = "1";
enableCmd = "0";
in
{
config = lib.mkIf cfg.enable (
lib.mkMerge [
{
boot.kernelModules = [ "kvm-amd" ];
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
(lib.mkIf cfg.powersave {
module.powersave = {
enable = true;
cpu.boost = { inherit controlFile enableCmd disableCmd; };
};
})
]
);
}

View file

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

View file

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

View file

@ -1,15 +1,13 @@
{ config, lib, ... }:
let
cfg = config.module.bluetooth;
in
{
config,
lib,
...
}: let
cfg = config.module.bluetooth;
in {
config = lib.mkIf cfg.enable {
services.blueman.enable = true;
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
};
};
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,
...
}: let
cfg = config.module.brightness;
in {
config = lib.mkIf cfg.enable {
programs.light.enable = true;
};
config = lib.mkIf cfg.enable { programs.light.enable = true; };
}

View file

@ -1,42 +1,51 @@
{ lib, config, ... }:
let
cfg = config.module.display;
in
{
lib,
config,
...
}: let
cfg = config.module.display;
in {
# REF: https://www.kernel.org/doc/Documentation/fb/fbcon.txt
# REF: https://patchwork.kernel.org/project/dri-devel/patch/20191110154101.26486-10-hdegoede@redhat.com/#22993841
config = lib.mkMerge [
# NOTE: `tty` name is special.
(lib.mkIf (cfg.rotate != null) {
boot.kernelParams = lib.mapAttrsToList (name: rotate:
let
hint =
if rotate == 90 then "left_side_up"
else if rotate == 180 then "upside_down"
else if rotate == 270 then "right_side_up"
else "normal";
# REF: https://www.kernel.org/doc/Documentation/fb/fbcon.txt
# REF: https://patchwork.kernel.org/project/dri-devel/patch/20191110154101.26486-10-hdegoede@redhat.com/#22993841
config = lib.mkMerge [
# NOTE: `tty` name is special.
(lib.mkIf (cfg.rotate != null) {
boot.kernelParams = lib.mapAttrsToList (
name: rotate:
let
# ISSUE: https://github.com/swaywm/sway/issues/8478
hint =
if rotate == 90 then
"left_side_up"
else if rotate == 180 then
"upside_down"
else if rotate == 270 then
"right_side_up"
else
"normal";
value =
if rotate == 90 then 1
else if rotate == 180 then 2
else if rotate == 270 then 3
else 0;
value =
if rotate == 90 then
1
else if rotate == 180 then
2
else if rotate == 270 then
3
else
0;
command = if name == "tty" then
"fbcon=rotate:${toString value}"
else
"video=${name}:rotate=${toString rotate}";
# "video=${name}:panel_orientation=${hint}";
# "video=${name}:rotate=${toString rotate},panel_orientation=${hint}";
in command
) cfg.rotate;
command =
if name == "tty" then
"fbcon=rotate:${toString value}"
else
"video=${name}:rotate=${toString rotate}";
in
# "video=${name}:panel_orientation=${hint}";
# "video=${name}:rotate=${toString rotate},panel_orientation=${hint}";
command
) cfg.rotate;
module.sway.extraConfig = lib.mapAttrsToList (name: rotate:
"output ${name} transform ${toString rotate}"
) cfg.rotate;
})
];
module.sway.extraConfig = lib.mapAttrsToList (
name: rotate: "output ${name} transform ${toString 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,
lib,
pkgs,
...
}: let
cfg = config.module.distrobox;
in {
config = lib.mkIf cfg.enable {
# Distrobox works best with Podman, so enable it here.
module.podman.enable = true;
environment.systemPackages = with pkgs; [
distrobox
];
};
config,
lib,
pkgs,
...
}:
let
cfg = config.module.distrobox;
in
{
config = lib.mkIf cfg.enable {
# Distrobox works best with Podman, so enable it here.
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,
...
}: let
cfg = config.module.docker;
in {
config = lib.mkIf cfg.enable (lib.mkMerge [
{
virtualisation.docker.enable = true;
config = lib.mkIf cfg.enable (
lib.mkMerge [
{
virtualisation.docker.enable = true;
systemd = if cfg.autostart then { } else {
sockets.docker.wantedBy = lib.mkForce [ ];
services = {
docker-prune.wantedBy = lib.mkForce [ ];
docker.wantedBy = lib.mkForce [ ];
};
};
}
systemd =
if cfg.autostart then
{ }
else
{
sockets.docker.wantedBy = lib.mkForce [ ];
services = {
docker-prune.wantedBy = lib.mkForce [ ];
docker.wantedBy = lib.mkForce [ ];
};
};
}
(lib.mkIf cfg.rootless {
virtualisation.docker.rootless = {
enable = true;
setSocketVariable = true;
};
})
]);
(lib.mkIf cfg.rootless {
virtualisation.docker.rootless = {
enable = true;
setSocketVariable = true;
};
})
]
);
}

View file

@ -1,77 +1,81 @@
{
config,
lib,
pkgs,
...
}: let
cfg = config.module.dpi.bypass;
config,
lib,
pkgs,
...
}:
let
cfg = config.module.dpi.bypass;
whitelist = lib.optionalString (
(builtins.length cfg.whitelist) != 0
) "--hostlist ${pkgs.writeText "zapret-whitelist" (lib.concatStringsSep "\n" cfg.whitelist)}";
whitelist = lib.optionalString (
(builtins.length cfg.whitelist) != 0
) "--hostlist ${pkgs.writeText "zapret-whitelist" (lib.concatStringsSep "\n" cfg.whitelist)}";
blacklist = lib.optionalString (
(builtins.length cfg.blacklist) != 0
) "--hostlist-exclude ${pkgs.writeText "zapret-blacklist" (lib.concatStringsSep "\n" cfg.blacklist)}";
blacklist =
lib.optionalString ((builtins.length cfg.blacklist) != 0)
"--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;
in {
disabledModules = [ "services/networking/zapret.nix" ];
# imports = [ "${inputs.nixpkgsMaster}/nixos/modules/services/networking/zapret.nix" ];
qnum = toString cfg.qnum;
in
{
disabledModules = [ "services/networking/zapret.nix" ];
# imports = [ "${inputs.nixpkgsMaster}/nixos/modules/services/networking/zapret.nix" ];
config = lib.mkIf cfg.enable (lib.mkMerge [
{
systemd.services.zapret = {
description = "DPI bypass service";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
ExecStart = "${cfg.package}/bin/nfqws --pidfile=/run/nfqws.pid ${params} ${whitelist} ${blacklist} --qnum=${qnum}";
Type = "simple";
PIDFile = "/run/nfqws.pid";
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.
config = lib.mkIf cfg.enable (
lib.mkMerge [
{
systemd.services.zapret = {
description = "DPI bypass service";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
ExecStart = "${cfg.package}/bin/nfqws --pidfile=/run/nfqws.pid ${params} ${whitelist} ${blacklist} --qnum=${qnum}";
Type = "simple";
PIDFile = "/run/nfqws.pid";
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.
DevicePolicy = "closed";
KeyringMode = "private";
PrivateTmp = true;
PrivateMounts = true;
ProtectHome = true;
ProtectHostname = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
ProtectSystem = "strict";
ProtectProc = "invisible";
RemoveIPC = true;
RestrictNamespaces = true;
RestrictRealtime = true;
RestrictSUIDSGID = true;
SystemCallArchitectures = "native";
};
};
}
# Route system traffic via service for specified ports.
(lib.mkIf cfg.configureFirewall {
networking.firewall.extraCommands =
let
httpParams = lib.optionalString (
cfg.httpMode == "first"
) "-m connbytes --connbytes-dir=original --connbytes-mode=packets --connbytes 1:6";
# Hardening.
DevicePolicy = "closed";
KeyringMode = "private";
PrivateTmp = true;
PrivateMounts = true;
ProtectHome = true;
ProtectHostname = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
ProtectSystem = "strict";
ProtectProc = "invisible";
RemoveIPC = true;
RestrictNamespaces = true;
RestrictRealtime = true;
RestrictSUIDSGID = true;
SystemCallArchitectures = "native";
};
};
}
# Route system traffic via service for specified ports.
(lib.mkIf cfg.configureFirewall {
networking.firewall.extraCommands =
let
httpParams = lib.optionalString (
cfg.httpMode == "first"
) "-m connbytes --connbytes-dir=original --connbytes-mode=packets --connbytes 1:6";
udpPorts = lib.concatStringsSep "," cfg.udpPorts;
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
''
+ 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
''
+ 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
'';
})
]);
udpPorts = lib.concatStringsSep "," cfg.udpPorts;
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
''
+ 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
''
+ 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
'';
})
]
);
}

View file

@ -1,26 +1,23 @@
{ config, lib, ... }:
let
cfg = config.module.ftpd;
in
{
config,
lib,
util,
...
}: let
cfg = config.module.ftpd;
in {
config = lib.mkIf cfg.enable {
services.vsftpd = {
enable = true;
allowWriteableChroot = true;
anonymousMkdirEnable = true;
anonymousUmask = "000";
anonymousUploadEnable = true;
anonymousUser = true;
anonymousUserHome = cfg.storage;
anonymousUserNoPassword = true;
localUsers = false;
writeEnable = true;
extraConfig = util.trimTabs ''
anon_other_write_enable=YES
'';
};
};
config = lib.mkIf cfg.enable {
services.vsftpd = {
enable = true;
allowWriteableChroot = true;
anonymousMkdirEnable = true;
anonymousUmask = "000";
anonymousUploadEnable = true;
anonymousUser = true;
anonymousUserHome = cfg.storage;
anonymousUserNoPassword = true;
localUsers = false;
writeEnable = true;
extraConfig = ''
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.
{
config,
lib,
...
}: let
cfg = config.module.intel.cpu;
{ config, lib, ... }:
let
cfg = config.module.intel.cpu;
controlFile = "/sys/devices/system/cpu/intel_pstate/no_turbo";
disableCmd = "0";
enableCmd = "1";
in {
config = lib.mkIf cfg.enable (lib.mkMerge [
{
boot.kernelModules = [
"kvm-intel"
];
}
(lib.mkIf cfg.powersave {
module.powersave = {
enable = true;
cpu.boost = {
inherit controlFile enableCmd disableCmd;
};
};
})
]);
controlFile = "/sys/devices/system/cpu/intel_pstate/no_turbo";
disableCmd = "0";
enableCmd = "1";
in
{
config = lib.mkIf cfg.enable (
lib.mkMerge [
{ boot.kernelModules = [ "kvm-intel" ]; }
(lib.mkIf cfg.powersave {
module.powersave = {
enable = true;
cpu.boost = { inherit controlFile enableCmd disableCmd; };
};
})
]
);
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,20 +1,22 @@
{
config,
lib,
pkgs,
...
}: let
cfg = config.module.virtmanager;
in {
config = lib.mkIf cfg.enable {
virtualisation.libvirtd.enable = true;
programs.virt-manager.enable = true;
config,
lib,
pkgs,
...
}:
let
cfg = config.module.virtmanager;
in
{
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/
# May also need to run: `gsettings set org.gnome.desktop.interface cursor-theme "Adwaita"`
environment.systemPackages = with pkgs; [
# glib
adwaita-icon-theme # default gnome cursors,
];
};
# 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"`
environment.systemPackages = with pkgs; [
# glib
adwaita-icon-theme # default gnome cursors,
];
};
}

View file

@ -1,14 +1,12 @@
{
config,
lib,
pkgs,
...
}: let
cfg = config.module.waybar;
in {
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
waybar
];
};
config,
lib,
pkgs,
...
}:
let
cfg = config.module.waybar;
in
{
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,
pkgs,
...
}: let
cfg = config.module.wayland;
in {
config = {
programs.xwayland.enable = true;
environment = {
systemPackages = with pkgs; [
wl-clipboard # CLI clipboard support.
];
variables = {
# Compatibility variables.
ECORE_EVAS_ENGINE = "wayland_egl";
ELM_ENGINE = "wayland_egl";
GDK_BACKEND = "wayland";
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";
};
};
};
config = {
programs.xwayland.enable = true;
environment = {
systemPackages = with pkgs; [
wl-clipboard # CLI clipboard support.
];
variables = {
# Compatibility variables.
ECORE_EVAS_ENGINE = "wayland_egl";
ELM_ENGINE = "wayland_egl";
GDK_BACKEND = "wayland";
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 = {
# SOURCE: https://github.com/NixOS/nixpkgs
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
nixpkgsUnstable.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgsMaster.url = "github:nixos/nixpkgs/master";
inputs = {
# SOURCE: https://github.com/NixOS/nixpkgs
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
nixpkgsUnstable.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgsMaster.url = "github:nixos/nixpkgs/master";
# SOURCE: https://github.com/nix-community/home-manager
home-manager = {
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
# SOURCE: https://github.com/nix-community/home-manager
home-manager = {
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
# SOURCE: https://github.com/nix-community/nix-on-droid
nix-on-droid = {
url = "github:t184256/nix-on-droid/release-24.05";
inputs = {
home-manager.follows = "home-manager";
nixpkgs.follows = "nixpkgs";
};
};
# SOURCE: https://github.com/nix-community/nix-on-droid
nix-on-droid = {
url = "github:t184256/nix-on-droid/release-24.05";
inputs = {
home-manager.follows = "home-manager";
nixpkgs.follows = "nixpkgs";
};
};
# SOURCE: https://github.com/LilleAila/nix-cursors
nix-cursors = {
url = "github:LilleAila/nix-cursors";
inputs.nixpkgs.follows = "nixpkgs";
};
# SOURCE: https://github.com/LilleAila/nix-cursors
nix-cursors = {
url = "github:LilleAila/nix-cursors";
inputs.nixpkgs.follows = "nixpkgs";
};
# SOURCE: https://github.com/danth/stylix
stylix = {
url = "github:danth/stylix/release-24.05";
inputs = {
home-manager.follows = "home-manager";
nixpkgs.follows = "nixpkgs";
};
};
# SOURCE: https://github.com/danth/stylix
stylix = {
url = "github:danth/stylix/release-24.05";
inputs = {
home-manager.follows = "home-manager";
nixpkgs.follows = "nixpkgs";
};
};
nixpkgsJobber.url = "github:nixos/nixpkgs/051f920625ab5aabe37c920346e3e69d7d34400e";
poetry2nixJobber.url = "github:nix-community/poetry2nix/304f8235fb0729fd48567af34fcd1b58d18f9b95";
nixpkgsJobber.url = "github:nixos/nixpkgs/051f920625ab5aabe37c920346e3e69d7d34400e";
poetry2nixJobber.url = "github:nix-community/poetry2nix/304f8235fb0729fd48567af34fcd1b58d18f9b95";
nvimAlign = { flake = false; url = "github:echasnovski/mini.align"; };
nvimAutoclose = { flake = false; url = "github:m4xshen/autoclose.nvim"; };
nvimBufferline = { flake = false; url = "github:akinsho/bufferline.nvim"; };
nvimCloseBuffers = { flake = false; url = "github:kazhala/close-buffers.nvim"; };
nvimColorizer = { 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"; };
};
nvimAlign = {
flake = false;
url = "github:echasnovski/mini.align";
};
nvimAutoclose = {
flake = false;
url = "github:m4xshen/autoclose.nvim";
};
nvimBufferline = {
flake = false;
url = "github:akinsho/bufferline.nvim";
};
nvimCloseBuffers = {
flake = false;
url = "github:kazhala/close-buffers.nvim";
};
nvimColorizer = {
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 = {
home-manager,
nix-on-droid,
nixpkgs,
nixpkgsJobber,
nixpkgsMaster,
nixpkgsUnstable,
poetry2nixJobber,
self,
stylix,
...
} @inputs: let
lib = nixpkgs.lib;
outputs =
{
home-manager,
nix-on-droid,
nixpkgs,
nixpkgsJobber,
nixpkgsMaster,
nixpkgsUnstable,
poetry2nixJobber,
self,
stylix,
...
}@inputs:
let
lib = nixpkgs.lib;
const = {
droidStateVersion = "24.05";
stateVersion = "24.11";
timeZone = "Europe/Moscow";
url = "https://git.voronind.com/voronind/nix.git";
};
const = {
droidStateVersion = "24.05";
stateVersion = "24.11";
timeZone = "Europe/Moscow";
url = "https://git.voronind.com/voronind/nix.git";
};
__findFile = _: p: ./${p};
__findFile = _: p: ./${p};
ls = 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};
system = "x86_64-linux";
in {
${system}.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
nixd
];
# buildInputs = with pkgs; [ ];
ls =
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};
system = "x86_64-linux";
in
{
${system}.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
nixd
nixfmt-rfc-style
treefmt
];
# buildInputs = with pkgs; [ ];
# LD_LIBRARY_PATH = "${lib.makeLibraryPath buildInputs}";
# SOURCE_DATE_EPOCH = "${toString self.lastModified}";
};
};
# LD_LIBRARY_PATH = "${lib.makeLibraryPath buildInputs}";
# SOURCE_DATE_EPOCH = "${toString self.lastModified}";
};
};
nixosConfigurations = let
mkHost = { system, hostname }: lib.nixosSystem {
inherit system;
modules = [
# Make a device hostname match the one from this config.
{ networking.hostName = hostname; }
nixosConfigurations =
let
mkHost =
{ system, hostname }:
lib.nixosSystem {
inherit system;
modules =
[
# Make a device hostname match the one from this config.
{ networking.hostName = hostname; }
# Specify current release version.
{ system.stateVersion = const.stateVersion; }
# Specify current release version.
{ system.stateVersion = const.stateVersion; }
# Add Home Manager module.
home-manager.nixosModules.home-manager
# Add Home Manager module.
home-manager.nixosModules.home-manager
# Add Stylix module.
stylix.nixosModules.stylix
# Add Stylix module.
stylix.nixosModules.stylix
# HM config.
./home/NixOs.nix
]
++ (ls ./host/${system}/${hostname})
++ (ls ./option)
++ (ls ./config)
++ (ls ./overlay)
++ (ls ./system)
;
specialArgs = let
util = import ./lib/Util.nix { inherit lib; };
in {
inherit const __findFile inputs self poetry2nixJobber util;
pkgsJobber = nixpkgsJobber.legacyPackages.${system}.pkgs;
pkgsMaster = nixpkgsMaster.legacyPackages.${system}.pkgs;
pkgsUnstable = nixpkgsUnstable.legacyPackages.${system}.pkgs;
secret = import ./secret { };
};
};
# HM config.
./home/NixOs.nix
]
++ (ls ./host/${system}/${hostname})
++ (ls ./option)
++ (ls ./config)
++ (ls ./overlay)
++ (ls ./system);
specialArgs =
let
util = import ./lib/Util.nix { inherit lib; };
in
{
inherit
const
__findFile
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: {
inherit system;
hosts = builtins.attrNames (builtins.readDir ./host/${system});
});
systems =
builtins.attrNames (builtins.readDir ./host)
|> map (system: {
inherit system;
hosts = builtins.attrNames (builtins.readDir ./host/${system});
});
hosts = map (system:
map (host: { inherit host; inherit (system) system; }) system.hosts
) systems |> lib.foldl' (acc: h: acc ++ h) [];
hosts =
map (
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;
in
lib.foldl' (result: cfg: result // cfg) {} configurations;
configurations = map (cfg: mkSystem cfg.system cfg.host) hosts;
in
lib.foldl' (result: cfg: result // cfg) { } configurations;
nixOnDroidConfigurations.default = let
pkgs = nixpkgs.legacyPackages.${system}.pkgs;
pkgsMaster = nixpkgsMaster.legacyPackages.${system}.pkgs;
pkgsUnstable = nixpkgsUnstable.legacyPackages.${system}.pkgs;
system = "aarch64-linux";
in nix-on-droid.lib.nixOnDroidConfiguration {
inherit pkgs;
modules = [
{ home.android.enable = true; }
{ home-manager.config.stylix.autoEnable = lib.mkForce false; }
./home/Android.nix
]
++ (ls ./option)
;
extraSpecialArgs = {
inherit inputs self pkgsMaster pkgsUnstable const __findFile;
secret = import ./secret { };
util = import ./lib/Util.nix { inherit lib; };
};
};
};
nixOnDroidConfigurations.default =
let
pkgs = nixpkgs.legacyPackages.${system}.pkgs;
pkgsMaster = nixpkgsMaster.legacyPackages.${system}.pkgs;
pkgsUnstable = nixpkgsUnstable.legacyPackages.${system}.pkgs;
system = "aarch64-linux";
in
nix-on-droid.lib.nixOnDroidConfiguration {
inherit pkgs;
modules = [
{ home.android.enable = true; }
{ home-manager.config.stylix.autoEnable = lib.mkForce false; }
./home/Android.nix
] ++ (ls ./option);
extraSpecialArgs = {
inherit
inputs
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.
{
__findFile,
config,
const,
inputs,
lib,
pkgs,
pkgsMaster,
pkgsUnstable,
self,
...
} @args: let
cfg = config.home.android;
android = import ./android args;
env = import ./env args;
file = import ./file args;
package = import <package> args;
programs = import ./program args;
stylix = import <system/Stylix.nix> args;
in {
options.home.android = {
enable = lib.mkEnableOption "the Android HM config.";
};
__findFile,
config,
const,
inputs,
lib,
pkgs,
pkgsMaster,
pkgsUnstable,
self,
...
}@args:
let
cfg = config.home.android;
android = import ./android args;
env = import ./env args;
file = import ./file args;
package = import <package> args;
programs = import ./program args;
stylix = import <system/Stylix.nix> args;
in
{
options.home.android = {
enable = lib.mkEnableOption "the Android HM config.";
};
config = lib.mkIf cfg.enable {
environment.packages = package.core;
nix.extraOptions = "experimental-features = nix-command flakes";
system.stateVersion = const.droidStateVersion;
time.timeZone = const.timeZone;
terminal = {
inherit (android) font colors;
};
home-manager.config = stylix // {
programs = with programs; core;
imports = [
inputs.stylix.homeManagerModules.stylix
];
home = {
inherit (env) sessionVariables;
inherit file;
stateVersion = const.droidStateVersion;
};
};
};
config = lib.mkIf cfg.enable {
environment.packages = package.core;
nix.extraOptions = "experimental-features = nix-command flakes";
system.stateVersion = const.droidStateVersion;
time.timeZone = const.timeZone;
terminal = { inherit (android) font colors; };
home-manager.config = stylix // {
programs = with programs; core;
imports = [ inputs.stylix.homeManagerModules.stylix ];
home = {
inherit (env) sessionVariables;
inherit file;
stateVersion = const.droidStateVersion;
};
};
};
}

View file

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

View file

@ -1,15 +1,14 @@
{ config, pkgs, ... }:
{
config,
pkgs,
...
}: {
font = pkgs.runCommandNoCC "font" { } ''
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; {
background = "#${bg.dark}";
cursor = "#${fg.light}";
foreground = "#${fg.light}";
};
colors = with config.module.style.color; {
background = "#${bg.dark}";
cursor = "#${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.
MANPAGER = "nvim +Man!"; # App to use for man pages.
MOZ_LEGACY_PROFILES = "1"; # Disable Firefox profile switching on rebuild.
NIXPKGS_ALLOW_UNFREE = "1"; # Allow unfree packages in shell.
NIX_CURRENT_SYSTEM = "${pkgs.stdenv.system}"; # Current system architecture.
TERM = "xterm-256color"; # Terminal settings.
WINEFSYNC = "1"; # Use fsync for Wine.
EDITOR = "nvim"; # Default text editor.
GTK_CSD = 0; # GTK apps compat.
MANGOHUD = "1"; # Enable Mangohud by default.
MANPAGER = "nvim +Man!"; # App to use for man pages.
MOZ_LEGACY_PROFILES = "1"; # Disable Firefox profile switching on rebuild.
NIXPKGS_ALLOW_UNFREE = "1"; # Allow unfree packages in shell.
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,
...
} @args: {
sessionVariables = import ./Variable.nix args;
sessionVariables = import ./Variable.nix args;
}

View file

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

View file

@ -1,98 +1,93 @@
{ pkgs, config, ... }:
{
pkgs,
config,
...
}: {
preferences = (pkgs.formats.json { }).generate "ChromiumConfig" {
name = "Work";
bookmark_bar.show_on_all_tabs = false;
browser.show_home_button = false;
default_apps_install_state = 2;
download.prompt_for_download = false;
download_bubble.partial_view_enabled = false;
intl.selected_languages = "en-US,en";
session.restore_on_startup = 1;
side_panel.is_right_aligned = false;
default_search_provider = {
guid = "5761b040-db50-4f8e-9d00-c9ad985779a4";
synced_guid = "5761b040-db50-4f8e-9d00-c9ad985779a4";
};
default_search_provider_data = {
template_url_data = {
id = 11;
is_active = 1;
keyword = "s";
short_name = "SearX";
synced_guid = "5761b040-db50-4f8e-9d00-c9ad985779a4";
url = "https://search.voronind.com/search?q={searchTerms}";
};
};
extensions = {
alerts.initialized = false;
commands = {
"linux:Alt+Shift+L" = {
command_name = "addSite";
extension = "eimadpbcbfnmbkopoojfekhnkhdbieeh";
global = false;
};
"linux:Alt+Shift+B" = {
command_name = "_execute_browser_action";
extension = "cgbcahbpdhpcegmbfconppldiemgcoii";
global = false;
};
"linux:Alt+Shift+K" = {
command_name = "launch-element-zapper";
extension = "cgbcahbpdhpcegmbfconppldiemgcoii";
global = false;
};
"linux:Alt+Shift+J" = {
command_name = "toggle-javascript";
extension = "cgbcahbpdhpcegmbfconppldiemgcoii";
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;
};
webkit = {
webprefs = {
default_fixed_font_size = 14;
default_font_size = 17;
minimum_font_size = 16;
fonts = let
mono = config.module.style.font.monospace.name;
sans = config.module.style.font.sansSerif.name;
in {
fixed.Zyyy = mono;
sansserif.Zyyy = sans;
serif.Zyyy = sans;
standard.Zyyy = sans;
};
};
};
};
preferences = (pkgs.formats.json { }).generate "ChromiumConfig" {
name = "Work";
bookmark_bar.show_on_all_tabs = false;
browser.show_home_button = false;
default_apps_install_state = 2;
download.prompt_for_download = false;
download_bubble.partial_view_enabled = false;
intl.selected_languages = "en-US,en";
session.restore_on_startup = 1;
side_panel.is_right_aligned = false;
default_search_provider = {
guid = "5761b040-db50-4f8e-9d00-c9ad985779a4";
synced_guid = "5761b040-db50-4f8e-9d00-c9ad985779a4";
};
default_search_provider_data = {
template_url_data = {
id = 11;
is_active = 1;
keyword = "s";
short_name = "SearX";
synced_guid = "5761b040-db50-4f8e-9d00-c9ad985779a4";
url = "https://search.voronind.com/search?q={searchTerms}";
};
};
extensions = {
alerts.initialized = false;
commands = {
"linux:Alt+Shift+L" = {
command_name = "addSite";
extension = "eimadpbcbfnmbkopoojfekhnkhdbieeh";
global = false;
};
"linux:Alt+Shift+B" = {
command_name = "_execute_browser_action";
extension = "cgbcahbpdhpcegmbfconppldiemgcoii";
global = false;
};
"linux:Alt+Shift+K" = {
command_name = "launch-element-zapper";
extension = "cgbcahbpdhpcegmbfconppldiemgcoii";
global = false;
};
"linux:Alt+Shift+J" = {
command_name = "toggle-javascript";
extension = "cgbcahbpdhpcegmbfconppldiemgcoii";
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;
};
webkit = {
webprefs = {
default_fixed_font_size = 14;
default_font_size = 17;
minimum_font_size = 16;
fonts =
let
mono = config.module.style.font.monospace.name;
sans = config.module.style.font.sansSerif.name;
in
{
fixed.Zyyy = mono;
sansserif.Zyyy = sans;
serif.Zyyy = sans;
standard.Zyyy = sans;
};
};
};
};
localState = (pkgs.formats.json { }).generate "ChromiumLocalState" {
browser = {
first_run_finished = true;
enabled_labs_experiments = [
"smooth-scrolling@2"
];
};
};
localState = (pkgs.formats.json { }).generate "ChromiumLocalState" {
browser = {
first_run_finished = true;
enabled_labs_experiments = [ "smooth-scrolling@2" ];
};
};
# REF: https://chromeenterprise.google/intl/en_us/policies/
policy = (pkgs.formats.json { }).generate "ChromiumPolicy" {
DefaultBrowserSettingEnabled = false;
URLBlocklist = [
"darkreader.org"
];
};
# REF: https://chromeenterprise.google/intl/en_us/policies/
policy = (pkgs.formats.json { }).generate "ChromiumPolicy" {
DefaultBrowserSettingEnabled = false;
URLBlocklist = [ "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";
location-mode = "path-bar";
show-hidden = false;
show-size-column = true;
show-type-column = true;
sidebar-width = "166";
sort-column = "modified";
sort-directories-first = true;
sort-order = "descending";
type-format = "category";
view-type = "list";
};
{ ... }:
{
"org/gtk/gtk4/settings/file-chooser" = {
date-format = "regular";
location-mode = "path-bar";
show-hidden = false;
show-size-column = true;
show-type-column = true;
sidebar-width = "166";
sort-column = "modified";
sort-directories-first = true;
sort-order = "descending";
type-format = "category";
view-type = "list";
};
"org/gtk/settings/file-chooser" = {
date-format = "regular";
location-mode = "path-bar";
show-hidden = false;
show-size-column = true;
show-type-column = true;
sort-column = "modified";
sort-directories-first = true;
sort-order = "descending";
type-format = "category";
};
"org/gtk/settings/file-chooser" = {
date-format = "regular";
location-mode = "path-bar";
show-hidden = false;
show-size-column = true;
show-type-column = true;
sort-column = "modified";
sort-directories-first = true;
sort-order = "descending";
type-format = "category";
};
}

View file

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

View file

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

View file

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

View file

@ -1,7 +1,8 @@
{ ... }: {
"org/gnome/desktop/media-handling" = {
automount = false;
automount-open = false;
autorun-never = true;
};
{ ... }:
{
"org/gnome/desktop/media-handling" = {
automount = false;
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" = {
default-zoom-level = "small";
use-tree-view = false;
};
"org/gnome/nautilus/list-view" = {
default-zoom-level = "small";
use-tree-view = false;
};
"org/gnome/nautilus/preferences" = {
click-policy = "single";
default-folder-viewer = "list-view";
default-sort-in-reverse-order = false;
default-sort-order = "name";
migrated-gtk-settings = true;
search-filter-time-type = "last_modified";
search-view = "list-view";
show-image-thumbnails = "local-only";
};
"org/gnome/nautilus/preferences" = {
click-policy = "single";
default-folder-viewer = "list-view";
default-sort-in-reverse-order = false;
default-sort-order = "name";
migrated-gtk-settings = true;
search-filter-time-type = "last_modified";
search-view = "list-view";
show-image-thumbnails = "local-only";
};
}

View file

@ -1,10 +1,11 @@
{ ... }: {
"org/gnome/settings-daemon/plugins/power" = {
ambient-enabled = false;
idle-dim = false;
power-button-action = "nothing";
sleep-inactive-ac-timeout = "0";
sleep-inactive-ac-type = "nothing";
sleep-inactive-battery-type = "nothing";
};
{ ... }:
{
"org/gnome/settings-daemon/plugins/power" = {
ambient-enabled = false;
idle-dim = false;
power-button-action = "nothing";
sleep-inactive-ac-timeout = "0";
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;
old-files-age = mkUint32 30;
recent-files-max-age = mkUint32 30;
remove-old-temp-files = true;
remove-old-trash-files = true;
report-technical-problems = true;
};
"org/gnome/desktop/privacy" = with lib.gvariant; {
disable-camera = false;
disable-microphone = false;
old-files-age = mkUint32 30;
recent-files-max-age = mkUint32 30;
remove-old-temp-files = true;
remove-old-trash-files = true;
report-technical-problems = true;
};
"org/gnome/system/location" = {
enabled = false;
};
"org/gnome/system/location" = {
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;
disable-user-extensions = false;
favorite-apps = [ "" ];
had-bluetooth-devices-setup = true;
last-selected-power-profile = "power-saver";
remember-mount-password = false;
};
{ ... }:
{
"org/gnome/shell" = {
disable-extension-version-validation = true;
disable-user-extensions = false;
favorite-apps = [ "" ];
had-bluetooth-devices-setup = true;
last-selected-power-profile = "power-saver";
remember-mount-password = false;
};
"system/proxy" = {
mode = "none";
};
"system/proxy" = {
mode = "none";
};
}

View file

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

View file

@ -1,7 +1,8 @@
{ ... }: {
"org/gnome/desktop/sound" = {
allow-volume-above-100-percent = false;
event-sounds = false;
theme-name = "freedesktop";
};
{ ... }:
{
"org/gnome/desktop/sound" = {
allow-volume-above-100-percent = false;
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";
button-layout = "appmenu:close";
focus-mode = "click"; # `click` or `sloppy`.
};
"org/gnome/desktop/wm/preferences" = {
action-middle-click-titlebar = "minimize";
action-right-click-titlebar = "menu";
button-layout = "appmenu:close";
focus-mode = "click"; # `click` or `sloppy`.
};
"org/gnome/mutter" = {
attach-modal-dialogs = true;
center-new-windows = true;
dynamic-workspaces = true;
edge-tiling = true;
workspaces-only-on-primary = true;
};
"org/gnome/mutter" = {
attach-modal-dialogs = true;
center-new-windows = true;
dynamic-workspaces = true;
edge-tiling = true;
workspaces-only-on-primary = true;
};
"org/gnome/settings-daemon/plugins/color" = with lib.gvariant; {
night-light-enabled = false;
night-light-schedule-automatic = false;
night-light-schedule-from = "0.0";
night-light-schedule-to = "0.0";
night-light-temperature = mkUint32 3700;
};
"org/gnome/settings-daemon/plugins/color" = with lib.gvariant; {
night-light-enabled = false;
night-light-schedule-automatic = false;
night-light-schedule-from = "0.0";
night-light-schedule-to = "0.0";
night-light-temperature = mkUint32 3700;
};
"org/gnome/shell/app-switcher" = {
current-workspace-only = true;
};
"org/gnome/shell/app-switcher" = {
current-workspace-only = true;
};
"org/gnome/shell/overrides" = {
edge-tiling = false;
};
"org/gnome/shell/overrides" = {
edge-tiling = false;
};
}

View file

@ -1,57 +1,59 @@
{
config,
inputs,
self,
...
} @args: let
btop = import ./btop args;
chromium = import ./chromium args;
editor = import ./editorconfig args;
foot = import ./foot args;
fuzzel = import ./fuzzel args;
git = import ./git args;
jetbrains = import ./jetbrains args;
keyd = import ./keyd args;
mako = import ./mako args;
mangohud = import ./mangohud args;
nvim = import ./nvim args;
ssh = import ./ssh args;
swappy = import ./swappy args;
sway = import ./sway args;
tmux = import ./tmux args;
waybar = import ./waybar args;
yazi = import ./yazi args;
in {
".Wallpaper".source = config.module.wallpaper.path;
".config/MangoHud/MangoHud.conf".source = mangohud.config;
".config/MangoHud/presets.conf".source = mangohud.presets;
".config/autostart".text = "";
".config/btop/btop.conf".source = btop.file;
".config/chromium/Default/Preferences".source = chromium.preferences;
".config/chromium/Local State".source = chromium.localState;
".config/foot/foot.ini".source = foot.file;
".config/fuzzel/fuzzel.ini".source = fuzzel.file;
".config/keyd/app.conf".text = keyd.text;
".config/mako/config".source = mako.file;
".config/nvim/init.vim".text = nvim.text;
".config/swappy/config".source = swappy.config;
".config/sway/config".text = sway.text;
".config/tmux/tmux.conf".text = tmux.text;
".config/waybar/config".source = waybar.config;
".config/waybar/style.css".source = waybar.style;
".config/yazi/init.lua".source = yazi.init;
".config/yazi/keymap.toml".source = yazi.keymap;
".config/yazi/theme.toml".source = yazi.theme;
".config/yazi/yazi.toml".source = yazi.yazi;
".editorconfig".source = editor.file;
".gitconfig".source = git.file;
".ideavimrc".text = jetbrains.ideavimrc;
".nix".source = self;
".nixpkgs".source = inputs.nixpkgs;
".parallel/will-cite".text = "";
".ssh/config".text = ssh.text;
".template".source = ./template;
# ".nixpkgs_master".source = inputs.nixpkgs;
# ".nixpkgs_unstable".source = inputs.nixpkgs;
# TODO: Add after migrating to stable.
config,
inputs,
self,
...
}@args:
let
btop = import ./btop args;
chromium = import ./chromium args;
editor = import ./editorconfig args;
foot = import ./foot args;
fuzzel = import ./fuzzel args;
git = import ./git args;
jetbrains = import ./jetbrains args;
keyd = import ./keyd args;
mako = import ./mako args;
mangohud = import ./mangohud args;
nvim = import ./nvim args;
ssh = import ./ssh args;
swappy = import ./swappy args;
sway = import ./sway args;
tmux = import ./tmux args;
waybar = import ./waybar args;
yazi = import ./yazi args;
in
{
".Wallpaper".source = config.module.wallpaper.path;
".config/MangoHud/MangoHud.conf".source = mangohud.config;
".config/MangoHud/presets.conf".source = mangohud.presets;
".config/autostart".text = "";
".config/btop/btop.conf".source = btop.file;
".config/chromium/Default/Preferences".source = chromium.preferences;
".config/chromium/Local State".source = chromium.localState;
".config/foot/foot.ini".source = foot.file;
".config/fuzzel/fuzzel.ini".source = fuzzel.file;
".config/keyd/app.conf".text = keyd.text;
".config/mako/config".source = mako.file;
".config/nvim/init.vim".text = nvim.text;
".config/swappy/config".source = swappy.config;
".config/sway/config".text = sway.text;
".config/tmux/tmux.conf".text = tmux.text;
".config/waybar/config".source = waybar.config;
".config/waybar/style.css".source = waybar.style;
".config/yazi/init.lua".source = yazi.init;
".config/yazi/keymap.toml".source = yazi.keymap;
".config/yazi/theme.toml".source = yazi.theme;
".config/yazi/yazi.toml".source = yazi.yazi;
".editorconfig".source = editor.file;
".gitconfig".source = git.file;
".ideavimrc".text = jetbrains.ideavimrc;
".nix".source = self;
".nixpkgs".source = inputs.nixpkgs;
".parallel/will-cite".text = "";
".ssh/config".text = ssh.text;
".template".source = ./template;
# ".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;
};
sections = {
"*" = {
charset = "utf-8";
end_of_line = "lf";
indent_size = 8;
indent_style = "tab";
insert_final_newline = false;
trim_trailing_whitespace = true;
};
"*.nix" = {
indent_size = 2;
};
"*.{lua,kt,kts,rs,py}" = {
indent_size = 4;
};
"*.md" = {
trim_trailing_whitespace = false;
};
};
};
file = (pkgs.formats.iniWithGlobalSection { }).generate "EditorconfigConfig" {
globalSection = {
root = true;
};
sections = {
"*" = {
charset = "utf-8";
end_of_line = "lf";
indent_size = 8;
indent_style = "tab";
insert_final_newline = false;
trim_trailing_whitespace = true;
};
"*.nix" = {
indent_style = "space";
indent_size = 2;
};
"*.{lua,kt,kts,rs,py}" = {
indent_size = 4;
};
"*.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,
pkgs,
...
}: let
borderSize = toString config.module.style.window.border;
dpiAware = if config.module.display.dpiAware then "yes" else "no";
fontStep = 1;
in {
file = (pkgs.formats.iniWithGlobalSection { }).generate "FootConfig" {
globalSection = {
dpi-aware = dpiAware;
font = "${config.module.style.font.monospace.name}:size=${toString config.module.style.font.size.terminal}";
# font-bold = "${config.module.style.font.monospace.name}:size=${toString config.module.style.font.size.terminal}";
font-bold-italic = "${config.module.style.font.monospace.name}:size=${toString config.module.style.font.size.terminal}";
font-italic = "${config.module.style.font.monospace.name}:size=${toString config.module.style.font.size.terminal}";
font-size-adjustment = fontStep;
pad = "${borderSize}x${borderSize} center";
};
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";
};
};
};
file = (pkgs.formats.iniWithGlobalSection { }).generate "FootConfig" {
globalSection = {
dpi-aware = dpiAware;
font = "${config.module.style.font.monospace.name}:size=${toString config.module.style.font.size.terminal}";
# font-bold = "${config.module.style.font.monospace.name}:size=${toString config.module.style.font.size.terminal}";
font-bold-italic = "${config.module.style.font.monospace.name}:size=${toString config.module.style.font.size.terminal}";
font-italic = "${config.module.style.font.monospace.name}:size=${toString config.module.style.font.size.terminal}";
font-size-adjustment = fontStep;
pad = "${borderSize}x${borderSize} center";
};
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,
config,
...
}: let
dpiAware = if config.module.display.dpiAware then "yes" else "no";
in {
file = (pkgs.formats.ini { }).generate "FuzzelConfig" {
main = {
dpi-aware = dpiAware;
font = "Minecraftia:size=${toString config.module.style.font.size.popup}";
lines = 20;
prompt = "\"\"";
show-actions = "yes";
terminal = "foot";
width = 40;
};
border = {
radius = 0;
width = 1;
};
colors = let
defaultOpacity = "ff";
in {
background = config.module.style.color.bg.dark + config.module.style.opacity.hex;
border = config.module.style.color.border + config.module.style.opacity.hex;
counter = config.module.style.color.bg.regular + defaultOpacity;
input = config.module.style.color.fg.light + defaultOpacity;
match = config.module.style.color.fg.light + defaultOpacity;
placeholder = config.module.style.color.bg.regular + defaultOpacity;
prompt = 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;
};
};
file = (pkgs.formats.ini { }).generate "FuzzelConfig" {
main = {
dpi-aware = dpiAware;
font = "Minecraftia:size=${toString config.module.style.font.size.popup}";
lines = 20;
prompt = "\"\"";
show-actions = "yes";
terminal = "foot";
width = 40;
};
border = {
radius = 0;
width = 1;
};
colors =
let
defaultOpacity = "ff";
in
{
background = config.module.style.color.bg.dark + config.module.style.opacity.hex;
border = config.module.style.color.border + config.module.style.opacity.hex;
counter = config.module.style.color.bg.regular + defaultOpacity;
input = config.module.style.color.fg.light + defaultOpacity;
match = config.module.style.color.fg.light + defaultOpacity;
placeholder = config.module.style.color.bg.regular + defaultOpacity;
prompt = 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,
pkgs,
...
}: {
file = (pkgs.formats.gitIni { listsAsDuplicateKeys = true; }).generate "GitConfig" {
gpg.format = secret.crypto.sign.git.format;
gpg.ssh.allowedSignersFile = toString secret.crypto.sign.git.allowed;
init.defaultBranch = "main";
pull.rebase = true;
push.autoSetupRemote = true;
rebase.autoStash = true;
safe.directory = "*";
user.signingkey = builtins.readFile secret.crypto.sign.git.key;
diff.algorithm = "histogram";
};
file = (pkgs.formats.gitIni { listsAsDuplicateKeys = true; }).generate "GitConfig" {
gpg.format = secret.crypto.sign.git.format;
gpg.ssh.allowedSignersFile = toString secret.crypto.sign.git.allowed;
init.defaultBranch = "main";
pull.rebase = true;
push.autoSetupRemote = true;
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 = util.trimTabs ''
" Plugins.
Plug 'tpope/vim-commentary'
Plug 'machakann/vim-highlightedyank'
" Plug 'junegunn/vim-easy-align'
ideavimrc = ''
" Plugins.
Plug 'tpope/vim-commentary'
Plug 'machakann/vim-highlightedyank'
" Plug 'junegunn/vim-easy-align'
" General config.
set scrolloff=4
set incsearch
set hlsearch
set clipboard=unnamedplus
set relativenumber
set number
" General config.
set scrolloff=4
set incsearch
set hlsearch
set clipboard=unnamedplus
set relativenumber
set number
" Space as a leader.
nnoremap <SPACE> <Nop>
let mapleader=" "
" Space as a leader.
nnoremap <SPACE> <Nop>
let mapleader=" "
" Align. ISSUE: Broken.
" vmap <Leader>a <Plug>(EasyAlign)
" Align. ISSUE: Broken.
" vmap <Leader>a <Plug>(EasyAlign)
" Sort.
vmap <Leader>A :sort<cr>
'';
" Sort.
vmap <Leader>A :sort<cr>
'';
}

View file

@ -1,6 +1,4 @@
{ util, ... }@args:
{
util,
...
} @args: {
text = util.catFile (util.ls ./module) 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.
"alt.x" = "C-w"; # Close tab.
"alt.u" = "C-S-t"; # Restore closed tab.
"alt.q" = "C-pageup"; # Prev tab.
"alt.e" = "C-pagedown"; # Next tab.
"alt.Q" = "C-S-pageup"; # Move tab left.
"alt.E" = "C-S-pagedown"; # Move tab right.
"alt.a" = "A-left"; # Go back.
"alt.d" = "A-right"; # Go forward.
"alt.s" = "down"; # Scroll down.
"alt.w" = "up"; # Scroll up.
"alt.f" = "C-f"; # Find text.
"alt.N" = "S-f3"; # Find prev.
"alt.n" = "f3"; # Find next.
"alt.space" = "f6"; # Focus address bar.
"alt.r" = "C-f5"; # Full refresh.
"alt.l" = "A-S-l"; # Toggle dark mode.
"alt.enter" = "C-S-l"; # Fill password.
"alt.p" = "A-S-p"; # Toggle proxy.
"alt.j" = "A-S-j"; # Toggle js.
"alt.k" = "A-S-k"; # Block element.
"alt.b" = "A-S-b"; # Show uBlock.
};
};
file = (pkgs.formats.ini { }).generate "KeydChromiumConfig" {
"chromium-browser" = {
"alt.capslock" = "C-t"; # New tab.
"alt.x" = "C-w"; # Close tab.
"alt.u" = "C-S-t"; # Restore closed tab.
"alt.q" = "C-pageup"; # Prev tab.
"alt.e" = "C-pagedown"; # Next tab.
"alt.Q" = "C-S-pageup"; # Move tab left.
"alt.E" = "C-S-pagedown"; # Move tab right.
"alt.a" = "A-left"; # Go back.
"alt.d" = "A-right"; # Go forward.
"alt.s" = "down"; # Scroll down.
"alt.w" = "up"; # Scroll up.
"alt.f" = "C-f"; # Find text.
"alt.N" = "S-f3"; # Find prev.
"alt.n" = "f3"; # Find next.
"alt.space" = "f6"; # Focus address bar.
"alt.r" = "C-f5"; # Full refresh.
"alt.l" = "A-S-l"; # Toggle dark mode.
"alt.enter" = "C-S-l"; # Fill password.
"alt.p" = "A-S-p"; # Toggle proxy.
"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" = "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.2" = "macro(enter 10ms H e c k space y e s ! 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.[" = "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.a" = "macro(enter 10ms Y e s 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.d" = "macro(enter 10ms N o 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.g" = "macro(enter 10ms g g 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.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.q" = "macro(enter 10ms T h a n k s ! enter)";
"alt.r" = "macro(enter 10ms N e e d space m o r e space a m m o enter)";
"alt.s" = "macro(enter 10ms W a i t enter)";
"alt.t" = "macro(enter 10ms M a y space I space t a k e space e x t r a ? enter)";
"alt.v" = "macro(enter 10ms A F K enter)";
"alt.w" = "macro(enter 10ms r enter)";
"alt.x" = "macro(enter 10ms > space H e r e space < enter)";
"alt.z" = "macro(enter 10ms < space L e f t enter)";
leftshift = "timeout(leftcontrol, 150, leftshift)";
};
};
file = (pkgs.formats.ini { }).generate "KeydDrgConfig" {
steam-app-548430 = {
"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.2" = "macro(enter 10ms H e c k space y e s ! 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.[" =
"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.a" = "macro(enter 10ms Y e s 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.d" = "macro(enter 10ms N o 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.g" = "macro(enter 10ms g g 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.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.q" = "macro(enter 10ms T h a n k s ! enter)";
"alt.r" = "macro(enter 10ms N e e d space m o r e space a m m o enter)";
"alt.s" = "macro(enter 10ms W a i t enter)";
"alt.t" = "macro(enter 10ms M a y space I space t a k e space e x t r a ? enter)";
"alt.v" = "macro(enter 10ms A F K enter)";
"alt.w" = "macro(enter 10ms r enter)";
"alt.x" = "macro(enter 10ms > space H e r e space < enter)";
"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,
...
}: let
apps = [
"gimp"
"gimp-*"
"steam-proton"
"steam-app-*"
];
file =
let
keySets = builtins.map (key: {
name = key;
value = key;
}) keys;
keys = [
"escape"
"leftcontrol"
];
in {
file = let
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);
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.
"alt.x" = "C-w"; # Close tab.
"alt.u" = "C-S-t"; # Restore closed tab.
"alt.q" = "C-pageup"; # Prev tab.
"alt.e" = "C-pagedown"; # Next tab.
"alt.Q" = "C-S-pageup"; # Move tab left.
"alt.E" = "C-S-pagedown"; # Move tab right.
"alt.a" = "A-left"; # Go back.
"alt.d" = "A-right"; # Go forward.
"alt.s" = "down"; # Scroll down.
"alt.w" = "up"; # Scroll up.
"alt.f" = "C-f"; # Find text.
"alt.N" = "S-f3"; # Find prev.
"alt.n" = "f3"; # Find next.
"alt.space" = "f6"; # Focus address bar.
"alt.r" = "C-f5"; # Full refresh.
"alt.l" = "A-S-a"; # Toggle dark mode.
"alt.m" = "C-m"; # Toggle tab mute.
"alt.enter" = "C-S-l"; # Fill password.
};
};
file = (pkgs.formats.ini { }).generate "KeydFirefoxConfig" {
"firefox-esr" = {
"alt.capslock" = "C-t"; # New tab.
"alt.x" = "C-w"; # Close tab.
"alt.u" = "C-S-t"; # Restore closed tab.
"alt.q" = "C-pageup"; # Prev tab.
"alt.e" = "C-pagedown"; # Next tab.
"alt.Q" = "C-S-pageup"; # Move tab left.
"alt.E" = "C-S-pagedown"; # Move tab right.
"alt.a" = "A-left"; # Go back.
"alt.d" = "A-right"; # Go forward.
"alt.s" = "down"; # Scroll down.
"alt.w" = "up"; # Scroll up.
"alt.f" = "C-f"; # Find text.
"alt.N" = "S-f3"; # Find prev.
"alt.n" = "f3"; # Find next.
"alt.space" = "f6"; # Focus address bar.
"alt.r" = "C-f5"; # Full refresh.
"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.
"alt.equal" = "C-A-l"; # Reformat.
"alt.c" = "S-escape"; # Close panel.
"alt.capslock" = "C-A-S-insert"; # New scratch file.
"alt.q" = "A-left"; # Prev tab.
"alt.e" = "A-right"; # Next tab.
"alt.x" = "C-f4"; # Close tab.
"alt.f" = "C-S-f"; # Find text.
"alt.n" = "C-A-n"; # Find next.
"alt.g" = "macro(gd)"; # Go to definition.
"alt.i" = "C-i"; # Implement.
"alt.o" = "C-o"; # Override.
"alt.r" = "S-f10"; # Run.
"alt.z" = "C-f2"; # Stop app.
"alt.d" = "S-f9"; # Run debugger.
"alt.a" = "C-A-5"; # Attach debugger.
"alt.m" = "C-A-s"; # Settings.
"alt.v" = "C-q"; # Show doc under cursor.
"alt.s" = "C-S-A-t"; # Refactor selection.
file = (pkgs.formats.ini { }).generate "KeydJetbrainsConfig" {
"jetbrains-*" = {
"alt.b" = "C-f8"; # Toggle line breakpoint.
"alt.equal" = "C-A-l"; # Reformat.
"alt.c" = "S-escape"; # Close panel.
"alt.capslock" = "C-A-S-insert"; # New scratch file.
"alt.q" = "A-left"; # Prev tab.
"alt.e" = "A-right"; # Next tab.
"alt.x" = "C-f4"; # Close tab.
"alt.f" = "C-S-f"; # Find text.
"alt.n" = "C-A-n"; # Find next.
"alt.g" = "macro(gd)"; # Go to definition.
"alt.i" = "C-i"; # Implement.
"alt.o" = "C-o"; # Override.
"alt.r" = "S-f10"; # Run.
"alt.z" = "C-f2"; # Stop app.
"alt.d" = "S-f9"; # Run debugger.
"alt.a" = "C-A-5"; # Attach debugger.
"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,
config,
pkgs,
...
} @args: let
swayscript = pkgs.callPackage <package/swayscript> args;
alpha = config.module.style.opacity.hex;
color = config.module.style.color;
max = 2;
in {
file = (pkgs.formats.iniWithGlobalSection { }).generate "MakoConfig" {
globalSection = {
anchor = "top-center";
background-color = "#${color.highlight}${alpha}";
border-color = "#${color.border}${alpha}";
default-timeout = 10000;
font = "${config.module.style.font.serif.name} ${toString config.module.style.font.size.popup}";
height = 120;
icons = 0;
margin = 32;
max-history = max;
max-visible = max;
on-notify = "exec ${swayscript}/bin/swayscript notify";
text-color = "#${config.module.style.color.bg.dark}";
width = 480;
};
sections = {
"mode=dnd" = {
invisible = 1;
on-notify = "exec ${pkgs.coreutils}/bin/true";
};
};
};
__findFile,
config,
pkgs,
...
}@args:
let
swayscript = pkgs.callPackage <package/swayscript> args;
alpha = config.module.style.opacity.hex;
color = config.module.style.color;
max = 2;
in
{
file = (pkgs.formats.iniWithGlobalSection { }).generate "MakoConfig" {
globalSection = {
anchor = "top-center";
background-color = "#${color.highlight}${alpha}";
border-color = "#${color.border}${alpha}";
default-timeout = 10000;
font = "${config.module.style.font.serif.name} ${toString config.module.style.font.size.popup}";
height = 120;
icons = 0;
margin = 32;
max-history = max;
max-visible = max;
on-notify = "exec ${swayscript}/bin/swayscript notify";
text-color = "#${config.module.style.color.bg.dark}";
width = 480;
};
sections = {
"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";
fps_sampling_period = 1000;
frame_timing = 0;
preset = "0,1,2";
toggle_logging = "F2";
toggle_preset = "F1";
};
};
config = (pkgs.formats.iniWithGlobalSection { }).generate "MangoConfig" {
globalSection = {
blacklist = "example";
fps_sampling_period = 1000;
frame_timing = 0;
preset = "0,1,2";
toggle_logging = "F2";
toggle_preset = "F1";
};
};
presets = (pkgs.formats.ini { }).generate "MangoPresets" {
"preset 0" = {
no_display = 1;
};
"preset 1" = {
alpha = 1.0;
arch = 0;
background_alpha = 0.5;
battery = 1;
battery_time = 1;
benchmark_percentiles = 0;
cpu_temp = 1;
device_battery = "gamepad,mouse";
font_size = 12;
fps_sampling_period = 1000;
gpu_junction_temp = 0;
gpu_mem_temp = 1;
gpu_temp = 1;
hud_no_margin = 1;
ram = 1;
swap = 1;
throttling_status = 1;
time = 1;
vram = 1;
};
"preset 2" = {
full = 1;
};
};
presets = (pkgs.formats.ini { }).generate "MangoPresets" {
"preset 0" = {
no_display = 1;
};
"preset 1" = {
alpha = 1.0;
arch = 0;
background_alpha = 0.5;
battery = 1;
battery_time = 1;
benchmark_percentiles = 0;
cpu_temp = 1;
device_battery = "gamepad,mouse";
font_size = 12;
fps_sampling_period = 1000;
gpu_junction_temp = 0;
gpu_mem_temp = 1;
gpu_temp = 1;
hud_no_margin = 1;
ram = 1;
swap = 1;
throttling_status = 1;
time = 1;
vram = 1;
};
"preset 2" = {
full = 1;
};
};
}

View file

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

View file

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

View file

@ -1,36 +1,37 @@
{ ... }: {
text = ''
-- TODO: Add comments and separate files.
vim.opt.clipboard = "unnamedplus"
vim.opt.cursorline = false
vim.opt.fixeol = false
vim.opt.incsearch = true
vim.opt.number = true
vim.opt.scrolloff = 4
vim.opt.splitbelow = true
vim.opt.splitright = true
vim.opt.termguicolors = true
vim.opt.ttyfast = true
vim.opt.wildmode = "longest,list"
-- vim.opt.completeopt = "menuone,noselect"
{ ... }:
{
text = ''
-- TODO: Add comments and separate files.
vim.opt.clipboard = "unnamedplus"
vim.opt.cursorline = false
vim.opt.fixeol = false
vim.opt.incsearch = true
vim.opt.number = true
vim.opt.scrolloff = 4
vim.opt.splitbelow = true
vim.opt.splitright = true
vim.opt.termguicolors = true
vim.opt.ttyfast = true
vim.opt.wildmode = "longest,list"
-- vim.opt.completeopt = "menuone,noselect"
-- Disable continuing comments on newline.
vim.cmd("autocmd BufEnter * set fo-=c fo-=r fo-=o")
-- Disable continuing comments on newline.
vim.cmd("autocmd BufEnter * set fo-=c fo-=r fo-=o")
-- Disable mouse.
vim.cmd("set mouse=")
-- Disable mouse.
vim.cmd("set mouse=")
-- Disable signs for diagnostics.
vim.diagnostic.config({ signs = false })
-- Disable signs for diagnostics.
vim.diagnostic.config({ signs = false })
-- Display invisible characters.
-- vim.cmd("set list listchars=tab:>\\ ,trail:-,eol:,lead:.")
vim.cmd("set list listchars=tab:>\\ ,trail:-,lead:·")
-- Display invisible characters.
-- vim.cmd("set list listchars=tab:>\\ ,trail:-,eol:,lead:.")
vim.cmd("set list listchars=tab:>\\ ,trail:-,lead:·")
-- Relative line numbers.
vim.wo.relativenumber = true
-- Relative line numbers.
vim.wo.relativenumber = true
-- Disable swap files.
vim.opt.swapfile = false
'';
-- Disable swap files.
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,
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 {
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}
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.
${mkHighlight "Visual" selection}
${mkHighlight "PmenuSel" selection}
-- Selection.
${mkHighlight "Visual" selection}
${mkHighlight "PmenuSel" selection}
-- Transparent.
${mkHighlight "NormalFloat" transparent}
-- Transparent.
${mkHighlight "NormalFloat" transparent}
-- Border.
${mkHighlight "FloatBorder" border}
${mkHighlight "FloatTitle" border}
${mkHighlight "TelescopeBorder" border}
end
})
'';
-- Border.
${mkHighlight "FloatBorder" border}
${mkHighlight "FloatTitle" border}
${mkHighlight "TelescopeBorder" border}
end
})
'';
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,7 @@
{ ... }: {
text = ''
-- 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>")
'';
{ ... }:
{
text = ''
-- 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.maplocalleader = leader
vim.g.mapleader = leader
vim.g.maplocalleader = leader
-- Disable key press timeout.
vim.cmd("set notimeout nottimeout")
'';
-- Disable key press timeout.
vim.cmd("set notimeout nottimeout")
'';
}

View file

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

View file

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

View file

@ -1,53 +1,54 @@
{ ... }: {
text = ''
-- Base rekey function.
local function rekey(t, key, command)
vim.api.nvim_set_keymap(t, key, command, { noremap = true })
end
{ ... }:
{
text = ''
-- Base rekey function.
local function rekey(t, key, command)
vim.api.nvim_set_keymap(t, key, command, { noremap = true })
end
-- Base remap function.
local function remap(t, key, command)
vim.api.nvim_set_keymap(t, key, command, { noremap = false })
end
-- Base remap function.
local function remap(t, key, command)
vim.api.nvim_set_keymap(t, key, command, { noremap = false })
end
-- Rekey in normal mode.
function rekey_normal(key, command)
rekey("n", key, command)
end
-- Rekey in normal mode.
function rekey_normal(key, command)
rekey("n", key, command)
end
-- Rekey in input mode.
function rekey_input(key, command)
rekey("i", key, command)
end
-- Rekey in input mode.
function rekey_input(key, command)
rekey("i", key, command)
end
-- Rekey in visual mode.
function rekey_visual(key, command)
rekey("v", key, command)
end
-- Rekey in visual mode.
function rekey_visual(key, command)
rekey("v", key, command)
end
-- Rekey in terminal mode.
function rekey_terminal(key, command)
rekey("t", key, command)
end
-- Rekey in terminal mode.
function rekey_terminal(key, command)
rekey("t", key, command)
end
-- Remap in normal mode.
function remap_normal(key, command)
remap("n", key, command)
end
-- Remap in normal mode.
function remap_normal(key, command)
remap("n", key, command)
end
-- Remap in input mode.
function remap_input(key, command)
remap("i", key, command)
end
-- Remap in input mode.
function remap_input(key, command)
remap("i", key, command)
end
-- Remap in visual mode.
function remap_visual(key, command)
remap("v", key, command)
end
-- Remap in visual mode.
function remap_visual(key, command)
remap("v", key, command)
end
-- Remap in terminal mode.
function remap_terminal(key, command)
remap("t", key, command)
end
'';
-- Remap in terminal mode.
function remap_terminal(key, command)
remap("t", key, command)
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.
function bye()
pcall(vim.cmd, "wa")
vim.cmd[[qa!]]
end
{ ... }:
{
text = ''
-- Write all we can and exit. Created this to drop non-writable stuff when piping to nvim.
function bye()
pcall(vim.cmd, "wa")
vim.cmd[[qa!]]
end
-- Save everything.
rekey_normal("<C-s>", "<cmd>wa!<cr>")
rekey_input("<C-s>", "<cmd>wa!<cr>")
-- Save everything.
rekey_normal("<C-s>", "<cmd>wa!<cr>")
rekey_input("<C-s>", "<cmd>wa!<cr>")
-- Save all we can and leave.
rekey_normal("<Leader>z", "<cmd>lua bye()<cr>")
-- Save all we can and leave.
rekey_normal("<Leader>z", "<cmd>lua bye()<cr>")
-- Just leave, no saves.
rekey_normal("<Leader>Z", "<cmd>qa!<cr>")
'';
-- Just leave, no saves.
rekey_normal("<Leader>Z", "<cmd>qa!<cr>")
'';
}

View file

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

View file

@ -1,21 +1,22 @@
{ ... }: {
text = ''
function toggle_tab_width()
if vim.bo.shiftwidth == 2 then
vim.bo.shiftwidth = 4
vim.bo.tabstop = 4
vim.bo.softtabstop = 4
elseif vim.bo.shiftwidth == 4 then
vim.bo.shiftwidth = 8
vim.bo.tabstop = 8
vim.bo.softtabstop = 8
elseif vim.bo.shiftwidth == 8 then
vim.bo.shiftwidth = 2
vim.bo.tabstop = 2
vim.bo.softtabstop = 2
end
end
{ ... }:
{
text = ''
function toggle_tab_width()
if vim.bo.shiftwidth == 2 then
vim.bo.shiftwidth = 4
vim.bo.tabstop = 4
vim.bo.softtabstop = 4
elseif vim.bo.shiftwidth == 4 then
vim.bo.shiftwidth = 8
vim.bo.tabstop = 8
vim.bo.softtabstop = 8
elseif vim.bo.shiftwidth == 8 then
vim.bo.shiftwidth = 2
vim.bo.tabstop = 2
vim.bo.softtabstop = 2
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";
in {
text = ''
rekey_normal("<Leader>${mod}a", "<cmd>Telescope<cr>")
rekey_normal("<Leader>${mod}b", "<cmd>lua require('telescope.builtin').buffers()<cr>")
rekey_normal("<Leader>${mod}f", "<cmd>lua require('telescope.builtin').find_files()<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>")
'';
{ ... }:
let
mod = "f";
in
{
text = ''
rekey_normal("<Leader>${mod}a", "<cmd>Telescope<cr>")
rekey_normal("<Leader>${mod}b", "<cmd>lua require('telescope.builtin').buffers()<cr>")
rekey_normal("<Leader>${mod}f", "<cmd>lua require('telescope.builtin').find_files()<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.
rekey_normal("<Leader>4", "<cmd>terminal<cr>")
{ ... }:
{
text = ''
-- Open terminal window.
rekey_normal("<Leader>4", "<cmd>terminal<cr>")
-- Detach from terminal with Esc key.
rekey_terminal("<Esc>", "<C-\\><C-n>")
'';
-- Detach from terminal with Esc key.
rekey_terminal("<Esc>", "<C-\\><C-n>")
'';
}

View file

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

View file

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

View file

@ -1,17 +1,18 @@
{ ... }: {
text = ''
require("autoclose").setup({
keys = {
["'"] = { 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 = {} },
},
-- options = {
-- disabled_filetypes = { "text", "markdown" },
-- }
})
'';
{ ... }:
{
text = ''
require("autoclose").setup({
keys = {
["'"] = { 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 = {} },
},
-- 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({
file_glob_ignore = {},
file_regex_ignore = {},
filetype_ignore = {},
next_buffer_cmd = nil,
preserve_window_layout = { "this", "nameless" },
})
'';
{ ... }:
{
text = ''
require("close_buffers").setup({
file_glob_ignore = {},
file_regex_ignore = {},
filetype_ignore = {},
next_buffer_cmd = nil,
preserve_window_layout = { "this", "nameless" },
})
'';
}

View file

@ -1,8 +1,9 @@
{ ... }: {
text = ''
-- Ensure termguicolors is enabled if not already
vim.opt.termguicolors = true
{ ... }:
{
text = ''
-- 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