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

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

View file

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

16
.treefmt.toml Normal file
View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -3,25 +3,28 @@
lib, lib,
pkgs, pkgs,
... ...
}: let }:
let
cfg = config.module.dpi.bypass; cfg = config.module.dpi.bypass;
whitelist = lib.optionalString ( whitelist = lib.optionalString (
(builtins.length cfg.whitelist) != 0 (builtins.length cfg.whitelist) != 0
) "--hostlist ${pkgs.writeText "zapret-whitelist" (lib.concatStringsSep "\n" cfg.whitelist)}"; ) "--hostlist ${pkgs.writeText "zapret-whitelist" (lib.concatStringsSep "\n" cfg.whitelist)}";
blacklist = lib.optionalString ( blacklist =
(builtins.length cfg.blacklist) != 0 lib.optionalString ((builtins.length cfg.blacklist) != 0)
) "--hostlist-exclude ${pkgs.writeText "zapret-blacklist" (lib.concatStringsSep "\n" cfg.blacklist)}"; "--hostlist-exclude ${pkgs.writeText "zapret-blacklist" (lib.concatStringsSep "\n" cfg.blacklist)}";
params = lib.concatStringsSep " " cfg.params; params = lib.concatStringsSep " " cfg.params;
qnum = toString cfg.qnum; qnum = toString cfg.qnum;
in { in
{
disabledModules = [ "services/networking/zapret.nix" ]; disabledModules = [ "services/networking/zapret.nix" ];
# imports = [ "${inputs.nixpkgsMaster}/nixos/modules/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 = { systemd.services.zapret = {
description = "DPI bypass service"; 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 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, ... }:
config, let
lib,
util,
...
}: let
cfg = config.module.ftpd; cfg = config.module.ftpd;
in { in
{
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
services.vsftpd = { services.vsftpd = {
enable = true; enable = true;
@ -18,7 +15,7 @@ in {
anonymousUserNoPassword = true; anonymousUserNoPassword = true;
localUsers = false; localUsers = false;
writeEnable = true; writeEnable = true;
extraConfig = util.trimTabs '' extraConfig = ''
anon_other_write_enable=YES anon_other_write_enable=YES
''; '';
}; };

View file

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

View file

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

View file

@ -3,10 +3,13 @@
lib, lib,
pkgsUnstable, pkgsUnstable,
... ...
}: let }:
let
cfg = config.module.kernel; cfg = config.module.kernel;
in { in
config = lib.mkIf cfg.enable (lib.mkMerge [ {
config = lib.mkIf cfg.enable (
lib.mkMerge [
{ {
boot.kernel.sysctl = { boot.kernel.sysctl = {
# Allow sysrq. # Allow sysrq.
@ -51,12 +54,9 @@ in {
}; };
}) })
(lib.mkIf cfg.hotspotTtlBypass { (lib.mkIf cfg.hotspotTtlBypass { boot.kernel.sysctl."net.ipv4.ip_default_ttl" = 65; })
boot.kernel.sysctl."net.ipv4.ip_default_ttl" = 65;
})
(lib.mkIf cfg.latest { (lib.mkIf cfg.latest { boot.kernelPackages = pkgsUnstable.linuxPackages_latest; })
boot.kernelPackages = pkgsUnstable.linuxPackages_latest; ]
}) );
]);
} }

View file

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

View file

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

View file

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

View file

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

View file

