create core branch without any profiles

This core will be used as the new base for the reuse branch, which is
essentiall the same as the existing template branch, except that it is
rebased from this core, simplifying future rebasing.
This commit is contained in:
Timothy DeHerrera 2021-02-03 18:58:58 -07:00
parent bd9878f82a
commit 40b49c52c1
No known key found for this signature in database
GPG Key ID: 8985725DB5B0C122
97 changed files with 5 additions and 3632 deletions

View File

@ -1,7 +1,7 @@
{ suites, ... }:
{
### root password is empty by default ###
imports = suites.graphics;
imports = suites.core;
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;

View File

@ -1,6 +1 @@
[
./services/torrent/qbittorrent.nix
./security/mitigations.nix
./services/hardware/wii-u-gc-adapter.nix
./services/x11/window-managers/steam.nix
]
[ ]

View File

@ -1,50 +0,0 @@
{ config, lib, ... }:
with lib;
let
inherit (builtins) readFile fetchurl;
cfg = config.security.mitigations;
cmdline = ''
ibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier mds=off tsx=on tsx_async_abort=off mitigations=off
'';
in
{
options = {
security.mitigations.disable = mkOption {
type = types.bool;
default = false;
description = ''
Whether to disable spectre and meltdown mitigations in the kernel. Do
not use this in mission critical deployments, or on any machine you do
not have physical access to.
'';
};
security.mitigations.acceptRisk = mkOption {
type = types.bool;
default = false;
description = ''
To ensure users know what they are doing, they must explicitly accept
the risk of turning off mitigations by enabling this.
'';
};
};
config = mkIf cfg.disable {
assertions = [{
assertion = cfg.acceptRisk;
message = ''
You have enabled 'security.mitigations.disable' without accepting the
risk of disabling mitigations.
You must explicitly accept the risk of running the kernel without
Spectre or Meltdown mitigations. Set 'security.mitigations.acceptRisk'
to 'true' only if you know what your doing!
'';
}];
boot.kernelParams = splitString " " cmdline;
};
}

View File

@ -1,36 +0,0 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.services.gamemode;
in
{
options.services.gamemode = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
Whether to enable the gamemoded systemd user service.
'';
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.gamemode ];
services.dbus.packages = [ pkgs.gamemode ];
systemd.user.services.gamemoded = {
description = "gamemoded";
serviceConfig = {
Type = "dbus";
BusName = "com.feralinteractive.GameMode";
NotifyAccess = "main";
ExecStart = "${pkgs.gamemode}/bin/gamemoded";
};
wantedBy = [ "graphical-session.target" ];
partOf = [ "graphical-session.target" ];
};
};
}

View File

@ -1,40 +0,0 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.services.wii-u-gc-adapter;
in
{
options = {
services.wii-u-gc-adapter = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
Whether to enable wii-u-gc-adapter service to automatically start
when the controller adapter is plugged in.
'';
};
};
};
config = mkIf cfg.enable {
services.udev.extraRules = ''
# start wii-u-gc-adapter when plugged in
ACTION=="add", SUBSYSTEM=="usb", ENV{ID_VENDOR_ID}=="057e", \
ENV{ID_MODEL_ID}=="0337", TAG+="systemd", \
ENV{SYSTEMD_ALIAS}="/sys/subsystem/usb/wii-u-gc-adapter", \
ENV{SYSTEMD_WANTS}+="wii-u-gc-adapter.service"
# workaround for https://github.com/systemd/systemd/issues/7587
ACTION=="remove", SUBSYSTEM=="usb", ENV{PRODUCT}=="57e/337/100", \
TAG+="systemd"
'';
systemd.services.wii-u-gc-adapter = {
enable = true;
script = ''
${pkgs.wii-u-gc-adapter}/bin/wii-u-gc-adapter
'';
unitConfig = { StopWhenUnneeded = true; };
};
};
}

View File

@ -1,114 +0,0 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.qbittorrent;
configDir = "${cfg.dataDir}/.config";
openFilesLimit = 4096;
in
{
options.services.qbittorrent = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
Run qBittorrent headlessly as systemwide daemon
'';
};
dataDir = mkOption {
type = types.path;
default = "/var/lib/qbittorrent";
description = ''
The directory where qBittorrent will create files.
'';
};
user = mkOption {
type = types.str;
default = "qbittorrent";
description = ''
User account under which qBittorrent runs.
'';
};
group = mkOption {
type = types.str;
default = "qbittorrent";
description = ''
Group under which qBittorrent runs.
'';
};
port = mkOption {
type = types.port;
default = 8080;
description = ''
qBittorrent web UI port.
'';
};
openFirewall = mkOption {
type = types.bool;
default = false;
description = ''
Open services.qBittorrent.port to the outside network.
'';
};
openFilesLimit = mkOption {
default = openFilesLimit;
description = ''
Number of files to allow qBittorrent to open.
'';
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.qbittorrent ];
nixpkgs.overlays = [
(final: prev: {
qbittorrent = prev.qbittorrent.override { guiSupport = false; };
})
];
networking.firewall = mkIf cfg.openFirewall {
allowedTCPPorts = [ cfg.port ];
allowedUDPPorts = [ cfg.port ];
};
systemd.services.qbittorrent = {
after = [ "network.target" ];
description = "qBittorrent Daemon";
wantedBy = [ "multi-user.target" ];
path = [ pkgs.qbittorrent ];
serviceConfig = {
ExecStart = ''
${pkgs.qbittorrent}/bin/qbittorrent-nox \
--profile=${configDir} \
--webui-port=${toString cfg.port}
'';
# To prevent "Quit & shutdown daemon" from working; we want systemd to
# manage it!
Restart = "on-success";
User = cfg.user;
Group = cfg.group;
UMask = "0002";
LimitNOFILE = cfg.openFilesLimit;
};
};
users.users = mkIf (cfg.user == "qbittorrent") {
qbittorrent = {
group = cfg.group;
home = cfg.dataDir;
createHome = true;
description = "qBittorrent Daemon user";
};
};
users.groups =
mkIf (cfg.group == "qbittorrent") { qbittorrent = { gid = null; }; };
};
}

View File

@ -1,45 +0,0 @@
{ pkgs, lib, config, ... }:
with lib;
let cfg = config.services.xserver.windowManager.steam;
in
{
options = {
services.xserver.windowManager.steam = {
enable = mkEnableOption "steam";
package = mkOption {
type = lib.types.package;
default = pkgs.steam;
description = ''
The Steam package to use.
'';
};
extraSessionCommands = mkOption {
type = lib.types.str;
default = "";
description = ''
Shell commands executed just before Steam is started.
'';
};
};
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [ cfg.package ];
services.xserver.windowManager.session = [{
name = "steam";
start = ''
${cfg.extraSessionCommands}
# needed to ensure conflicting compositors are not running
${pkgs.systemd}/bin/systemctl --user stop graphical-session.target
${pkgs.xorg.xset}/bin/xset -dpms
${pkgs.xorg.xset}/bin/xset s off
${pkgs.steamcompmgr}/bin/steamcompmgr &
steam -tenfoot -fulldesktopres
'';
}];
};
}

View File

@ -1,11 +0,0 @@
final: prev: {
any-nix-shell = prev.any-nix-shell.overrideAttrs
(o: {
src = prev.fetchFromGitHub {
owner = "haslersn";
repo = "any-nix-shell";
rev = "e6b86e6e6d86cf7bcbc2691596d54d0a1db29d29";
hash = "sha256-ZmMl58sYVj5TVw19nxPht5nAv9qWnIyImRhs1/TrsRc=";
};
});
}

View File

@ -1,7 +0,0 @@
final: prev: {
# set default cursor theme when installed
cursor = prev.writeTextDir "share/icons/default/index.theme" ''
[icon theme]
Inherits=Adwaita
'';
}

View File

@ -1,16 +0,0 @@
final: prev: {
kakoune = prev.kakoune.override {
configure.plugins = with final.kakounePlugins; [
(kak-fzf.override { fzf = final.skim; })
kak-auto-pairs
kak-buffers
kak-powerline
kak-vertical-selection
];
};
# wrapper to specify config dir
kakoune-config = prev.writeShellScriptBin "k" ''
XDG_CONFIG_HOME=/etc/xdg exec ${final.kakoune}/bin/kak "$@"
'';
}

View File

@ -1,10 +0,0 @@
final: prev: {
nix-zsh-completions = prev.nix-zsh-completions.overrideAttrs (o: {
src = prev.fetchFromGitHub {
owner = "Ma27";
repo = "nix-zsh-completions";
hash = "sha256-3HVYez/wt7EP8+TlhTppm968Wl8x5dXuGU0P+8xNDpo=";
rev = "939c48c182e9d018eaea902b1ee9d00a415dba86";
};
});
}

View File

@ -1,6 +0,0 @@
final: prev: {
qutebrowser = prev.qutebrowser.overrideAttrs
(self: {
meta.platforms = prev.lib.filter (platform: ! prev.lib.elem platform [ "aarch64-linux" "i686-linux" ]) self.meta.platforms;
});
}

View File

@ -1,11 +0,0 @@
final: prev: {
# with sway/wayland support
redshift = (prev.redshift.overrideAttrs (o: {
src = prev.fetchFromGitHub {
owner = "minus7";
repo = "redshift";
rev = "wayland";
hash = "sha256-pyR7xNdi/83NSoC2WIrX8U+A6nU+vZBlePLXrQZnc1k=";
};
})).override { withAppIndicator = prev.stdenv.isLinux; };
}

View File

@ -1,23 +0,0 @@
let version = "1.9.0";
in
final: prev: {
retroarchBare = prev.retroarchBare.overrideAttrs (o: {
inherit version;
src = prev.fetchFromGitHub {
owner = "libretro";
repo = "RetroArch";
hash = "sha256-dzPOuT+v1JtYzvAtqZ/eVWQSYQLAWX3TyS3jXdBmDdg=";
rev = "v${version}";
};
# fix darwin builds
nativeBuildInputs =
if ! prev.stdenv.isLinux then
prev.lib.filter
(drv: ! prev.lib.hasPrefix "wayland" drv.name)
o.nativeBuildInputs
else
o.nativeBuildInputs;
});
}

View File

@ -1,3 +0,0 @@
final: prev: {
slock = prev.slock.overrideAttrs (o: { patches = [ ../pkgs/misc/screensavers/slock/window_name.patch ]; });
}

View File

@ -1,11 +0,0 @@
final: prev: {
# nixpkgs version causing issues for me
wl-clipboard = prev.wl-clipboard.overrideAttrs (o: {
src = prev.fetchFromGitHub {
owner = "bugaevc";
repo = "wl-clipboard";
rev = "c010972e6b0d2eb3002c49a6a1b5620ff5f7c910";
sha256 = "020l3jy9gsj6gablwdfzp1wfa8yblay3axdjc56i9q8pbhz7g12j";
};
});
}

View File

@ -1,29 +0,0 @@
{ stdenv, fetchFromGitHub, ... }:
let version = "0.1.5";
in
stdenv.mkDerivation {
pname = "sddm-chili";
inherit version;
src = fetchFromGitHub {
owner = "MarianArlt";
repo = "sddm-chili";
rev = "${version}";
hash = "sha256-wxWsdRGC59YzDcSopDRzxg8TfjjmA3LHrdWjepTuzgw=";
};
installPhase = ''
mkdir -p $out/share/sddm/themes/chili
cp -r * $out/share/sddm/themes/chili
'';
meta = with stdenv.lib; {
inherit version;
description = "The hottest theme around for SDDM";
homepage = "https://github.com/MarianArlt/sddm-chili";
maintainers = [ maintainers.nrdxp ];
license = licenses.gpl3;
platforms = platforms.linux;
};
}

View File

@ -1,47 +0,0 @@
{ stdenv
, fetchFromGitHub
, libudev
, SDL
, SDL_image
, libXdamage
, libXcomposite
, libXrender
, libXext
, libXxf86vm
, pkgconfig
, autoreconfHook
, gnumake
}:
stdenv.mkDerivation {
name = "steamcompmgr";
src = fetchFromGitHub {
owner = "gamer-os";
repo = "steamos-compositor-plus";
rev = "c3855fcb5015ecdca299ee4b46b9f90c7a6788de";
hash = "sha256-sRthjN+pnabl67PuJS+zbUznW4ws0fub0R9bTzelg18=";
};
buildInputs = [
libudev
SDL
SDL_image
libXdamage
libXcomposite
libXrender
libXext
libXxf86vm
pkgconfig
autoreconfHook
gnumake
];
meta = with stdenv.lib; {
description = "SteamOS Compositor";
homepage = "https://github.com/steamos-compositor-plus";
maintainers = [ maintainers.nrdxp ];
license = licenses.bsd2;
platforms = platforms.linux;
inherit version;
};
}

View File

