mass refactoring

This commit is contained in:
Dmitriy Kholkin 2020-08-07 23:27:49 +04:00
parent ecc84e35bd
commit 6a4ea8d180
23 changed files with 345 additions and 302 deletions

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"files.eol": "\n"
}

17
flake.lock generated
View File

@ -98,6 +98,22 @@
"type": "indirect"
}
},
"nixpkgs-mozilla": {
"flake": false,
"locked": {
"lastModified": 1594829078,
"narHash": "sha256-yRCkO499a5gucHmxgWb/QDqPt/UBTbuPURuPZ9DLmIc=",
"owner": "mozilla",
"repo": "nixpkgs-mozilla",
"rev": "efda5b357451dbb0431f983cca679ae3cd9b9829",
"type": "github"
},
"original": {
"owner": "mozilla",
"repo": "nixpkgs-mozilla",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1591633336,
@ -137,6 +153,7 @@
"materia-theme": "materia-theme",
"nix": "nix",
"nixpkgs": "nixpkgs_3",
"nixpkgs-mozilla": "nixpkgs-mozilla",
"spotify-tui": "spotify-tui",
"zsh-autosuggestions": "zsh-autosuggestions",
"zsh-nix-shell": "zsh-nix-shell",

View File

@ -33,6 +33,10 @@
url = github:Rigellute/spotify-tui;
flake = false;
};
nixpkgs-mozilla = {
url = github:mozilla/nixpkgs-mozilla;
flake = false;
};
};
# outputs = inputs@{ nixpkgs, ... }: {

View File

@ -59,51 +59,35 @@ with import ../support.nix { inherit lib config; }; {
# desktop = "gnumeric";
# };
};
home-manager.users.alukard.xdg.configFile."mimeapps.list.home".text =
with config.defaultApplications;
let
apps = builtins.mapAttrs (name: value: "${value.desktop}.desktop;") {
"text/html" = browser;
# "image/*" = { desktop = "org.kde.gwenview"; };
"application/x-bittorrent" = torrent;
"application/zip" = archive;
"application/rar" = archive;
"application/7z" = archive;
"application/*tar" = archive;
"application/x-kdenlive" = archive;
"x-scheme-handler/http" = browser;
"x-scheme-handler/https" = browser;
"x-scheme-handler/about" = browser;
"x-scheme-handler/unknown" = browser;
# "x-scheme-handler/mailto" = mail;
"application/pdf" = pdf;
# "application/pdf" = { desktop = "org.kde.okular"; };
# "application/vnd.openxmlformats-officedocument.wordprocessingml.document" =
# text_processor;
# "application/msword" = text_processor;
# "application/vnd.oasis.opendocument.text" = text_processor;
# "text/csv" = spreadsheet;
# "application/vnd.oasis.opendocument.spreadsheet" = spreadsheet;
"text/plain" = editor;
};
in genIni {
"Default Applications" = apps;
"Added Associations" = apps;
};
home-manager.users.alukard.xdg.configFile."filetypesrc".text = genIni {
EmbedSettings = {
"embed-application/*" = false;
"embed-text/*" = false;
"embed-text/plain" = false;
};
};
home-manager.users.alukard.home.activation.mimeapps = {
before = [];
after = ["linkGeneration"];
data = ''
$DRY_RUN_CMD rm -f ~/.config/mimeapps.list
$DRY_RUN_CMD cp ~/.config/mimeapps.list.home ~/.config/mimeapps.list
'';
home-manager.users.alukard.xdg.mimeApps = {
enable = true;
defaultApplications =
with config.defaultApplications;
builtins.mapAttrs (name: value:
if value ? desktop then [ "${value.desktop}.desktop" ] else value) {
"text/html" = browser;
# "image/*" = { desktop = "org.kde.gwenview"; };
"application/x-bittorrent" = torrent;
"application/zip" = archive;
"application/rar" = archive;
"application/7z" = archive;
"application/*tar" = archive;
"application/x-kdenlive" = archive;
"x-scheme-handler/http" = browser;
"x-scheme-handler/https" = browser;
"x-scheme-handler/about" = browser;
"x-scheme-handler/unknown" = browser;
# "x-scheme-handler/mailto" = mail;
"application/pdf" = pdf;
# "application/pdf" = { desktop = "org.kde.okular"; };
# "application/vnd.openxmlformats-officedocument.wordprocessingml.document" =
# text_processor;
# "application/msword" = text_processor;
# "application/vnd.oasis.opendocument.text" = text_processor;
# "text/csv" = spreadsheet;
# "application/vnd.oasis.opendocument.spreadsheet" = spreadsheet;
"text/plain" = editor;
};
};
};
}

