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" "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": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1591633336, "lastModified": 1591633336,
@ -137,6 +153,7 @@
"materia-theme": "materia-theme", "materia-theme": "materia-theme",
"nix": "nix", "nix": "nix",
"nixpkgs": "nixpkgs_3", "nixpkgs": "nixpkgs_3",
"nixpkgs-mozilla": "nixpkgs-mozilla",
"spotify-tui": "spotify-tui", "spotify-tui": "spotify-tui",
"zsh-autosuggestions": "zsh-autosuggestions", "zsh-autosuggestions": "zsh-autosuggestions",
"zsh-nix-shell": "zsh-nix-shell", "zsh-nix-shell": "zsh-nix-shell",

View File

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

View File

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

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 bashmount
zip zip
feh feh
# new tools
tldr
ncdu
fd
ripgrep
lnav
advance-touch
exa
vimv
# cli # cli
ranger ranger
youtube-dl youtube-dl

View File

@ -1,22 +1,6 @@
device: device:
{ config, lib, ... }: { { config, lib, ... }: {
imports = [ 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 ./applications/packages.nix
# ./workspace/barrier.nix # ./workspace/barrier.nix
@ -37,5 +21,21 @@ device:
./workspace/ssh.nix ./workspace/ssh.nix
./workspace/xresources.nix ./workspace/xresources.nix
./workspace/zsh.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, ... }: { pkgs, config, lib, inputs, ... }:
# let
# mozilla_overlay = import inputs.nixpkgs-mozilla;
# in
{ {
nixpkgs.overlays = [ nixpkgs.overlays = [
inputs.nix.overlay inputs.nix.overlay
@ -15,6 +18,8 @@
xonar-fp = pkgs.callPackage ./applications/xonar-fp.nix { }; xonar-fp = pkgs.callPackage ./applications/xonar-fp.nix { };
advance-touch = pkgs.callPackage ./applications/advance-touch.nix { };
# git-with-libsecret = super.git.override { withLibsecret = true; }; # git-with-libsecret = super.git.override { withLibsecret = true; };
# spotifyd = super.spotifyd.override { withPulseAudio = true; }; # spotifyd = super.spotifyd.override { withPulseAudio = true; };

View File

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

View File

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

View File

@ -3,67 +3,77 @@ with lib;
let let
colorType = types.str; colorType = types.str;
color = (name: color = (name:
(mkOption { (mkOption {
description = "${name} color of palette"; description = "${name} color of palette";
type = colorType; type = colorType;
})); }));
fromBase16 = { base00, base01, base02, base03, base04, base05, base06, base07 fromBase16 = { base00, base01, base02, base03, base04, base05, base06, base07
, base08, base09, base0A, base0B, base0C, base0D, base0E, base0F, ... }: , base08, base09, base0A, base0B, base0C, base0D, base0E, base0F, ... }:
builtins.mapAttrs (_: v: "#" + v) { builtins.mapAttrs (_: v: "#" + v) {
bg = base00; bg = base00;
fg = base07; fg = base07;
gray = base03; gray = base03;
alt = base02; alt = base02;
dark = base01; dark = base01;
red = base08; red = base08;
orange = base09; orange = base09;
yellow = base0A; yellow = base0A;
green = base0B; green = base0B;
cyan = base0C; cyan = base0C;
blue = base0D; blue = base0D;
purple = base0E; purple = base0E;
}; };
fromYAML = yaml: fromYAML = yaml:
builtins.fromJSON ( builtins.fromJSON (builtins.readFile (pkgs.stdenv.mkDerivation {
builtins.readFile ( name = "fromYAML";
pkgs.stdenv.mkDerivation { phases = [ "buildPhase" ];
name = "fromYAML"; buildPhase = "echo '${yaml}' | ${pkgs.yaml2json}/bin/yaml2json > $out";
phases = ["buildPhase"]; }));
buildPhase = ''echo '${yaml}' | ${pkgs.yaml2json}/bin/yaml2json > $out'';
}
)
);
in { in {
options = { options = {
themes = { themes = {
colors = mkOption { colors = mkOption {
description = 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; type = with types;
submodule { submodule {
options = { options = {
bg = color "background"; bg = color "background";
fg = color "foreground"; fg = color "foreground";
gray = color "gray"; gray = color "gray";
alt = color "alternative";
dark = color "darker"; alt = color "alternative";
blue = color "blue"; dark = color "darker";
green = color "green";
red = color "red"; blue = color "blue";
orange = color "orange"; green = color "green";
yellow = color "yellow"; red = color "red";
cyan = color "cyan"; orange = color "orange";
purple = color "purple"; 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 = { config = {
themes.colors = fromBase16 (fromYAML (builtins.readFile themes.colors = (fromBase16 (fromYAML
"${inputs.base16-horizon-scheme}/horizon-dark.yaml")); (builtins.readFile "${inputs.base16-horizon-scheme}/horizon-dark.yaml")));
}; };
} }

View File

@ -17,6 +17,7 @@
"pulse" "pulse"
"adbusers" "adbusers"
"input" "input"
"libvirtd"
"vboxusers" "vboxusers"
"smbgrp" "smbgrp"
"cdrom" "cdrom"
@ -29,9 +30,28 @@
security.sudo = { security.sudo = {
enable = true; enable = true;
# extraConfig = '' # 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 # alukard ALL = (root) NOPASSWD: /run/current-system/sw/bin/nixos-rebuild switch
# ''; # '';
}; };
# nix.requireSignedBinaryCaches = false; # nix.requireSignedBinaryCaches = false;
home-manager.useUserPackages = true; 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, ... }: { config, pkgs, lib, ... }:
with lib;
let let
cfg = config.secrets.wireguard.${config.device}; cfg = config.secrets.wireguard.${config.device};
in { in {
config = lib.mkIf cfg.enable { config = mkIf cfg.enable {
# boot.extraModulePackages = [ config.boot.kernelPackages.wireguard ]; boot.extraModulePackages = optional (versionOlder kernel.kernel.version "5.6") kernel.wireguard;
environment.systemPackages = [ pkgs.wireguard pkgs.wireguard-tools ]; environment.systemPackages = [ pkgs.wireguard-tools ];
networking.firewall.checkReversePath = false; networking.firewall.checkReversePath = false;
systemd.services."wg-quick-wg0" = { systemd.services."wg-quick-wg0" = {
@ -21,20 +22,20 @@ in {
}; };
script = '' script = ''
${lib.strings.optionalString (!config.boot.isContainer) "modprobe wireguard"} ${strings.optionalString (!config.boot.isContainer) "modprobe wireguard"}
wg-quick up /root/wg0.conf 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 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 # 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 iptables -I OUTPUT -s 192.168.0.0/16 -j ACCEPT && iptables -I OUTPUT -s 172.16.0.0/12 -j ACCEPT
''; '';
preStop = '' 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 # 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 wg-quick down /root/wg0.conf
''; '';

View File

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

View File

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

View File

@ -2,6 +2,7 @@
let let
thm = config.themes.colors; thm = config.themes.colors;
apps = config.defaultApplications; apps = config.defaultApplications;
# lock = pkgs.writeShellScript "lock" "sudo /run/current-system/sw/bin/lock";
in { in {
environment.sessionVariables._JAVA_AWT_WM_NONREPARENTING = "1"; environment.sessionVariables._JAVA_AWT_WM_NONREPARENTING = "1";
@ -17,10 +18,6 @@ in {
]; ];
"" = [ "" = [
{ class = "^Telegram"; } { class = "^Telegram"; }
{ class = "^VK"; }
{ class = "^trojita"; }
{ title = "weechat"; }
{ class = "nheko"; }
]; ];
"" = [{ class = "cantata"; }]; "" = [{ class = "cantata"; }];
}; };
@ -77,7 +74,7 @@ in {
smartGaps = true; smartGaps = true;
smartBorders = "on"; smartBorders = "on";
}; };
focus.mouseWarping = false; focus.mouseWarping = true;
focus.followMouse = false; focus.followMouse = false;
modifier = "Mod4"; modifier = "Mod4";
window = { window = {
@ -92,14 +89,9 @@ in {
]; ];
}; };
startup = map (a: { notification = false; } // a) [ 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.pywal}/bin/wal -R"; }
{ command = "${pkgs.tdesktop}/bin/telegram-desktop"; } { command = "${pkgs.tdesktop}/bin/telegram-desktop"; }
{ command = "${apps.term.cmd} -e spt"; }
{
command =
"${pkgs.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1";
}
{ {
command = command =
"${pkgs.keepassxc}/bin/keepassxc --keyfile=/home/alukard/.passwords.key /home/alukard/nixos-config/misc/Passwords.kdbx"; "${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}"; script = name: content: "exec ${pkgs.writeScript name content}";
workspaces = (builtins.genList (x: [ (toString x) (toString x) ]) 10) workspaces = (builtins.genList (x: [ (toString x) (toString x) ]) 10)
++ [ [ "c" "" ] [ "t" "" ] [ "m" "" ] ]; ++ [ [ "c" "" ] [ "t" "" ] [ "m" "" ] ];
# moveMouse = '' moveMouse = ''
# "sh -c 'eval `${pkgs.xdotool}/bin/xdotool \ exec "sh -c 'eval `${pkgs.xdotool}/bin/xdotool \
# getactivewindow \ getactivewindow \
# getwindowgeometry --shell`; ${pkgs.xdotool}/bin/xdotool \ getwindowgeometry --shell`; ${pkgs.xdotool}/bin/xdotool \
# mousemove \ mousemove \
# $((X+WIDTH/2)) $((Y+HEIGHT/2))'"''; $((X+WIDTH/2)) $((Y+HEIGHT/2))'"'';
in ({ in ({
"${modifier}+q" = "kill"; "${modifier}+q" = "kill";
"${modifier}+w" = "exec ${apps.dmenu.cmd}"; "${modifier}+w" = "exec ${apps.dmenu.cmd}";
"${modifier}+Return" = "exec ${apps.term.cmd}"; "${modifier}+Return" = "exec ${apps.term.cmd}";
"${modifier}+e" = "exec ${apps.editor.cmd}"; "${modifier}+e" = "exec ${apps.editor.cmd}";
"${modifier}+l" = "layout toggle all"; # "${modifier}+l" = "layout toggle all";
"${modifier}+Left" = "focus child; focus left"; "${modifier}+Left" = "focus child; focus left; ${moveMouse}";
"${modifier}+Right" = "focus child; focus right"; "${modifier}+Right" = "focus child; focus right; ${moveMouse}";
"${modifier}+Up" = "focus child; focus up"; "${modifier}+Up" = "focus child; focus up; ${moveMouse}";
"${modifier}+Down" = "focus child; focus down"; "${modifier}+Down" = "focus child; focus down; ${moveMouse}";
"${modifier}+Control+Left" = "focus parent; focus left"; "${modifier}+Control+Left" = "focus parent; focus left; ${moveMouse}";
"${modifier}+Control+Right" = "focus parent; focus right"; "${modifier}+Control+Right" = "focus parent; focus right; ${moveMouse}";
"${modifier}+Control+Up" = "focus parent; focus up"; "${modifier}+Control+Up" = "focus parent; focus up; ${moveMouse}";
# "${modifier}+Control+Down" = "focus parent; focus down; ${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+Up" = "move up";
"${modifier}+Shift+Down" = "move down"; "${modifier}+Shift+Down" = "move down";
"${modifier}+Shift+Right" = "move right"; "${modifier}+Shift+Right" = "move right";
@ -146,10 +130,13 @@ in {
"${modifier}+f" = "fullscreen toggle"; "${modifier}+f" = "fullscreen toggle";
"${modifier}+r" = "mode resize"; "${modifier}+r" = "mode resize";
"${modifier}+Shift+f" = "floating toggle"; "${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}+d" = "exec ${apps.fm.cmd}";
"${modifier}+Escape" = "exec ${apps.monitor.cmd}";
"${modifier}+y" = "exec ${pkgs.youtube-to-mpv}/bin/yt-mpv"; "${modifier}+y" = "exec ${pkgs.youtube-to-mpv}/bin/yt-mpv";
"${modifier}+Shift+y" = "exec ${pkgs.youtube-to-mpv}/bin/yt-mpv --no-video"; "${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"; "${pkgs.maim}/bin/maim -s | xclip -selection clipboard -t image/png";
"${modifier}+x" = "move workspace to output right"; "${modifier}+x" = "move workspace to output right";
"${modifier}+k" = "exec '${pkgs.xorg.xkill}/bin/xkill'";
"${modifier}+F5" = "reload"; "${modifier}+F5" = "reload";
"${modifier}+Shift+F5" = "exit"; "${modifier}+Shift+F5" = "exit";
"${modifier}+Shift+h" = "layout splith"; "${modifier}+Shift+h" = "layout splith";
@ -176,6 +162,7 @@ in {
"${modifier}+F2" = "scratchpad show"; "${modifier}+F2" = "scratchpad show";
"${modifier}+F11" = "output * dpms off"; "${modifier}+F11" = "output * dpms off";
"${modifier}+F12" = "output * dpms on"; "${modifier}+F12" = "output * dpms on";
# "${modifier}+End" = "exec ${lock}";
"XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; "XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
"XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next"; "XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next";
@ -198,6 +185,9 @@ in {
workspaceLayout = "tabbed"; workspaceLayout = "tabbed";
}; };
extraConfig = '' extraConfig = ''
default_border pixel 1
hide_edge_borders --i3 smart
set_from_resource $bg i3wm.background "{background}" set_from_resource $bg i3wm.background "{background}"
set_from_resource $fg i3wm.foreground "{foreground}" set_from_resource $fg i3wm.foreground "{foreground}"
set_from_resource $dark i3wm.color0 "{color0}" 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, ... }: { pkgs, lib, config, ... }:
with import ../../../support.nix { inherit lib config; }; { with import ../../../support.nix { inherit lib config; }; {
# services.flatpak.enable = true; # xdg.portal.enable = true;
# services.flatpak.extraPortals = [pkgs.plasma5.xdg-desktop-portal-kde]; # # services.flatpak.enable = true;
# services.dbus.packages = # xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-kde ];
# [ pkgs.plasma5.xdg-desktop-portal-kde pkgs.flatpak pkgs.firefox pkgs.systemd ]; # services.dbus.packages = [
# nixpkgs.config.firefox.enablePlasmaBrowserIntegration = true; # pkgs.plasma5.xdg-desktop-portal-kde
# home-manager.users.alukard.home.packages = [pkgs.qt5ct]; # pkgs.flatpak
# environment.sessionVariables = { # pkgs.firefox
# DESKTOP_SESSION = "kde"; # pkgs.systemd
# QT_XFT = "true"; # pkgs.papirus-icon-theme
# QT_SELECT = "5"; # pkgs.kdeApplications.kdegraphics-thumbnailers
# XDG_CURRENT_DESKTOP = "KDE"; # pkgs.kdeFrameworks.baloo
# KDE_SESSION_VERSION = "5"; # pkgs.kdeFrameworks.kio
# QT_SCALE_FACTOR = "1"; # pkgs.kdeApplications.kio-extras
# QT_AUTO_SCREEN_SCALE_FACTOR = "0"; # pkgs.kdeApplications.dolphin-plugins
# GTK_USE_PORTAL = "1"; # ];
# DE = "kde"; # environment.systemPackages = [
# QT_QPA_PLATFORMTHEME="kde"; # 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 { home-manager.users.alukard.xdg.configFile."kdeglobals".text = genIni {
"Colors:Button" = { "Colors:Button" = {
BackgroundAlternate = thmDec.dark; BackgroundAlternate = thmDec.dark;
BackgroundNormal = thmDec.bg; BackgroundNormal = thmDec.bg;
DecorationFocus = thmDec.blue; DecorationFocus = thmDec.alt;
DecorationHover = thmDec.blue; DecorationHover = thmDec.alt;
ForegroundActive = thmDec.blue; ForegroundActive = thmDec.alt;
ForegroundInactive = thmDec.alt; ForegroundInactive = thmDec.dark;
ForegroundLink = thmDec.blue; ForegroundLink = thmDec.blue;
ForegroundNegative = thmDec.red; ForegroundNegative = thmDec.red;
ForegroundNeutral = thmDec.orange; ForegroundNeutral = thmDec.orange;
@ -36,22 +58,22 @@ with import ../../../support.nix { inherit lib config; }; {
"Colors:Complementary" = { "Colors:Complementary" = {
BackgroundAlternate = thmDec.dark; BackgroundAlternate = thmDec.dark;
BackgroundNormal = thmDec.bg; BackgroundNormal = thmDec.bg;
DecorationFocus = thmDec.blue; DecorationFocus = thmDec.alt;
DecorationHover = thmDec.blue; DecorationHover = thmDec.alt;
ForegroundActive = thmDec.orange; ForegroundActive = thmDec.orange;
ForegroundInactive = thmDec.alt; ForegroundInactive = thmDec.dark;
ForegroundLink = thmDec.blue; ForegroundLink = thmDec.blue;
ForegroundNegative = thmDec.red; ForegroundNegative = thmDec.red;
ForegroundNeutral = thmDec.yellow; ForegroundNeutral = thmDec.yellow;
ForegroundNormal = thmDec.fg; ForegroundNormal = thmDec.fg;
ForegroundPositive = thmDec.green; ForegroundPositive = thmDec.green;
ForegroundVisited = thmDec.blue; ForegroundVisited = thmDec.alt;
}; };
"Colors:Selection" = { "Colors:Selection" = {
BackgroundAlternate = thmDec.blue; BackgroundAlternate = thmDec.alt;
BackgroundNormal = thmDec.blue; BackgroundNormal = thmDec.alt;
DecorationFocus = thmDec.blue; DecorationFocus = thmDec.alt;
DecorationHover = thmDec.blue; DecorationHover = thmDec.alt;
ForegroundActive = thmDec.fg; ForegroundActive = thmDec.fg;
ForegroundInactive = thmDec.fg; ForegroundInactive = thmDec.fg;
ForegroundLink = thmDec.blue; ForegroundLink = thmDec.blue;
@ -64,10 +86,10 @@ with import ../../../support.nix { inherit lib config; }; {
"Colors:Tooltip" = { "Colors:Tooltip" = {
BackgroundAlternate = thmDec.dark; BackgroundAlternate = thmDec.dark;
BackgroundNormal = thmDec.bg; BackgroundNormal = thmDec.bg;
DecorationFocus = thmDec.blue; DecorationFocus = thmDec.alt;
DecorationHover = thmDec.blue; DecorationHover = thmDec.alt;
ForegroundActive = thmDec.blue; ForegroundActive = thmDec.alt;
ForegroundInactive = thmDec.alt; ForegroundInactive = thmDec.dark;
ForegroundLink = thmDec.blue; ForegroundLink = thmDec.blue;
ForegroundNegative = thmDec.red; ForegroundNegative = thmDec.red;
ForegroundNeutral = thmDec.orange; ForegroundNeutral = thmDec.orange;
@ -78,10 +100,10 @@ with import ../../../support.nix { inherit lib config; }; {
"Colors:View" = { "Colors:View" = {
BackgroundAlternate = thmDec.dark; BackgroundAlternate = thmDec.dark;
BackgroundNormal = thmDec.bg; BackgroundNormal = thmDec.bg;
DecorationFocus = thmDec.blue; DecorationFocus = thmDec.alt;
DecorationHover = thmDec.blue; DecorationHover = thmDec.alt;
ForegroundActive = thmDec.blue; ForegroundActive = thmDec.alt;
ForegroundInactive = thmDec.alt; ForegroundInactive = thmDec.dark;
ForegroundLink = thmDec.blue; ForegroundLink = thmDec.blue;
ForegroundNegative = thmDec.red; ForegroundNegative = thmDec.red;
ForegroundNeutral = thmDec.orange; ForegroundNeutral = thmDec.orange;
@ -92,10 +114,10 @@ with import ../../../support.nix { inherit lib config; }; {
"Colors:Window" = { "Colors:Window" = {
BackgroundAlternate = thmDec.dark; BackgroundAlternate = thmDec.dark;
BackgroundNormal = thmDec.bg; BackgroundNormal = thmDec.bg;
DecorationFocus = thmDec.blue; DecorationFocus = thmDec.alt;
DecorationHover = thmDec.blue; DecorationHover = thmDec.alt;
ForegroundActive = thmDec.blue; ForegroundActive = thmDec.alt;
ForegroundInactive = thmDec.alt; ForegroundInactive = thmDec.dark;
ForegroundLink = thmDec.blue; ForegroundLink = thmDec.blue;
ForegroundNegative = thmDec.red; ForegroundNegative = thmDec.red;
ForegroundNeutral = thmDec.orange; ForegroundNeutral = thmDec.orange;
@ -106,12 +128,12 @@ with import ../../../support.nix { inherit lib config; }; {
General = { General = {
ColorScheme = "Generated"; ColorScheme = "Generated";
Name = "Generated"; Name = "Generated";
fixed = "Roboto Mono,11,-1,5,50,0,0,0,0,0"; fixed = "IBM Plex Mono,11,-1,5,50,0,0,0,0,0";
font = "Roboto,11,-1,5,50,0,0,0,0,0"; font = "IBM Plex,11,-1,5,50,0,0,0,0,0";
menuFont = "Roboto,11,-1,5,50,0,0,0,0,0"; menuFont = "IBM Plex,11,-1,5,50,0,0,0,0,0";
shadeSortColumn = true; shadeSortColumn = true;
smallestReadableFont = "Roboto,8,-1,5,57,0,0,0,0,0,Medium"; smallestReadableFont = "IBM Plex,8,-1,5,57,0,0,0,0,0,Medium";
toolBarFont = "Roboto,11,-1,5,50,0,0,0,0,0"; toolBarFont = "IBM Plex,11,-1,5,50,0,0,0,0,0";
}; };
KDE = { KDE = {
DoubleClickInterval = 400; DoubleClickInterval = 400;

View File

@ -2,9 +2,13 @@
i18n.defaultLocale = "en_GB.UTF-8"; i18n.defaultLocale = "en_GB.UTF-8";
console = { console.font = "cyr-sun16";
font = "cyr-sun16"; console.keyMap = "ruwin_cplk-UTF-8";
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"; time.timeZone = "Europe/Volgograd";

View File

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

View File

@ -48,10 +48,10 @@
"URxvt.keysym.Control-Left" = "\\033[1;5D"; "URxvt.keysym.Control-Left" = "\\033[1;5D";
}; };
home.activation.xrdb = { # home.activation.xrdb = {
after = ["linkGeneration"]; # after = ["linkGeneration"];
before = []; # before = [];
data = "DISPLAY=:0 ${pkgs.xorg.xrdb}/bin/xrdb -merge ${config.users.users.alukard.home}/.Xresources"; # 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"; "wgup" = "_ systemctl start wg-quick-wg0.service";
"wgdown" = "_ systemctl stop wg-quick-wg0.service"; "wgdown" = "_ systemctl stop wg-quick-wg0.service";
"show-packages" = "_ nix-store -q --references /run/current-system/sw"; "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 = '' initExtra = ''
nixify() { nixify() {

View File

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