@ -4,26 +4,24 @@
lib, lib,
pkgs, pkgs,
... ...
}: let }:
let
cfg = config.module.polkit; cfg = config.module.polkit;
in { in
{
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
security.polkit.enable = true; security.polkit.enable = true;
systemd = { systemd = {
packages = with pkgs; [ packages = with pkgs; [ polkit-kde-agent ];
polkit-kde-agent
];
user = { user = {
services.plasma-polkit-agent = { services.plasma-polkit-agent = {
environment.PATH = lib.mkForce null; environment.PATH = lib.mkForce null;
wantedBy = [ "gui-session.target" ];
serviceConfig = { serviceConfig = {
Restart = "always"; Restart = "always";
RestartSec = 2; RestartSec = 2;
Slice = "session.slice"; Slice = "session.slice";
}; };
wantedBy = [
"gui-session.target"
];
}; };
}; };
}; };

View file

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

View file

@ -3,15 +3,15 @@
config, config,
lib, lib,
pkgs, pkgs,
util,
... ...
}: let }:
let
cfg = config.module.powerlimit.thinkpad; cfg = config.module.powerlimit.thinkpad;
controlFileMax = "/sys/class/power_supply/BAT0/charge_control_end_threshold"; controlFileMax = "/sys/class/power_supply/BAT0/charge_control_end_threshold";
controlFileMin = "/sys/class/power_supply/BAT0/charge_control_start_threshold"; controlFileMin = "/sys/class/power_supply/BAT0/charge_control_start_threshold";
script = pkgs.writeShellScriptBin "powerlimit" (util.trimTabs '' script = pkgs.writeShellScriptBin "powerlimit" ''
function toggle() { function toggle() {
if status; then if status; then
echo ${toString cfg.offMax} > ${controlFileMax} echo ${toString cfg.offMax} > ${controlFileMax}
@ -37,19 +37,16 @@
} }
''${@} ''${@}
''); '';
in { in
{
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
environment.systemPackages = [ environment.systemPackages = [ script ];
script
];
systemd = { systemd = {
services.powerlimit = { services.powerlimit = {
enable = true; enable = true;
description = "Limit battery charge"; description = "Limit battery charge";
wantedBy = [ wantedBy = [ "multi-user.target" ];
"multi-user.target"
];
serviceConfig = { serviceConfig = {
Type = "simple"; Type = "simple";
RemainAfterExit = "yes"; RemainAfterExit = "yes";

View file

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

View file

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

View file

@ -1,10 +1,8 @@
{ { config, lib, ... }:
config, let
lib,
...
}: let
cfg = config.module.purpose; cfg = config.module.purpose;
in { in
{
config = lib.mkMerge [ config = lib.mkMerge [
(lib.mkIf cfg.creative { (lib.mkIf cfg.creative {
module = { module = {
@ -39,9 +37,7 @@ in {
}; };
}) })
(lib.mkIf cfg.gaming { (lib.mkIf cfg.gaming { module.package.gaming = true; })
module.package.gaming = true;
})
(lib.mkIf cfg.laptop { (lib.mkIf cfg.laptop {
services.tlp.enable = true; # Automatic powersaving based on Pluged/AC states. services.tlp.enable = true; # Automatic powersaving based on Pluged/AC states.
@ -79,8 +75,7 @@ in {
}; };
}) })
(lib.mkIf cfg.phone { (lib.mkIf cfg.phone { })
})
(lib.mkIf cfg.router { (lib.mkIf cfg.router {
module = { module = {

View file

@ -4,25 +4,23 @@
pkgs, pkgs,
secret, secret,
... ...
}: let }:
let
cfg = config.module.builder; cfg = config.module.builder;
serverKeyPath = "/root/.nixbuilder"; serverKeyPath = "/root/.nixbuilder";
serverSshPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFqr7zKGOy/2bbAQCD85Ol+NoGGtvdMbSy3jGb98jM+f"; # Use ssh-keyscan. serverSshPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFqr7zKGOy/2bbAQCD85Ol+NoGGtvdMbSy3jGb98jM+f"; # Use ssh-keyscan.
in { in
{
config = lib.mkMerge [ config = lib.mkMerge [
(lib.mkIf cfg.server.enable { (lib.mkIf cfg.server.enable {
# Service that generates new key on boot if not present. # Service that generates new key on boot if not present.
# Don't forget to add new public key to secret.ssh.buildKeys. # Don't forget to add new public key to secret.ssh.buildKeys.
systemd.services.generate-nix-cache-key = { systemd.services.generate-nix-cache-key = {
wantedBy = [ wantedBy = [ "multi-user.target" ];
"multi-user.target"
];
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
}; };
path = [ path = [ pkgs.nix ];
pkgs.nix
];
script = '' script = ''
[[ -f "${serverKeyPath}/private-key" ]] && exit [[ -f "${serverKeyPath}/private-key" ]] && exit
mkdir ${serverKeyPath} || true mkdir ${serverKeyPath} || true
@ -46,12 +44,8 @@ in {
# Sign store automatically. # Sign store automatically.
# Sign existing store with: nix store sign --all -k /path/to/secret-key-file # Sign existing store with: nix store sign --all -k /path/to/secret-key-file
nix.settings = { nix.settings = {
trusted-users = [ trusted-users = [ "nixbuilder" ];
"nixbuilder" secret-key-files = [ "${serverKeyPath}/private-key" ];
];
secret-key-files = [
"${serverKeyPath}/private-key"
];
}; };
}) })
@ -59,7 +53,8 @@ in {
# NOTE: Requires host public key to be present in secret.ssh.builderKeys. # NOTE: Requires host public key to be present in secret.ssh.builderKeys.
nix = { nix = {
distributedBuilds = true; distributedBuilds = true;
buildMachines = [{ buildMachines = [
{
hostName = "nixbuilder"; hostName = "nixbuilder";
maxJobs = 16; maxJobs = 16;
protocol = "ssh-ng"; protocol = "ssh-ng";
@ -76,30 +71,25 @@ in {
"kvm" "kvm"
"nixos-test" "nixos-test"
]; ];
}]; }
settings = let
substituters = [
"ssh-ng://nixbuilder"
]; ];
in { settings =
let
substituters = [ "ssh-ng://nixbuilder" ];
in
{
builders-use-substitutes = true; builders-use-substitutes = true;
max-jobs = 0; max-jobs = 0;
substituters = lib.mkForce substituters; substituters = lib.mkForce substituters;
trusted-substituters = substituters ++ [ trusted-substituters = substituters ++ [ "https://cache.nixos.org/" ];
"https://cache.nixos.org/" trusted-public-keys = [ secret.ssh.builderKey ];
];
trusted-public-keys = [
secret.ssh.builderKey
];
# require-sigs = false; # require-sigs = false;
# substitute = false; # substitute = false;
}; };
}; };
services.openssh.knownHosts.nixbuilder = { services.openssh.knownHosts.nixbuilder = {
publicKey = serverSshPublicKey; publicKey = serverSshPublicKey;
extraHostNames = [ extraHostNames = [ "[10.0.0.1]:22143" ];
"[10.0.0.1]:22143"
];
}; };
}) })
]; ];

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

176
flake.nix
View file

@ -38,27 +38,82 @@
nixpkgsJobber.url = "github:nixos/nixpkgs/051f920625ab5aabe37c920346e3e69d7d34400e"; nixpkgsJobber.url = "github:nixos/nixpkgs/051f920625ab5aabe37c920346e3e69d7d34400e";
poetry2nixJobber.url = "github:nix-community/poetry2nix/304f8235fb0729fd48567af34fcd1b58d18f9b95"; poetry2nixJobber.url = "github:nix-community/poetry2nix/304f8235fb0729fd48567af34fcd1b58d18f9b95";
nvimAlign = { flake = false; url = "github:echasnovski/mini.align"; }; nvimAlign = {
nvimAutoclose = { flake = false; url = "github:m4xshen/autoclose.nvim"; }; flake = false;
nvimBufferline = { flake = false; url = "github:akinsho/bufferline.nvim"; }; url = "github:echasnovski/mini.align";
nvimCloseBuffers = { flake = false; url = "github:kazhala/close-buffers.nvim"; }; };
nvimColorizer = { flake = false; url = "github:brenoprata10/nvim-highlight-colors"; }; nvimAutoclose = {
nvimDevicons = { flake = false; url = "github:nvim-tree/nvim-web-devicons"; }; flake = false;
nvimDressing = { flake = false; url = "github:stevearc/dressing.nvim"; }; url = "github:m4xshen/autoclose.nvim";
nvimGen = { flake = false; url = "github:David-Kunz/gen.nvim"; }; };
nvimGitsigns = { flake = false; url = "github:lewis6991/gitsigns.nvim"; }; nvimBufferline = {
nvimGruvboxMaterial = { flake = false; url = "github:sainnhe/gruvbox-material"; }; flake = false;
nvimIndentoMatic = { flake = false; url = "github:Darazaki/indent-o-matic"; }; url = "github:akinsho/bufferline.nvim";
nvimLspconfig = { flake = false; url = "github:neovim/nvim-lspconfig"; }; };
nvimPlenary = { flake = false; url = "github:nvim-lua/plenary.nvim"; }; nvimCloseBuffers = {
nvimTelescope = { flake = false; url = "github:nvim-telescope/telescope.nvim"; }; flake = false;
nvimTodo = { flake = false; url = "github:folke/todo-comments.nvim"; }; url = "github:kazhala/close-buffers.nvim";
nvimTree = { flake = false; url = "github:nvim-tree/nvim-tree.lua"; }; };
nvimTreesitter = { flake = false; url = "github:nvim-treesitter/nvim-treesitter"; }; nvimColorizer = {
nvimTrouble = { flake = false; url = "github:folke/trouble.nvim"; }; flake = false;
url = "github:brenoprata10/nvim-highlight-colors";
};
nvimDevicons = {
flake = false;
url = "github:nvim-tree/nvim-web-devicons";
};
nvimDressing = {
flake = false;
url = "github:stevearc/dressing.nvim";
};
nvimGen = {
flake = false;
url = "github:David-Kunz/gen.nvim";
};
nvimGitsigns = {
flake = false;
url = "github:lewis6991/gitsigns.nvim";
};
nvimGruvboxMaterial = {
flake = false;
url = "github:sainnhe/gruvbox-material";
};
nvimIndentoMatic = {
flake = false;
url = "github:Darazaki/indent-o-matic";
};
nvimLspconfig = {
flake = false;
url = "github:neovim/nvim-lspconfig";
};
nvimPlenary = {
flake = false;
url = "github:nvim-lua/plenary.nvim";
};
nvimTelescope = {
flake = false;
url = "github:nvim-telescope/telescope.nvim";
};
nvimTodo = {
flake = false;
url = "github:folke/todo-comments.nvim";
};
nvimTree = {
flake = false;
url = "github:nvim-tree/nvim-tree.lua";
};
nvimTreesitter = {
flake = false;
url = "github:nvim-treesitter/nvim-treesitter";
};
nvimTrouble = {
flake = false;
url = "github:folke/trouble.nvim";
};
}; };
outputs = { outputs =
{
home-manager, home-manager,
nix-on-droid, nix-on-droid,
nixpkgs, nixpkgs,
@ -69,7 +124,8 @@
self, self,
stylix, stylix,
... ...
} @inputs: let }@inputs:
let
lib = nixpkgs.lib; lib = nixpkgs.lib;
const = { const = {
@ -81,19 +137,26 @@
__findFile = _: p: ./${p}; __findFile = _: p: ./${p};
ls = path: map (f: "${path}/${f}") ( ls =
path:
map (f: "${path}/${f}") (
builtins.filter (i: builtins.readFileType "${path}/${i}" == "regular") ( builtins.filter (i: builtins.readFileType "${path}/${i}" == "regular") (
builtins.attrNames (builtins.readDir path) builtins.attrNames (builtins.readDir path)
) )
); );
in { in
devShells = let {
devShells =
let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
system = "x86_64-linux"; system = "x86_64-linux";
in { in
{
${system}.default = pkgs.mkShell { ${system}.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
nixd nixd
nixfmt-rfc-style
treefmt
]; ];
# buildInputs = with pkgs; [ ]; # buildInputs = with pkgs; [ ];
@ -102,10 +165,14 @@
}; };
}; };
nixosConfigurations = let nixosConfigurations =
mkHost = { system, hostname }: lib.nixosSystem { let
mkHost =
{ system, hostname }:
lib.nixosSystem {
inherit system; inherit system;
modules = [ modules =
[
# Make a device hostname match the one from this config. # Make a device hostname match the one from this config.
{ networking.hostName = hostname; } { networking.hostName = hostname; }
@ -125,12 +192,20 @@
++ (ls ./option) ++ (ls ./option)
++ (ls ./config) ++ (ls ./config)
++ (ls ./overlay) ++ (ls ./overlay)
++ (ls ./system) ++ (ls ./system);
; specialArgs =
specialArgs = let let
util = import ./lib/Util.nix { inherit lib; }; util = import ./lib/Util.nix { inherit lib; };
in { in
inherit const __findFile inputs self poetry2nixJobber util; {
inherit
const
__findFile
inputs
self
poetry2nixJobber
util
;
pkgsJobber = nixpkgsJobber.legacyPackages.${system}.pkgs; pkgsJobber = nixpkgsJobber.legacyPackages.${system}.pkgs;
pkgsMaster = nixpkgsMaster.legacyPackages.${system}.pkgs; pkgsMaster = nixpkgsMaster.legacyPackages.${system}.pkgs;
pkgsUnstable = nixpkgsUnstable.legacyPackages.${system}.pkgs; pkgsUnstable = nixpkgsUnstable.legacyPackages.${system}.pkgs;
@ -140,35 +215,50 @@
mkSystem = system: hostname: { "${hostname}" = mkHost { inherit system hostname; }; }; mkSystem = system: hostname: { "${hostname}" = mkHost { inherit system hostname; }; };
systems = builtins.attrNames (builtins.readDir ./host) |> map (system: { systems =
builtins.attrNames (builtins.readDir ./host)
|> map (system: {
inherit system; inherit system;
hosts = builtins.attrNames (builtins.readDir ./host/${system}); hosts = builtins.attrNames (builtins.readDir ./host/${system});
}); });
hosts = map (system: hosts =
map (host: { inherit host; inherit (system) system; }) system.hosts map (
) systems |> lib.foldl' (acc: h: acc ++ h) []; system:
map (host: {
inherit host;
inherit (system) system;
}) system.hosts
) systems
|> lib.foldl' (acc: h: acc ++ h) [ ];
configurations = map (cfg: mkSystem cfg.system cfg.host) hosts; configurations = map (cfg: mkSystem cfg.system cfg.host) hosts;
in in
lib.foldl' (result: cfg: result // cfg) {} configurations; lib.foldl' (result: cfg: result // cfg) { } configurations;
nixOnDroidConfigurations.default = let nixOnDroidConfigurations.default =
let
pkgs = nixpkgs.legacyPackages.${system}.pkgs; pkgs = nixpkgs.legacyPackages.${system}.pkgs;
pkgsMaster = nixpkgsMaster.legacyPackages.${system}.pkgs; pkgsMaster = nixpkgsMaster.legacyPackages.${system}.pkgs;
pkgsUnstable = nixpkgsUnstable.legacyPackages.${system}.pkgs; pkgsUnstable = nixpkgsUnstable.legacyPackages.${system}.pkgs;
system = "aarch64-linux"; system = "aarch64-linux";
in nix-on-droid.lib.nixOnDroidConfiguration { in
nix-on-droid.lib.nixOnDroidConfiguration {
inherit pkgs; inherit pkgs;
modules = [ modules = [
{ home.android.enable = true; } { home.android.enable = true; }
{ home-manager.config.stylix.autoEnable = lib.mkForce false; } { home-manager.config.stylix.autoEnable = lib.mkForce false; }
./home/Android.nix ./home/Android.nix
] ] ++ (ls ./option);
++ (ls ./option)
;
extraSpecialArgs = { extraSpecialArgs = {
inherit inputs self pkgsMaster pkgsUnstable const __findFile; inherit
inputs
self
pkgsMaster
pkgsUnstable
const
__findFile
;
secret = import ./secret { }; secret = import ./secret { };
util = import ./lib/Util.nix { inherit lib; }; util = import ./lib/Util.nix { inherit lib; };
}; };

View file

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

View file

@ -7,12 +7,14 @@
pkgs, pkgs,
util, util,
... ...
} @args: let }@args:
let
cfg = config.home.nixos; cfg = config.home.nixos;
env = import ./env args; env = import ./env args;
file = import ./file args; file = import ./file args;
programs = import ./program args; programs = import ./program args;
in { in
{
imports = (util.ls <user>); imports = (util.ls <user>);
options.home.nixos = { options.home.nixos = {
@ -25,9 +27,13 @@ in {
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home-manager = { home-manager = {
backupFileExtension = "backup-" + pkgs.lib.readFile "${pkgs.runCommand "timestamp" { } "echo -n date '+%Y%m%d%H%M%S' > $out"}"; backupFileExtension =
users = builtins.foldl' (acc: user: "backup-"
acc // { + pkgs.lib.readFile "${pkgs.runCommand "timestamp" { } "echo -n date '+%Y%m%d%H%M%S' > $out"}";
users = builtins.foldl' (
acc: user:
acc
// {
${user.username} = { ${user.username} = {
home = { home = {
inherit (const) stateVersion; inherit (const) stateVersion;

View file

@ -1,10 +1,9 @@
{ config, pkgs, ... }:
{ {
config,
pkgs,
...
}: {
font = pkgs.runCommandNoCC "font" { } '' 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; { colors = with config.module.style.color; {

View file

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

View file

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

View file

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

View file

@ -1,8 +1,5 @@
{ pkgs, config, ... }:
{ {
pkgs,
config,
...
}: {
preferences = (pkgs.formats.json { }).generate "ChromiumConfig" { preferences = (pkgs.formats.json { }).generate "ChromiumConfig" {
name = "Work"; name = "Work";
bookmark_bar.show_on_all_tabs = false; bookmark_bar.show_on_all_tabs = false;
@ -66,10 +63,12 @@
default_fixed_font_size = 14; default_fixed_font_size = 14;
default_font_size = 17; default_font_size = 17;
minimum_font_size = 16; minimum_font_size = 16;
fonts = let fonts =
let
mono = config.module.style.font.monospace.name; mono = config.module.style.font.monospace.name;
sans = config.module.style.font.sansSerif.name; sans = config.module.style.font.sansSerif.name;
in { in
{
fixed.Zyyy = mono; fixed.Zyyy = mono;
sansserif.Zyyy = sans; sansserif.Zyyy = sans;
serif.Zyyy = sans; serif.Zyyy = sans;
@ -82,17 +81,13 @@
localState = (pkgs.formats.json { }).generate "ChromiumLocalState" { localState = (pkgs.formats.json { }).generate "ChromiumLocalState" {
browser = { browser = {
first_run_finished = true; first_run_finished = true;
enabled_labs_experiments = [ enabled_labs_experiments = [ "smooth-scrolling@2" ];
"smooth-scrolling@2"
];
}; };
}; };
# REF: https://chromeenterprise.google/intl/en_us/policies/ # REF: https://chromeenterprise.google/intl/en_us/policies/
policy = (pkgs.formats.json { }).generate "ChromiumPolicy" { policy = (pkgs.formats.json { }).generate "ChromiumPolicy" {
DefaultBrowserSettingEnabled = false; DefaultBrowserSettingEnabled = false;
URLBlocklist = [ URLBlocklist = [ "darkreader.org" ];
"darkreader.org"
];
}; };
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,10 +1,8 @@
{ { pkgs, config, ... }:
pkgs, let
config,
...
}: let
dpiAware = if config.module.display.dpiAware then "yes" else "no"; dpiAware = if config.module.display.dpiAware then "yes" else "no";
in { in
{
file = (pkgs.formats.ini { }).generate "FuzzelConfig" { file = (pkgs.formats.ini { }).generate "FuzzelConfig" {
main = { main = {
dpi-aware = dpiAware; dpi-aware = dpiAware;
@ -19,9 +17,11 @@ in {
radius = 0; radius = 0;
width = 1; width = 1;
}; };
colors = let colors =
let
defaultOpacity = "ff"; defaultOpacity = "ff";
in { in
{
background = config.module.style.color.bg.dark + config.module.style.opacity.hex; background = config.module.style.color.bg.dark + config.module.style.opacity.hex;
border = config.module.style.color.border + config.module.style.opacity.hex; border = config.module.style.color.border + config.module.style.opacity.hex;
counter = config.module.style.color.bg.regular + defaultOpacity; 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" { file = (pkgs.formats.gitIni { listsAsDuplicateKeys = true; }).generate "GitConfig" {
gpg.format = secret.crypto.sign.git.format; gpg.format = secret.crypto.sign.git.format;
gpg.ssh.allowedSignersFile = toString secret.crypto.sign.git.allowed; gpg.ssh.allowedSignersFile = toString secret.crypto.sign.git.allowed;

View file

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

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

View file

@ -1,14 +1,15 @@
{ pkgs, ... }:
{ {
pkgs,
...
}: {
file = (pkgs.formats.ini { }).generate "KeydDrgConfig" { file = (pkgs.formats.ini { }).generate "KeydDrgConfig" {
steam-app-548430 = { 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.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.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.]" = "macro(enter 10ms Q ' r o n a r space S h e l l b a c k ! enter)";
"alt.a" = "macro(enter 10ms Y e s enter)"; "alt.a" = "macro(enter 10ms Y e s enter)";
"alt.b" = "macro(enter 10ms I ' m space b a c k enter)"; "alt.b" = "macro(enter 10ms I ' m space b a c k enter)";
@ -20,7 +21,8 @@
"alt.j" = "macro(enter 10ms G o o d space j o b enter)"; "alt.j" = "macro(enter 10ms G o o d space j o b enter)";
"alt.k" = "macro(enter 10ms O k a y enter)"; "alt.k" = "macro(enter 10ms O k a y enter)";
"alt.l" = "macro(enter 10ms L e a f space l o v e r enter)"; "alt.l" = "macro(enter 10ms L e a f space l o v e r enter)";
"alt.m" = "macro(enter 10ms I space r e p l y space u s i n g space m a c r o s . 10ms space U s e space s o f t w a r e space l i k e space k e y d , 10ms space o r space b u y space a space Q M K space k e y b o a r d . enter)"; "alt.m" =
"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.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.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.s" = "macro(enter 10ms W a i t enter)";

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -3,12 +3,13 @@
pkgs, pkgs,
util, util,
... ...
} @args: let }@args:
nvimRc = { runtimes, configs }: let let
nvimRc =
{ runtimes, configs }:
let
# Plugin paths to install. # Plugin paths to install.
runtimeRc = builtins.foldl' (acc: r: runtimeRc = builtins.foldl' (acc: r: acc + "set runtimepath+=${r}\n") "" runtimes;
acc + "set runtimepath+=${r}\n"
) "" runtimes;
# My configuration files combined into one big file. # My configuration files combined into one big file.
config = pkgs.writeText "nvimRc" (util.catText configs args); config = pkgs.writeText "nvimRc" (util.catText configs args);
@ -17,7 +18,8 @@
configRc = "lua dofile(\"${config}\")"; configRc = "lua dofile(\"${config}\")";
in in
runtimeRc + configRc; runtimeRc + configRc;
in { in
{
text = nvimRc { text = nvimRc {
runtimes = [ runtimes = [
"~/.cache/nvim" "~/.cache/nvim"

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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