@ -1,27 +0,0 @@
let version = "2.0.0";
in
{ stdenv, fetchzip }:
stdenv.mkDerivation {
pname = "dejavu-nerdfont";
inherit version;
src = fetchzip {
url =
"https://github.com/ryanoasis/nerd-fonts/releases/download/v${version}/DejaVuSansMono.zip";
hash = "sha256-yMvKzt5CKpK1bThT25lqSyRvZRCFvo6HHbTj+ripdCo=";
stripRoot = false;
};
buildCommand = ''
install --target $out/share/fonts/opentype -D $src/*Mono.ttf
'';
meta = with stdenv.lib; {
description = "Nerdfont version of DejaVu";
homepage = "https://github.com/ryanoasis/nerd-fonts";
license = licenses.mit;
maintainers = [ maintainers.nrdxp ];
platforms = platforms.unix;
inherit version;
};
}

View File

@ -1,11 +1 @@
final: prev: {
sddm-chili =
prev.callPackage ./applications/display-managers/sddm/themes/chili { };
dejavu_nerdfont = prev.callPackage ./data/fonts/dejavu-nerdfont { };
purs = prev.callPackage ./shells/zsh/purs { };
pure = prev.callPackage ./shells/zsh/pure { };
wii-u-gc-adapter = prev.callPackage ./misc/drivers/wii-u-gc-adapter { };
libinih = prev.callPackage ./development/libraries/libinih { };
steamcompmgr =
prev.callPackage ./applications/window-managers/steamcompmgr { };
}
final: prev: { }

View File

@ -1,30 +0,0 @@
{ stdenv, meson, ninja, fetchFromGitHub, ... }:
let version = "r50";
in
stdenv.mkDerivation {
pname = "libinih";
inherit version;
src = fetchFromGitHub {
owner = "benhoyt";
repo = "inih";
rev = "${version}";
hash = "sha256-GF+TVEysaXJxSBBjMsTr2IQvRKlzdEu3rlPQ88PE3nI=";
};
buildInputs = [ meson ninja ];
mesonFlags = ''
-Ddefault_library=shared
-Ddistro_install=true
'';
meta = with stdenv.lib; {
description = "Simple .INI file parser in C";
homepage = "https://github.com/benhoyt/inih";
maintainers = [ maintainers.nrdxp ];
license = licenses.bsd3;
platforms = platforms.all;
inherit version;
};
}

View File

@ -1,31 +0,0 @@
{ stdenv, fetchFromGitHub, pkgconfig, libudev, libusb, ... }:
stdenv.mkDerivation {
pname = "wii-u-gc-adapter";
version = "ae6b46d";
buildInputs = [ pkgconfig libudev libusb ];
src = fetchFromGitHub {
owner = "ToadKing";
repo = "wii-u-gc-adapter";
rev = "ae6b46d7a2b32068e746f1d2d816f4b3d6a7ac80";
hash = "sha256-Dk4jMaL5P85yxH3pDVBDNKjtGL4gRkhN5CJqZnOAshE=";
};
installPhase = ''
mkdir -p $out/bin
install wii-u-gc-adapter $out/bin
'';
hardeningDisable = [ "format" ];
meta = with stdenv.lib; {
description = "Tool for using the Wii U GameCube Adapter on Linux";
homepage = "https://github.com/ToadKing/wii-u-gc-adapter";
maintainers = [ maintainers.nrdxp ];
license = licenses.mit;
platforms = platforms.linux;
inherit version;
};
}

View File

@ -1,26 +0,0 @@
diff --git a/slock.c b/slock.c
index d2f0886..b0418f0 100644
--- a/slock.c
+++ b/slock.c
@@ -219,8 +219,13 @@ lockscreen(Display *dpy, struct xrandr *rr, int screen)
struct lock *lock;
XColor color, dummy;
XSetWindowAttributes wa;
+ XTextProperty title;
+ char *name = "slock";
Cursor invisible;
+ if (XStringListToTextProperty(&name, 1, &title) == 0)
+ die("slock: out of memory\n");
+
if (dpy == NULL || screen < 0 || !(lock = malloc(sizeof(struct lock))))
return NULL;
@@ -243,6 +248,7 @@ lockscreen(Display *dpy, struct xrandr *rr, int screen)
CopyFromParent,
DefaultVisual(dpy, lock->screen),
CWOverrideRedirect | CWBackPixel, &wa);
+ XSetWMName(dpy, lock->win, &title);
lock->pmap = XCreateBitmapFromData(dpy, lock->win, curs, 8, 8);
invisible = XCreatePixmapCursor(dpy, lock->pmap, lock->pmap,
&color, &color, 0, 0);

View File

@ -1,52 +0,0 @@
let version = "1.5.1";
in
{ stdenv
, meson
, ninja
, polkit
, pkgconfig
, systemd
, dbus
, libinih
, fetchFromGitHub
, ...
}:
stdenv.mkDerivation {
pname = "gamemode";
inherit version;
src = fetchFromGitHub {
owner = "FeralInteractive";
repo = "gamemode";
rev = "${version}";
hash = "sha256-x3VM7HJL4+zLDBdCm0ekc0UX33lrRWlOieJjihhA5L4=";
};
prePatch = ''
substituteInPlace daemon/gamemode-tests.c --replace "/usr/bin/gamemoderun" $out/bin/gamemoderun
substituteInPlace daemon/gamemode-gpu.c --replace "/usr/bin/pkexec" ${polkit}/bin/pkexec
substituteInPlace daemon/gamemode-context.c --replace "/usr/bin/pkexec" ${polkit}/bin/pkexec
substituteInPlace lib/gamemode_client.h --replace 'dlopen("' 'dlopen("${
placeholder "out"
}/lib/'
'';
buildInputs = [ meson ninja pkgconfig systemd dbus libinih ];
mesonFlags = ''
-Dwith-util=false
-Dwith-examples=false
-Dwith-systemd-user-unit-dir=${placeholder "out"}/lib/systemd/user
'';
meta = with stdenv.lib; {
description = "Optimise Linux system performance on demand";
homepage = "https://github.com/FeralInteractive/gamemode";
maintainers = [ maintainers.nrdxp ];
license = licenses.bsd3;
platforms = platforms.linux;
broken = true;
inherit version;
};
}

View File

@ -5,14 +5,7 @@
pkgs: final: prev:
{
inherit (pkgs)
dhall
discord
element-desktop
manix
nixpkgs-fmt
qutebrowser
signal-desktop
starship;
manix;
haskellPackages = prev.haskellPackages.override {
overrides = hfinal: hprev:

View File

@ -1,30 +0,0 @@
{ stdenv, fetchFromGitHub }:
let version = "0e87bd8";
in
stdenv.mkDerivation {
pname = "pure";
inherit version;
srcs = fetchFromGitHub {
owner = "sindresorhus";
repo = "pure";
rev = "0e87bd897bb67049329c55174dcc643926337b01";
hash = "sha256-JytsTviVHphYnP5KTbSkbaiNeg2fMufYc6r0X0SQyqI=";
};
buildPhase = "true";
installPhase = ''
mkdir -p $out/share/zsh/plugins/pure
cp -r ./ $out/share/zsh/plugins/pure
'';
meta = with stdenv.lib; {
description = "Pretty, minimal and fast ZSH prompt";
homepage = "https://github.com/sindresorhus/pure";
maintainers = [ maintainers.nrdxp ];
platforms = platforms.unix;
license = licenses.mit;
inherit version;
};
}

View File

@ -1,44 +0,0 @@
{ stdenv, fetchFromGitHub, openssl, pkgconfig, rustPlatform }:
with rustPlatform;
let
inherit (builtins) readFile toFile;
init = toFile "init.sh" "${readFile ./init.sh}";
in
buildRustPackage {
pname = "purs";
version = "0.1.0";
srcs = fetchFromGitHub {
owner = "TimB87";
repo = "purs";
rev = "ee40ff5edf79a1aee7f87b97ca32744944778769";
hash = "sha256-ETU7dDGVa2ggM+qoFgi8k4MJNuqb3kNCX9ZbEA4r5PM=";
};
nativeBuildInputs = [ openssl pkgconfig ];
cargoSha256 = "sha256-FPxJuVyuuHdo2dNLhmJK6xXy12LJsbKNWBAo8pcuLDg=";
preBuild = ''
export PKG_CONFIG_PATH=${openssl.dev}/lib/pkgconfig
export OPENSSL_DIRS=${openssl.out}:${openssl.dev}
'';
postInstall = ''
mkdir -p $out/share/zsh/plugins/purs
substitute ${init} $out/share/zsh/plugins/purs/purs.zsh \
--subst-var-by PURS $out
'';
meta = with stdenv.lib; {
description = "A Pure-inspired prompt in Rust";
homepage = "https://github.com/xcambar/purs";
maintainers = [ maintainers.nrdxp ];
license = licenses.mit;
platforms = platforms.unix;
inherit version;
};
}

View File

@ -1,17 +0,0 @@
function zle-line-init zle-keymap-select {
if [[ $USER == root ]]; then
PROMPT=`@PURS@/bin/purs prompt -u -k "$KEYMAP" -r "$?" --venv "${${VIRTUAL_ENV:t}%-*}"`
else
PROMPT=`@PURS@/bin/purs prompt -us -k "$KEYMAP" -r "$?" --venv "${${VIRTUAL_ENV:t}%-*}"`
fi
zle reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select
autoload -Uz add-zsh-hook
function _prompt_purs_precmd() {
@PURS@/bin/purs precmd
}
add-zsh-hook precmd _prompt_purs_precmd

View File

@ -1,3 +0,0 @@
{ ... }: {
services.hercules-ci-agent.enable = true;
}

View File

@ -1 +0,0 @@
{ ... }: { }

View File

@ -1,7 +0,0 @@
{ pkgs, ... }: {
services.postgresql = {
enable = true;
dataDir = "/srv/postgres";
package = pkgs.postgresql_12;
};
}

View File

@ -1,38 +0,0 @@
{ pkgs, ... }: {
imports = [ ./zsh ./kakoune ./tmux ];
environment.shellAliases = { v = "$EDITOR"; pass = "gopass"; };
environment.sessionVariables = {
PAGER = "less";
LESS = "-iFJMRWX -z-4 -x4";
LESSOPEN = "|${pkgs.lesspipe}/bin/lesspipe.sh %s";
EDITOR = "k";
VISUAL = "k";
};
environment.systemPackages = with pkgs; [
clang
file
git-crypt
gnupg
less
ncdu
gopass
tig
tokei
wget
];
fonts = {
fonts = [ pkgs.dejavu_nerdfont ];
fontconfig.defaultFonts.monospace =
[ "DejaVu Sans Mono Nerd Font Complete Mono" ];
};
documentation.dev.enable = true;
programs.thefuck.enable = true;
programs.firejail.enable = true;
programs.mtr.enable = true;
}

View File

@ -1,17 +0,0 @@
{ pkgs, ... }:
let
inherit (pkgs) ghc;
in
{
environment.systemPackages = [
(ghc.withHoogle
(self: with self; [
cabal2nix
cabal-install
implicit-hie
hie-bios
stack
])
)
];
}

View File

@ -1,28 +0,0 @@
{ pkgs, ... }: {
imports = [ ../python ../haskell ];
environment.systemPackages = with pkgs; [
clang-tools
editorconfig-core-c
kak-lsp
kakoune-config
kakoune-unwrapped
nixpkgs-fmt
python3Packages.python-language-server
rustup
nix-linter
dhall
dhall-lsp-server
haskellPackages.haskell-language-server
];
environment.etc = {
"xdg/kak-lsp/kak-lsp.toml".source = ./kak-lsp.toml;
"xdg/kak/kakrc".source = ./kakrc;
"xdg/kak/autoload/plugins".source = ./plugins;
"xdg/kak/autoload/lint".source = ./lint;
"xdg/kak/autoload/lsp".source = ./lsp;
"xdg/kak/autoload/default".source =
"${pkgs.kakoune-unwrapped}/share/kak/rc";
};
}

View File

@ -1,191 +0,0 @@
snippet_support = true
verbosity = 2
[semantic_scopes]
# Map textmate scopes to kakoune faces for semantic highlighting
# the underscores are translated to dots, and indicate nesting.
# That is, if variable_other_field is omitted, it will try the face for
# variable_other and then variable
#
# To see a list of available scopes in the debug buffer, run lsp-semantic-available-scopes
variable = "variable"
entity_name_function = "function"
entity_name_type = "type"
variable_other_enummember = "variable"
entity_name_namespace = "module"
# Semantic tokens support
# See https://github.com/microsoft/vscode-languageserver-node/blob/8c8981eb4fb6adec27bf1bb5390a0f8f7df2899e/client/src/semanticTokens.proposed.ts#L288
# for token/modifier types.
[semantic_tokens]
type = "type"
variable = "variable"
namespace = "module"
function = "function"
string = "string"
keyword = "keyword"
operator = "operator"
comment = "comment"
[semantic_token_modifiers]
documentation = "documentation"
readonly = "default+d"
[server]
# exit session if no requests were received during given period in seconds
# works only in unix sockets mode (-s/--session)
# set to 0 to disable
timeout = 1800 # seconds = 30 minutes
[language.bash]
filetypes = ["sh"]
roots = [".git", ".hg"]
command = "bash-language-server"
args = ["start"]
[language.c_cpp]
filetypes = ["c", "cpp"]
roots = ["compile_commands.json", ".clangd"]
command = "clangd"
[language.crystal]
filetypes = ["crystal"]
roots = ["shard.yml"]
command = "scry"
[language.css]
filetypes = ["css"]
roots = ["package.json"]
command = "css-languageserver"
args = ["--stdio"]
[language.d]
filetypes = ["d", "di"]
roots = [".git", "dub.sdl", "dub.json"]
command = "dls"
[language.dart]
# start shell to find path to dart analysis server source
filetypes = ["dart"]
roots = ["pubspec.yaml", ".git"]
command = "sh"
args = ["-c", "dart $(dirname $(which dart))/snapshots/analysis_server.dart.snapshot --lsp"]
[language.elixir]
filetypes = ["elixir"]
roots = ["mix.exs"]
command = "elixir-ls"
[language.elm]
filetypes = ["elm"]
roots = ["elm.json"]
command = "elm-language-server"
args = ["--stdio"]
[language.elm.initialization_options]
runtime = "node"
elmPath = "elm"
elmFormatPath = "elm-format"
elmTestPath = "elm-test"
[language.go]
filetypes = ["go"]
roots = ["Gopkg.toml", "go.mod", ".git", ".hg"]
command = "gopls"
offset_encoding = "utf-8"
[language.haskell]
filetypes = ["haskell"]
roots = ["Setup.hs", "stack.yaml", "*.cabal"]
command = "haskell-language-server"
args = ["--lsp"]
[language.html]
filetypes = ["html"]
roots = ["package.json"]
command = "html-languageserver"
args = ["--stdio"]
[language.javascript]
filetypes = ["javascript"]
roots = [".flowconfig"]
command = "flow"
args = ["lsp"]
[language.json]
filetypes = ["json"]
roots = ["package.json"]
command = "json-languageserver"
args = ["--stdio"]
[language.latex]
filetypes = ["latex"]
roots = [".git"]
command = "texlab"
[language.nim]
filetypes = ["nim"]
roots = ["*.nimble", ".git"]
command = "nimlsp"
[language.nix]
filetypes = ["nix"]
roots = ["flake.nix", "shell.nix", ".git"]
command = "rnix-lsp"
[language.dhall]
filetypes = ["dhall"]
roots = [".git"]
command = "dhall-lsp-server"
[language.ocaml]
filetypes = ["ocaml"]
roots = ["Makefile", "opam", "*.opam", "dune"]
command = "ocaml-language-server"
args = ["--stdio"]
[language.php]
filetypes = ["php"]
roots = [".htaccess", "composer.json"]
command = "intelephense"
args = ["--stdio"]
[language.php.initialization_options]
storagePath = "/tmp/intelephense"
[language.python]
filetypes = ["python"]
roots = ["requirements.txt", "setup.py", ".git", ".hg"]
command = "pyls"
offset_encoding = "utf-8"
[language.reason]
filetypes = ["reason"]
roots = ["package.json", "Makefile", ".git", ".hg"]
command = "ocaml-language-server"
args = ["--stdio"]
[language.ruby]
filetypes = ["ruby"]
roots = ["Gemfile"]
command = "solargraph"
args = ["stdio"]
[language.rust]
filetypes = ["rust"]
roots = ["Cargo.toml"]
command = "sh"
args = ["-c", "if command -v rustup >/dev/null; then $(rustup which rls); else rls; fi"]
# [language.rust]
# filetypes = ["rust"]
# roots = ["Cargo.toml"]
# command = "sh"
# args = ["-c", "if command -v rustup >/dev/null; then $(rustup which rust-analyzer); else rust-analyzer; fi"]
[language.terraform]
filetypes = ["terraform"]
roots = ["*.tf"]
command = "terraform-ls"
args = ["serve"]

View File

@ -1,104 +0,0 @@
hook global WinCreate ^[^*]+$ %{ add-highlighter window/ number-lines }
# colorscheme
face global Information yellow,default
face global MenuBackground black,white
face global MenuForeground white,black
face global comment white+d
face global meta blue
addhl global/ column 80 SecondaryCursor
# convert tabs to spaces and cleanup trailing whitespace on save
hook global BufWritePre ^[^*]+$ %{
try %{ execute-keys -draft \%@s\h+$<ret>d }
}
# use .editorconfig
hook global WinCreate .* %{editorconfig-load}
# useful mappings
map global normal <a-q> ': delete-buffer<ret>'
map global normal <c-s> ': write<ret>'
map global normal <c-q> ': quit<ret>'
map global normal <c-a-n> ': buffer-next<ret>'
map global normal <c-a-p> ': buffer-previous<ret>'
map global -docstring "comment line" user c ': comment-line<ret>'
map global -docstring "comment block" user C ': comment-block<ret>'
map -docstring "format buffer" global user f ': format<ret>'
# splits just like vim using tmux
define-command -params 0.. -file-completion \
-docstring "split tmux pane vertically" split \
%{ tmux-terminal-vertical kak -c %val{session} -e edit! %arg{@} }
define-command -params 0.. -file-completion \
-docstring "split tmux pane horizontally" vsplit \
%{ tmux-terminal-horizontal kak -c %val{session} -e edit! %arg{@} }
alias global sp split
alias global vs vsplit
# jj to leave insert mode
hook global InsertChar j %{ try %{
exec -draft hH <a-k>jj<ret> d
exec <esc>
}}
set global ui_options ncurses_assistant=none
set global tabstop 2
set global indentwidth 2
hook global InsertCompletionShow .* %{
try %{
# this command temporarily removes cursors preceded by whitespace;
# if there are no cursors left, it raises an error, does not
# continue to execute the mapping commands, and the error is eaten
# by the `try` command so no warning appears.
execute-keys -draft 'h<a-K>\h<ret>'
map window insert <tab> <c-n>
map window insert <s-tab> <c-p>
}
}
hook global InsertCompletionHide .* %{
unmap window insert <tab> <c-n>
unmap window insert <s-tab> <c-p>
}
try %{ require-module kak }
add-highlighter shared/kakrc/code/if_else regex \b(if|else)\b 0:keyword
# create an if for conditional parsing
define-command -docstring "if <condition> <expression> [else [if <condition>] <expression>]: if statement that accepts shell-valid condition string" \
if -params 2.. %{ evaluate-commands %sh{
while [ true ]; do
condition="[ $1 ]"
if [ -n "$3" ] && [ "$3" != "else" ]; then
printf "%s\n" "fail %{if: unknown operator '$3'}"
elif [ $# -eq 3 ]; then
printf "%s\n" "fail %{if: wrong argument count}"
elif eval $condition; then
[ -n "${2##*&*}" ] && arg="$2" || arg="$(printf '%s' "$2" | sed 's/&/&&/g')"
printf "%s\n" "evaluate-commands %& $arg &"
elif [ $# -eq 4 ]; then
[ -n "${4##*&*}" ] && arg="$4" || arg="$(printf '%s' "$4" | sed 's/&/&&/g')"
printf "%s\n" "evaluate-commands %& $arg &"
elif [ $# -gt 4 ]; then
if [ "$4" = "if" ]; then
shift 4
continue
else
printf "%s\n" "fail %{if: wrong argument count}"
fi
fi
exit
done
}}
# show git diff on sidebar if it git repository
if %[ "$(command git status 2>/dev/null)" ] %{
hook global WinCreate .* %{ git show-diff }
hook global BufWritePost .* %{ git show-diff }
hook global ModeChange insert:normal %{ git show-diff }
}
hook global WinCreate .* %{ kakboard-enable }

View File

@ -1,12 +0,0 @@
hook -group lint global WinSetOption filetype=nix %{
# remove '' for nix, annoying for string literals
set buffer auto_pairs ( ) { } [ ] '"' '"' ` `
set buffer lintcmd '/etc/xdg/kak/autoload/lint/nix.sh'
set buffer formatcmd "nixpkgs-fmt"
hook buffer BufWritePre .* %{
format
lint
}
}

View File

@ -1,13 +0,0 @@
#!/usr/bin/env zsh
nix-linter -W all $1 2>&1 | < /dev/stdin > /tmp/lint.out
if head -1 /tmp/lint.out | grep Failure &> /dev/null; then
sed -n 2p /tmp/lint.out | tr '\n' ' '
printf "error: "
awk 'NR>5 {printf "%s; ", $0}' /tmp/lint.out
else
awk '{$(NF-1)=""; print $NF ": warning: " $0}' /tmp/lint.out > /tmp/lint.2
awk '{$NF="";gsub(/-[0-9]*:[0-9]*:*/, ":"); print $0}' /tmp/lint.2
fi
rm -f /tmp/lint.out
rm -f /tmp/lint.2