View File

@ -0,0 +1,21 @@
{ stdenv, python3Packages, fetchFromGitHub }:
python3Packages.buildPythonApplication rec {
name = "advance-touch";
src = fetchFromGitHub {
owner = "tanrax";
repo = "terminal-AdvancedNewFile";
rev = "38481017b65e764db240c8ec3b4c8ed6faafabf9";
sha256 = "1n4wng4jhmib7zpm7vykprf24rckvh3r1b7sr2navy7ndns6vk3q";
};
propagatedBuildInputs = with python3Packages; [ click ];
meta = {
homepage = "https://github.com/tanrax/terminal-AdvancedNewFile";
description = "Add to your terminal the option to quickly create folders and files like a pro";
license = stdenv.lib.licenses.unlicense;
maintainers = with stdenv.lib.maintainers; [ alukardbf ];
};
}

View File

@ -48,6 +48,16 @@ in {
bashmount
zip
feh
# new tools
tldr
ncdu
fd
ripgrep
lnav
advance-touch
exa
vimv
# cli
ranger
youtube-dl

View File

@ -1,22 +1,6 @@
device:
{ config, lib, ... }: {
imports = [
./applications.nix
./devices.nix
./filesystems.nix
./hardware.nix
./network.nix
./packages.nix
./power.nix
./samba.nix
./secrets.nix
./services.nix
./sound
./themes.nix
./users.nix
./wireguard.nix
./xserver.nix
./applications/packages.nix
# ./workspace/barrier.nix
@ -37,5 +21,21 @@ device:
./workspace/ssh.nix
./workspace/xresources.nix
./workspace/zsh.nix
./applications.nix
./devices.nix
./filesystems.nix
./hardware.nix
./network.nix
./packages.nix
./power.nix
./samba.nix
./secrets.nix
./services.nix
./sound
./themes.nix
./users.nix
./wireguard.nix
./xserver.nix
];
}

View File

@ -1,4 +1,7 @@
{ pkgs, config, lib, inputs, ... }:
# let
# mozilla_overlay = import inputs.nixpkgs-mozilla;
# in
{
nixpkgs.overlays = [
inputs.nix.overlay
@ -15,6 +18,8 @@
xonar-fp = pkgs.callPackage ./applications/xonar-fp.nix { };
advance-touch = pkgs.callPackage ./applications/advance-touch.nix { };
# git-with-libsecret = super.git.override { withLibsecret = true; };
# spotifyd = super.spotifyd.override { withPulseAudio = true; };

View File

@ -8,21 +8,21 @@ let
type = nullOr str;
};
mkCredOption = service: extra:
mkOption {
description = "Credentials for ${service}";
type = nullOr (submodule {
options = {
user = mkOption {
type = str;
description = "Username for ${service}";
};
password = mkOption {
type = str;
description = "Password for ${service}";
};
} // extra;
});
};
mkOption {
description = "Credentials for ${service}";
type = nullOr (submodule {
options = {
user = mkOption {
type = str;
description = "Username for ${service}";
};
password = mkOption {
type = str;
description = "Password for ${service}";
};
} // extra;
});
};
in rec {
options.secrets = {
wireguard = mkOption {

View File

@ -12,9 +12,9 @@ in {
};
services.earlyoom = {
enable = device.ram < 12;
enable = device.ram < 16;
freeMemThreshold = 5;
freeSwapThreshold = 20;
freeSwapThreshold = 100;
};
# Enable zram, disable zswap
@ -32,8 +32,6 @@ in {
};
programs.dconf.enable = true;
services.accounts-daemon.enable = true;
services.avahi = {
enable = true;
# ipv6 = true;
@ -49,16 +47,18 @@ in {
services.upower.enable = true;
services.gnome3.gnome-keyring.enable = false;
virtualisation.docker.enable = device.enableVirtualisation;
virtualisation.virtualbox.host = {
virtualisation.libvirtd = {
enable = device.enableVirtualisation;
# enableHardening = false;
enableExtensionPack = false;
};
# virtualisation.virtualbox.host = {
# enable = device.enableVirtualisation;
# # enableHardening = false;
# enableExtensionPack = false;
# };
# Install cdemu for some gaming purposes
# programs.cdemu = {
# enable = true;

View File

@ -3,67 +3,77 @@ with lib;
let
colorType = types.str;
color = (name:
(mkOption {
description = "${name} color of palette";
type = colorType;
}));
(mkOption {
description = "${name} color of palette";
type = colorType;
}));
fromBase16 = { base00, base01, base02, base03, base04, base05, base06, base07
, base08, base09, base0A, base0B, base0C, base0D, base0E, base0F, ... }:
builtins.mapAttrs (_: v: "#" + v) {
bg = base00;
fg = base07;
, base08, base09, base0A, base0B, base0C, base0D, base0E, base0F, ... }:
builtins.mapAttrs (_: v: "#" + v) {
bg = base00;
fg = base07;
gray = base03;
alt = base02;
dark = base01;
gray = base03;
alt = base02;
dark = base01;
red = base08;
orange = base09;
yellow = base0A;
green = base0B;
cyan = base0C;
blue = base0D;
purple = base0E;
};
red = base08;
orange = base09;
yellow = base0A;
green = base0B;
cyan = base0C;
blue = base0D;
purple = base0E;
};
fromYAML = yaml:
builtins.fromJSON (
builtins.readFile (
pkgs.stdenv.mkDerivation {
name = "fromYAML";
phases = ["buildPhase"];
buildPhase = ''echo '${yaml}' | ${pkgs.yaml2json}/bin/yaml2json > $out'';
}
)
);
builtins.fromJSON (builtins.readFile (pkgs.stdenv.mkDerivation {
name = "fromYAML";
phases = [ "buildPhase" ];
buildPhase = "echo '${yaml}' | ${pkgs.yaml2json}/bin/yaml2json > $out";
}));
in {
options = {
themes = {
colors = mkOption {
description =
"Set of colors from which the themes for various applications will be generated";
"Set of colors from which the themes for various applications will be generated";
type = with types;
submodule {
options = {
bg = color "background";
fg = color "foreground";
gray = color "gray";
alt = color "alternative";
dark = color "darker";
blue = color "blue";
green = color "green";
red = color "red";
orange = color "orange";
yellow = color "yellow";
cyan = color "cyan";
purple = color "purple";
submodule {
options = {
bg = color "background";
fg = color "foreground";
gray = color "gray";
alt = color "alternative";
dark = color "darker";
blue = color "blue";
green = color "green";
red = color "red";
orange = color "orange";
yellow = color "yellow";
cyan = color "cyan";
purple = color "purple";
};
};
};
};
};
};
# config = {
# themes.colors = (fromBase16 (fromYAML
# (builtins.readFile "${inputs.base16-unclaimed-schemes}/irblack.yaml")))
# // {
# alt = "#001d6c";
# red = "#da1e28";
# green = "#24a148";
# orange = "#ff832b";
# yellow = "#f1c21b";
# };
# };
config = {
themes.colors = fromBase16 (fromYAML (builtins.readFile
"${inputs.base16-horizon-scheme}/horizon-dark.yaml"));
themes.colors = (fromBase16 (fromYAML
(builtins.readFile "${inputs.base16-horizon-scheme}/horizon-dark.yaml")));
};
}

View File

@ -17,6 +17,7 @@
"pulse"
"adbusers"
"input"
"libvirtd"
"vboxusers"
"smbgrp"
"cdrom"
@ -29,9 +30,28 @@
security.sudo = {
enable = true;
# extraConfig = ''
# alukard ALL = (root) NOPASSWD: /run/current-system/sw/bin/lock
# alukard ALL = (root) NOPASSWD: /run/current-system/sw/bin/lock this
# alukard ALL = (root) NOPASSWD: /run/current-system/sw/bin/nixos-rebuild switch
# '';
};
# nix.requireSignedBinaryCaches = false;
home-manager.useUserPackages = true;
systemd.services."user@" = { serviceConfig = { Restart = "always"; }; };
services.mingetty.autologinUser = "alukard";
# auto-login without greeters
# environment.loginShellInit = ''
# [[ "$(tty)" == /dev/tty? ]] && sudo /run/current-system/sw/bin/lock this
# [[ "$(tty)" == /dev/tty1 ]] && i3
# '';
# environment.systemPackages = [
# (pkgs.writeShellScriptBin "lock" ''
# if [[ "$1" == this ]]
# then args="-s"
# else args="-san"
# fi
# USER=alukard ${pkgs.vlock}/bin/vlock "$args"
# '')
# ];
}

View File

@ -1,10 +1,11 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.secrets.wireguard.${config.device};
in {
config = lib.mkIf cfg.enable {
# boot.extraModulePackages = [ config.boot.kernelPackages.wireguard ];
environment.systemPackages = [ pkgs.wireguard pkgs.wireguard-tools ];
config = mkIf cfg.enable {
boot.extraModulePackages = optional (versionOlder kernel.kernel.version "5.6") kernel.wireguard;
environment.systemPackages = [ pkgs.wireguard-tools ];
networking.firewall.checkReversePath = false;
systemd.services."wg-quick-wg0" = {
@ -21,20 +22,20 @@ in {
};
script = ''
${lib.strings.optionalString (!config.boot.isContainer) "modprobe wireguard"}
${strings.optionalString (!config.boot.isContainer) "modprobe wireguard"}
wg-quick up /root/wg0.conf
'';
postStart = lib.mkIf cfg.killswitch ''
postStart = mkIf cfg.killswitch ''
iptables -I OUTPUT ! -o wg0 -m mark ! --mark $(wg show wg0 fwmark) -m addrtype ! --dst-type LOCAL -j REJECT && ip6tables -I OUTPUT ! -o wg0 -m mark ! --mark $(wg show wg0 fwmark) -m addrtype ! --dst-type LOCAL -j REJECT
# Allow IPv4 private ip addresses
iptables -I OUTPUT -s 192.168.0.0/16 -j ACCEPT && iptables -I OUTPUT -s 172.16.0.0/12 -j ACCEPT
'';
preStop = ''
${lib.strings.optionalString (cfg.killswitch) "iptables -D OUTPUT ! -o wg0 -m mark ! --mark $(wg show wg0 fwmark) -m addrtype ! --dst-type LOCAL -j REJECT && ip6tables -D OUTPUT ! -o wg0 -m mark ! --mark $(wg show wg0 fwmark) -m addrtype ! --dst-type LOCAL -j REJECT"}
${strings.optionalString (cfg.killswitch) "iptables -D OUTPUT ! -o wg0 -m mark ! --mark $(wg show wg0 fwmark) -m addrtype ! --dst-type LOCAL -j REJECT && ip6tables -D OUTPUT ! -o wg0 -m mark ! --mark $(wg show wg0 fwmark) -m addrtype ! --dst-type LOCAL -j REJECT"}
# Delete rule thats allow IPv4 private ip addresses
${lib.strings.optionalString (cfg.killswitch) "iptables -D OUTPUT -s 192.168.0.0/16 && iptables -D OUTPUT -s 172.16.0.0/12"}
${strings.optionalString (cfg.killswitch) "iptables -D OUTPUT -s 192.168.0.0/16 && iptables -D OUTPUT -s 172.16.0.0/12"}
wg-quick down /root/wg0.conf
'';

View File

@ -1,15 +1,14 @@
{ pkgs, config, lib, ... }: {
fonts = {
fonts = with pkgs; [
terminus_font
opensans-ttf
# terminus_font
# opensans-ttf
roboto
roboto-mono
roboto-slab
fira-code
noto-fonts
noto-fonts-emoji
# hasklig
# noto-fonts
# noto-fonts-emoji
powerline-fonts
material-icons
font-awesome_4

View File

@ -44,8 +44,9 @@ in {
'';
};
})];
services.dbus.packages = with pkgs; [ gnome3.dconf ];
home-manager.users.alukard = {
home.packages = [pkgs.generated-gtk-theme];
# home.packages = [pkgs.generated-gtk-theme];
gtk = {
enable = true;
iconTheme = {
@ -57,12 +58,13 @@ in {
package = pkgs.generated-gtk-theme;
};
font = {
name = "Roboto 11";
package = pkgs.roboto;
name = "Roboto 12";
# package = pkgs.roboto;
};
gtk3.extraConfig.gtk-cursor-theme-name = "bibata_oil";
};
home.sessionVariables.GTK_THEME = "Generated";
};
environment.sessionVariables.GTK_THEME = "Generated";
environment.sessionVariables.GDK_BACKEND = "x11";
# environment.sessionVariables.GTK_THEME = "Generated";
# environment.sessionVariables.GDK_BACKEND = "x11";
}

View File

@ -2,6 +2,7 @@
let
thm = config.themes.colors;
apps = config.defaultApplications;
# lock = pkgs.writeShellScript "lock" "sudo /run/current-system/sw/bin/lock";
in {
environment.sessionVariables._JAVA_AWT_WM_NONREPARENTING = "1";
@ -17,10 +18,6 @@ in {
];
"" = [
{ class = "^Telegram"; }
{ class = "^VK"; }
{ class = "^trojita"; }
{ title = "weechat"; }
{ class = "nheko"; }
];
"" = [{ class = "cantata"; }];
};
@ -77,7 +74,7 @@ in {
smartGaps = true;
smartBorders = "on";
};
focus.mouseWarping = false;
focus.mouseWarping = true;
focus.followMouse = false;
modifier = "Mod4";
window = {
@ -92,14 +89,9 @@ in {
];
};
startup = map (a: { notification = false; } // a) [
{ command = "${pkgs.xorg.xrdb}/bin/xrdb -merge ~/.Xresources"; }
# { command = "${pkgs.xorg.xrdb}/bin/xrdb -merge ~/.Xresources"; }
{ command = "${pkgs.pywal}/bin/wal -R"; }
{ command = "${pkgs.tdesktop}/bin/telegram-desktop"; }
{ command = "${apps.term.cmd} -e spt"; }
{
command =
"${pkgs.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1";
}
{
command =
"${pkgs.keepassxc}/bin/keepassxc --keyfile=/home/alukard/.passwords.key /home/alukard/nixos-config/misc/Passwords.kdbx";
@ -109,35 +101,27 @@ in {
script = name: content: "exec ${pkgs.writeScript name content}";
workspaces = (builtins.genList (x: [ (toString x) (toString x) ]) 10)
++ [ [ "c" "" ] [ "t" "" ] [ "m" "" ] ];
# moveMouse = ''
# "sh -c 'eval `${pkgs.xdotool}/bin/xdotool \
# getactivewindow \
# getwindowgeometry --shell`; ${pkgs.xdotool}/bin/xdotool \
# mousemove \
# $((X+WIDTH/2)) $((Y+HEIGHT/2))'"'';
in ({
moveMouse = ''
exec "sh -c 'eval `${pkgs.xdotool}/bin/xdotool \
getactivewindow \
getwindowgeometry --shell`; ${pkgs.xdotool}/bin/xdotool \
mousemove \
$((X+WIDTH/2)) $((Y+HEIGHT/2))'"'';
in ({
"${modifier}+q" = "kill";
"${modifier}+w" = "exec ${apps.dmenu.cmd}";
"${modifier}+Return" = "exec ${apps.term.cmd}";
"${modifier}+e" = "exec ${apps.editor.cmd}";
"${modifier}+l" = "layout toggle all";
# "${modifier}+l" = "layout toggle all";
"${modifier}+Left" = "focus child; focus left";
"${modifier}+Right" = "focus child; focus right";
"${modifier}+Up" = "focus child; focus up";
"${modifier}+Down" = "focus child; focus down";
"${modifier}+Control+Left" = "focus parent; focus left";
"${modifier}+Control+Right" = "focus parent; focus right";
"${modifier}+Control+Up" = "focus parent; focus up";
# "${modifier}+Control+Down" = "focus parent; focus down; ${moveMouse}";
# "${modifier}+Left" = "focus child; focus left; ${moveMouse}";
# "${modifier}+Right" = "focus child; focus right; ${moveMouse}";
# "${modifier}+Up" = "focus child; focus up; ${moveMouse}";
# "${modifier}+Down" = "focus child; focus down; ${moveMouse}";
# "${modifier}+Control+Left" = "focus parent; focus left; ${moveMouse}";
# "${modifier}+Control+Right" = "focus parent; focus right; ${moveMouse}";
# "${modifier}+Control+Up" = "focus parent; focus up; ${moveMouse}";
# "${modifier}+Control+Down" = "focus parent; focus down; ${moveMouse}";
"${modifier}+Left" = "focus child; focus left; ${moveMouse}";
"${modifier}+Right" = "focus child; focus right; ${moveMouse}";
"${modifier}+Up" = "focus child; focus up; ${moveMouse}";
"${modifier}+Down" = "focus child; focus down; ${moveMouse}";
"${modifier}+Control+Left" = "focus parent; focus left; ${moveMouse}";
"${modifier}+Control+Right" = "focus parent; focus right; ${moveMouse}";
"${modifier}+Control+Up" = "focus parent; focus up; ${moveMouse}";
"${modifier}+Control+Down" = "focus parent; focus down; ${moveMouse}";
"${modifier}+Shift+Up" = "move up";
"${modifier}+Shift+Down" = "move down";
"${modifier}+Shift+Right" = "move right";
@ -146,10 +130,13 @@ in {
"${modifier}+f" = "fullscreen toggle";
"${modifier}+r" = "mode resize";
"${modifier}+Shift+f" = "floating toggle";
"${modifier}+j" = "focus mode_toggle";
"${modifier}+Escape" = "exec ${apps.monitor.cmd}";
"${modifier}+j" = "exec ${pkgs.playerctl}/bin/playerctl previous";
"${modifier}+k" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
"${modifier}+l" = "exec ${pkgs.playerctl}/bin/playerctl next";
"${modifier}+d" = "exec ${apps.fm.cmd}";
"${modifier}+Escape" = "exec ${apps.monitor.cmd}";
"${modifier}+y" = "exec ${pkgs.youtube-to-mpv}/bin/yt-mpv";
"${modifier}+Shift+y" = "exec ${pkgs.youtube-to-mpv}/bin/yt-mpv --no-video";
@ -165,7 +152,6 @@ in {
"${pkgs.maim}/bin/maim -s | xclip -selection clipboard -t image/png";
"${modifier}+x" = "move workspace to output right";
"${modifier}+k" = "exec '${pkgs.xorg.xkill}/bin/xkill'";
"${modifier}+F5" = "reload";
"${modifier}+Shift+F5" = "exit";
"${modifier}+Shift+h" = "layout splith";
@ -176,6 +162,7 @@ in {
"${modifier}+F2" = "scratchpad show";
"${modifier}+F11" = "output * dpms off";
"${modifier}+F12" = "output * dpms on";
# "${modifier}+End" = "exec ${lock}";
"XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
"XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next";
@ -198,6 +185,9 @@ in {
workspaceLayout = "tabbed";
};
extraConfig = ''
default_border pixel 1
hide_edge_borders --i3 smart
set_from_resource $bg i3wm.background "{background}"
set_from_resource $fg i3wm.foreground "{foreground}"
set_from_resource $dark i3wm.color0 "{color0}"

View File

@ -1,54 +0,0 @@
#!/usr/bin/env nix-shell
#!nix-shell -p perlPackages.AnyEvent perlPackages.AnyEventI3 perl -i perl
# vim:ts=4:sw=4:expandtab
# © 2012 Michael Stapelberg
# Licensed under BSD license, see https://github.com/i3/i3/blob/next/LICENSE
#
# Append this line to your i3 config file:
# exec_always ~/per-workspace-layout.pl
#
# Then, change the %layouts hash like you want your workspaces to be set up.
# This script requires i3 >= v4.4 for the extended workspace event.
use strict;
use warnings;
use AnyEvent;
use AnyEvent::I3;
use v5.10;
use utf8;
my %layouts = (
'' => 'tabbed',
'' => 'tabbed',
);
my $i3 = i3();
die "Could not connect to i3: $!" unless $i3->connect->recv();
die "Could not subscribe to the workspace event: $!" unless
$i3->subscribe({
workspace => sub {
my ($msg) = @_;
return unless $msg->{change} eq 'focus';
die "Your version of i3 is too old. You need >= v4.4"
unless exists($msg->{current});
my $ws = $msg->{current};
my $name = $ws->{name};
my $con_id = $ws->{id};
return unless exists $layouts{$name};
$i3->command(qq|[con_id="$con_id"] layout | . $layouts{$name});
},
_error => sub {
my ($msg) = @_;
say "AnyEvent::I3 error: $msg";
say "Exiting.";
exit 1;
},
})->recv->{success};
# Run forever.
AnyEvent->condvar->recv

View File

@ -1,31 +1,53 @@
{ pkgs, lib, config, ... }:
with import ../../../support.nix { inherit lib config; }; {
# services.flatpak.enable = true;
# services.flatpak.extraPortals = [pkgs.plasma5.xdg-desktop-portal-kde];
# services.dbus.packages =
# [ pkgs.plasma5.xdg-desktop-portal-kde pkgs.flatpak pkgs.firefox pkgs.systemd ];
# nixpkgs.config.firefox.enablePlasmaBrowserIntegration = true;
# home-manager.users.alukard.home.packages = [pkgs.qt5ct];
# environment.sessionVariables = {
# DESKTOP_SESSION = "kde";
# QT_XFT = "true";
# QT_SELECT = "5";
# XDG_CURRENT_DESKTOP = "KDE";
# KDE_SESSION_VERSION = "5";
# QT_SCALE_FACTOR = "1";
# QT_AUTO_SCREEN_SCALE_FACTOR = "0";
# GTK_USE_PORTAL = "1";
# DE = "kde";
# QT_QPA_PLATFORMTHEME="kde";
# };
# xdg.portal.enable = true;
# # services.flatpak.enable = true;
# xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-kde ];
# services.dbus.packages = [
# pkgs.plasma5.xdg-desktop-portal-kde
# pkgs.flatpak
# pkgs.firefox
# pkgs.systemd
# pkgs.papirus-icon-theme
# pkgs.kdeApplications.kdegraphics-thumbnailers
# pkgs.kdeFrameworks.baloo
# pkgs.kdeFrameworks.kio
# pkgs.kdeApplications.kio-extras
# pkgs.kdeApplications.dolphin-plugins
# ];
# environment.systemPackages = [
# pkgs.kdeFrameworks.baloo
# pkgs.kdeFrameworks.kio
# pkgs.kdeApplications.kio-extras
# pkgs.kdeApplications.kdegraphics-thumbnailers
# pkgs.kdeApplications.dolphin-plugins
# ];
# services.udev.packages = [
# pkgs.libmtp
# pkgs.media-player-info
# ];
environment.sessionVariables = {
# DESKTOP_SESSION = "kde";
QT_XFT = "true";
QT_SELECT = "5";
# XDG_CURRENT_DESKTOP = "KDE";
KDE_SESSION_VERSION = "5";
QT_SCALE_FACTOR = "1";
QT_AUTO_SCREEN_SCALE_FACTOR = "0";
# DE = "kde";
QT_QPA_PLATFORMTHEME = "kde";
KDEDIRS = "/run/current-system/sw:/run/current-system/sw/share/kservices5:/run/current-system/sw/share/kservicetypes5:/run/current-system/sw/share/kxmlgui5";
};
home-manager.users.alukard.xdg.configFile."kdeglobals".text = genIni {
"Colors:Button" = {
BackgroundAlternate = thmDec.dark;
BackgroundNormal = thmDec.bg;
DecorationFocus = thmDec.blue;
DecorationHover = thmDec.blue;
ForegroundActive = thmDec.blue;
ForegroundInactive = thmDec.alt;
DecorationFocus = thmDec.alt;
DecorationHover = thmDec.alt;
ForegroundActive = thmDec.alt;
ForegroundInactive = thmDec.dark;
ForegroundLink = thmDec.blue;
ForegroundNegative = thmDec.red;
ForegroundNeutral = thmDec.orange;
@ -36,22 +58,22 @@ with import ../../../support.nix { inherit lib config; }; {
"Colors:Complementary" = {
BackgroundAlternate = thmDec.dark;
BackgroundNormal = thmDec.bg;
DecorationFocus = thmDec.blue;
DecorationHover = thmDec.blue;
DecorationFocus = thmDec.alt;
DecorationHover = thmDec.alt;
ForegroundActive = thmDec.orange;
ForegroundInactive = thmDec.alt;
ForegroundInactive = thmDec.dark;
ForegroundLink = thmDec.blue;
ForegroundNegative = thmDec.red;
ForegroundNeutral = thmDec.yellow;
ForegroundNormal = thmDec.fg;
ForegroundPositive = thmDec.green;
ForegroundVisited = thmDec.blue;
ForegroundVisited = thmDec.alt;
};
"Colors:Selection" = {
BackgroundAlternate = thmDec.blue;
BackgroundNormal = thmDec.blue;
DecorationFocus = thmDec.blue;
DecorationHover = thmDec.blue;
BackgroundAlternate = thmDec.alt;
BackgroundNormal = thmDec.alt;
DecorationFocus = thmDec.alt;
DecorationHover = thmDec.alt;
ForegroundActive = thmDec.fg;
ForegroundInactive = thmDec.fg;
ForegroundLink = thmDec.blue;
@ -64,10 +86,10 @@ with import ../../../support.nix { inherit lib config; }; {
"Colors:Tooltip" = {
BackgroundAlternate = thmDec.dark;
BackgroundNormal = thmDec.bg;
DecorationFocus = thmDec.blue;
DecorationHover = thmDec.blue;
ForegroundActive = thmDec.blue;
ForegroundInactive = thmDec.alt;
DecorationFocus = thmDec.alt;
DecorationHover = thmDec.alt;
ForegroundActive = thmDec.alt;
ForegroundInactive = thmDec.dark;
ForegroundLink = thmDec.blue;
ForegroundNegative = thmDec.red;
ForegroundNeutral = thmDec.orange;
@ -78,10 +100,10 @@ with import ../../../support.nix { inherit lib config; }; {
"Colors:View" = {
BackgroundAlternate = thmDec.dark;
BackgroundNormal = thmDec.bg;
DecorationFocus = thmDec.blue;
DecorationHover = thmDec.blue;
ForegroundActive = thmDec.blue;
ForegroundInactive = thmDec.alt;
DecorationFocus = thmDec.alt;
DecorationHover = thmDec.alt;
ForegroundActive = thmDec.alt;
ForegroundInactive = thmDec.dark;
ForegroundLink = thmDec.blue;
ForegroundNegative = thmDec.red;
ForegroundNeutral = thmDec.orange;
@ -92,10 +114,10 @@ with import ../../../support.nix { inherit lib config; }; {
"Colors:Window" = {
BackgroundAlternate = thmDec.dark;
BackgroundNormal = thmDec.bg;
DecorationFocus = thmDec.blue;
DecorationHover = thmDec.blue;
ForegroundActive = thmDec.blue;
ForegroundInactive = thmDec.alt;
DecorationFocus = thmDec.alt;
DecorationHover = thmDec.alt;
ForegroundActive = thmDec.alt;
ForegroundInactive = thmDec.dark;
ForegroundLink = thmDec.blue;
ForegroundNegative = thmDec.red;
ForegroundNeutral = thmDec.orange;
@ -106,12 +128,12 @@ with import ../../../support.nix { inherit lib config; }; {
General = {
ColorScheme = "Generated";
Name = "Generated";
fixed = "Roboto Mono,11,-1,5,50,0,0,0,0,0";
font = "Roboto,11,-1,5,50,0,0,0,0,0";
menuFont = "Roboto,11,-1,5,50,0,0,0,0,0";
fixed = "IBM Plex Mono,11,-1,5,50,0,0,0,0,0";
font = "IBM Plex,11,-1,5,50,0,0,0,0,0";
menuFont = "IBM Plex,11,-1,5,50,0,0,0,0,0";
shadeSortColumn = true;
smallestReadableFont = "Roboto,8,-1,5,57,0,0,0,0,0,Medium";
toolBarFont = "Roboto,11,-1,5,50,0,0,0,0,0";
smallestReadableFont = "IBM Plex,8,-1,5,57,0,0,0,0,0,Medium";
toolBarFont = "IBM Plex,11,-1,5,50,0,0,0,0,0";
};
KDE = {
DoubleClickInterval = 400;

View File

@ -2,9 +2,13 @@
i18n.defaultLocale = "en_GB.UTF-8";
console = {
font = "cyr-sun16";
keyMap = "ruwin_cplk-UTF-8";
console.font = "cyr-sun16";
console.keyMap = "ruwin_cplk-UTF-8";
environment.sessionVariables = {
XKB_DEFAULT_LAYOUT = "us,ru";
XKB_DEFAULT_OPTIONS = "grp:win_space_toggle";
LANG = lib.mkForce "en_GB.UTF-8";
};
time.timeZone = "Europe/Volgograd";

View File

@ -5,7 +5,7 @@
VISUAL = config.defaultApplications.editor.cmd;
LESS = "-asrRix8";
NIX_AUTO_RUN = "1";
};
} // config.home-manager.users.alukard.home.sessionVariables;
services.atd.enable = true;
@ -18,7 +18,10 @@
enable = true;
userEmail = "alukard.develop@gmail.com";
userName = "Dmitriy Kholkin";
signing.key = "922DA6E758A0FE4CFAB4E4B2FD266B810DF48DF2";
signing = {
signByDefault = true;
key = "922DA6E758A0FE4CFAB4E4B2FD266B810DF48DF2";
};
extraConfig = {
core = {
editor = "code --wait";
@ -26,10 +29,7 @@
};
};
# GPG with SSH
programs.gpg = {
enable = true;
};
programs.gpg.enable = true;
services.gpg-agent = {
enable = true;
enableSshSupport = true;

View File

@ -48,10 +48,10 @@
"URxvt.keysym.Control-Left" = "\\033[1;5D";
};
home.activation.xrdb = {
after = ["linkGeneration"];
before = [];
data = "DISPLAY=:0 ${pkgs.xorg.xrdb}/bin/xrdb -merge ${config.users.users.alukard.home}/.Xresources";
};
# home.activation.xrdb = {
# after = ["linkGeneration"];
# before = [];
# data = "DISPLAY=:0 ${pkgs.xorg.xrdb}/bin/xrdb -merge ${config.users.users.alukard.home}/.Xresources";
# };
};
}

View File

@ -37,6 +37,11 @@
"wgup" = "_ systemctl start wg-quick-wg0.service";
"wgdown" = "_ systemctl stop wg-quick-wg0.service";
"show-packages" = "_ nix-store -q --references /run/current-system/sw";
"cat" = "${pkgs.bat}/bin/bat";
"nsp" = "nix-shell --run zsh -p";
"find" = "fd";
"grep" = "rg";
"mkdir" = "ad";
};
initExtra = ''
nixify() {

View File

@ -5,8 +5,8 @@ with rec {
with deviceSpecific; with themes; {
services.xserver = {
enable = true;
# enableTCP = true;
# TODO: Disable natural scrolling for external mouse
libinput = {
enable = isLaptop;
# sendEventsMode = "disabled-on-external-mouse";