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

@ -3,14 +3,14 @@
lib,
pkgs,
...
}: let
}:
let
cfg = config.module.amd.compute;
in {
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
];
hardware.graphics.extraPackages = with pkgs; [ rocmPackages.clr.icd ];
};
}

View file

@ -1,15 +1,14 @@
{
config,
lib,
...
}: let
{ 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 [
in
{
config = lib.mkIf cfg.enable (
lib.mkMerge [
{
boot.kernelModules = [ "kvm-amd" ];
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
@ -17,10 +16,9 @@ in {
(lib.mkIf cfg.powersave {
module.powersave = {
enable = true;
cpu.boost = {
inherit controlFile enableCmd disableCmd;
};
cpu.boost = { inherit controlFile enableCmd disableCmd; };
};
})
]);
]
);
}

View file

@ -1,18 +1,12 @@
{
config,
lib,
...
}: let
{ config, lib, ... }:
let
cfg = config.module.amd.gpu;
in {
in
{
config = lib.mkIf cfg.enable {
environment.variables.AMD_VULKAN_ICD = "RADV";
boot.initrd.kernelModules = [
"amdgpu"
];
services.xserver.videoDrivers = [
"amdgpu"
];
boot.initrd.kernelModules = [ "amdgpu" ];
services.xserver.videoDrivers = [ "amdgpu" ];
hardware.graphics = {
enable = true;
enable32Bit = true;

View file

@ -10,9 +10,11 @@
secret,
util,
...
}: let
}:
let
cfg = config.module.autoupdate;
in {
in
{
config = lib.mkIf cfg.enable {
programs.git = {
enable = true;
@ -23,10 +25,10 @@ in {
systemd.services.autoupdate = util.mkStaticSystemdService {
enable = true;
after = [ "network-online.target" ];
description = "Signed system auto-update.";
serviceConfig = {
Type = "oneshot";
};
serviceConfig.Type = "oneshot";
wants = [ "network-online.target" ];
path = with pkgs; [
bash
coreutils
@ -46,25 +48,17 @@ in {
};
timeout 55m make switch
'';
after = [
"network-online.target"
];
wants = [
"network-online.target"
];
};
systemd.timers.autoupdate = {
enable = true;
wantedBy = [ "timers.target" ];
timerConfig = {
OnCalendar = "hourly";
Persistent = true;
RandomizedDelaySec = 60;
Unit = "autoupdate.service";
};
wantedBy = [
"timers.target"
];
};
};
}

View file

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

View file

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

View file

@ -1,42 +1,51 @@
{
lib,
config,
...
}: let
{ lib, config, ... }:
let
cfg = config.module.display;
in {
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:
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";
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;
if rotate == 90 then
1
else if rotate == 180 then
2
else if rotate == 270 then
3
else
0;
command = if name == "tty" then
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}";
in command
command
) cfg.rotate;
module.sway.extraConfig = lib.mapAttrsToList (name: rotate:
"output ${name} transform ${toString 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

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

View file

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

View file

@ -3,25 +3,28 @@
lib,
pkgs,
...
}: let
}:
let
cfg = config.module.dpi.bypass;
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;
qnum = toString cfg.qnum;
in {
in
{
disabledModules = [ "services/networking/zapret.nix" ];
# imports = [ "${inputs.nixpkgsMaster}/nixos/modules/services/networking/zapret.nix" ];
config = lib.mkIf cfg.enable (lib.mkMerge [
config = lib.mkIf cfg.enable (
lib.mkMerge [
{
systemd.services.zapret = {
description = "DPI bypass service";
@ -73,5 +76,6 @@ in {
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,11 +1,8 @@
{
config,
lib,
util,
...
}: let
{ config, lib, ... }:
let
cfg = config.module.ftpd;
in {
in
{
config = lib.mkIf cfg.enable {
services.vsftpd = {
enable = true;
@ -18,7 +15,7 @@ in {
anonymousUserNoPassword = true;
localUsers = false;
writeEnable = true;
extraConfig = util.trimTabs ''
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
{ 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 [
in
{
boot.kernelModules = [
"kvm-intel"
];
}
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;
};
cpu.boost = { inherit controlFile enableCmd disableCmd; };
};
})
]);
]
);
}

View file

@ -3,10 +3,13 @@
lib,
pkgsUnstable,
...
}: let
}:
let
cfg = config.module.kernel;
in {
config = lib.mkIf cfg.enable (lib.mkMerge [
in
{
config = lib.mkIf cfg.enable (
lib.mkMerge [
{
boot.kernel.sysctl = {
# Allow sysrq.
@ -51,12 +54,9 @@ in {
};
})
(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

@ -3,13 +3,13 @@
lib,
pkgs,
...
}: let
}:
let
cfg = config.module.keyd;
in {
in
{
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
keyd
];
environment.systemPackages = with pkgs; [ keyd ];
services.keyd = {
enable = true;
@ -88,9 +88,7 @@ in {
# HACK: Workaround for https://github.com/NixOS/nixpkgs/issues/290161
users.groups.keyd = { };
systemd.services.keyd.serviceConfig.CapabilityBoundingSet = [
"CAP_SETGID"
];
systemd.services.keyd.serviceConfig.CapabilityBoundingSet = [ "CAP_SETGID" ];
# Debug toggle just in case I need it again.
# systemd.services.keyd.environment.KEYD_DEBUG = "1";

View file

@ -3,11 +3,12 @@
pkgsUnstable,
lib,
config,
util,
...
}: let
}:
let
cfg = config.module.ollama;
in {
in
{
config = lib.mkIf cfg.enable {
# Specify default model.
# environment.variables.OLLAMA_MODEL = cfg.primaryModel;
@ -44,7 +45,7 @@ in {
# serviceConfig = {
# Type = "simple";
# };
# script = util.trimTabs ''
# script = ''
# sleep 5
# ${lib.getExe pkgsUnstable.ollama} pull ${lib.concatStringsSep " " cfg.models}
# '';

View file

@ -4,10 +4,12 @@
lib,
pkgs,
...
} @args: let
}@args:
let
cfg = config.module.package;
package = import <package> args;
in {
in
{
config = lib.mkMerge [
# Core apps.
(lib.mkIf cfg.core {
@ -44,49 +46,45 @@ in {
services.gvfs.enable = true;
# Chromium config.
environment.etc = let
environment.etc =
let
chromium = import <home/file/chromium> args;
in {
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;
})
(lib.mkIf cfg.desktop { environment.systemPackages = package.desktop; })
# Gaming.
(lib.mkIf cfg.gaming {
programs.steam.enable = true;
environment.systemPackages = package.gaming;
hardware.graphics = let
hardware.graphics =
let
packages = with pkgs; [
dxvk
gamescope
pkgs.mangohud
vkd3d
];
in {
in
{
extraPackages = packages;
extraPackages32 = packages;
};
})
# Creativity.
(lib.mkIf cfg.creative {
environment.systemPackages = package.creative;
})
(lib.mkIf cfg.creative { environment.systemPackages = package.creative; })
# Development.
(lib.mkIf cfg.dev {
environment.systemPackages = package.dev;
})
(lib.mkIf cfg.dev { environment.systemPackages = package.dev; })
# Extras.
(lib.mkIf cfg.extra {
environment.systemPackages = package.extra;
})
(lib.mkIf cfg.extra { environment.systemPackages = package.extra; })
];
}

View file

@ -1,10 +1,8 @@
{
lib,
config,
...
}: let
{ lib, config, ... }:
let
cfg = config.module.podman;
in {
in
{
config = lib.mkIf cfg.enable {
virtualisation.podman = {
enable = true;

View file

@ -4,26 +4,24 @@
lib,
pkgs,
...
}: let
}:
let
cfg = config.module.polkit;
in {
in
{
config = lib.mkIf cfg.enable {
security.polkit.enable = true;
systemd = {
packages = with pkgs; [
polkit-kde-agent
];
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";
};
wantedBy = [
"gui-session.target"
];
};
};
};

View file

@ -4,17 +4,17 @@
lib,
pkgs,
...
}: let
}:
let
cfg = config.module.portal;
in {
in
{
config = lib.mkIf cfg.enable {
xdg.portal = {
enable = true;
wlr.enable = true;
xdgOpenUsePortal = false;
extraPortals = with pkgs; [
xdg-desktop-portal-gtk
];
extraPortals = with pkgs; [ xdg-desktop-portal-gtk ];
config.common.default = [
"gtk"
"wlr"

View file

@ -3,15 +3,15 @@
config,
lib,
pkgs,
util,
...
}: let
}:
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";
script = pkgs.writeShellScriptBin "powerlimit" (util.trimTabs ''
script = pkgs.writeShellScriptBin "powerlimit" ''
function toggle() {
if status; then
echo ${toString cfg.offMax} > ${controlFileMax}
@ -37,19 +37,16 @@
}
''${@}
'');
in {
'';
in
{
config = lib.mkIf cfg.enable {
environment.systemPackages = [
script
];
environment.systemPackages = [ script ];
systemd = {
services.powerlimit = {
enable = true;
description = "Limit battery charge";
wantedBy = [
"multi-user.target"
];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
RemainAfterExit = "yes";

View file

@ -2,12 +2,12 @@
lib,
config,
pkgs,
util,
...
}: let
}:
let
cfg = config.module.powersave;
script = pkgs.writeShellScriptBin "powersave" (util.trimTabs ''
script = pkgs.writeShellScriptBin "powersave" ''
function toggle() {
if status; then
echo ${cfg.cpu.boost.disableCmd} > ${cfg.cpu.boost.controlFile}
@ -31,19 +31,16 @@
}
''${@}
'');
in {
'';
in
{
config = lib.mkIf cfg.enable {
environment.systemPackages = [
script
];
environment.systemPackages = [ script ];
systemd = {
services.powersave-cpu = {
enable = true;
description = "disable CPU Boost";
wantedBy = [
"multi-user.target"
];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
RemainAfterExit = "yes";
@ -53,9 +50,7 @@ in {
};
# HACK: Allow user access.
tmpfiles.rules = [
"z ${cfg.cpu.boost.controlFile} 0777 - - - -"
];
tmpfiles.rules = [ "z ${cfg.cpu.boost.controlFile} 0777 - - - -" ];
};
};
}

View file

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

View file

@ -1,10 +1,8 @@
{
config,
lib,
...
}: let
{ config, lib, ... }:
let
cfg = config.module.purpose;
in {
in
{
config = lib.mkMerge [
(lib.mkIf cfg.creative {
module = {
@ -39,9 +37,7 @@ in {
};
})
(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.
@ -79,8 +75,7 @@ in {
};
})
(lib.mkIf cfg.phone {
})
(lib.mkIf cfg.phone { })
(lib.mkIf cfg.router {
module = {

View file

@ -4,25 +4,23 @@
pkgs,
secret,
...
}: let
}:
let
cfg = config.module.builder;
serverKeyPath = "/root/.nixbuilder";
serverSshPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFqr7zKGOy/2bbAQCD85Ol+NoGGtvdMbSy3jGb98jM+f"; # Use ssh-keyscan.
in {
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"
];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "oneshot";
};
path = [
pkgs.nix
];
path = [ pkgs.nix ];
script = ''
[[ -f "${serverKeyPath}/private-key" ]] && exit
mkdir ${serverKeyPath} || true
@ -46,12 +44,8 @@ in {
# 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"
];
trusted-users = [ "nixbuilder" ];
secret-key-files = [ "${serverKeyPath}/private-key" ];
};
})
@ -59,7 +53,8 @@ in {
# NOTE: Requires host public key to be present in secret.ssh.builderKeys.
nix = {
distributedBuilds = true;
buildMachines = [{
buildMachines = [
{
hostName = "nixbuilder";
maxJobs = 16;
protocol = "ssh-ng";
@ -76,30 +71,25 @@ in {
"kvm"
"nixos-test"
];
}];
settings = let
substituters = [
"ssh-ng://nixbuilder"
}
];
in {
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
];
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"
];
extraHostNames = [ "[10.0.0.1]:22143" ];
};
})
];

View file

@ -1,10 +1,8 @@
{
config,
lib,
...
}: let
{ config, lib, ... }:
let
cfg = config.module.sound;
in {
in
{
config = lib.mkIf cfg.enable {
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;

View file

@ -3,9 +3,11 @@
lib,
pkgs,
...
}: let
}:
let
cfg = config.module.sway;
in {
in
{
config = lib.mkIf cfg.enable {
services.gnome.gnome-keyring.enable = lib.mkForce false;
environment.variables.XDG_CURRENT_DESKTOP = "sway";
@ -19,13 +21,11 @@ in {
};
programs.sway = {
enable = true;
extraPackages = with pkgs; [ swaykbdd ];
wrapperFeatures = {
base = true;
gtk = true;
};
extraPackages = with pkgs; [
swaykbdd
];
};
};
}

View file

@ -2,19 +2,22 @@
config,
lib,
pkgs,
util,
...
}: let
}:
let
cfg = config.module.syncthing;
in {
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" ]; };
networking.hosts = {
"127.0.0.1" = [ "sync.local" ];
};
services.nginx.enable = true;
services.nginx.virtualHosts."sync.local".extraConfig = util.trimTabs ''
services.nginx.virtualHosts."sync.local".extraConfig = ''
location / {
allow 127.0.0.1;
deny all;
@ -23,27 +26,50 @@ in {
'';
services.syncthing = {
inherit (cfg) enable dataDir user group;
inherit (cfg)
enable
dataDir
user
group
;
openDefaultPorts = false;
systemService = true;
settings = let
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"; };
"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"; };
"dasha" = {
id = "VNRA5VH-LWNPVV4-Y2RF7FJ-446FHRQ-PET7Q4R-D3H5RT3-AUNARH5-5XYB3AT";
};
in lib.recursiveUpdate cfg.settings {
"dashaphone" = {
id = "QKGXSZC-HGAA6S5-RJJAT5Z-UPUGDAA-3GXEO6C-WHKMBUD-ESKQPZE-TZFNYA6";
};
};
in
lib.recursiveUpdate cfg.settings {
devices = myDevices // dashaDevices;
folders = let
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) {
in
lib.filterAttrs (n: v: builtins.elem config.networking.hostName v.devices) {
"save" = {
path = "${cfg.dataDir}/save";
devices = [

View file

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

View file

@ -3,9 +3,11 @@
lib,
pkgs,
...
}: let
}:
let
cfg = config.module.virtmanager;
in {
in
{
config = lib.mkIf cfg.enable {
virtualisation.libvirtd.enable = true;
programs.virt-manager.enable = true;

View file

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

View file

@ -1,10 +1,8 @@
{
config,
pkgs,
...
}: let
{ config, pkgs, ... }:
let
cfg = config.module.wayland;
in {
in
{
config = {
programs.xwayland.enable = true;
environment = {

174
flake.nix
View file

@ -38,27 +38,82 @@
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 = {
outputs =
{
home-manager,
nix-on-droid,
nixpkgs,
@ -69,7 +124,8 @@
self,
stylix,
...
} @inputs: let
}@inputs:
let
lib = nixpkgs.lib;
const = {
@ -81,19 +137,26 @@
__findFile = _: p: ./${p};
ls = path: map (f: "${path}/${f}") (
ls =
path:
map (f: "${path}/${f}") (
builtins.filter (i: builtins.readFileType "${path}/${i}" == "regular") (
builtins.attrNames (builtins.readDir path)
)
);
in {
devShells = let
in
{
devShells =
let
pkgs = nixpkgs.legacyPackages.${system};
system = "x86_64-linux";
in {
in
{
${system}.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
nixd
nixfmt-rfc-style
treefmt
];
# buildInputs = with pkgs; [ ];
@ -102,10 +165,14 @@
};
};
nixosConfigurations = let
mkHost = { system, hostname }: lib.nixosSystem {
nixosConfigurations =
let
mkHost =
{ system, hostname }:
lib.nixosSystem {
inherit system;
modules = [
modules =
[
# Make a device hostname match the one from this config.
{ networking.hostName = hostname; }
@ -125,12 +192,20 @@
++ (ls ./option)
++ (ls ./config)
++ (ls ./overlay)
++ (ls ./system)
;
specialArgs = let
++ (ls ./system);
specialArgs =
let
util = import ./lib/Util.nix { inherit lib; };
in {
inherit const __findFile inputs self poetry2nixJobber util;
in
{
inherit
const
__findFile
inputs
self
poetry2nixJobber
util
;
pkgsJobber = nixpkgsJobber.legacyPackages.${system}.pkgs;
pkgsMaster = nixpkgsMaster.legacyPackages.${system}.pkgs;
pkgsUnstable = nixpkgsUnstable.legacyPackages.${system}.pkgs;
@ -140,35 +215,50 @@
mkSystem = system: hostname: { "${hostname}" = mkHost { inherit system hostname; }; };
systems = builtins.attrNames (builtins.readDir ./host) |> map (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;
nixOnDroidConfigurations.default = let
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 {
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)
;
] ++ (ls ./option);
extraSpecialArgs = {
inherit inputs self pkgsMaster pkgsUnstable const __findFile;
inherit
inputs
self
pkgsMaster
pkgsUnstable
const
__findFile
;
secret = import ./secret { };
util = import ./lib/Util.nix { inherit lib; };
};

View file

@ -10,7 +10,8 @@
pkgsUnstable,
self,
...
} @args: let
}@args:
let
cfg = config.home.android;
android = import ./android args;
env = import ./env args;
@ -18,7 +19,8 @@
package = import <package> args;
programs = import ./program args;
stylix = import <system/Stylix.nix> args;
in {
in
{
options.home.android = {
enable = lib.mkEnableOption "the Android HM config.";
};
@ -28,14 +30,10 @@ in {
nix.extraOptions = "experimental-features = nix-command flakes";
system.stateVersion = const.droidStateVersion;
time.timeZone = const.timeZone;
terminal = {
inherit (android) font colors;
};
terminal = { inherit (android) font colors; };
home-manager.config = stylix // {
programs = with programs; core;
imports = [
inputs.stylix.homeManagerModules.stylix
];
imports = [ inputs.stylix.homeManagerModules.stylix ];
home = {
inherit (env) sessionVariables;
inherit file;

View file

@ -7,12 +7,14 @@
pkgs,
util,
...
} @args: let
}@args:
let
cfg = config.home.nixos;
env = import ./env args;
file = import ./file args;
programs = import ./program args;
in {
in
{
imports = (util.ls <user>);
options.home.nixos = {
@ -25,9 +27,13 @@ in {
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 // {
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;

View file

@ -1,10 +1,9 @@
{ config, pkgs, ... }:
{
config,
pkgs,
...
}: {
font = pkgs.runCommandNoCC "font" { } ''
cp ${pkgs.nerdfonts.override { fonts = [ "Terminus" ]; }}/share/fonts/truetype/NerdFonts/TerminessNerdFontMono-Regular.ttf $out
cp ${
pkgs.nerdfonts.override { fonts = [ "Terminus" ]; }
}/share/fonts/truetype/NerdFonts/TerminessNerdFontMono-Regular.ttf $out
'';
colors = with config.module.style.color; {

View file

@ -1,7 +1,5 @@
{ pkgs, ... }:
{
pkgs,
...
}: {
EDITOR = "nvim"; # Default text editor.
GTK_CSD = 0; # GTK apps compat.
MANGOHUD = "1"; # Enable Mangohud by default.

View file

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

View file

@ -1,8 +1,5 @@
{
pkgs,
lib,
...
}: let
{ pkgs, lib, ... }:
let
config = {
background_update = true;
base_10_sizes = true;
@ -82,18 +79,22 @@
};
mkOption = k: v: lib.generators.mkKeyValueDefault { } " = " k v;
in {
in
{
file = pkgs.writeText "BtopConfig" (
builtins.foldl' (acc: line: acc + "${line}\n") "" (
lib.mapAttrsToList (k: v: let
value = if builtins.isString v then
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
v;
in
mkOption k value
) config
)
);

View file

@ -1,8 +1,5 @@
{ pkgs, config, ... }:
{
pkgs,
config,
...
}: {
preferences = (pkgs.formats.json { }).generate "ChromiumConfig" {
name = "Work";
bookmark_bar.show_on_all_tabs = false;
@ -66,10 +63,12 @@
default_fixed_font_size = 14;
default_font_size = 17;
minimum_font_size = 16;
fonts = let
fonts =
let
mono = config.module.style.font.monospace.name;
sans = config.module.style.font.sansSerif.name;
in {
in
{
fixed.Zyyy = mono;
sansserif.Zyyy = sans;
serif.Zyyy = sans;
@ -82,17 +81,13 @@
localState = (pkgs.formats.json { }).generate "ChromiumLocalState" {
browser = {
first_run_finished = true;
enabled_labs_experiments = [
"smooth-scrolling@2"
];
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"
];
URLBlocklist = [ "darkreader.org" ];
};
}

View file

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

View file

@ -1,4 +1,5 @@
{ ... }: {
{ ... }:
{
"org/gtk/gtk4/settings/file-chooser" = {
date-format = "regular";
location-mode = "path-bar";

View file

@ -1,22 +1,26 @@
{ lib, config, ... }:
{
lib,
config,
...
}: {
"org/gnome/desktop/input-sources" = with lib.gvariant; let
"org/gnome/desktop/input-sources" =
with lib.gvariant;
let
sources = [
(mkTuple [ "xkb" "us" ])
(mkTuple [ "xkb" "ru" ])
(mkTuple [
"xkb"
"us"
])
(mkTuple [
"xkb"
"ru"
])
];
in {
in
{
inherit sources;
current = mkUint32 0;
mru-sources = sources;
per-window = false;
show-all-sources = true;
xkb-options = [
config.module.keyboard.options
];
xkb-options = [ config.module.keyboard.options ];
};
"org/gnome/desktop/peripherals/mouse" = {

View file

@ -1,6 +1,8 @@
{ ... }: let
{ ... }:
let
mod = "<Super>";
in {
in
{
"org/gnome/desktop/wm/keybindings" = {
activate-window-menu = [ "" ];
begin-move = [ "" ];

View file

@ -1,4 +1,5 @@
{ ... }: {
{ ... }:
{
"org/gnome/desktop/media-handling" = {
automount = false;
automount-open = false;

View file

@ -1,4 +1,5 @@
{ ... }: {
{ ... }:
{
"org/gnome/nautilus/icon-view" = {
default-zoom-level = "larger";
};

View file

@ -1,4 +1,5 @@
{ ... }: {
{ ... }:
{
"org/gnome/settings-daemon/plugins/power" = {
ambient-enabled = false;
idle-dim = false;

View file

@ -1,7 +1,5 @@
{ lib, ... }:
{
lib,
...
}: {
"org/gnome/desktop/privacy" = with lib.gvariant; {
disable-camera = false;
disable-microphone = false;

View file

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

View file

@ -1,4 +1,5 @@
{ ... }: {
{ ... }:
{
"org/gnome/shell" = {
disable-extension-version-validation = true;
disable-user-extensions = false;

View file

@ -1,4 +1,5 @@
{ ... }: {
{ ... }:
{
"org/gnome/software" = {
download-updates = false;
download-updates-notify = false;

View file

@ -1,4 +1,5 @@
{ ... }: {
{ ... }:
{
"org/gnome/desktop/sound" = {
allow-volume-above-100-percent = false;
event-sounds = false;

View file

@ -1,7 +1,5 @@
{ lib, ... }:
{
lib,
...
}: {
"org/gnome/desktop/wm/preferences" = {
action-middle-click-titlebar = "minimize";
action-right-click-titlebar = "menu";

View file

@ -3,7 +3,8 @@
inputs,
self,
...
} @args: let
}@args:
let
btop = import ./btop args;
chromium = import ./chromium args;
editor = import ./editorconfig args;
@ -21,7 +22,8 @@
tmux = import ./tmux args;
waybar = import ./waybar args;
yazi = import ./yazi args;
in {
in
{
".Wallpaper".source = config.module.wallpaper.path;
".config/MangoHud/MangoHud.conf".source = mangohud.config;
".config/MangoHud/presets.conf".source = mangohud.presets;

View file

@ -1,7 +1,5 @@
{ pkgs, ... }:
{
pkgs,
...
}: {
file = (pkgs.formats.iniWithGlobalSection { }).generate "EditorconfigConfig" {
globalSection = {
root = true;
@ -16,6 +14,7 @@
trim_trailing_whitespace = true;
};
"*.nix" = {
indent_style = "space";
indent_size = 2;
};
"*.{lua,kt,kts,rs,py}" = {

View file

@ -1,12 +1,10 @@
{
config,
pkgs,
...
}: let
{ config, pkgs, ... }:
let
borderSize = toString config.module.style.window.border;
dpiAware = if config.module.display.dpiAware then "yes" else "no";
fontStep = 1;
in {
in
{
file = (pkgs.formats.iniWithGlobalSection { }).generate "FootConfig" {
globalSection = {
dpi-aware = dpiAware;

View file

@ -1,10 +1,8 @@
{
pkgs,
config,
...
}: let
{ pkgs, config, ... }:
let
dpiAware = if config.module.display.dpiAware then "yes" else "no";
in {
in
{
file = (pkgs.formats.ini { }).generate "FuzzelConfig" {
main = {
dpi-aware = dpiAware;
@ -19,9 +17,11 @@ in {
radius = 0;
width = 1;
};
colors = let
colors =
let
defaultOpacity = "ff";
in {
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;

View file

@ -1,8 +1,5 @@
{ 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;

View file

@ -1,8 +1,6 @@
{ ... }:
{
util,
...
}: {
ideavimrc = util.trimTabs ''
ideavimrc = ''
" Plugins.
Plug 'tpope/vim-commentary'
Plug 'machakann/vim-highlightedyank'

View file

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

View file

@ -1,7 +1,5 @@
{ pkgs, ... }:
{
pkgs,
...
}: {
file = (pkgs.formats.ini { }).generate "KeydChromiumConfig" {
"chromium-browser" = {
"alt.capslock" = "C-t"; # New tab.

View file

@ -1,14 +1,15 @@
{ 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.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.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 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)";
@ -20,7 +21,8 @@
"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.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)";

View file

@ -1,7 +1,5 @@
{
pkgs,
...
}: let
{ pkgs, ... }:
let
apps = [
"gimp"
"gimp-*"
@ -13,8 +11,10 @@
"escape"
"leftcontrol"
];
in {
file = let
in
{
file =
let
keySets = builtins.map (key: {
name = key;
value = key;

View file

@ -1,7 +1,5 @@
{ pkgs, ... }:
{
pkgs,
...
}: {
file = (pkgs.formats.ini { }).generate "KeydFirefoxConfig" {
"firefox-esr" = {
"alt.capslock" = "C-t"; # New tab.

View file

@ -1,7 +1,5 @@
{ pkgs, ... }:
{
pkgs,
...
}: {
file = (pkgs.formats.ini { }).generate "KeydJetbrainsConfig" {
"jetbrains-*" = {
"alt.b" = "C-f8"; # Toggle line breakpoint.

View file

@ -3,12 +3,14 @@
config,
pkgs,
...
} @args: let
}@args:
let
swayscript = pkgs.callPackage <package/swayscript> args;
alpha = config.module.style.opacity.hex;
color = config.module.style.color;
max = 2;
in {
in
{
file = (pkgs.formats.iniWithGlobalSection { }).generate "MakoConfig" {
globalSection = {
anchor = "top-center";

View file

@ -1,7 +1,5 @@
{ pkgs, ... }:
{
pkgs,
...
}: {
config = (pkgs.formats.iniWithGlobalSection { }).generate "MangoConfig" {
globalSection = {
blacklist = "example";

View file

@ -3,12 +3,13 @@
pkgs,
util,
...
} @args: let
nvimRc = { runtimes, configs }: let
}@args:
let
nvimRc =
{ runtimes, configs }:
let
# Plugin paths to install.
runtimeRc = builtins.foldl' (acc: r:
acc + "set runtimepath+=${r}\n"
) "" runtimes;
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);
@ -17,7 +18,8 @@
configRc = "lua dofile(\"${config}\")";
in
runtimeRc + configRc;
in {
in
{
text = nvimRc {
runtimes = [
"~/.cache/nvim"

View file

@ -1,4 +1,5 @@
{ ... }: {
{ ... }:
{
text = ''
vim.o.autoread = true
vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "CursorHoldI", "FocusGained" }, {

View file

@ -1,4 +1,5 @@
{ ... }: {
{ ... }:
{
text = ''
-- TODO: Add comments and separate files.
vim.opt.clipboard = "unnamedplus"

View file

@ -1,10 +1,14 @@
{
config,
lib,
...
}: let
{ 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})'';
mkHighlight =
name: value:
''vim.api.nvim_set_hl(0, "${name}", ${
lib.generators.toLua {
multiline = false;
asBindings = false;
} value
})'';
bg = {
bg = "#${color.bg.regular}";
};
@ -20,7 +24,8 @@
bg = lib.generators.mkLuaInline "clear";
fg = "#${color.accent}";
};
in {
in
{
text = ''
vim.api.nvim_create_autocmd({"ColorScheme", "VimEnter"}, {
group = vim.api.nvim_create_augroup('Color', {}),

View file

@ -1,4 +1,5 @@
{ ... }: {
{ ... }:
{
text = ''
vim.opt.hlsearch = true
vim.opt.ignorecase = true

View file

@ -1,6 +1,8 @@
{ ... }: let
{ ... }:
let
indentDefault = 2;
in {
in
{
text = ''
vim.opt.autoindent = true
vim.opt.expandtab = false

View file

@ -1,4 +1,5 @@
{ ... }: {
{ ... }:
{
text = ''
-- Autocomplete.
rekey_input("<C-space>", "<C-n>")

View file

@ -1,4 +1,5 @@
{ ... }: {
{ ... }:
{
text = ''
-- New empty buffer.
remap_normal("<Leader>n", "<cmd>enew<cr>")

View file

@ -1,4 +1,5 @@
{ ... }: {
{ ... }:
{
text = ''
-- Remap ; to :.
rekey_normal(";", ":")

View file

@ -1,4 +1,5 @@
{ ... }: {
{ ... }:
{
text = ''
function toggle_contrast()
if vim.g.gruvbox_material_background == "light" then

View file

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

View file

@ -1,4 +1,5 @@
{ ... }: {
{ ... }:
{
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,4 +1,5 @@
{ ... }: {
{ ... }:
{
text = ''
leader = " "

View file

@ -1,7 +1,9 @@
{ ... }: let
{ ... }:
let
stepHorizontal = 4;
stepVertical = 2;
in {
in
{
text = ''
-- Switch windows.
rekey_normal("<Leader>a", "<C-w>h")

View file

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

View file

@ -1,4 +1,5 @@
{ ... }: {
{ ... }:
{
text = ''
-- Base rekey function.
local function rekey(t, key, command)

View file

@ -1,4 +1,5 @@
{ ... }: {
{ ... }:
{
text = ''
-- Write all we can and exit. Created this to drop non-writable stuff when piping to nvim.
function bye()

View file

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

View file

@ -1,4 +1,5 @@
{ ... }: {
{ ... }:
{
text = ''
function toggle_tab_width()
if vim.bo.shiftwidth == 2 then

View file

@ -1,6 +1,8 @@
{ ... }: let
{ ... }:
let
mod = "f";
in {
in
{
text = ''
rekey_normal("<Leader>${mod}a", "<cmd>Telescope<cr>")
rekey_normal("<Leader>${mod}b", "<cmd>lua require('telescope.builtin').buffers()<cr>")

View file

@ -1,4 +1,5 @@
{ ... }: {
{ ... }:
{
text = ''
-- Open terminal window.
rekey_normal("<Leader>4", "<cmd>terminal<cr>")

View file

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

View file

@ -1,4 +1,5 @@
{ ... }: {
{ ... }:
{
text = ''
require("mini.align").setup {
mappings = {

View file

@ -1,4 +1,5 @@
{ ... }: {
{ ... }:
{
text = ''
require("autoclose").setup({
keys = {

View file

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

View file

@ -1,4 +1,5 @@
{ ... }: {
{ ... }:
{
text = ''
require("close_buffers").setup({
file_glob_ignore = {},

View file

@ -1,4 +1,5 @@
{ ... }: {
{ ... }:
{
text = ''
-- Ensure termguicolors is enabled if not already
vim.opt.termguicolors = true

View file

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

View file

@ -1,4 +1,5 @@
{ ... }: {
{ ... }:
{
text = ''
-- Disable netrw at the very start of your init.lua.
vim.g.loaded_netrw = 1

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