View File

@ -1,3 +0,0 @@
hook -group lsp global WinSetOption filetype=(c|cpp) %{
lsp-enable-window
}

View File

@ -1,14 +0,0 @@
eval %sh{kak-lsp --kakoune -s $kak_session}
hook -group lsp global WinSetOption filetype=(elm|rust|c|cpp|python|dhall|haskell) %{
lsp-auto-hover-enable
# easily enter lsp mode
map -docstring "language-server mode" buffer user l ': enter-user-mode lsp<ret>'
set buffer lsp_hover_anchor true
set buffer lsp_auto_highlight_references true
hook buffer BufWritePre .* %{
lsp-formatting
}
}

View File

@ -1,3 +0,0 @@
hook -group lsp global WinSetOption filetype=dhall %{
lsp-enable-window
}

View File

@ -1,5 +0,0 @@
# elm formating is currently broken in els so use formatcmd as workaround
hook -group lsp global WinSetOption filetype=elm %{
set buffer formatcmd "elm-format --stdin --yes --elm-version 0.19"
lsp-enable-window
}

View File

@ -1,3 +0,0 @@
hook -group lsp global WinSetOption filetype=haskell %{
lsp-enable-window
}

View File

@ -1,3 +0,0 @@
hook -group lsp global WinSetOption filetype=python %{
lsp-enable-window
}

View File

@ -1,10 +0,0 @@
hook -group lsp global WinSetOption filetype=rust %{
# racer.kak conflicts with rls completion; keep before lsp-enable
racer-disable-autocomplete
# remove apostrophe from auto closing pairs; annoying for rust lifetimes
set buffer auto_pairs ( ) { } [ ] '"' '"' ` `
lsp-enable-window
set buffer lsp_server_configuration rust.clippy_preference="on"
}

View File

@ -1,6 +0,0 @@
hook global WinCreate .* %{
auto-pairs-enable
}
map global user s -docstring 'Surround' ': auto-pairs-surround <lt> <gt><ret>'
map global user S -docstring 'Surround++' ': auto-pairs-surround <lt> <gt> _ _ * *<ret>'

View File

@ -1,4 +0,0 @@
hook global WinDisplay .* info-buffers
map global user b ':enter-buffers-mode<ret>' -docstring 'buffers…'
map global user B ':enter-user-mode -lock buffers<ret>' -docstring 'buffers (lock)…'

View File

@ -1 +0,0 @@
map -docstring "fzf-mode" global normal <c-p> ': fzf-mode<ret>'

View File

@ -1,17 +0,0 @@
##
## git.kak by lenormf
##
# http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
# Faces that highlight text that overflows the following limits:
# - title: 50 characters
# - body: 72 characters
set-face global GitOverflowTitle yellow
set-face global GitOverflowBody yellow
hook -group git-commit-highlight global WinSetOption filetype=git-(commit|rebase) %{
add-highlighter window/git-commit-highlight/ regex "^\h*[^#\s][^\n]{71}([^\n]+)" 1:GitOverflowBody
add-highlighter window/git-commit-highlight/ regex "\A[\s\n]*[^#\s][^\n]{49}([^\n]+)" 1:GitOverflowTitle
}

View File

@ -1,182 +0,0 @@
declare-option -docstring 'command to copy to clipboard' \
str kakboard_copy_cmd
declare-option -docstring 'command to paste from clipboard' \
str kakboard_paste_cmd
declare-option -docstring 'keys to pull clipboard for' \
str-list kakboard_paste_keys p P R <a-p> <a-P> <a-R>
declare-option -docstring 'keys to copy to clipboard' \
str-list kakboard_copy_keys y c d
declare-option -hidden bool kakboard_enabled false
define-command -docstring 'copy system clipboard into the " register' \
kakboard-pull-clipboard %{ evaluate-commands %sh{
# Shell expansions are stripped of new lines, so the output of the
# command has to be wrapped in quotes (and its quotes escaped)
#
# (All of this quoting and escaping really messes up kakoune's syntax
# highlighter)
if test -n "$kak_opt_kakboard_paste_cmd"; then
printf 'set-register dquote %s' \
"'$($kak_opt_kakboard_paste_cmd | sed -e "s/'/''/g"; echo \')"
else
echo "echo -debug 'kakboard: kakboard_paste_cmd not set'"
fi
}}
define-command -docstring 'copy system clipboard if current register is unset' \
kakboard-pull-if-unset %{ evaluate-commands %sh{
if test -z "$kak_register"; then
echo "kakboard-pull-clipboard"
fi
}}
# Pull the clipboard and execute the key with the same context
define-command -docstring 'copy system clipboard then execute keys' \
kakboard-with-pull-clipboard -params 1 %{
kakboard-pull-if-unset
evaluate-commands %sh{
if test -n "$kak_register"; then
register="\"$kak_register"
fi
echo "execute-keys -with-hooks -save-regs '' '$register$kak_count$1'"
}
}
define-command -docstring 'set system clipboard from the " register' \
kakboard-push-clipboard %{ nop %sh{
# The copy command is executed and forked in a subshell because some
# commands (looking at you, xclip and wl-copy) block when executed by
# kakoune normally
if test -n "$kak_opt_kakboard_copy_cmd"; then
printf '%s' "$kak_main_reg_dquote" \
| ($kak_opt_kakboard_copy_cmd) >/dev/null 2>&1 &
else
echo "echo -debug 'kakboard: kakboard_copy_cmd not set'"
fi
}}
define-command -docstring 'set system clipboard if current register is unset' \
kakboard-push-if-unset %{ evaluate-commands %sh{
if test -z "$kak_register"; then
echo "kakboard-push-clipboard"
fi
}}
# Set the clipboard and execute the key with the same context
define-command -docstring 'execute keys then set system clipboard' \
kakboard-with-push-clipboard -params 1 %{
evaluate-commands %sh{
if test -n "$kak_register"; then
register="\"$kak_register"
fi
# Don't preserve registers since we want the same behavior as just
# executing the keys (and don't want to preseve the " register)
echo "execute-keys -with-hooks -save-regs '' '$register$kak_count$1'"
}
# Has to be outside of the sh expansion so that the register environment
# variable will update
kakboard-push-if-unset
}
define-command -hidden kakboard-autodetect %{
evaluate-commands %sh{
# Don't override if there are already commands
if test -n "$kak_opt_kakboard_copy_cmd" -o \
-n "$kak_opt_kakboard_paste_cmd"
then
exit
fi
copy=
paste=
case $(uname -s) in
Darwin)
copy="pbcopy"
paste="pbpaste"
;;
*)
if test -n "$WAYLAND_DISPLAY" \
&& command -v wl-copy >/dev/null \
&& command -v wl-paste >/dev/null
then
# wl-clipboard
copy="wl-copy --foreground"
paste="wl-paste --no-newline"
elif test -n "$DISPLAY" && command -v xsel >/dev/null; then
# xsel
copy="xsel --input --clipboard"
paste="xsel --output --clipboard"
elif test -n "$DISPLAY" && command -v xclip >/dev/null; then
# xclip
copy="xclip -in -selection clipboard"
paste="xclip -out -selection clipboard"
fi
;;
esac
echo "set-option global kakboard_copy_cmd '$copy'"
echo "set-option global kakboard_paste_cmd '$paste'"
}
}
define-command -docstring 'enable clipboard integration' kakboard-enable %{
set-option window kakboard_enabled true
kakboard-autodetect
evaluate-commands %sh{
if test -z "$kak_opt_kakboard_copy_cmd" -o \
-z "$kak_opt_kakboard_paste_cmd"
then
echo "echo -debug 'kakboard: Could not auto-detect clipboard commands. Please set them explicitly.'"
fi
# Still make the bindings so that they can be set later
eval set -- "$kak_quoted_opt_kakboard_paste_keys"
while test $# -gt 0; do
escaped=$(echo "$1" | sed -e 's/</<lt>/')
echo map global normal "$1" \
"': kakboard-with-pull-clipboard $escaped<ret>'"
shift
done
eval set -- "$kak_quoted_opt_kakboard_copy_keys"
while test $# -gt 0; do
escaped=$(echo "$1" | sed -e 's/</<lt>/')
echo map global normal "$1" \
"': kakboard-with-push-clipboard $escaped<ret>'"
shift
done
}
}
define-command -docstring 'disable clipboard integration' kakboard-disable %{
set-option window kakboard_enabled false
remove-hooks window kakboard
evaluate-commands %sh{
eval set -- "$kak_quoted_opt_kakboard_paste_keys" \
"$kak_quoted_opt_kakboard_copy_keys"
while test $# -gt 0; do
echo unmap global normal "$1"
shift
done
}
}
define-command -docstring 'toggle clipboard integration' kakboard-toggle %{
evaluate-commands %sh{
if test "$kak_opt_kakboard_enabled" = true; then
echo "kakboard-disable"
else
echo "kakboard-enable"
fi
}
}

View File

@ -1,3 +0,0 @@
map -docstring "vertical selection down" global user v ': vertical-selection-down<ret>'
map -docstring "vertical selection up" global user <a-v> ': vertical-selection-up<ret>'
map -docstring "vertical selection both" global user V ': vertical-selection-up-and-down<ret>'

View File

@ -1,47 +0,0 @@
{ pkgs, ... }:
let inherit (pkgs) python3Packages;
in
{
environment.systemPackages =
let
packages = pythonPackages:
with pythonPackages; [
numpy
pandas
ptpython
requests
scipy
];
python = pkgs.python3.withPackages packages;
in
[ python ];
environment.sessionVariables = {
PYTHONSTARTUP =
let
startup = pkgs.writers.writePython3 "ptpython.py"
{
libraries = with python3Packages; [ ptpython ];
} ''
from __future__ import unicode_literals
from pygments.token import Token
from ptpython.layout import CompletionVisualisation
import sys
${builtins.readFile ./ptconfig.py}
try:
from ptpython.repl import embed
except ImportError:
print("ptpython is not available: falling back to standard prompt")
else:
sys.exit(embed(globals(), locals(), configure=configure))
'';
in
"${startup}";
};
}

View File

@ -1,164 +0,0 @@
__all__ = ("configure",)
def configure(repl):
"""
Configuration method. This is called during the start-up of ptpython.
:param repl: `PythonRepl` instance.
"""
# Show function signature (bool).
repl.show_signature = True
# Show docstring (bool).
repl.show_docstring = True
# Show the "[Meta+Enter] Execute" message when pressing [Enter] only
# inserts a newline instead of executing the code.
repl.show_meta_enter_message = True
# Show completions. (NONE, POP_UP, MULTI_COLUMN or TOOLBAR)
repl.completion_visualisation = CompletionVisualisation.POP_UP
# When CompletionVisualisation.POP_UP has been chosen, use this
# scroll_offset in the completion menu.
repl.completion_menu_scroll_offset = 0
# Show line numbers (when the input contains multiple lines.)
repl.show_line_numbers = False
# Show status bar.
repl.show_status_bar = True
# When the sidebar is visible, also show the help text.
repl.show_sidebar_help = True
# Swap light/dark colors on or off
repl.swap_light_and_dark = False
# Highlight matching parethesis.
repl.highlight_matching_parenthesis = True
# Line wrapping. (Instead of horizontal scrolling.)
repl.wrap_lines = True
# Mouse support.
repl.enable_mouse_support = True
# Complete while typing. (Don't require tab before the
# completion menu is shown.)
repl.complete_while_typing = True
# Fuzzy and dictionary completion.
repl.enable_fuzzy_completion = False
repl.enable_dictionary_completion = False
# Vi mode.
repl.vi_mode = True
# Paste mode. (When True, don't insert whitespace after new line.)
repl.paste_mode = False
# Use the classic prompt. (Display '>>>' instead of 'In [1]'.)
repl.prompt_style = "classic" # 'classic' or 'ipython'
# Don't insert a blank line after the output.
repl.insert_blank_line_after_output = True
# History Search.
# When True, going back in history will filter the history on the records
# starting with the current input. (Like readline.)
# Note: When enable, please disable the `complete_while_typing` option.
# otherwise, when there is a completion available, the arrows will
# browse through the available completions instead of the history.
repl.enable_history_search = False
# Enable auto suggestions. (Pressing right arrow will complete the input,
# based on the history.)
repl.enable_auto_suggest = False
# Enable open-in-editor. Pressing C-X C-E in emacs mode or 'v' in
# Vi navigation mode will open the input in the current editor.
repl.enable_open_in_editor = True
# Enable system prompt. Pressing meta-! will display the system prompt.
# Also enables Control-Z suspend.
repl.enable_system_bindings = True
# Ask for confirmation on exit.
repl.confirm_exit = True
# Enable input validation. (Don't try to execute when the input contains
# syntax errors.)
repl.enable_input_validation = True
# Use this colorscheme for the code.
repl.use_code_colorscheme("monokai")
# Set color depth (keep in mind that not all terminals support true color).
# repl.color_depth = 'DEPTH_1_BIT' # Monochrome.
# repl.color_depth = 'DEPTH_4_BIT' # ANSI colors only.
# repl.color_depth = "DEPTH_8_BIT" # The default, 256 colors.
repl.color_depth = 'DEPTH_24_BIT' # True color.
# Syntax.
repl.enable_syntax_highlighting = True
# Install custom colorscheme named 'my-colorscheme' and use it.
"""
repl.install_ui_colorscheme('my-colorscheme', _custom_ui_colorscheme)
repl.use_ui_colorscheme('my-colorscheme')
"""
# Add custom key binding for PDB.
"""
@repl.add_key_binding(Keys.ControlB)
def _(event):
' Pressing Control-B will insert "pdb.set_trace()" '
event.cli.current_buffer.insert_text('\nimport pdb; pdb.set_trace()\n')
"""
# Typing ControlE twice should also execute the current command.
# (Alternative for Meta-Enter.)
"""
@repl.add_key_binding(Keys.ControlE, Keys.ControlE)
def _(event):
event.current_buffer.validate_and_handle()
"""
# Typing 'jj' in Vi Insert mode, should send escape. (Go back to navigation
# mode.)
"""
@repl.add_key_binding('j', 'j', filter=ViInsertMode())
def _(event):
" Map 'jj' to Escape. "
event.cli.key_processor.feed(KeyPress(Keys.Escape))
"""
# Custom key binding for some simple autocorrection while typing.
"""
corrections = {
'impotr': 'import',
'pritn': 'print',
}
@repl.add_key_binding(' ')
def _(event):
' When a space is pressed. Check & correct word before cursor. '
b = event.cli.current_buffer
w = b.document.get_word_before_cursor()
if w is not None:
if w in corrections:
b.delete_before_cursor(count=len(w))
b.insert_text(corrections[w])
b.insert_text(' ')
"""
# Custom colorscheme for the UI. See `ptpython/layout.py` and
# `ptpython/style.py` for all possible tokens.
_custom_ui_colorscheme = {
# Blue prompt.
Token.Layout.Prompt: "bg:#eeeeff #000000 bold",
# Make the status toolbar red.
Token.Toolbar.Status: "bg:#ff0000 #000000",
}

View File

@ -1,43 +0,0 @@
{ lib, pkgs, ... }:
let
inherit (builtins) readFile concatStringsSep;
inherit (lib) removePrefix;
pluginConf = plugins:
concatStringsSep "\n\n" (map
(plugin:
let name = removePrefix "tmuxplugin-" plugin.pname;
in "run-shell ${plugin}/share/tmux-plugins/${name}/${name}.tmux")
plugins
);
plugins = with pkgs.tmuxPlugins; [
copycat
open
resurrect
yank
vim-tmux-navigator
];
in
{
environment.shellAliases = { tx = "tmux new-session -A -s $USER"; };
programs.tmux = {
enable = true;
aggressiveResize = true;
escapeTime = 10;
historyLimit = 5000;
keyMode = "vi";
shortcut = "a";
terminal = "tmux-256color";
baseIndex = 1;
extraConfig = ''
${readFile ./tmuxline.conf}
${readFile ./tmux.conf}
${pluginConf plugins}
'';
};
}

View File

@ -1,57 +0,0 @@
# Enable mouse mode (tmux 2.1 and above)
set -g mouse on
# autmatic window name
setw -g automatic-rename on
# only update status line once per minute
set -g status-interval 60
# Enable focus events
set -g focus-events on
# truecolor in xterm
set -ga terminal-overrides ",*col*:Tc"
# Start a non login shell
set -g default-command "${SHELL}"
# pane movement
# Grab pane from the target window & joins to current,
bind-key j command-prompt -p "join pane from:" "join-pane -s '%%'"
# does reverse.
bind-key s command-prompt -p "send pane to:" "join-pane -t '%%'"
# Key binds
bind -n ^_ send-keys 'C-l'
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+
bind-key C-a last-window
bind-key | split-window -h
bind-key - split-window -v
bind-key _ split-window -v -p 38
bind-key \ split-window -h -p 38
bind-key b break-pane -d
bind-key x kill-pane
bind-key X kill-window
bind-key q confirm-before kill-session
bind-key Q confirm-before kill-server
bind-key , previous-window # <
bind-key . next-window # >
bind-key -r < swap-window -t :-
bind-key -r > swap-window -t :+
bind-key n command-prompt 'rename-window %%'
bind-key N command-prompt 'rename-session %%'
bind-key Escape copy-mode -u
bind-key Up copy-mode -u
bind-key r source-file ~/.tmux.conf
bind-key R refresh-client
bind-key S set-option status
# Resize panes with alt-jkhl
bind-key -n C-M-j resize-pane -D
bind-key -n C-M-k resize-pane -U
bind-key -n C-M-h resize-pane -L
bind-key -n C-M-l resize-pane -R
bind -T copy-mode-vi 'v' send-keys -X begin-selection

View File

@ -1,26 +0,0 @@
# statusbar configuration
set -g status-justify "left"
set -g status "on"
set -g status-style "none"
set -g message-command-style bg="colour31"
set -g status-left-length "100"
set -g pane-active-border-style fg="colour254"
set -g status-bg "colour234"
set -g message-command-style fg="colour231"
set -g pane-border-style fg="colour240"
set -g message-style bg="colour31"
set -g status-left-style "none"
set -g status-right-style "none"
set -g status-right-length "100"
set -g message-style fg="colour231"
setw -g window-status-style fg="colour250"
setw -g window-status-style "none"
setw -g window-status-activity-style bg="colour234"
setw -g window-status-activity-style "none"
setw -g window-status-activity-style fg="colour250"
setw -g window-status-separator ""
setw -g window-status-style bg="colour234"
set -g status-left "#[fg=colour16,bg=colour254,bold] #S #[fg=colour254,bg=colour234,nobold,nounderscore,noitalics]"
set -g status-right "#[fg=colour236,bg=colour234,nobold,nounderscore,noitalics]#[fg=colour247,bg=colour236] %l:%M%p #[fg=colour252,bg=colour236,nobold,nounderscore,noitalics]#[fg=colour235,bg=colour252] #h "
setw -g window-status-format "#[fg=colour244,bg=colour234] #I #[fg=colour250,bg=colour234] #W "
setw -g window-status-current-format "#[fg=colour234,bg=colour31,nobold,nounderscore,noitalics]#[fg=colour117,bg=colour31] #I #[fg=colour231,bg=colour31,bold] #W #[fg=colour31,bg=colour234,nobold,nounderscore,noitalics]"

View File

@ -1 +0,0 @@
while read line; do line=${(Q)line}; [[ -d $line ]] && echo $line; done < $HOME/.cache/zsh-cdr/recent-dirs

View File

@ -1,11 +0,0 @@
if [[ -z "$ZSH_CDR_DIR" ]]; then
ZSH_CDR_DIR=${XDG_CACHE_HOME:-$HOME/.cache}/zsh-cdr
fi
mkdir -p $ZSH_CDR_DIR
autoload -Uz chpwd_recent_dirs cdr
autoload -U add-zsh-hook
add-zsh-hook chpwd chpwd_recent_dirs
zstyle ':chpwd:*' recent-dirs-file $ZSH_CDR_DIR/recent-dirs
zstyle ':chpwd:*' recent-dirs-max 1000
# fall through to cd
zstyle ':chpwd:*' recent-dirs-default yes

View File

@ -1,150 +0,0 @@
{ lib, pkgs, ... }:
let
inherit (builtins) concatStringsSep;
inherit (lib) fileContents;
in
{
users.defaultUserShell = pkgs.zsh;
environment = {
sessionVariables =
let fd = "${pkgs.fd}/bin/fd -H";
in
{
BAT_PAGER = "less";
SKIM_ALT_C_COMMAND =
let
alt_c_cmd = pkgs.writeScriptBin "cdr-skim.zsh" ''
#!${pkgs.zsh}/bin/zsh
${fileContents ./cdr-skim.zsh}
'';
in
"${alt_c_cmd}/bin/cdr-skim.zsh";
SKIM_DEFAULT_COMMAND = fd;
SKIM_CTRL_T_COMMAND = fd;
};
shellAliases = {
cat = "${pkgs.bat}/bin/bat";
df = "df -h";
du = "du -h";
ls = "exa";
l = "ls -lhg --git";
la = "l -a";
t = "l -T";
ta = "la -T";
ps = "${pkgs.procs}/bin/procs";
rz = "exec zsh";
};
systemPackages = with pkgs; [
bat
bzip2
devshell.cli
exa
gitAndTools.hub
gzip
lrzip
p7zip
procs
skim
unrar
unzip
xz
zsh-completions
];
};
programs.zsh = {
enable = true;
enableGlobalCompInit = false;
histSize = 10000;
setOptions = [
"extendedglob"
"incappendhistory"
"sharehistory"
"histignoredups"
"histfcntllock"
"histreduceblanks"
"histignorespace"
"histallowclobber"
"autocd"
"cdablevars"
"nomultios"
"pushdignoredups"
"autocontinue"
"promptsubst"
];
promptInit = ''
eval "$(${pkgs.starship}/bin/starship init zsh)"
'';
interactiveShellInit =
let
zshrc = fileContents ./zshrc;
sources = with pkgs; [
./cdr.zsh
"${skim}/share/skim/completion.zsh"
"${oh-my-zsh}/share/oh-my-zsh/plugins/sudo/sudo.plugin.zsh"
"${oh-my-zsh}/share/oh-my-zsh/plugins/extract/extract.plugin.zsh"
"${zsh-you-should-use}/share/zsh/plugins/you-should-use/you-should-use.plugin.zsh"
"${zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
"${zsh-history-substring-search}/share/zsh-history-substring-search/zsh-history-substring-search.zsh"
];
source = map (source: "source ${source}") sources;
functions = pkgs.stdenv.mkDerivation {
name = "zsh-functions";
src = ./functions;
ripgrep = "${pkgs.ripgrep}";
man = "${pkgs.man}";
exa = "${pkgs.exa}";
installPhase =
let basename = "\${file##*/}";
in
''
mkdir $out
for file in $src/*; do
substituteAll $file $out/${basename}
chmod 755 $out/${basename}
done
'';
};
plugins = concatStringsSep "\n" ([
"${pkgs.any-nix-shell}/bin/any-nix-shell zsh --info-right | source /dev/stdin"
] ++ source);
in
''
${plugins}
fpath+=( ${functions} )
autoload -Uz ${functions}/*(:t)
${zshrc}
eval "$(${pkgs.direnv}/bin/direnv hook zsh)"
eval $(${pkgs.gitAndTools.hub}/bin/hub alias -s)
source ${pkgs.skim}/share/skim/key-bindings.zsh
# needs to remain at bottom so as not to be overwritten
bindkey jj vi-cmd-mode
'';
};
}

View File

@ -1,5 +0,0 @@
[[ -z $3 ]] || return 1
file=$1
ext=$2
new="${file:r}.${ext}"
mv $file $new

View File

@ -1,6 +0,0 @@
# pipe exa into PAGER with colors
if [[ -t 1 && -n $PAGER ]]; then
@exa@/bin/exa --color=always $@ | $PAGER
else
@exa@/bin/exa $@
fi

View File

@ -1,12 +0,0 @@
RED='\033[0;31m'
NC='\033[0m'
# needs one arguement or exit
[[ -n $2 || -z $1 ]] && {
print -u2 \
"${RED}error:${NC} takes exactly one package as an arguement"
return 1
}
nix profile install "nixpkgs#$1"

View File

@ -1,8 +0,0 @@
# colorful man pages
LESS_TERMCAP_md=$'\e[01;31m' \
LESS_TERMCAP_me=$'\e[0m' \
LESS_TERMCAP_se=$'\e[0m' \
LESS_TERMCAP_so=$'\e[01;44;33m' \
LESS_TERMCAP_ue=$'\e[0m' \
LESS_TERMCAP_us=$'\e[01;32m' \
@man@/bin/man "$@"

View File

@ -1,2 +0,0 @@
# mkdir & cd to it
mkdir -p "$1" && cd "$1"

View File

@ -1,6 +0,0 @@
# pipe rg into PAGER with colors
if [[ -t 1 && -n $PAGER ]]; then
@ripgrep@/bin/rg -p $@ | $PAGER
else
@ripgrep@/bin/rg $@
fi

View File

@ -1,4 +0,0 @@
[[ -z $3 ]] || return 1
head=${1:h}
name="${head}/${2}"
mv $1 $name

View File

@ -1,58 +0,0 @@
# useful functions
autoload -Uz zmv zcalc zargs url-quote-magic bracketed-paste-magic
zle -N self-insert url-quote-magic
zle -N bracketed-paste bracketed-paste-magic
# tilde directories
hash -d \
nixos=/etc/nixos \
dl=~/Downloads \
git=~/git
hash -d \
github=~git/github.com \
gitlab=~git/gitlab.com
# key binds
bindkey -v '^?' backward-delete-char
bindkey '^[OA' history-substring-search-up
bindkey '^[OB' history-substring-search-down
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down
# if in tmux launch skim in tmux pane
[[ ${+TMUX} == 1 ]] \
&& SKIM_TMUX=1
#load compinit
autoload -Uz compinit
if [[ -f ~/.zcompdump ]]; then
typeset -i updated_at=$(date +'%j' -r ~/.zcompdump \
|| stat -f '%Sm' -t '%j' ~/.zcompdump)
# save time if completion cache has been update recently
if [ $(date +'%j') != $updated_at ]; then
compinit -u
else
compinit -C
fi
else
compinit -C
fi
# Case insens only when no case match; after all completions loaded
zstyle ':completion:*' matcher-list \
"" 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
# Auto rehash for new binaries
zstyle ':completion:*' rehash true
# remove duplicates from paths
typeset -U path
typeset -U fpath
# keep shell state frozen
ttyctl -f

View File

@ -1,88 +0,0 @@
{ pkgs, ... }:
let inherit (builtins) readFile;
in
{
imports = [ ./sway ../develop ./xmonad ../network ./im ];
hardware.opengl.enable = true;
hardware.opengl.driSupport = true;
hardware.pulseaudio.enable = true;
boot = {
tmpOnTmpfs = true;
kernel.sysctl."kernel.sysrq" = 1;
};
environment = {
etc = {
"xdg/gtk-3.0/settings.ini" = {
text = ''
[Settings]
gtk-icon-theme-name=Papirus
gtk-theme-name=Adapta
gtk-cursor-theme-name=Adwaita
'';
mode = "444";
};
};
sessionVariables = {
# Theme settings
QT_QPA_PLATFORMTHEME = "gtk2";
GTK2_RC_FILES =
let
gtk = ''
gtk-icon-theme-name="Papirus"
gtk-cursor-theme-name="Adwaita"
'';
in
[
("${pkgs.writeText "iconrc" "${gtk}"}")
"${pkgs.adapta-gtk-theme}/share/themes/Adapta/gtk-2.0/gtkrc"
"${pkgs.gnome3.gnome-themes-extra}/share/themes/Adwaita/gtk-2.0/gtkrc"
];
};
systemPackages = with pkgs; [
adapta-gtk-theme
cursor
dzen2
feh
ffmpeg-full
gnome3.adwaita-icon-theme
gnome3.networkmanagerapplet
gnome-themes-extra
imagemagick
imlib2
librsvg
libsForQt5.qtstyleplugins
manpages
papirus-icon-theme
pulsemixer
qt5.qtgraphicaleffects
sddm-chili
stdmanpages
xsel
zathura
];
};
services.xbanish.enable = true;
services.gnome3.gnome-keyring.enable = true;
services.xserver = {
enable = true;
libinput.enable = true;
displayManager.sddm = {
enable = true;
theme = "chili";
};
};
}

View File

@ -1,29 +0,0 @@
{ pkgs, ... }: {
imports = [ ./udev.nix ];
environment.systemPackages = with pkgs; [
retroarchBare
steam-run
pcsx2
qjoypad
];
services.wii-u-gc-adapter.enable = true;
# fps games on laptop need this
services.xserver.libinput.disableWhileTyping = false;
# Launch steam from display managers
services.xserver.windowManager.steam = { enable = true; };
# 32-bit support needed for steam
hardware.opengl.driSupport32Bit = true;
hardware.pulseaudio.support32Bit = true;
hardware.steam-hardware.enable = true;
# better for steam proton games
systemd.extraConfig = "DefaultLimitNOFILE=1048576";
# improve wine performance
environment.sessionVariables = { WINEDEBUG = "-all"; };
}

View File

@ -1,45 +0,0 @@
{
# correct controller support for steam
services.udev.extraRules = ''
# This rule is needed for basic functionality of the controller in Steam and keyboard/mouse emulation
SUBSYSTEM=="usb", ATTRS{idVendor}=="28de", MODE="0666"
# This rule is necessary for gamepad emulation
KERNEL=="uinput", MODE="0660", GROUP="input", OPTIONS+="static_node=uinput"
KERNEL=="js*", MODE="0660", GROUP="input"
# Valve HID devices over USB hidraw
KERNEL=="hidraw*", ATTRS{idVendor}=="28de", MODE="0666"
# Valve HID devices over bluetooth hidraw
KERNEL=="hidraw*", KERNELS=="*28DE:*", MODE="0666"
# DualShock 4 over USB hidraw
KERNEL=="hidraw*", ATTRS{idVendor}=="054c", ATTRS{idProduct}=="05c4", MODE="0666"
# DualShock 4 wireless adapter over USB hidraw
KERNEL=="hidraw*", ATTRS{idVendor}=="054c", ATTRS{idProduct}=="0ba0", MODE="0666"
# DualShock 4 Slim over USB hidraw
KERNEL=="hidraw*", ATTRS{idVendor}=="054c", ATTRS{idProduct}=="09cc", MODE="0666"
# DualShock 4 over bluetooth hidraw
KERNEL=="hidraw*", KERNELS=="*054C:05C4*", MODE="0666"
# DualShock 4 Slim over bluetooth hidraw
KERNEL=="hidraw*", KERNELS=="*054C:09CC*", MODE="0666"
# DualShock 3 controller, Bluetooth
KERNEL=="hidraw*", KERNELS=="*054C:0268*", MODE="0660", TAG+="uaccess"
# DualShock 3 controller, USB
KERNEL=="hidraw*", ATTRS{idVendor}=="054c", ATTRS{idProduct}=="0268", MODE="0660", TAG+="uaccess"
# Nintendo Switch Pro Controller over USB hidraw
KERNEL=="hidraw*", ATTRS{idVendor}=="057e", ATTRS{idProduct}=="2009", MODE="0666"
# Nintendo Switch Pro Controller over bluetooth hidraw
KERNEL=="hidraw*", KERNELS=="*057E:2009*", MODE="0666"
'';
}

View File

@ -1,7 +0,0 @@
{ pkgs, ... }: {
environment.systemPackages = with pkgs; [
discord
element-desktop
signal-desktop
];
}

View File

@ -1,18 +0,0 @@
{ pkgs, ... }:
let inherit (pkgs) alsaUtils bash gnugrep volnoti;
in
pkgs.writeScript "volnoti.sh" ''
#!${bash}/bin/bash
declare -i current=$(${alsaUtils}/bin/amixer get Master | ${gnugrep}/bin/grep -m1 -Po "[0-9]+(?=%)")
if [[ $current -gt 100 ]]; then
current=100
fi
if ${alsaUtils}/bin/amixer get Master | ${gnugrep}/bin/grep -Fq "[off]"; then
${volnoti}/bin/volnoti-show -m $current
else
${volnoti}/bin/volnoti-show $current
fi
''

View File

@ -1,10 +0,0 @@
{ ... }: {
services.plex = {
enable = true;
dataDir = "/srv/plex";
group = "media";
openFirewall = true;
};
users.groups.media.members = [ "plex" ];
}

View File

@ -1,276 +0,0 @@
# Documentation:
# qute://help/configuring.html
# qute://help/settings.html
# Disable autoconfig
config.load_autoconfig(False)
# Require a confirmation before quitting the application.
# Type: ConfirmQuit
# Valid values:
# - always: Always show a confirmation.
# - multiple-tabs: Show a confirmation if multiple tabs are opened.
# - downloads: Show a confirmation if downloads are running
# - never: Never show a confirmation.
c.confirm_quit = ['downloads']
# Additional arguments to pass to Qt, without leading `--`. With
# QtWebEngine, some Chromium arguments (see
# https://peter.sh/experiments/chromium-command-line-switches/ for a
# list) will work.
# Type: List of String
c.qt.args = [
'enable-native-gpu-memory-buffers'
]
# Allow websites to request geolocations.
# Type: BoolAsk
# Valid values:
# - true
# - false
# - ask
c.content.geolocation = False
c.content.pdfjs = True
# Value to send in the `DNT` header. When this is set to true,
# qutebrowser asks websites to not track your identity. If set to null,
# the DNT header is not sent at all.
# Type: Bool
c.content.headers.do_not_track = True
c.content.cookies.accept = "no-3rdparty"
c.content.canvas_reading = False
c.content.dns_prefetch = True
c.content.webrtc_ip_handling_policy = "default-public-interface-only"
# Allow JavaScript to read from or write to the clipboard. With
# QtWebEngine, writing the clipboard as response to a user interaction
# is always allowed.
# Type: Bool
c.content.javascript.can_access_clipboard = False
# Allow JavaScript to open new tabs without user interaction.
# Type: Bool
c.content.javascript.can_open_tabs_automatically = False
# Enable JavaScript.
# Type: Bool
c.content.javascript.enabled = True
# Enable JavaScript.
# Type: Bool
config.set('content.javascript.enabled', True, 'file://*')
# Enable JavaScript.
# Type: Bool
config.set('content.javascript.enabled', True, 'chrome://*/*')
# Enable JavaScript.
# Type: Bool
config.set('content.javascript.enabled', True, 'qute://*/*')
# Allow locally loaded documents to access remote URLs.
# Type: Bool
c.content.local_content_can_access_remote_urls = False
# Allow locally loaded documents to access other local URLs.
# Type: Bool
c.content.local_content_can_access_file_urls = True
# Enable support for HTML 5 local storage and Web SQL.
# Type: Bool
c.content.local_storage = True
# Enable plugins in Web pages.
# Type: Bool
c.content.plugins = False
# Draw the background color and images also when the page is printed.
# Type: Bool
c.content.print_element_backgrounds = True
# Open new windows in private browsing mode which does not record
# visited pages.
# Type: Bool
c.content.private_browsing = False
# Enable WebGL.
# Type: Bool
c.content.webgl = False
# Monitor load requests for cross-site scripting attempts. Suspicious
# scripts will be blocked and reported in the inspector's JavaScript
# console. Enabling this feature might have an impact on performance.
# Type: Bool
c.content.xss_auditing = True
# What to display in the download filename input.
# Type: String
# Valid values:
# - path: Show only the download path.
# - filename: Show only download filename.
# - both: Show download path and filename.
c.downloads.location.suggestion = 'filename'
# Where to show the downloaded files.
# Type: VerticalPosition
# Valid values:
# - top
# - bottom
c.downloads.position = 'top'
# Duration (in milliseconds) to wait before removing finished downloads.
# If set to -1, downloads are never removed.
# Type: Int
c.downloads.remove_finished = 8000
# Automatically enter insert mode if an editable element is focused
# after loading the page.
# Type: Bool
c.input.insert_mode.auto_load = True
# Leave insert mode if a non-editable element is clicked.
# Type: Bool
c.input.insert_mode.auto_leave = True
# Duration (in milliseconds) to show messages in the statusbar for. Set
# to 0 to never clear messages.
# Type: Int
c.messages.timeout = 8000
# Enable smooth scrolling for web pages. Note smooth scrolling does not
# work with the `:scroll-px` command.
# Type: Bool
c.scrolling.smooth = True
# Languages to use for spell checking. You can check for available
# languages and install dictionaries using scripts/dictcli.py. Run the
# script with -h/--help for instructions.
# Type: List of String
# Valid values:
# - af-ZA: Afrikaans (South Africa)
# - bg-BG: Bulgarian (Bulgaria)
# - ca-ES: Catalan (Spain)
# - cs-CZ: Czech (Czech Republic)
# - da-DK: Danish (Denmark)
# - de-DE: German (Germany)
# - el-GR: Greek (Greece)
# - en-AU: English (Australia)
# - en-CA: English (Canada)
# - en-GB: English (United Kingdom)
# - en-US: English (United States)
# - es-ES: Spanish (Spain)
# - et-EE: Estonian (Estonia)
# - fa-IR: Farsi (Iran)
# - fo-FO: Faroese (Faroe Islands)
# - fr-FR: French (France)
# - he-IL: Hebrew (Israel)
# - hi-IN: Hindi (India)
# - hr-HR: Croatian (Croatia)
# - hu-HU: Hungarian (Hungary)
# - id-ID: Indonesian (Indonesia)
# - it-IT: Italian (Italy)
# - ko: Korean
# - lt-LT: Lithuanian (Lithuania)
# - lv-LV: Latvian (Latvia)
# - nb-NO: Norwegian (Norway)
# - nl-NL: Dutch (Netherlands)
# - pl-PL: Polish (Poland)
# - pt-BR: Portuguese (Brazil)
# - pt-PT: Portuguese (Portugal)
# - ro-RO: Romanian (Romania)
# - ru-RU: Russian (Russia)
# - sh: Serbo-Croatian
# - sk-SK: Slovak (Slovakia)
# - sl-SI: Slovenian (Slovenia)
# - sq: Albanian
# - sr: Serbian
# - sv-SE: Swedish (Sweden)
# - ta-IN: Tamil (India)
# - tg-TG: Tajik (Tajikistan)
# - tr-TR: Turkish (Turkey)
# - uk-UA: Ukrainian (Ukraine)
# - vi-VN: Vietnamese (Viet Nam)
c.spellcheck.languages = []
# Position of the tab bar.
# Type: Position
# Valid values:
# - top
# - bottom
# - left
# - right
c.tabs.position = 'top'
# When to show the tab bar.
# Type: String
# Valid values:
# - always: Always show the tab bar.
# - never: Always hide the tab bar.
# - multiple: Hide the tab bar if only one tab is open.
# - switching: Show the tab bar when switching tabs.
c.tabs.show = 'switching'
# Search engines which can be used via the address bar. Maps a search
# engine name (such as `DEFAULT`, or `ddg`) to a URL with a `{}`
# placeholder. The placeholder will be replaced by the search term, use
# `{{` and `}}` for literal `{`/`}` signs. The search engine named
# `DEFAULT` is used when `url.auto_search` is turned on and something
# else than a URL was entered to be opened. Other search engines can be
# used by prepending the search engine name to the search term, e.g.
# `:open google qutebrowser`.
# Type: Dict
c.url.searchengines = {
'DEFAULT': 'https://duckduckgo.com/?q={}',
'y': 'https://youtube.com/results?search_query={}',
'w': 'https://en.wikipedia.org/w/index.php?search={}',
'aw': 'https://wiki.archlinux.org/index.php?search={}',
'g': 'https://www.google.com/search?source=&q={}',
'gi': 'https://www.google.com/search?tbm=isch&q={}',
'aur': 'https://aur.archlinux.org/packages/?O=0&K={}',
'c': 'https://en.cppreference.com/w/cpp/keyword/{}',
'r': 'https://doc.rust-lang.org/stable/std/?search={}'
}
c.url.start_pages = ['https://nixos.org/nixos/manual/options.html']
c.hints.chars = "asdfghjklvbcntyruewom"
c.colors.webpage.darkmode.enabled = True
c.colors.webpage.prefers_color_scheme_dark = True
# Font color for hints.
# Type: QssColor
c.colors.hints.fg = '#EFF0EB'
# Background color for hints. Note that you can use a `rgba(...)` value
# for transparency.
# Type: QssColor
c.colors.hints.bg = '#1E1F29'
# Font color for the matched part of hints.
# Type: QssColor
c.colors.hints.match.fg = '#5AF78E'
# leave listed modes easily with <a-j>
for mode in\
['caret', 'command', 'hint',
'insert', 'passthrough', 'prompt',
'yesno']:
config.bind('<Alt+j>', 'leave-mode', mode=mode)
# Bindings for normal mode
config.bind(',p', 'spawn --userscript qute-pass -M gopass')
config.bind(',P', 'set-cmd-text -s :open -p')
config.bind(',r', 'restart')
config.bind(',c', 'config-source')
config.bind(';I', 'hint images download')
config.bind('X', 'undo')
config.bind('d', 'scroll-page 0 0.5')
config.bind('u', 'scroll-page 0 -0.5')
config.bind('x', 'tab-close')

View File

@ -1,31 +0,0 @@
{ pkgs, ... }:
let inherit (builtins) readFile;
in
{
sound.enable = true;
environment = {
etc."xdg/qutebrowser/config.py".text =
let mpv = "${pkgs.mpv}/bin/mpv";
in
''
${readFile ./config.py}
config.bind(',m', 'hint links spawn -d ${mpv} {hint-url}')
config.bind(',v', 'spawn -d ${mpv} {url}')
'';
sessionVariables.BROWSER = "qute";
systemPackages = with pkgs; [ qute qutebrowser mpv youtubeDL rofi ];
};
nixpkgs.overlays = [
(final: prev: {
# wrapper to specify config file
qute = prev.writeShellScriptBin "qute" ''
QUTE_DARKMODE_VARIANT=qt_515_2 QT_QPA_PLATFORMTHEME= exec ${final.qutebrowser}/bin/qutebrowser -C /etc/xdg/qutebrowser/config.py "$@"
'';
})
];
}

View File

@ -1,241 +0,0 @@
### Variables
#
# Logo key. Use Mod1 for Alt.
set $mod Mod4
# Home row direction keys, like vim
set $left h
set $down j
set $up k
set $right l
# preferred terminal emulator
set $term alacritty
# preferred browser
set $browser $$BROWSER
# Your preferred application launcher
# Note: it's recommended that you pass the final command to sway
set $menu dmenu_path | dmenu -b | xargs swaymsg exec --
# network manager
set $net_menu networkmanager_dmenu -b
# don't show window titles only show single pixel as border
default_border pixel
set $φ 38 ppt
set $Φ 62 ppt
# reusable regexes
set $media "mpv|retroarch"
### Autostart configuration
# launch browser and tmux session in $terminal on launch
for_window [app_id="Alacritty"] resize set width $φ
for_window [app_id="org.qutebrowser.qutebrowser"] resize set width $Φ
for_window [app_id="org.qutebrowser.qutebrowser"] move left
exec $term -e tmux new-session -A -s$$USER \; split-window -v -p 38
### idle configuration
exec swayidle -w \
timeout 300 'loginctl lock-session' \
timeout 300 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"' \
lock 'swaylock -e -f -c 000000' \
before-sleep 'loginctl lock-session'
for_window [class=".*"] inhibit_idle fullscreen
for_window [app_id=".*"] inhibit_idle fullscreen
### Input configuration
#
# Example configuration:
#
input "2:7:SynPS/2_Synaptics_TouchPad" {
dwt disable
tap enabled
natural_scroll enabled
middle_emulation enabled
pointer_accel 1
}
# hide mouse cursor after one second
seat seat0 {
hide_cursor 1000
}
#
# You can get the names of your inputs by running: swaymsg -t get_inputs
# Read `man 5 sway-input` for more information about this section.
### Key bindings
#
# Basics:
#
# Start a terminal
bindsym $mod+Return exec $term
# Start browser
bindsym $mod+Shift+b exec $browser
# Kill focused window
bindsym $mod+Shift+c kill
# Start your launcher
bindsym $mod+d exec $menu
# start network manager
bindsym $mod+n exec $net_menu
# lock screen
bindsym $mod+Ctrl+l exec loginctl lock-session
# go fullscreen
bindsym $mod+f fullscreen
# display volume level when pushed
bindsym XF86AudioRaiseVolume exec $volume; $mixer 2%+ unmute
bindsym XF86AudioLowerVolume exec $volume; $mixer 2%- unmute
bindsym XF86AudioMute exec $volume; $mixer toggle
# Drag floating windows by holding down $mod and left mouse button.
# Resize them with right mouse button + $mod.
# Despite the name, also works for non-floating windows.
# Change normal to inverse to use left mouse button for resizing and right
# mouse button for dragging.
floating_modifier $mod normal
# Reload the configuration file
bindsym $mod+Shift+q reload
# Exit sway (logs you out of your Wayland session)
bindsym $mod+Shift+e exec 'swaymsg exit'
#
# Moving around:
#
# Move your focus around
bindsym $mod+$left focus left
bindsym $mod+$down focus down
bindsym $mod+$up focus up
bindsym $mod+$right focus right
# Or use $mod+[up|down|left|right]
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# Move the focused window with the same, but add Shift
bindsym $mod+Shift+$left move left
bindsym $mod+Shift+$down move down
bindsym $mod+Shift+$up move up
bindsym $mod+Shift+$right move right
# Ditto, with arrow keys
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
#
# Workspaces:
#
# Switch to workspace
bindsym $mod+1 workspace 1:main
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6:media
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10
# Move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1:main
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6:media
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10
# Note: workspaces can have any name you want, not just numbers.
# We just use 1-10 as the default.
assign [app_id=$media] workspace 6:media
for_window [app_id=$media] fullscreen enable
for_window [app_id=$media] focus
#
# Layout stuff:
#
# You can "split" the current object of your focus with
# $mod+b or $mod+v, for horizontal and vertical splits
# respectively.
bindsym $mod+b splith
bindsym $mod+v splitv
# Switch the current container between different layout styles
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# Toggle the current focus between tiling and floating mode
bindsym $mod+t floating toggle
# Swap focus between the tiling area and the floating area
bindsym $mod+Shift+t focus mode_toggle
# resize window to φ ratio of screen or ½
bindsym $mod+Shift+space exec swaymsg resize set width $φ
bindsym $mod+space exec swaymsg resize set width $Φ
bindsym $mod+Ctrl+space exec swaymsg resize set width 50
# Move focus to the parent container
bindsym $mod+a focus parent
#
# Scratchpad:
#
# Sway has a "scratchpad", which is a bag of holding for windows.
# You can send windows there and get them back later.
# Move the currently focused window to the scratchpad
bindsym $mod+Shift+minus move scratchpad
# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
bindsym $mod+minus scratchpad show
#
# Resizing containers:
#
mode "resize" {
# left will shrink the containers width
# right will grow the containers width
# up will shrink the containers height
# down will grow the containers height
bindsym $left resize shrink width 10px
bindsym $down resize grow height 10px
bindsym $up resize shrink height 10px
bindsym $right resize grow width 10px
# Ditto, with arrow keys
bindsym Left resize shrink width 10px
bindsym Down resize grow height 10px
bindsym Up resize shrink height 10px
bindsym Right resize grow width 10px
# Return to default mode
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"
#
# Status Bar:
#
# Read `man 5 sway-bar` for more information about this section.
bar {
swaybar_command waybar
}
exec "systemctl --user import-environment; systemctl --user start sway-session.target"

View File

@ -1,94 +0,0 @@
{ lib, config, options, pkgs, ... }:
let
inherit (builtins) readFile;
inherit (config.hardware) pulseaudio;
in
{
imports = [ ../qutebrowser ];
sound.enable = true;
programs.sway = {
enable = true;
extraSessionCommands = ''
export SDL_VIDEODRIVER=wayland
# needs qt5.qtwayland in systemPackages
export QT_QPA_PLATFORM=wayland
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
# Fix for some Java AWT applications (e.g. Android Studio),
# use this if they aren't displayed properly:
export _JAVA_AWT_WM_NONREPARENTING=1
'';
extraPackages = with pkgs;
options.programs.sway.extraPackages.default ++ [
dmenu
networkmanager_dmenu
qt5.qtwayland
alacritty
volnoti
wl-clipboard
(waybar.override { pulseSupport = pulseaudio.enable; })
grim
slurp
];
};
environment.etc = {
"sway/config".text =
let volnoti = import ../misc/volnoti.nix { inherit pkgs; };
in
''
set $volume ${volnoti}
set $mixer "${pkgs.alsaUtils}/bin/amixer -q set Master"
# set background
output * bg ${pkgs.adapta-backgrounds}/share/backgrounds/adapta/tri-fadeno.jpg fill
${readFile ./config}
'';
"xdg/waybar".source = ./waybar;
};
programs.tmux.extraConfig = lib.mkBefore ''
set -g @override_copy_command 'wl-copy'
'';
services.redshift = {
enable = true;
temperature.night = 3200;
};
location = {
latitude = 38.833881;
longitude = -104.821365;
};
systemd.user.targets.sway-session = {
enable = true;
description = "sway compositor session";
documentation = [ "man:systemd.special(7)" ];
bindsTo = [ "graphical-session.target" ];
wants = [ "graphical-session-pre.target" ];
after = [ "graphical-session-pre.target" ];
requiredBy = [ "graphical-session.target" "graphical-session-pre.target" ];
};
systemd.user.services.volnoti = {
enable = true;
description = "volnoti volume notification";
documentation = [ "volnoti --help" ];
wantedBy = [ "sway-session.target" ];
script = "${pkgs.volnoti}/bin/volnoti -n";
serviceConfig = {
Restart = "always";
RestartSec = 3;
};
};
}

View File

@ -1,77 +0,0 @@
{
"layer": "top", // Waybar at top layer
// Choose the order of the modules
"modules-left": ["sway/workspaces", "sway/mode"],
"modules-center": ["sway/window"],
"modules-right": ["cpu", "memory", "temperature", "backlight", "pulseaudio", "network", "battery", "clock", "tray"],
// Modules configuration
"sway/mode": {
"format": "<span style=\"italic\">{}</span>"
},
"clock": {
"format": "{:%I:%M %p}",
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
"format-alt": "{:%Y-%m-%d}"
},
"cpu": {
"format": "{usage}% ",
"tooltip": false
},
"memory": {
"format": "{}% "
},
"temperature": {
// "thermal-zone": 2,
// "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input",
"critical-threshold": 80,
// "format-critical": "{temperatureC}°C {icon}",
"format": "{temperatureC}°C {icon}",
"format-icons": ["", "", ""]
},
"backlight": {
"format": "{percent}% {icon}",
"format-icons": ["", ""]
},
"battery": {
"states": {
"warning": 30,
"critical": 15
},
"format": "{capacity}% {icon}",
"format-charging": "{capacity}% ",
"format-plugged": "{capacity}% ",
"format-alt": "{time} {icon}",
// "format-good": "", // An empty format will hide the module
// "format-full": "",
"format-icons": ["", "", "", "", ""]
},
"network": {
"format-wifi": "{essid} ({signalStrength}%) ",
"format-ethernet": "{ifname}: {ipaddr}/{cidr} ",
"format-linked": "{ifname} (No IP) ",
"format-disconnected": "Disconnected ⚠",
"format-alt": "{ifname}: {ipaddr}/{cidr}"
},
"pulseaudio": {
// "scroll-step": 1, // %, can be a float
"format": "{volume}% {icon} {format_source}",
"format-bluetooth": "{volume}% {icon} {format_source}",
"format-bluetooth-muted": " {icon} {format_source}",
"format-muted": " {format_source}",
"format-source": "{volume}% ",
"format-source-muted": "",
"format-icons": {
"headphones": "",
"handsfree": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", "", ""]
}
},
"tray": {
"icon-size": 21,
"spacing": 10
}
}

View File

@ -1,122 +0,0 @@
* {
border: none;
border-radius: 0;
font-family: Roboto, Helvetica, Arial, sans-serif;
font-size: 13px;
min-height: 0;
}
window#waybar {
background-color: rgba(43, 48, 59, 0.5);
border-bottom: 3px solid rgba(100, 114, 125, 0.5);
color: #ffffff;
transition-property: background-color;
transition-duration: .5s;
}
window#waybar.hidden {
opacity: 0.2;
}
/*
window#waybar.empty {
background-color: transparent;
}
window#waybar.solo {
background-color: #FFFFFF;
}
*/
window#waybar.termite {
background-color: #3F3F3F;
}
window#waybar.chromium {
background-color: #000000;
border: none;
}
#workspaces button {
padding: 0 5px;
background-color: transparent;
color: #ffffff;
border-bottom: 3px solid transparent;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
#workspaces button:hover {
background: rgba(0, 0, 0, 0.2);
box-shadow: inherit;
border-bottom: 3px solid #ffffff;
}
#workspaces button.focused {
background-color: #64727D;
border-bottom: 3px solid #ffffff;
}
#workspaces button.urgent {
background-color: #eb4d4b;
}
#mode {
background-color: #64727D;
border-bottom: 3px solid #ffffff;
}
#clock,
#battery,
#cpu,
#memory,
#temperature,
#backlight,
#network,
#pulseaudio,
#custom-media,
#tray,
#mode,
#idle_inhibitor {
padding: 0 10px;
margin: 0 4px;
color: #ffffff;
}
#battery.charging {
color: #ffffff;
background-color: #26A65B;
}
@keyframes blink {
to {
background-color: #ffffff;
color: #000000;
}
}
#battery.critical:not(.charging) {
background-color: #f53c3c;
color: #ffffff;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
label:focus {
background-color: #000000;
}
#network.disconnected {
background-color: #f53c3c;
}
#pulseaudio.muted {
background-color: #90b1b1;
color: #2a5c45;
}
#temperature.critical {
background-color: #eb4d4b;
}

View File

@ -1,87 +0,0 @@
import XMonad
import XMonad.Config.Desktop (desktopConfig)
import XMonad.Hooks.EwmhDesktops (ewmh)
import XMonad.Hooks.ICCCMFocus (takeTopFocus)
import XMonad.Hooks.ManageDocks
import XMonad.Util.EZConfig (additionalKeys)
import Data.Maybe (fromMaybe)
import Graphics.X11.ExtraTypes.XF86 (xF86XK_AudioLowerVolume,
xF86XK_AudioMute,
xF86XK_AudioRaiseVolume)
import Graphics.X11.Types (KeyMask, KeySym, Window)
import System.Environment (lookupEnv)
import XMonad.Layout.ResizableTile (ResizableTall(..),
MirrorResize (MirrorShrink,
MirrorExpand))
import XMonad.Layout.MultiToggle
import XMonad.Layout.MultiToggle.Instances
import Control.Monad (liftM2)
import Data.Monoid (Endo)
import XMonad.Core (Layout, Query,
ScreenDetail, ScreenId,
WorkspaceId, X)
import XMonad.Hooks.SetWMName (setWMName)
import XMonad.Layout.NoBorders (smartBorders)
import XMonad.Layout.PerWorkspace (onWorkspace)
import XMonad.Layout.Reflect (reflectHoriz)
import XMonad.Util.Cursor
import qualified XMonad.StackSet as S (StackSet, greedyView,
shift)
main :: IO ()
main =
xmonad . ewmh $ desktopConfig
{ terminal = "alacritty"
, modMask = myModKey
, layoutHook = avoidStruts myLayout
, workspaces = myWorkspaces
, startupHook = myAutostart
, manageHook = myManageHook
<+> manageHook defaultConfig
<+> manageDocks
, borderWidth = 0
, logHook = takeTopFocus
}
`additionalKeys` myKeys
myLayout = smartBorders
. mkToggle ( NBFULL ?? EOT)
. onWorkspace "7:im" ( half ||| Mirror half ||| tiled ||| reflectHoriz tiled )
$ tiled ||| reflectHoriz tiled ||| half ||| Mirror half
where
tiled = ResizableTall nmaster delta ratiot []
half = ResizableTall nmaster delta ratioh []
nmaster = 1
ratiot = 309/500
ratioh = 1/2
delta = 1/9
myWorkspaces :: [ String ]
myWorkspaces = ["1:main", "2:art", "3:net", "4:pdf", "5:game", "6:media", "7:im", "8", "9"]
-- Move Programs by X11 Class to specific workspaces on opening
myManageHook :: Query
( Endo
( S.StackSet WorkspaceId (Layout Window) Window ScreenId ScreenDetail )
)
myManageHook = composeAll
[ className =? "st-256color" --> viewShift "1:main"
, className =? "qutebrowser" --> viewShift "1:main"
, className =? "Gimp" --> viewShift "2:art"
, className =? "krita" --> viewShift "2:art"
, className =? "qBittorrent" --> viewShift "3:torrent"
, className =? "PCSX2" --> viewShift "5:game"
, className =? "RPCS3" --> viewShift "5:game"
, className =? "mpv" --> viewShift "6:media"
, className =? "Zathura" --> viewShift "4:pdf"
, className =? "Signal" --> doShift "7:im"
, className =? "Steam" --> doFloat
, className =? "Wine" --> doFloat
]
where viewShift = doF . liftM2 (.) S.greedyView S.shift
-- Set ModKey to the Windows Key
myModKey :: KeyMask
myModKey = mod4Mask

View File

@ -1,111 +0,0 @@
{ autostart, screenshots, pkgs, stoggle, volnoti }:
let inherit (pkgs) alsaUtils;
in
''
-- Function for fullscreen toggle
fullToggle :: X ()
fullToggle = do
spawn "${stoggle}"
sendMessage $ Toggle NBFULL
sendMessage $ SetStruts [] [minBound .. maxBound]
setVolume :: String -> X ()
setVolume options = do
spawn ("${alsaUtils}/bin/amixer -q set Master " ++ options)
spawn "${volnoti}"
myAutostart :: X ()
myAutostart = do
spawn "${autostart}"
spawn "feh --bg-fill --no-fehbg ${pkgs.adapta-backgrounds}/share/backgrounds/adapta/tri-fadeno.jpg"
setWMName "LG3D"
sendMessage $ SetStruts [] [minBound .. maxBound]
setDefaultCursor xC_left_ptr
-- Set custom keybinds below following the structure:
-- ( ( ModifierKey, KeyPress ), Action )
myKeys :: [ ( ( KeyMask, KeySym ), X () ) ]
myKeys =
-- toggle fullscreen, along with power state
[ ( ( myModKey , xK_f )
, fullToggle
)
-- resize windows in master pane
, ( ( myModKey , xK_Left )
, sendMessage MirrorExpand
)
, ( ( myModKey , xK_Right )
, sendMessage MirrorShrink
)
, ( ( myModKey , xK_Up )
, sendMessage MirrorExpand
)
, ( ( myModKey , xK_Down )
, sendMessage MirrorShrink
)
-- toggle systray
, ( ( myModKey .|. shiftMask , xK_f )
, sendMessage ToggleStruts
)
-- lower volume
, ( ( 0 , xF86XK_AudioLowerVolume )
, setVolume "2%- unmute"
)
-- raise volume
, ( ( 0 , xF86XK_AudioRaiseVolume )
, setVolume "2%+ unmute"
)
-- mute volume
, ( ( 0 , xF86XK_AudioMute )
, setVolume "toggle"
)
-- start qutebrowser
, ( ( myModKey , xK_b )
, spawn "qute"
)
-- screen lock
, ( ( myModKey .|. shiftMask , xK_l )
, spawn "loginctl lock-session"
)
-- screenshot
, ( ( myModKey , xK_Print )
, spawn "maim -u \
\ | png2ff | xz -9 - \
\ > ~/${screenshots}/$(date +%m.%d.%y_%I.%M.%S_%p).ff.xz"
)
-- screenshot focused window
, ( ( myModKey .|. shiftMask , xK_Print )
, spawn "maim -u -i$(xdotool getactivewindow) \
\ | png2ff \
\ | xz -9 - \
\ > ~/${screenshots}/$(date +%m.%d.%y_%I.%M.%S_%p).ff.xz"
)
-- screenshot selection to clipboard
, ( ( myModKey .|. controlMask , xK_Print )
, spawn "maim -s -u \
\ | xclip -selection clipboard -t image/png"
)
-- screenshot selection file
, ( ( myModKey .|. controlMask .|. shiftMask, xK_Print )
, spawn "maim -s -u \
\ | png2ff \
\ | xz -9 - \
\ > ~/${screenshots}/$(date +%m.%d.%y_%I.%M.%S_%p).ff.xz"
)
-- screenshot selection to imgur and paste url in clipboard
, ( ( myModKey .|. shiftMask , xK_i )
, spawn "maim -s -u /tmp/img.png; \
\ imgurbash2 /tmp/img.png; \
\ rm /tmp/img.png"
)
-- dmenu frontend for network manager
, ( ( myModKey , xK_n )
, spawn "networkmanager_dmenu -fn 'monospace'"
)
]
''

View File

@ -1,27 +0,0 @@
{ pkgs, ... }: {
environment.systemPackages = with pkgs; [
farbfeld
xss-lock
imgurbash2
maim
xclip
xorg.xdpyinfo
];
services.xserver.windowManager.xmonad = {
enable = true;
enableContribAndExtras = true;
config = import ./xmonad.hs.nix { inherit pkgs; };
};
services.picom = {
enable = true;
inactiveOpacity = 0.8;
settings = {
"unredir-if-possible" = true;
"focus-exclude" = "name = 'slock'";
};
};
programs.slock.enable = true;
}

View File

@ -1,16 +0,0 @@
#!/usr/bin/env zsh
terminal="alacritty"
# set screen locker to slock
pgrep -x xss-lock \
|| xss-lock slock&!
pgrep -x xbanish \
|| xbanish&!
${terminal} -e tmux new-session -As $(whoami)&!
if ! pgrep -f qutebrowser; then
${BROWSER} &!
fi

View File

@ -1,45 +0,0 @@
#!/usr/bin/env zsh
# variables for dzen2
WIDTH=512
WINDOW_HEIGHT=$( xdpyinfo \
| awk '$1 ~ /dimensions/ {split($2,arr,"x"); print int(arr[2])}' \
)
WINDOW_WIDTH=$( xdpyinfo \
| awk '$1 ~ /dimensions/ {split($2,arr,"x"); print int(arr[1])}' \
)
XPOS=$(( ( ${WINDOW_WIDTH} / 2 ) - ( ${WIDTH} / 2 ) ))
YPOS=$(( ${WINDOW_HEIGHT} / 2 ))
readonly WIDTH WINDOW_HEIGHT WINDOW_WIDTH XPOS YPOS
# get current state of dpms
xset -q \
| grep -Eo 'DPMS is (Enabled|Disabled)' \
| awk '{print $3}' \
| read dpms_state
# function to call dzen2 with current state
dzen2_dpms_state () {
local -r \
new_dpms_state=$1
print "Power Management ${new_dpms_state}" \
| dzen2 -fn "monospace" -p 2 -tw ${WIDTH} -x ${XPOS} -y ${YPOS}
}
case $dpms_state in
Enabled)
xset -dpms
xset s off
dzen2_dpms_state "Disabled"
;;
Disabled)
xset +dpms
xset s on
xset s 300
dzen2_dpms_state "Enabled"
;;
*)
exit 1
;;
esac

View File

@ -1,19 +0,0 @@
{ pkgs, ... }:
let
inherit (builtins) readFile;
inherit (pkgs) writeScript;
screenshots = "Pictures/shots";
autostart = writeScript "xmonad-autostart" (readFile ./scripts/autostart);
stoggle = writeScript "xmonad-stoggle" (readFile ./scripts/stoggle);
volnoti = import ../misc/volnoti.nix { inherit pkgs; };
in
''
${readFile ./_xmonad.hs}
${import ./_xmonad.nix {
inherit screenshots autostart stoggle pkgs volnoti;
}}
''

View File

@ -1,62 +0,0 @@
{ config, pkgs, lib, ... }: {
environment.systemPackages = with pkgs; [
acpi
lm_sensors
wirelesstools
pciutils
usbutils
];
hardware.bluetooth.enable = true;
# to enable brightness keys 'keys' value may need updating per device
programs.light.enable = true;
services.actkbd = {
enable = true;
bindings = [
{
keys = [ 225 ];
events = [ "key" ];
command = "/run/current-system/sw/bin/light -A 5";
}
{
keys = [ 224 ];
events = [ "key" ];
command = "/run/current-system/sw/bin/light -U 5";
}
];
};
sound.mediaKeys = lib.mkIf (!config.hardware.pulseaudio.enable) {
enable = true;
volumeStep = "1dB";
};
# better timesync for unstable internet connections
services.chrony.enable = true;
services.timesyncd.enable = false;
# power management features
services.tlp.enable = true;
services.tlp.settings = {
CPU_SCALING_GOVERNOR_ON_AC = "performance";
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
CPU_HWP_ON_AC = "performance";
};
services.logind.lidSwitch = "suspend";
nixpkgs.overlays =
let
light_ov = self: super: {
light = super.light.overrideAttrs (o: {
src = self.fetchFromGitHub {
owner = "haikarainen";
repo = "light";
rev = "ae7a6ebb45a712e5293c7961eed8cceaa4ebf0b6";
sha256 = "00z9bxrkjpfmfhz9fbf6mjbfqvixx6857mvgmiv01fvvs0lr371n";
};
});
};
in
[ light_ov ];
}

View File

@ -1 +0,0 @@
{ ... }: { }

View File

@ -1 +0,0 @@
{ ... }: { security.mitigations.disable = true; }

View File

@ -1,44 +0,0 @@
{ pkgs, ... }:
let
inherit (builtins) concatStringsSep;
inherit (pkgs) fetchFromGitHub stdenv gnugrep;
inherit (builtins) readFile fetchurl;
hosts = stdenv.mkDerivation {
name = "hosts";
src = fetchFromGitHub {
owner = "StevenBlack";
repo = "hosts";
rev = "a204d5a1e9049dd12378fa5f9c5ab3fc6bf3d63e";
hash = "sha256-8WVEvpxxvxmOpP1XVgO2GFAbEHO1QileWZ3behpgYEs=";
};
nativeBuildInputs = [ gnugrep ];
installPhase = ''
mkdir -p $out/etc
# filter whitelist
grep -Ev '(${whitelist})' hosts > $out/etc/hosts
# filter blacklist
cat << EOF >> $out/etc/hosts
${blacklist}
EOF
'';
};
whitelist = concatStringsSep "|" [ ".*pirate(bay|proxy).*" ];
blacklist = concatStringsSep ''
0.0.0.0 ''
[
"# auto-generated: must be first"
# starts here
];
in
{ networking.extraHosts = readFile "${hosts}/etc/hosts"; }

View File

@ -1,3 +0,0 @@
{ ... }: {
imports = [ ./networkmanager ./adblocking ];
}

View File

@ -1,25 +0,0 @@
{ lib, ... }: {
networking.networkmanager = {
enable = true;
wifi.backend = "iwd";
dns = lib.mkForce "none";
extraConfig = ''
[main]
systemd-resolved=false
'';
};
networking.nameservers =
[ "1.1.1.1#one.one.one.one" "1.0.0.1#one.one.one.one" ];
networking.wireless.iwd.enable = true;
services.resolved = {
enable = true;
dnssec = "true";
fallbackDns = [ "1.1.1.1#one.one.one.one" "1.0.0.1#one.one.one.one" ];
extraConfig = ''
DNSOverTLS=yes
'';
};
}

View File

@ -1,28 +0,0 @@
{ ... }: {
services.stubby = {
enable = true;
upstreamServers = ''
- address_data: 1.1.1.1
tls_port: 853
tls_auth_name: "cloudflare-dns.com"
- address_data: 1.0.0.1
tls_port: 853
tls_auth_name: "cloudflare-dns.com"
'';
};
environment.etc = {
"resolv.conf" = {
text = ''
options edns0
nameserver 127.0.0.1
'';
mode = "444";
};
};
networking = {
networkmanager.dns = "none";
resolvconf.dnsExtensionMechanism = false;
};
}

View File

@ -1,24 +0,0 @@
{ config, lib, ... }:
let
inherit (config.services.qbittorrent) port;
inherit (lib) mkAfter;
in
{
services.qbittorrent = {
enable = true;
group = "media";
openFirewall = true;
};
users.groups.media.members = [ "qbittorrent" ];
environment.etc."xdg/qutebrowser/config.py".text = mkAfter ''
c.url.searchengines['to'] = 'https://torrentz2.eu/search?f={}'
config.bind(',t', """hint all spawn curl -X POST\
-F "urls={hint-url}"\
-F "sequentialDownload=true"\
http://localhost:${toString port}/api/v2/torrents/add"""
)
'';
}

View File

@ -1,8 +0,0 @@
{ ... }: {
services.openssh = {
enable = true;
challengeResponseAuthentication = false;
passwordAuthentication = false;
forwardX11 = true;
};
}

View File

@ -16,19 +16,7 @@ with profiles;
mapAttrs (_: v: lib.flk.profileMap v)
# define your own suites below
rec {
work = [ develop virt users.nixos users.root ];
graphics = work ++ [ graphical ];
mobile = graphics ++ [ laptop ];
play = graphics ++ [
graphical.games
network.torrent
misc.disable-mitigations
];
goPlay = play ++ [ laptop ];
core = [ users.nixos users.root ];
} // {
inherit allProfiles allUsers;
}

View File

@ -1,26 +0,0 @@
{ pkgs, ... }: {
virtualisation = {
libvirtd = {
enable = true;
qemuRunAsRoot = false;
allowedBridges = [
"virbr0"
"virbr1"
];
};
containers.enable = true;
podman.enable = true;
oci-containers.backend = "podman";
};
# you'll need to add your user to 'libvirtd' group to use virt-manager
environment.systemPackages = with pkgs; [ virt-manager vagrant ];
environment.shellAliases.docker = "podman";
environment.sessionVariables = {
VAGRANT_DEFAULT_PROVIDER = "libvirt";
};
}

View File

@ -1,44 +0,0 @@
{
programs.alacritty = {
enable = true;
settings = {
env.TERM = "xterm-256color";
window.decorations = "full";
font.size = 9.0;
cursor.style = "Beam";
# snazzy theme
colors = {
# Default colors
primary = {
background = "0x282a36";
foreground = "0xeff0eb";
};
# Normal colors
normal = {
black = "0x282a36";
red = "0xff5c57";
green = "0x5af78e";
yellow = "0xf3f99d";
blue = "0x57c7ff";
magenta = "0xff6ac1";
cyan = "0x9aedfe";
white = "0xf1f1f0";
};
# Bright colors
bright = {
black = "0x686868";
red = "0xff5c57";
green = "0x5af78e";
yellow = "0xf3f99d";
blue = "0x57c7ff";
magenta = "0xff6ac1";
cyan = "0x9aedfe";
white = "0xf1f1f0";
};
};
};
};
}