Compare commits

..

1 Commits

Author SHA1 Message Date
Ricard Illa 2fcb8531a0
feat: kile v2 2023-06-04 11:34:44 +02:00
162 changed files with 4888 additions and 1714 deletions

310
capibara.nix Normal file
View File

@ -0,0 +1,310 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, stablePkgs, impermanence, ... }:
let
home = "/home/rilla";
offline-backups = pkgs.writeScriptBin "offline-backups" ''
#!${pkgs.dash}/bin/dash
set -xe
for x in 0 1 2; do
${pkgs.systemd}/bin/systemctl start "mnt-backups-''${x}.mount"
done && \
/run/wrappers/bin/doas -u btrbk \
${pkgs.btrbk}/bin/btrbk \
--config /etc/btrbk/offline-backups.conf \
--progress \
--verbose \
"$@"
'';
in {
imports = [ ./nixos/hardware-configuration/capibara.nix ./nixos/common.nix ];
home-manager = {
users.rilla.imports =
[ home/capibara.nix "${impermanence}/home-manager.nix" ];
};
fileSystems = {
"/mnt/btr_root" = {
device = "/dev/mapper/root";
fsType = "btrfs";
options = [ "subvolid=5" "compress=zstd" ];
};
"/mnt/btr_data" = {
device = "/dev/mapper/data";
fsType = "btrfs";
options = [ "subvolid=5" "compress=zstd" ];
};
"/mnt/persist" = {
device = "/dev/mapper/data";
fsType = "btrfs";
options = [ "subvol=persist" "compress=zstd" ];
neededForBoot = true;
};
"/mnt/logs" = {
device = "/dev/mapper/root";
fsType = "btrfs";
options = [ "subvol=logs" "compress=zstd" ];
neededForBoot = true;
};
"/mnt/data" = {
device = "/dev/mapper/data";
fsType = "btrfs";
options = [ "subvol=data" "compress=zstd" ];
neededForBoot = true;
};
"/nix" = {
device = "/dev/mapper/root";
fsType = "btrfs";
options = [ "subvol=nix" "compress=zstd" ];
};
"/boot" = {
device = "/dev/disk/by-uuid/c99d1f1b-45a4-4a25-b5b8-bc76464c6825";
fsType = "ext4";
};
"/swap" = {
device = "/dev/mapper/root";
fsType = "btrfs";
options = [ "subvol=swap" ];
};
"/mnt/vfs_share" = {
device = "/dev/mapper/data";
fsType = "btrfs";
options = [ "subvol=vfs_share" "compress=zstd" ];
};
"/mnt/backups/0" = {
device = "/dev/mapper/backups0";
fsType = "btrfs";
options = [ "noauto" "subvolid=5" "compress=zstd" ];
};
"/mnt/backups/1" = {
device = "/dev/mapper/backups1";
fsType = "btrfs";
options = [ "noauto" "subvolid=5" "compress=zstd" ];
};
"/mnt/backups/2" = {
device = "/dev/mapper/backups2";
fsType = "btrfs";
options = [ "noauto" "subvolid=5" "compress=zstd" ];
};
};
environment.etc = {
crypttab = {
text = ''
backups0 UUID="e45232d5-f46f-46f3-a150-be26374b3357" /etc/luks-keys/backups.bin noauto
backups1 UUID="5b3da928-4862-4451-89cd-5bd6a95466d0" /etc/luks-keys/backups.bin noauto
backups2 UUID="cbfa9cba-dee2-4d0b-8cde-2f1d1849b22c" /etc/luks-keys/backups.bin noauto
'';
};
};
environment.variables = {
NIXOS_CONFIG = "${home}/configs/nix-config/capibara.nix";
LV2_PATH =
"${home}/.nix-profile/lib/lv2:${home}/Audio/plugins/lv2:/run/current-system/sw/lib/lv2";
LXVST_PATH =
"${home}/.nix-profile/lib/lxvst:${home}/Audio/plugins/lxvst:/run/current-system/sw/lib/lxvst";
LADSPA_PATH =
"${home}/.nix-profile/lib/ladspa:${home}/Audio/plugins/ladspa:/run/current-system/sw/lib/ladspa";
};
networking.networkmanager.wifi.macAddress = "CC:AF:78:75:29:32";
nixpkgs.config.allowUnfree = true;
programs.steam.enable = true;
boot = {
loader = {
grub = {
efiSupport = false;
efiInstallAsRemovable = false;
enable = true;
device = "/dev/disk/by-id/ata-KINGSTON_SKC600MS512G_50026B7783FC3D2F";
};
};
initrd = {
luks = {
devices = {
root = {
device = "/dev/disk/by-uuid/869b4b9e-5004-4625-877f-6b1c9489ac8f";
allowDiscards = true;
};
data = {
device = "/dev/disk/by-uuid/6a9246a0-984b-471c-9950-be16db3060f5";
allowDiscards = true;
};
};
reusePassphrases = true;
};
};
};
services.earlyoom.enable = true;
# Power management
powerManagement.enable = true;
services.upower.enable = true;
# services.thermald.enable = true;
services.tlp.enable = true;
services.power-profiles-daemon.enable = false;
environment.systemPackages = with pkgs; [ powertop acpi offline-backups ];
#services.beesd.filesystems = {
# root = {
# spec = "/dev/mapper/root";
# hashTableSizeMB = 256;
# verbosity = "info";
# extraOptions = [ "--loadavg-target" "2.0" ];
# };
#};
# todo: target and/or archive
services.btrbk.instances = {
btrbk = {
onCalendar = "*:0/30"; # every 30 minutes
settings = {
snapshot_preserve = "2d";
snapshot_preserve_min = "latest";
snapshot_create = "onchange";
volume."/mnt/btr_data" = {
snapshot_dir = "btrbk_snapshots";
subvolume = {
data = { };
persist = { };
};
};
};
};
# doas -u btrbk btrbk -c /etc/btrbk/offline-backups.conf --dry-run --progress --verbose run
offline-backups = {
onCalendar = null;
settings = {
ssh_user = "btrbk";
ssh_identity = "/etc/btrbk/id_ed25519";
backend_remote = "btrfs-progs-doas";
snapshot_create = "onchange";
snapshot_preserve_min = "latest";
target_preserve_min = "all";
volume = {
"ssh://narwhal:22/mnt/btr_pool" = {
stream_buffer = "50%";
stream_compress = "zstd";
snapshot_dir = "btrbk_snapshots_offline";
subvolume = {
backups = { };
books = { };
certs = { };
data = { };
docker_volumes = { };
home = { };
http = { };
music = { };
secrets = { };
transmission = { };
videos = { };
};
target = {
"/mnt/backups/0/btr_backup/narwhal" = { };
"/mnt/backups/1/btr_backup/narwhal" = { };
"/mnt/backups/2/btr_backup/narwhal" = { };
};
};
"ssh://suricata:22/mnt/btr_pool" = {
stream_buffer = "50%";
snapshot_dir = "btrbk_snapshots_offline";
compat_remote = "busybox";
subvolume = {
home = { };
rancher_config = { };
backups = { };
configs = { };
};
target = {
"/mnt/backups/0/btr_backup/suricata" = { };
"/mnt/backups/1/btr_backup/suricata" = { };
"/mnt/backups/2/btr_backup/suricata" = { };
};
};
"ssh://caladan/mnt/btr_pool" = {
stream_buffer = "50%";
snapshot_dir = "btrbk_snapshots_offline";
compat_remote = "busybox";
subvolume = {
certs = { };
volumes = { };
};
target = {
"/mnt/backups/0/btr_backup/caladan" = { };
"/mnt/backups/1/btr_backup/caladan" = { };
"/mnt/backups/2/btr_backup/caladan" = { };
};
};
"/mnt/btr_data" = {
snapshot_dir = "btrbk_snapshots_offline";
subvolume = {
data = { };
persist = { };
};
target = {
"/mnt/backups/0/btr_backup/capibara" = { };
"/mnt/backups/1/btr_backup/capibara" = { };
"/mnt/backups/2/btr_backup/capibara" = { };
};
};
};
};
};
};
services.xserver.deviceSection = ''
Option "TearFree" "true"
'';
xdg.portal = {
enable = true;
wlr.enable = true;
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
};
networking = {
hostName = "capibara";
interfaces = {
eno0.useDHCP = true;
wlp2s0.useDHCP = true;
};
};
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "22.11"; # Did you read the comment?
}

157
echidna.nix Normal file
View File

@ -0,0 +1,157 @@
{ config, pkgs, ... }:
let
choose-pass =
pkgs.callPackage ./macos/choose-pass.nix { inherit config pkgs; };
in {
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
# nixpkgs.config.permittedInsecurePackages = [ "python-2.7.18.6" ];
# List packages installed in system profile. To search by name, run:
# $ nix-env -qaP | grep wget
# environment.systemPackages = [ ];
environment.systemPackages = [
(pkgs.pass.withExtensions (exts: [ exts.pass-otp ]))
choose-pass
# pkgs.khal
pkgs.alacritty
pkgs.gopass
pkgs.ansible
pkgs.bat
pkgs.black
pkgs.cheat
pkgs.cmatrix
pkgs.colima
pkgs.coreutils-full
pkgs.csvkit
pkgs.curl
pkgs.diff-so-fancy
pkgs.docker-client
pkgs.docker-machine
pkgs.exa
pkgs.fzf
pkgs.getopt
pkgs.gnupg
pkgs.go
pkgs.google-cloud-sdk
pkgs.gping
pkgs.hlint
pkgs.htop
pkgs.imagemagick
pkgs.jq
pkgs.khard
pkgs.libmysqlclient.dev
pkgs.mosh
pkgs.mpc-cli
pkgs.ncmpcpp
pkgs.neofetch
pkgs.neomutt
pkgs.newsboat
pkgs.nixfmt
pkgs.nodePackages.pyright
pkgs.python310Packages.python-lsp-server
# pkgs.python310Packages.pylsp-mypy
pkgs.openssh
pkgs.pinentry_mac
pkgs.pipenv
pkgs.python310Full
pkgs.python310Packages.pip
pkgs.python310Packages.virtualenvwrapper
# pkgs.pythonFull
pkgs.ripgrep
pkgs.shellcheck
pkgs.shfmt
pkgs.sqlfluff
pkgs.starship
pkgs.stow
pkgs.terraform
pkgs.tmux
pkgs.tree
pkgs.urlscan
pkgs.vagrant
pkgs.vdirsyncer
pkgs.virtualenv
pkgs.wget
pkgs.wireguard-go
pkgs.wireguard-tools
pkgs.yubikey-personalization
pkgs.zsh
];
# Use a custom configuration.nix location.
# $ darwin-rebuild switch -I darwin-config=$HOME/.config/nixpkgs/darwin/configuration.nix
environment.darwinConfig = "/Users/rilla/configs/nix-config/echidna.nix";
# environment.variables.DOCKER_HOST = "tcp://localhost:2375";
# Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true;
# nix.package = pkgs.nix;
# Create /etc/bashrc that loads the nix-darwin environment.
programs.zsh.enable = true; # default shell on catalina
# programs.fish.enable = true;
# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
homebrew = {
enable = true;
onActivation = {
cleanup = "zap";
autoUpdate = true;
upgrade = true;
};
global = {
brewfile = true;
lockfiles = true;
};
casks = [ "kmbmpdc" "librewolf" "virtualbox" "bluetility" ];
brews = [
"pyenv"
"pyenv-virtualenv"
"mpd"
"choose-gui"
"vitetris"
"yabai"
"skhd"
"spacebar"
"gnu-getopt"
"coreutils"
"pinentry-mac"
];
taps = [
"homebrew/bundle"
"homebrew/cask"
"homebrew/core"
"homebrew/services"
"koekeishiya/formulae"
"cmacrae/formulae"
];
};
fonts = {
fontDir.enable = true;
fonts = [
(pkgs.nerdfonts.override { fonts = [ "Hack" "MPlus" ]; })
pkgs.inter
pkgs.hack-font
pkgs.libertinus
];
};
users.users.rilla = {
name = "rilla";
home = "/Users/rilla";
};
home-manager = { users.rilla.imports = [ home/echidna.nix ]; };
system.stateVersion = 4;
}

View File

@ -1,40 +1,17 @@
{ {
"nodes": { "nodes": {
"agenix": {
"inputs": {
"darwin": "darwin",
"home-manager": "home-manager",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1690228878,
"narHash": "sha256-9Xe7JV0krp4RJC9W9W9WutZVlw6BlHTFMiUP/k48LQY=",
"owner": "ryantm",
"repo": "agenix",
"rev": "d8c973fd228949736dedf61b7f8cc1ece3236792",
"type": "github"
},
"original": {
"owner": "ryantm",
"repo": "agenix",
"type": "github"
}
},
"darwin": { "darwin": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"agenix",
"nixpkgs" "nixpkgs"
] ]
}, },
"locked": { "locked": {
"lastModified": 1673295039, "lastModified": 1684774948,
"narHash": "sha256-AsdYgE8/GPwcelGgrntlijMg4t3hLFJFCRF3tL5WVjA=", "narHash": "sha256-hJTaw4dYzcB+lsasKejnafq0CxPsVetn9RLXrcL+4jE=",
"owner": "lnl7", "owner": "lnl7",
"repo": "nix-darwin", "repo": "nix-darwin",
"rev": "87b9d090ad39b25b2400029c64825fc2a8868943", "rev": "b8c286c82c6b47826a6c0377e7017052ad91353c",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -47,36 +24,15 @@
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"agenix",
"nixpkgs" "nixpkgs"
] ]
}, },
"locked": { "locked": {
"lastModified": 1682203081, "lastModified": 1685019994,
"narHash": "sha256-kRL4ejWDhi0zph/FpebFYhzqlOBrk0Pl3dzGEKSAlEw=", "narHash": "sha256-81o6SKZPALvib21hIOMx2lIhFSs0mRy0PfPvg0zsfTk=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "32d3e39c491e2f91152c84f8ad8b003420eab0a1", "rev": "d1f04b0f365a34896a37d9015637796537ec88a3",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"home-manager_2": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1691882297,
"narHash": "sha256-e1/LAQSGLnBywfA1TfMl0Vj3tvYka73XOZ/D2/CJowE=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "c3ab5ea047e6dc73df530948f7367455749d8906",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -88,11 +44,11 @@
}, },
"impermanence": { "impermanence": {
"locked": { "locked": {
"lastModified": 1690797372, "lastModified": 1684264534,
"narHash": "sha256-GImz19e33SeVcIvBB7NnhbJSbTpFFmNtWLh7Z85Y188=", "narHash": "sha256-K0zr+ry3FwIo3rN2U/VWAkCJSgBslBisvfRIPwMbuCQ=",
"owner": "nix-community", "owner": "nix-community",
"repo": "impermanence", "repo": "impermanence",
"rev": "e3a7acd113903269a1b5c8b527e84ce7ee859851", "rev": "89253fb1518063556edd5e54509c30ac3089d5e6",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -103,11 +59,11 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1691871742, "lastModified": 1684899633,
"narHash": "sha256-6yDNjfbAMpwzWL4y75fxs6beXHRANfYX8BNSPjYehck=", "narHash": "sha256-NtwerXX8UFsoNy6k+DukJMriWtEjQtMU/Urbff2O2Dg=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "430a56dd16fe583a812b2df44dca002acab2f4f6", "rev": "4cc688ee711159b9bcb5a367be44007934e1a49d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -119,11 +75,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1691654369, "lastModified": 1684935479,
"narHash": "sha256-gSILTEx1jRaJjwZxRlnu3ZwMn1FVNk80qlwiCX8kmpo=", "narHash": "sha256-6QMMsXMr2nhmOPHdti2j3KRHt+bai2zw+LJfdCl97Mk=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "ce5e4a6ef2e59d89a971bc434ca8ca222b9c7f5e", "rev": "f91ee3065de91a3531329a674a45ddcb3467a650",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -134,23 +90,23 @@
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1691831739, "lastModified": 1684936879,
"narHash": "sha256-6e12VCvA7jOjhzJ1adLiUV1GTPXGBcCfhggsDwiuNB4=", "narHash": "sha256-BOSq/QiX7MDs8tUnAt4+nYTJctgYkzVSNL95qlfMYeM=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "3fe694c4156b84dac12627685c7ae592a71e2206", "rev": "99fe1b870522d6ee3e692c2b6e663d6868a3fde4",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "id": "nixpkgs",
"ref": "nixos-23.05", "ref": "nixos-22.11",
"type": "indirect" "type": "indirect"
} }
}, },
"root": { "root": {
"inputs": { "inputs": {
"agenix": "agenix", "darwin": "darwin",
"home-manager": "home-manager_2", "home-manager": "home-manager",
"impermanence": "impermanence", "impermanence": "impermanence",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",

View File

@ -1,7 +1,7 @@
{ {
inputs = { inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable"; nixpkgs.url = "nixpkgs/nixos-unstable";
nixpkgs-stable.url = "nixpkgs/nixos-23.05"; nixpkgs-stable.url = "nixpkgs/nixos-22.11";
home-manager = { home-manager = {
url = "github:nix-community/home-manager/master"; url = "github:nix-community/home-manager/master";
@ -9,68 +9,50 @@
}; };
impermanence.url = "github:nix-community/impermanence"; impermanence.url = "github:nix-community/impermanence";
nixos-hardware.url = "github:NixOS/nixos-hardware/master"; nixos-hardware.url = "github:NixOS/nixos-hardware/master";
agenix = { darwin = {
url = "github:ryantm/agenix"; url = "github:lnl7/nix-darwin/master";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
}; };
outputs = outputs = { self, nixpkgs, nixpkgs-stable, nixos-hardware, home-manager
{ self , impermanence, darwin }@inputs: {
, nixpkgs
, nixpkgs-stable
, nixos-hardware
, home-manager
, impermanence
, agenix
, ...
}@inputs:
let
inherit (self) outputs;
in
rec {
overlays = import ./overlays { inherit inputs; };
nixosModules = import ./modules/nixos;
homeManagerModules = import ./modules/home-manager;
secrets = import ./secrets;
stablePkgs = nixpkgs-stable.legacyPackages."x86_64-linux";
nixosConfigurations = { nixosConfigurations = {
trantor = nixpkgs.lib.nixosSystem { trantor = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
# unstablePkgs = nixpkgs-unstable.legacyPackages."x86_64-linux";
stablePkgs = nixpkgs-stable.legacyPackages."x86_64-linux";
impermanence = impermanence;
};
modules = [ modules = [
./hosts/trantor ./trantor.nix
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
impermanence.nixosModules.impermanence impermanence.nixosModules.impermanence
agenix.nixosModules.default
]; ];
}; };
capibara = nixpkgs.lib.nixosSystem { capibara = nixpkgs.lib.nixosSystem {
specialArgs = { inherit stablePkgs impermanence inputs outputs; }; system = "x86_64-linux";
specialArgs = {
# unstablePkgs = nixpkgs-unstable.legacyPackages."x86_64-linux";
stablePkgs = nixpkgs-stable.legacyPackages."x86_64-linux";
impermanence = impermanence;
};
modules = [ modules = [
./hosts/capibara ./capibara.nix
nixos-hardware.nixosModules.lenovo-thinkpad-x230 nixos-hardware.nixosModules.lenovo-thinkpad-x230
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
impermanence.nixosModules.impermanence impermanence.nixosModules.impermanence
agenix.nixosModules.default
]; ];
}; };
}; };
homeConfigurations = { darwinConfigurations.echidna = darwin.lib.darwinSystem {
system = "x86_64-darwin";
"rilla@echidna" = home-manager.lib.homeManagerConfiguration { modules = [ ./echidna.nix home-manager.darwinModule ];
pkgs = nixpkgs.legacyPackages.x86_64-linux;
extraSpecialArgs = { inherit inputs outputs; };
modules = [ ./hosts/echidna/home.nix ];
};
"ricard@coder-workspace" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
extraSpecialArgs = { inherit inputs outputs; };
modules = [ ./hosts/coder-workspace/home.nix ];
};
}; };
}; };
} }

BIN
grub_background.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -0,0 +1,7 @@
{ config, pkgs, ... }:
{
imports = [ ./nixos.nix ];
# programs.alacritty.settings.font.size = 9;
programs.alacritty.settings.font.size = 7;
}

View File

@ -44,10 +44,6 @@
family = "Hack Nerd Font"; family = "Hack Nerd Font";
style = "Italic"; style = "Italic";
}; };
offset = {
x = 0;
y = 0;
};
}; };
selection = { save_to_clipboard = true; }; selection = { save_to_clipboard = true; };
shell = { shell = {

15
home/alacritty/nixos.nix Normal file
View File

@ -0,0 +1,15 @@
{ config, pkgs, ... }:
{
imports = [ ./common.nix ];
programs.alacritty = {
settings = {
font = {
offset = {
x = 0;
y = 0;
};
};
};
};
}

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
imports = [ ./common.nix ]; imports = [ ./nixos.nix ];
programs.alacritty.settings.font.size = 7.5; programs.alacritty.settings.font.size = 7.5;
} }

View File

@ -9,6 +9,7 @@ in
# enableDragDrop = true; # enableDragDrop = true;
enableCrypto = true; enableCrypto = true;
name = "capibara"; name = "capibara";
server = "echidna";
}; };
home.file.".local/share/barrier/SSL/Fingerprints/TrustedServers.txt".text = "${fingerprint}\n"; home.file.".local/share/barrier/SSL/Fingerprints/TrustedServers.txt".text = "${fingerprint}\n";

12
home/browsers/default.nix Normal file
View File

@ -0,0 +1,12 @@
{ config, pkgs, ... }:
{
# imports = [ ./firefox ];
home.packages = [ pkgs.librewolf pkgs.firefox pkgs.tor-browser-bundle-bin ];
programs.chromium = {
enable = true;
package = pkgs.ungoogled-chromium;
};
}

View File

@ -0,0 +1,61 @@
{ config, pkgs, ... }:
{
# nix-env -f '<nixpkgs>' -qaP -A nur.repos.rycee.firefox-addons
programs.firefox = {
enable = true;
# maybe enable tridactyl?
# nix-env -f '<nixpkgs>' -qaP -A nur.repos.rycee.firefox-addons
# extensions = with pkgs.nur.repos.rycee.firefox-addons; [
# browserpass
# canvasblocker
# clearurls
# cookie-autodelete
# darkreader
# floccus
# foxyproxy-standard
# https-everywhere
# i-dont-care-about-cookies
# localcdn
# noscript
# privacy-possum
# privacy-redirect
# ublock-origin
# vimium
# # todo: AdNauseam, wallabagger, DownThemAll! Wayback Machine
# ];
profiles = {
default = {
id = 0;
name = "default";
isDefault = true;
settings = {
# change some values from arkenfox's defaults
"privacy.resistFingerprinting" =
false; # if true, this would the window size to rounded dimensions, which is too annoying on a tiling window manager
"extensions.pocket.enabled" = false;
"identity.fxaccounts.enabled" = false;
"browser.search.suggest.enabled" = true;
"browser.urlbar.suggest.searches" = true;
"keyword.enable" = true;
# for Firefox-UI-Fix
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
"browser.proton.enabled" = true;
"svg.context-properties.content.enabled" = true;
"layout.css.backdrop-filter.enabled" = true;
"browser.compactmode.show" = true;
"browser.urlbar.suggest.calculator" = true;
"browser.uidensity" = 1;
# "browser.search.region" = "GB";
# "browser.search.isUS" = false;
# "distribution.searchplugins.defaultLocale" = "en-GB";
# "general.useragent.locale" = "en-GB";
# "browser.bookmarks.showMobileBookmarks" = true;
};
};
};
};
}

8
home/capibara.nix Normal file
View File

@ -0,0 +1,8 @@
{ config, pkgs, ... }:
{
imports =
# [ ./nixos-common.nix ./desktop-sway ./alacritty/capibara.nix ./theming ];
# [ ./nixos-common.nix ./desktop-xmonad/capibara.nix ./alacritty/capibara.nix ./theming ];
[ ./nixos-common.nix ./desktop-river ./alacritty/capibara.nix ./theming ];
}

View File

@ -4,16 +4,9 @@ let
calendars = "${config.home.homeDirectory}/Calendars"; calendars = "${config.home.homeDirectory}/Calendars";
contacts = "${config.home.homeDirectory}/Contacts"; contacts = "${config.home.homeDirectory}/Contacts";
addressbook = "${config.home.homeDirectory}/.abook/addressbook"; addressbook = "${config.home.homeDirectory}/.abook/addressbook";
davsync = pkgs.callPackage ./davsync.nix {
inherit config pkgs contacts addressbook;
};
pass = "${pkgs.pass}/bin/pass"; pass = "${pkgs.pass}/bin/pass";
tokens = "${config.home.homeDirectory}/.vdirsyncer/tokens/"; tokens = "${config.home.homeDirectory}/.vdirsyncer/tokens/";
in {
in
{
home.packages = with pkgs; [ dav-sync vdirsyncer khal khard abook ];
home.file.".config/vdirsyncer/config".text = '' home.file.".config/vdirsyncer/config".text = ''
[general] [general]
status_path = "${config.home.homeDirectory}/.vdirsyncer/status/" status_path = "${config.home.homeDirectory}/.vdirsyncer/status/"
@ -28,7 +21,7 @@ in
[pair nextcloud_calendar] [pair nextcloud_calendar]
a = "nextcloud_calendar_local" a = "nextcloud_calendar_local"
b = "nextcloud_calendar_remote" b = "nextcloud_calendar_remote"
collections = ["personal", "contact_birthdays", "events"] collections = ["personal", "contact_birthdays", "yoga", "events"]
metadata = ["color"] metadata = ["color"]
[storage nextcloud_calendar_local] [storage nextcloud_calendar_local]
@ -100,6 +93,47 @@ in
token_file = "${tokens}/google_contacts" token_file = "${tokens}/google_contacts"
client_id.fetch = ["command", "${pass}", "google.com/vdirsyncer/client_id"] client_id.fetch = ["command", "${pass}", "google.com/vdirsyncer/client_id"]
client_secret.fetch = ["command", "${pass}", "google.com/vdirsyncer/client_secret"] client_secret.fetch = ["command", "${pass}", "google.com/vdirsyncer/client_secret"]
###########
# trakken #
###########
## calendar
[pair trakken_calendar_sync]
a = "trakken_calendar_remote"
b = "trakken_calendar_local"
collections = [["trakken_cal", "ricard@trkkn.com", "ricard@trkkn.com"]]
[storage trakken_calendar_local]
type = "filesystem"
path = "${calendars}/trakken/"
fileext = ".ics"
[storage trakken_calendar_remote]
type = "google_calendar"
token_file = "${tokens}/trakken_calendar"
client_id.fetch = ["command", "${pass}", "google.com/vdirsyncer/client_id"]
client_secret.fetch = ["command", "${pass}", "google.com/vdirsyncer/client_secret"]
## contacts
[pair trakken_contacts]
a = "trakken_contacts_local"
b = "trakken_contacts_remote"
collections = [["trakken_contacts", "default", "default"]]
[storage trakken_contacts_local]
type = "filesystem"
path = "${contacts}/trakken"
fileext = ".vcf"
[storage trakken_contacts_remote]
type = "google_contacts"
token_file = "${tokens}/trakken_contacts"
client_id.fetch = ["command", "${pass}", "google.com/vdirsyncer/client_id"]
client_secret.fetch = ["command", "${pass}", "google.com/vdirsyncer/client_secret"]
''; '';
home.file.".config/khal/config".text = '' home.file.".config/khal/config".text = ''
@ -117,6 +151,14 @@ in
path = ${calendars}/google/r.illa.pujagut@gmail.com/ path = ${calendars}/google/r.illa.pujagut@gmail.com/
color = dark blue color = dark blue
[[trakken]]
path = ${calendars}/trakken/ricard@trkkn.com/
color = dark red
[[yoga]]
path = ${calendars}/nextcloud/yoga/
color = dark magenta
[[events]] [[events]]
path = ${calendars}/nextcloud/events path = ${calendars}/nextcloud/events
color = brown color = brown
@ -147,6 +189,8 @@ in
path = ${contacts}/nextcloud/contacts/ path = ${contacts}/nextcloud/contacts/
[[google]] [[google]]
path = ${contacts}/google/default/ path = ${contacts}/google/default/
[[trakken]]
path = ${contacts}/trakken/default/
[general] [general]
debug = no debug = no

22
home/dav/davsync.nix Normal file
View File

@ -0,0 +1,22 @@
{ config, pkgs, contacts, addressbook, ... }:
let
shell = "${pkgs.dash}/bin/dash";
vdirsyncer = "${pkgs.vdirsyncer}/bin/vdirsyncer";
mkdir = "${pkgs.coreutils}/bin/mkdir";
cat = "${pkgs.coreutils}/bin/cat";
abook = "${pkgs.abook}/bin/abook";
dirname = "${pkgs.coreutils}/bin/dirname";
in
pkgs.writeScriptBin "davsync" ''
#!${shell}
${vdirsyncer} discover && \
${vdirsyncer} sync && \
${mkdir} -p "$(${dirname} ${addressbook})" && \
${cat} "${contacts}"/*/*/* | \
${abook} \
--convert \
--informat vcard \
--outformat abook > \
"${config.home.homeDirectory}/.abook/adressbook"
''

12
home/dav/default.nix Normal file
View File

@ -0,0 +1,12 @@
{ config, pkgs, ... }:
let
contacts = "${config.home.homeDirectory}/Contacts";
addressbook = "${config.home.homeDirectory}/.abook/addressbook";
davsync = pkgs.callPackage ./davsync.nix {
inherit config pkgs contacts addressbook;
};
in {
imports = [ ./common.nix ];
home.packages = [ davsync pkgs.vdirsyncer pkgs.khal pkgs.khard pkgs.abook ];
}

View File

@ -2,11 +2,11 @@
{ {
imports = [ imports = [
./kile
./bemenu.nix ./bemenu.nix
./fusuma.nix ./foot.nix
./init.nix ./init.nix
./kanshi.nix ./kanshi.nix
./kile
./mako.nix ./mako.nix
./swaybg.nix ./swaybg.nix
./swaylock.nix ./swaylock.nix
@ -21,13 +21,11 @@
light light
pamixer pamixer
playerctl playerctl
ristate
river river
swaybg swaybg
wl-clipboard wl-clipboard
wtype wtype
xdg-utils xdg-utils
(pkgs.callPackage ./screenshot.nix { inherit config pkgs; })
]; ];
programs.zsh.loginExtra = '' programs.zsh.loginExtra = ''
@ -61,9 +59,4 @@
Install = { WantedBy = [ "river-session.target" ]; }; Install = { WantedBy = [ "river-session.target" ]; };
}; };
home.sessionVariables = {
XDG_CURRENT_DESKTOP = "river";
MOZ_ENABLE_WAYLAND = 1;
};
} }

View File

@ -3,8 +3,7 @@
let let
font-name = "Hack Nerd Font"; font-name = "Hack Nerd Font";
font-size = "10"; font-size = "10";
in in {
{
programs.foot = { programs.foot = {
enable = true; enable = true;
server.enable = true; server.enable = true;
@ -44,5 +43,4 @@ in
}; };
}; };
home.sessionVariables.TERMINAL = "${pkgs.foot}/bin/foot";
} }

View File

@ -161,8 +161,6 @@ in {
${riverctl} map $mode None XF86MonBrightnessDown spawn '${light} -U 5' ${riverctl} map $mode None XF86MonBrightnessDown spawn '${light} -U 5'
done done
${riverctl} attach-mode bottom
# Set background and border color # Set background and border color
${riverctl} background-color 0x282828 ${riverctl} background-color 0x282828
${riverctl} border-color-focused 0x458588 ${riverctl} border-color-focused 0x458588

View File

@ -0,0 +1,72 @@
{ config, pkgs, ... }:
let
shell = "${pkgs.dash}/bin/dash";
default_master_ratio = "0.6";
up_layout = "Up ((h: v v) 1 ${default_master_ratio} 0)";
down_layout = "Down ((h: v v) 1 ${default_master_ratio} 1)";
left_layout = "Left ((v: h h) 1 ${default_master_ratio} 0)";
right_layout = "Right ((v: h h) 1 ${default_master_ratio} 1)";
deck_layout = "Deck deck";
full_layout = "Full full";
wide_layout = "Wide ((v: h h h) 1 0.5 1)";
column_layout = "Cols (v: v)";
default_layout = left_layout;
riverctl = "${pkgs.river}/bin/riverctl";
kile = "${pkgs.kile-wl}/bin/kile";
kile_namespace = "kile";
in {
home.packages = with pkgs; [ kile-wl ];
systemd.user.services.kile-wl = {
Unit = {
Description = "kile layout generator";
BindsTo = [ "river-session.target" ];
};
Service = {
Type = "simple";
ExecStart =
"${kile} --namespace ${kile_namespace}";
};
Install = { WantedBy = [ "river-session.target" ]; };
};
xdg.dataFile = {
layout = {
target = "${config.xdg.configHome}/river/layout.kl";
source = ./layout.kl;
};
init-kile = {
executable = true;
target = "${config.xdg.configHome}/river/init-kile";
text = ''
#!${shell}
# Super+H and Super+L to decrease/increase the main ratio
${riverctl} map -repeat normal Super Equal send-layout-cmd ${kile_namespace} "mod_main_ratio +0.01"
${riverctl} map -repeat normal Super Minus send-layout-cmd ${kile_namespace} "mod_main_ratio -0.01"
# Super+Comma and Super+Period. to increment/decrement the main count
${riverctl} map normal Super Comma send-layout-cmd ${kile_namespace} "mod_main_amount +1"
${riverctl} map normal Super Period send-layout-cmd ${kile_namespace} "mod_main_amount -1"
# Super+{Up,Right,Down,Left} to change layout orientation
${riverctl} map normal Super+Control K send-layout-cmd ${kile_namespace} "focused ${up_layout}"
${riverctl} map normal Super+Control J send-layout-cmd ${kile_namespace} "focused ${down_layout}"
${riverctl} map normal Super+Control H send-layout-cmd ${kile_namespace} "focused ${left_layout}"
${riverctl} map normal Super+Control L send-layout-cmd ${kile_namespace} "focused ${right_layout}"
${riverctl} map normal Super+Control D send-layout-cmd ${kile_namespace} "focused ${deck_layout}"
${riverctl} map normal Super+Control F send-layout-cmd ${kile_namespace} "focused ${full_layout}"
${riverctl} map normal Super+Control W send-layout-cmd ${kile_namespace} "focused ${wide_layout}"
${riverctl} map normal Super+Control C send-layout-cmd ${kile_namespace} "focused ${column_layout}"
${riverctl} map normal Super+Shift Space send-layout-cmd ${kile_namespace} "focused ${default_layout}"
${riverctl} default-layout ${kile_namespace}
'';
};
};
}

View File

@ -0,0 +1,8 @@
const ver Vertical
const hor Horizontal
const vsplit (ver | hor ([1 - 0.5] *hsplit))
const hsplit (hor | ver ([1 - 0.5] *vsplit))
# Preview
const default vsplit

View File

@ -0,0 +1,101 @@
{ config, pkgs, ... }:
# usage: bemenu [options]
# Options
# -h, --help display this help and exit.
# -v, --version display version.
# -i, --ignorecase match items case insensitively.
# -F, --filter filter entries for a given string.
# -w, --wrap wraps cursor selection.
# -l, --list list items vertically with the given number of lines.
# -p, --prompt defines the prompt text to be displayed.
# -P, --prefix text to show before highlighted item.
# -I, --index select item at index automatically.
# -x, --password hide input.
# -s, --no-spacing disable the title spacing on entries.
# --scrollbar display scrollbar. (none (default), always, autohide)
# --ifne only display menu if there are items.
# --fork always fork. (bemenu-run)
# --no-exec do not execute command. (bemenu-run)
#
# Use BEMENU_BACKEND env variable to force backend:
# curses ncurses based terminal backend
# wayland wayland backend
# x11 x11 backend
#
# If BEMENU_BACKEND is empty, one of the GUI backends is selected automatically.
#
# Backend specific options
# c = ncurses, w == wayland, x == x11
# (...) At end of help indicates the backend support for option.
#
# -b, --bottom appears at the bottom of the screen. (wx)
# -c, --center appears at the center of the screen. (wx)
# -f, --grab show the menu before reading stdin. (wx)
# -n, --no-overlap adjust geometry to not overlap with panels. (w)
# -m, --monitor index of monitor where menu will appear. (wx)
# -H, --line-height defines the height to make each menu line (0 = default height). (wx)
# -M, --margin defines the empty space on either side of the menu. (wx)
# -W, --width-factor defines the relative width factor of the menu (from 0 to 1). (wx)
# -B, --border defines the width of the border in pixels around the menu. (wx)
# --ch defines the height of the cursor (0 = scales with line height). (wx)
# --cw defines the width of the cursor. (wx)
# --hp defines the horizontal padding for the entries in single line mode. (wx)
# --fn defines the font to be used ('name [size]'). (wx)
# --tb defines the title background color. (wx)
# --tf defines the title foreground color. (wx)
# --fb defines the filter background color. (wx)
# --ff defines the filter foreground color. (wx)
# --nb defines the normal background color. (wx)
# --nf defines the normal foreground color. (wx)
# --hb defines the highlighted background color. (wx)
# --hf defines the highlighted foreground color. (wx)
# --fbb defines the feedback background color. (wx)
# --fbf defines the feedback foreground color. (wx)
# --sb defines the selected background color. (wx)
# --sf defines the selected foreground color. (wx)
# --ab defines the alternating background color. (wx)
# --af defines the alternating foreground color. (wx)
# --scb defines the scrollbar background color. (wx)
# --scf defines the scrollbar foreground color. (wx)
# --bdr defines the border color. (wx)
let
bemenuColors = {
titleBackground = "#282828E0";
titleForeground = "#fbf1c7";
filterBackground = "#282828E0";
filterForeground = "#ebdbb2";
normalBackground = "#282828E0";
normalForeground = "#ebdbb2";
highlightedBackground = "#458588E0";
highlightedForeground = "#fbf1c7";
scrollbarBackground = "#282828E0";
scrollbarForeground = "#458588E0";
};
in {
home.packages = [ pkgs.bemenu ];
home.sessionVariables.BEMENU_OPTS = ''
--ignorecase \
--list 20 \
--prompt '' \
--scrollbar none \
--wrap \
--scrollbar autohide \
--no-overlap \
--monitor all \
--fn 'Inter 13px' \
--tb '${bemenuColors.titleBackground}' \
--tf '${bemenuColors.titleForeground}' \
--fb '${bemenuColors.filterBackground}' \
--ff '${bemenuColors.filterForeground}' \
--nb '${bemenuColors.normalBackground}' \
--ab '${bemenuColors.normalBackground}' \
--nf '${bemenuColors.normalForeground}' \
--af '${bemenuColors.normalForeground}' \
--hb '${bemenuColors.highlightedBackground}' \
--hf '${bemenuColors.highlightedForeground}' \
--scb '${bemenuColors.scrollbarBackground}' \
--scf '${bemenuColors.scrollbarForeground}'
'';
}

View File

@ -0,0 +1,64 @@
{ config, pkgs, ... }:
{
imports = [ ./sway.nix ./waybar.nix ./bemenu.nix ];
home.packages = with pkgs; [
swaylock
swayidle
wl-clipboard
wtype
brightnessctl
foot
];
programs.mako = {
enable = true;
actions = true;
anchor = "top-right";
backgroundColor = "#282828E6";
borderColor = "#458588";
borderRadius = 0;
borderSize = 1;
font = "Inter 10";
icons = true;
textColor = "#ebdbb2";
defaultTimeout = 5000;
};
home.file.".config/swaylock/config".text = ''
ignore-empty-password
font=Inter
color=282828E6
inside-color=504945
ring-color=504945
line-color=504945
separator-color=504945
inside-clear-color=FE8019
line-clear-color=FE8019
ring-clear-color=FE8019
inside-ver-color=458588
line-ver-color=458588
ring-ver-color=458588
inside-wrong-color=CC241D
line-wrong-color=CC241D
ring-wrong-color=CC241D
key-hl-color=B8BB26
bs-hl-color=FB4934
text-color=282828
text-clear-color=282828
text-ver-color=282828
text-wrong-color=282828
'';
programs.zsh.loginExtra = ''
[[ -z "''${DISPLAY}" ]] && [[ "$(tty)" = "/dev/tty1" ]] && \
exec ${pkgs.sway}/bin/sway 1> "${config.home.homeDirectory}/.sway-errors" 2>&1
'';
}

172
home/desktop-sway/sway.nix Normal file
View File

@ -0,0 +1,172 @@
{ config, pkgs, ... }:
let
cfg = config.wayland.windowManager.sway.config;
pactl = "${pkgs.pulseaudio}/bin/pactl";
brightnessctl = "${pkgs.brightnessctl}/bin/brightnessctl";
playerctl = "${pkgs.playerctl}/bin/playerctl";
wallpapers = "${config.home.homeDirectory}/Images/wallpapers/enabled";
# # todo: do it properly like in https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/security/pass/rofi-pass.nix
# tessenSrc = builtins.fetchTarball {
# url =
# "https://github.com/ayushnix/tessen/releases/download/v1.3.1/tessen-1.3.1.tar.gz";
# };
# tessen = pkgs.runCommandLocal "tessen" {
# nativeBuildInputs = [ pkgs.makeWrapper ];
# } ''
# install -m755 ${tessenSrc}/tessen -D $out/bin/tessen
# patchShebangs $out/bin/tessen
# wrapProgram $out/bin/tessen \
# --prefix PATH: ${pkgs.lib.makeBinPath [ pkgs.bash ]}
# '';
in {
# home.packages = [ tessen ];
wayland.windowManager.sway = {
enable = true;
wrapperFeatures.gtk = true;
config = {
modifier = "Mod4";
terminal = "alacritty";
menu = "${pkgs.bemenu}/bin/bemenu-run";
left = "h";
down = "j";
up = "k";
right = "l";
output = {
"LVDS-1" = {
resolution = "1366x768";
bg =
"`${pkgs.findutils}/bin/find ${wallpapers} -type f | ${pkgs.coreutils}/bin/shuf -n 1` fill";
};
};
input = {
"type:keyboard" = {
xkb_layout = "us";
xkb_variant = "altgr-intl";
xkb_options = "caps:escape";
};
};
keybindings = {
"${cfg.modifier}+Return" = "exec ${cfg.terminal}";
"${cfg.modifier}+Shift+c" = "kill";
"${cfg.modifier}+r" = "exec ${cfg.menu}";
"${cfg.modifier}+Shift+r" = "reload";
"${cfg.modifier}+Shift+Escape" = "exec ${pkgs.sway}/bin/swaymsg exit";
"${cfg.modifier}+Escape" = "exec ${pkgs.swaylock}/bin/swaylock";
"${cfg.modifier}+${cfg.left}" = "focus left";
"${cfg.modifier}+${cfg.down}" = "focus down";
"${cfg.modifier}+${cfg.up}" = "focus up";
"${cfg.modifier}+${cfg.right}" = "focus right";
"${cfg.modifier}+Shift+${cfg.left}" = "move left";
"${cfg.modifier}+Shift+${cfg.down}" = "move down";
"${cfg.modifier}+Shift+${cfg.up}" = "move up";
"${cfg.modifier}+Shift+${cfg.right}" = "move right";
"${cfg.modifier}+Control+${cfg.left}" = "move workspace to output left";
"${cfg.modifier}+Control+${cfg.down}" = "move workspace to output down";
"${cfg.modifier}+Control+${cfg.up}" = "move workspace to output up";
"${cfg.modifier}+Control+${cfg.right}" =
"move workspace to output right";
"${cfg.modifier}+Shift+w" = "move window to output left";
"${cfg.modifier}+Shift+e" = "move window to output right";
"${cfg.modifier}+w" = "focus output left";
"${cfg.modifier}+e" = "focus output right";
"${cfg.modifier}+1" = "workspace number 1";
"${cfg.modifier}+2" = "workspace number 2";
"${cfg.modifier}+3" = "workspace number 3";
"${cfg.modifier}+4" = "workspace number 4";
"${cfg.modifier}+5" = "workspace number 5";
"${cfg.modifier}+6" = "workspace number 6";
"${cfg.modifier}+7" = "workspace number 7";
"${cfg.modifier}+8" = "workspace number 8";
"${cfg.modifier}+9" = "workspace number 9";
"${cfg.modifier}+Shift+1" = "move container to workspace number 1";
"${cfg.modifier}+Shift+2" = "move container to workspace number 2";
"${cfg.modifier}+Shift+3" = "move container to workspace number 3";
"${cfg.modifier}+Shift+4" = "move container to workspace number 4";
"${cfg.modifier}+Shift+5" = "move container to workspace number 5";
"${cfg.modifier}+Shift+6" = "move container to workspace number 6";
"${cfg.modifier}+Shift+7" = "move container to workspace number 7";
"${cfg.modifier}+Shift+8" = "move container to workspace number 8";
"${cfg.modifier}+Shift+9" = "move container to workspace number 9";
"${cfg.modifier}+b" = "splith";
"${cfg.modifier}+v" = "splitv";
"${cfg.modifier}+s" = "layout stacking";
"${cfg.modifier}+t" = "layout tabbed";
# "${cfg.modifier}+e" = "layout toggle split";
"${cfg.modifier}+m" = "fullscreen toggle";
"${cfg.modifier}+a" = "focus parent";
"${cfg.modifier}+f" = "floating toggle";
# "${cfg.modifier}+space" = "focus mode_toggle";
"${cfg.modifier}+d" = "mode resize";
"${cfg.modifier}+space" = "layout toggle all";
"${cfg.modifier}+Shift+space" = "layout default";
# "${cfg.modifier}+p" = "exec ${tessen}/bin/tessen";
"XF86AudioRaiseVolume" =
"exec ${pactl} set-sink-volume @DEFAULT_SINK@ +5%";
"XF86AudioLowerVolume" =
"exec ${pactl} set-sink-volume @DEFAULT_SINK@ -5%";
"XF86AudioMute" = "exec ${pactl} set-sink-mute @DEFAULT_SINK@ toggle";
"XF86AudioMicMute" =
"exec ${pactl} set-source-mute @DEFAULT_SOURCE@ toggle";
"XF86MonBrightnessDown" = "exec ${brightnessctl} set 5%-";
"XF86MonBrightnessUp" = "exec ${brightnessctl} set +5%";
"XF86AudioPlay" = "exec ${playerctl} play-pause";
"XF86AudioNext" = "exec ${playerctl} next";
"XF86AudioPrev" = "exec ${playerctl} previous";
"XF86Search" = "exec ${cfg.menu}";
};
colors = {
focused = rec {
childBorder = "#458588";
background = "#282828";
text = "#fbf1c7";
indicator = "#3c3836";
border = "#83a598";
};
unfocused = rec {
childBorder = "#504945";
background = "#282828";
text = "#ebdbb2";
indicator = "#3c3836";
border = "#bdae93";
};
};
focus.followMouse = true;
window.border = 3;
workspaceAutoBackAndForth = true;
bars = [ ];
startup = [{
command = "${pkgs.autotiling}/bin/autotiling";
always = true;
}];
};
};
}

View File

@ -0,0 +1,150 @@
{ config, pkgs, ... }:
{
programs.waybar = {
enable = true;
settings = [
{
modules-left = [ "sway/workspaces" ];
modules-center = [ "sway/window" ];
modules-right = [ "tray" "pulseaudio" "battery" "network" "clock" ];
modules = {
clock.format = "{: %m/%d <span color=\"#a89984\">|</span> %H:%M}";
network = {
format-icons = [
"<span color=\"#fb4944\"></span>"
"<span color=\"#fabd2f\"></span>"
"<span color=\"#b8bb26\"></span>"
];
format = "({ifname})";
format-wifi = "{icon} {signalStrength}";
format-disconnected = "<span color=\"#a89974\"></span>";
format-ethernet = "";
};
battery = {
states = {
good = 95;
warning = 50;
critical = 20;
};
format-icons = {
discharging = [
"<span color=\"#fb4944\"></span>"
"<span color=\"#fb4944\"></span>"
"<span color=\"#fb4944\"></span>"
"<span color=\"#fabd2f\"></span>"
"<span color=\"#fabd2f\"></span>"
"<span color=\"#fabd2f\"></span>"
"<span color=\"#b8bb26\"></span>"
"<span color=\"#b8bb26\"></span>"
"<span color=\"#b8bb26\"></span>"
]; # 
charging = [
"<span color=\"#fb4944\"></span>"
"<span color=\"#fb4944\"></span>"
"<span color=\"#fabd2f\"></span>"
"<span color=\"#fabd2f\"></span>"
"<span color=\"#b8bb26\"></span>"
"<span color=\"#b8bb26\"></span>"
]; # 
};
format = " {capacity}";
format-full = "";
format-good-charging = "";
format-plugged = "";
format-charging = "{icon} {capacity}";
format-discharging = "{icon} {capacity} ({time})";
interval = 5;
};
pulseaudio = {
states = {
high = 101;
very_high = 111;
};
format-icons = [
"<span color=\"#a89974\"></span>"
"<span color=\"#83a587\">奔</span>"
"<span color=\"#b8bb26\"></span>"
];
format = "{icon} {volume}";
format-bluetooth = "{icon} {volume}";
format-muted = "";
};
tray.icon-size = 14;
};
}
];
style = ''
* {
border-radius: 0px;
border: none;
font-family: Inter, "mplus Nerd Font";
font-size: 13px;
min-height: 0;
}
window#waybar {
background-color: #282828;
color: #ebdbb2;
}
#workspaces {
padding: 0px;
margin: 0px;
}
#workspaces button {
padding: 0px;
margin: 0px;
background: transparent;
}
#window {
color: #fbf1c7;
padding-left: 10px;
padding-right: 10px;
}
#workspaces button.focused {
background-color: #458588;
color: #fbf1c7;
}
#tray,
#pulseaudio,
#battery,
#network,
#cpu,
#memory,
#clock {
color: #fbf1c7;
padding-left: 5px;
padding-right: 5px;
}
#tray,
#pulseaudio,
#battery,
#cpu,
#memory,
#network {
border-right: 1px solid #a89984;
}
#pulseaudio.high {
color: #fabd2f;
}
#pulseaudio.very_high {
color: #fb4944;
}
#pulseaudio.muted {
color: #a8997a;
}
'';
systemd.enable = true;
};
}

View File

@ -0,0 +1,48 @@
{ config, pkgs, ... }:
let
ext_monitor_fingerprint =
"00ffffffffffff0009d1e67845540000261d0103803c22782e4825a756529c270f5054a56b80d1c0b300a9c08180810081c001010101023a801871382d40582c450056502100001e000000ff004c394b30303333313031510a20000000fd00324c1e5311000a202020202020000000fc0042656e51204757323738300a200117020322f14f901f04130312021101140607151605230907078301000065030c001000023a801871382d40582c450056502100001f011d8018711c1620582c250056502100009f011d007251d01e206e28550056502100001e8c0ad08a20e02d10103e960056502100001800000000000000000000000000000000000000000047";
lvds_fingerprint =
"00ffffffffffff0030e4d8020000000000160103801c1078ea8855995b558f261d505400000001010101010101010101010101010101601d56d85000183030404700159c1000001b000000000000000000000000000000000000000000fe004c4720446973706c61790a2020000000fe004c503132355748322d534c42330059";
lvds_config = {
enable = true;
crtc = 0;
mode = "1366x768";
position = "0x0";
rate = "60.00";
};
hdmi_config = {
enable = true;
primary = true;
crtc = 0;
mode = "1920x1080";
position = "0x0";
rate = "60.00";
};
in {
imports = [ ./common.nix ];
programs.autorandr.profiles = {
default = {
fingerprint."LVDS-1" = lvds_fingerprint;
config."LVDS-1" = lvds_config;
};
docked = {
fingerprint = {
"HDMI-2" = ext_monitor_fingerprint;
"LVDS-1" = lvds_fingerprint;
};
config = {
"LVDS-1" = lvds_config // { position = "1920x0"; };
"HDMI-2" = hdmi_config;
};
};
docked_closed = {
fingerprint."HDMI-2" = ext_monitor_fingerprint;
config."HDMI-2" = hdmi_config;
};
};
}

View File

@ -0,0 +1,12 @@
{ config, pkgs, ... }:
{
programs.autorandr = {
enable = true;
hooks.postswitch = {
"change-background" =
"/run/current-system/sw/bin/systemctl --user restart random-background.service";
"restart-xmonad" = "${pkgs.xmonad-with-packages}/bin/xmonad --restart";
};
};
}

View File

@ -0,0 +1,69 @@
{ config, pkgs, ... }:
let
ext_monitor_fingerprint =
"00ffffffffffff0009d1e67845540000261d0103803c22782e4825a756529c270f5054a56b80d1c0b300a9c08180810081c001010101023a801871382d40582c450056502100001e000000ff004c394b30303333313031510a20000000fd00324c1e5311000a202020202020000000fc0042656e51204757323738300a200117020322f14f901f04130312021101140607151605230907078301000065030c001000023a801871382d40582c450056502100001f011d8018711c1620582c250056502100009f011d007251d01e206e28550056502100001e8c0ad08a20e02d10103e960056502100001800000000000000000000000000000000000000000047";
edp_fingerprint =
"00ffffffffffff0030e46e040000000000180104a52615780a0bb5a35955a0270c5054000000010101010101010101010101010101012e3680a070381f40302035007ed71000001b1f2480a070381f40302035007ed71000001b00000000000000000000000000000000000000000002000a30ff0a3c96191d4896000000003f";
edp_config = {
enable = true;
crtc = 0;
# mode = "1368x768";
mode = "1920x1080";
# position = "1920x0";
position = "0x0";
rate = "60.00";
# rotate = "left";
};
hdmi_config = {
enable = true;
primary = true;
crtc = 0;
mode = "1920x1080";
position = "0x0";
rate = "60.00";
};
in {
imports = [ ./common.nix ];
programs.autorandr.profiles = {
default = {
fingerprint = {
"HDMI-1-1" = ext_monitor_fingerprint;
"eDP-1-1" = edp_fingerprint;
};
config = {
"HDMI-1-1" = hdmi_config;
"eDP-1-1" = edp_config;
};
};
default_intel = {
fingerprint = {
"HDMI-1" = ext_monitor_fingerprint;
"eDP-1" = edp_fingerprint;
};
config = {
"HDMI-1" = hdmi_config;
"eDP-1" = edp_config;
};
};
nomonitor_intel = {
fingerprint."eDP-1" = edp_fingerprint;
config."eDP-1" = edp_config // { position = "0x0"; };
};
onlymonitor_intel = {
fingerprint = { "HDMI-1" = ext_monitor_fingerprint; };
config = { "HDMI-1" = hdmi_config; };
};
nomonitor_nvidia = {
fingerprint."eDP-1-1" = edp_fingerprint;
config."eDP-1-1" = edp_config // { position = "0x0"; };
};
onlymonitor_nvidia = {
fingerprint = { "HDMI-1-1" = ext_monitor_fingerprint; };
config = { "HDMI-1-1" = hdmi_config; };
};
};
}

View File

@ -0,0 +1,21 @@
{ config, pkgs, ... }:
let
desktopConfig = import ./desktop_config.nix {
config = config;
pkgs = pkgs;
};
in desktopConfig // {
imports = [ ./common.nix ./autorandr/capibara.nix ];
home.file.".xinitrc".text = ''
exec ${config.home.homeDirectory}/.xsession
'';
services.picom = {
enable = true;
fade = false;
shadow = true;
shadowExclude = [ "name ~= 'stalonetray'" ];
vSync = true;
};
}

View File

@ -0,0 +1,51 @@
{ config, pkgs, ... }:
let
obtoxmd = pkgs.callPackage ./obtoxmd.nix { inherit config pkgs; };
in {
imports = [ ./rofi.nix ./misc.nix ];
home = {
keyboard = {
layout = "us";
options = [ "caps:escape" ];
variant = "altgr-intl";
};
packages = [ obtoxmd pkgs.openbox pkgs.xsel ];
file = {
".xmonad/icons/3cols.xpm".source = ./icons/3cols.xpm;
".xmonad/icons/float.xpm".source = ./icons/float.xpm;
".xmonad/icons/full.xpm".source = ./icons/full.xpm;
".xmonad/icons/grid.xpm".source = ./icons/grid.xpm;
".xmonad/icons/mtall.xpm".source = ./icons/mtall.xpm;
".xmonad/icons/tabs.xpm".source = ./icons/tabs.xpm;
".xmonad/icons/tall.xpm".source = ./icons/tall.xpm;
};
};
xsession = {
enable = true;
initExtra = ''
xset s off -dpms
${pkgs.autorandr}/bin/autorandr --change --default default
export WINIT_X11_SCALE_FACTOR=1.33
'';
};
services.stalonetray = {
enable = true;
config = {
icon_size = 16;
background = "#282828"; # todo
sticky = true;
geometry = "3x1-350+0";
icon_gravity = "E";
grow_gravity = "E";
};
};
programs.zsh.loginExtra = ''
[[ -z "''${DISPLAY}" ]] && [[ "$(tty)" = "/dev/tty1" ]] && \
exec "${pkgs.xorg.xinit}/bin/startx" 1> "${config.home.homeDirectory}/.xsession-errors" 2>&1
'';
}

View File

@ -0,0 +1,249 @@
{ config, pkgs, fontSize ? "10", monoFontSize ? "9", ... }:
let
gruvbox-dark = {
bg = "#282828";
bg1 = "#3c3836";
bg2 = "#504945";
fg = "#ebdbb2";
fg0 = "#fbf1c7";
fg3 = "#bdae93";
red = "#cc241d";
green = "#98971a";
yellow = "#d79921";
blue = "#458588";
purple = "#b16286";
aqua = "#689d6a";
gray = "#a89984";
gray2 = "#928374";
red-light = "#fb4934";
green-light = "#b8bb26";
yellow-light = "#fabd2f";
blue-light = "#83a598";
purple-light = "#d3869b";
aqua-light = "#8ec07c";
};
colors = {
fg = gruvbox-dark.fg;
selFg = gruvbox-dark.fg0;
bg = gruvbox-dark.bg;
sel = gruvbox-dark.blue;
inactive = gruvbox-dark.gray;
inactiveBorder = gruvbox-dark.bg2;
urgent = gruvbox-dark.red;
};
rofiTransparency = "96";
font = {
name = "Inter";
size = fontSize;
};
monoFont = {
name = "Hack";
size = monoFontSize;
};
hmonitors = pkgs.haskellPackages.callPackage ./hmonitors.nix { };
hmonitorsQuery = "${hmonitors}/bin/hmonitors-query";
acpi = "${pkgs.acpi}/bin/acpi";
nmcli = "${pkgs.networkmanager}/bin/nmcli";
pamixer = "${pkgs.pamixer}/bin/pamixer";
in {
xsession.windowManager.xmonad = {
enable = true;
enableContribAndExtras = true;
extraPackages = haskellPackages: [
haskellPackages.monad-logger
haskellPackages.dbus
];
config = ./xmonad/xmonad.hs;
libFiles = {
"Bindings.hs" = ./xmonad/lib/Bindings.hs;
"DefaultConfig.hs" = ./xmonad/lib/DefaultConfig.hs;
"Layouts.hs" = ./xmonad/lib/Layouts.hs;
"ManageHook.hs" = ./xmonad/lib/ManageHook.hs;
"Prompts.hs" = ./xmonad/lib/Prompts.hs;
"Utils.hs" = ./xmonad/lib/Utils.hs;
"Xmobar.hs" = ./xmonad/lib/Xmobar.hs;
"HostConfig.hs" = pkgs.writeText "HostConfig.hs" ''
module HostConfig
( fontConfig
, colorConfig
, FontConfig (FontConfig)
, fontSize
, fontName
, ColorConfig (ColorConfig)
, fgColor
, selFgColor
, bgColor
, selColor
, inactiveColor
, inactiveBorderColor
, urgentColor
) where
fontConfig :: FontConfig
fontConfig = FontConfig
{ fontSize = ${font.size}
, fontName = "${font.name}"
}
colorConfig :: ColorConfig
colorConfig = ColorConfig
{ fgColor = "${colors.fg}"
, selFgColor = "${colors.selFg}"
, bgColor = "${colors.bg}"
, selColor = "${colors.sel}"
, inactiveColor = "${colors.inactive}"
, inactiveBorderColor = "${colors.inactiveBorder}"
, urgentColor = "${colors.urgent}"
}
data FontConfig = FontConfig
{ fontSize :: Int
, fontName :: String
} deriving Show
data ColorConfig = ColorConfig
{ fgColor :: String
, selFgColor :: String
, bgColor :: String
, selColor :: String
, inactiveColor :: String
, inactiveBorderColor :: String
, urgentColor :: String
} deriving Show
'';
};
};
programs.xmobar = {
enable = true;
extraConfig = ''
Config
{ font = "${font.name} ${font.size}"
, additionalFonts = ["mplus Nerd Font 12"]
, bgColor = "${colors.bg}"
, fgColor = "${colors.fg}"
, alignSep = "}{"
, sepChar = "%"
, template = "%StdinReader% }{ %vol%%bat%%net%%date%"
, lowerOnStart = True
, hideOnStart = False
, persistent = True
, allDesktops = True
, position = TopW L 100
, commands =
[ Run Com "${hmonitorsQuery}" ["date"] "date" 10
, Run Com "${hmonitorsQuery}" ["bat"] "bat" 10
-- , Run Com "${hmonitorsQuery}" ["net"] "net" 20
, Run Com "${hmonitorsQuery}" ["vol"] "vol" 5
, Run StdinReader
]
}
, wmClass = "xmobar"
, wmName = "xmobar"
, border = NoBorder
, borderColor = "${colors.bg}"
, pickBroadest = False
, alpha = 255
, iconRoot = "."
'';
};
services.dunst = {
enable = true;
iconTheme = {
name = "Papirus-Dark";
package = pkgs.papirus-icon-theme;
};
settings = {
global = {
font = "${font.name} ${font.size}";
format = "<b>%s</b>\\n%b";
sort = "yes";
indicate_hidden = "yes";
alignment = "left";
bounce_freq = 0;
show_age_threshold = 60;
word_wrap = "yes";
ignore_newline = "no";
geometry = "300x5-30+20";
shrink = "yes";
transparency = 0;
idle_threshold = 10;
monitor = 0;
follow = "mouse";
sticky_history = "yes";
history_length = 20;
show_indicators = "yes";
line_height = 0;
separator_height = 2;
padding = 8;
horizontal_padding = 8;
separator_color = "frame";
startup_notification = false;
dmenu = "${pkgs.rofi}/bin/rofi -dmenu -p dunst:";
browser = "${pkgs.firefox}/bin/firefox";
icon_position = "left";
frame_width = 0;
frame_color = colors.inactive;
};
shortcuts = {
close = "ctrl+space";
close_all = "ctrl+shift+space";
context = "ctrl+shift+period";
};
urgency_low = {
background = "${colors.bg}${rofiTransparency}";
foreground = colors.fg;
timeout = 10;
};
urgency_normal = {
background = "${colors.sel}${rofiTransparency}";
foreground = colors.selFg;
timeout = 10;
};
urgency_critical = {
background = "${colors.urgent}${rofiTransparency}";
foreground = colors.selFg;
timeout = 10;
};
};
};
programs.zathura = {
enable = true;
options = {
font = "${monoFont.name} ${monoFont.size}";
default-bg = colors.bg;
default-fg = gruvbox-dark.bg1;
statusbar-fg = gruvbox-dark.fg3;
statusbar-bg = gruvbox-dark.bg2;
inputbar-bg = colors.bg;
inputbar-fg = colors.sel;
notification-bg = colors.bg;
notification-fg = colors.sel;
notification-error-bg = colors.bg;
notification-error-fg = gruvbox-dark.red-light;
notification-warning-bg = colors.bg;
notification-warning-fg = gruvbox-dark.red-light;
highlight-color = gruvbox-dark.yellow-light;
highlight-active-color = gruvbox-dark.blue-light;
completion-bg = gruvbox-dark.bg1;
completion-fg = gruvbox-dark.blue-light;
completion-highlight-fg = colors.selFg;
completion-highlight-bg = gruvbox-dark.blue-light;
recolor-lightcolor = colors.bg;
recolor-darkcolor = colors.fg;
recolor = false;
recolor-keephue = false;
};
};
}

View File

@ -0,0 +1,16 @@
{ mkDerivation, base, containers, lib, process, regex-compat, split, time }:
mkDerivation {
pname = "hmonitors";
version = "0.1.0.0";
src = builtins.fetchGit {
name = "hmonitors";
url = "https://git.monotremata.xyz/rilla/hmonitors.git";
ref = "main";
rev = "a17f3f0e273b44c021d42c68f186fe1ae4149102";
};
isLibrary = true;
isExecutable = true;
libraryHaskellDepends = [ base containers process regex-compat split time ];
executableHaskellDepends = [ base ];
license = lib.licenses.bsd3;
}

View File

@ -0,0 +1,24 @@
/* XPM */
static char *_cols[] = {
/* columns rows colors chars-per-pixel */
"16 16 2 1 ",
" c #EBDBB2",
". c None",
/* pixels */
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. "
};

View File

@ -0,0 +1,24 @@
/* XPM */
static char *float[] = {
/* columns rows colors chars-per-pixel */
"16 16 2 1 ",
" c #EBDBB2",
". c None",
/* pixels */
".. ",
".. ",
".. ",
".. ",
".. ",
".. ",
".. ",
"......... ",
"......... ",
" .. ",
" .. ",
" .. ",
" .. ",
" .. ",
" .........",
" ........."
};

View File

@ -0,0 +1,23 @@
/* XPM */
static char *full[] = {
/* columns rows colors chars-per-pixel */
"16 16 1 1 ",
" c #EBDBB2",
/* pixels */
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "
};

View File

@ -0,0 +1,24 @@
/* XPM */
static char *grid[] = {
/* columns rows colors chars-per-pixel */
"16 16 2 1 ",
" c #EBDBB2",
". c None",
/* pixels */
" .. ",
" .. ",
" .. ",
" .. ",
" .. ",
" .. ",
" .. ",
"................",
"................",
" .. ",
" .. ",
" .. ",
" .. ",
" .. ",
" .. ",
" .. "
};

View File

@ -0,0 +1,24 @@
/* XPM */
static char *mtall[] = {
/* columns rows colors chars-per-pixel */
"16 16 2 1 ",
" c #EBDBB2",
". c None",
/* pixels */
" ",
" ",
" ",
" ",
" ",
" ",
" ",
"................",
"................",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. "
};

View File

@ -0,0 +1,24 @@
/* XPM */
static char *tabs[] = {
/* columns rows colors chars-per-pixel */
"16 16 2 1 ",
" c #EBDBB2",
". c None",
/* pixels */
" ",
" .............. ",
" ",
"................",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "
};

View File

@ -0,0 +1,24 @@
/* XPM */
static char *tall[] = {
/* columns rows colors chars-per-pixel */
"16 16 2 1 ",
" c #EBDBB2",
". c None",
/* pixels */
" .. ",
" .. ",
" .. ",
" .. ",
" .........",
" .........",
" .. ",
" .. ",
" .. ",
" .. ",
" .........",
" .........",
" .. ",
" .. ",
" .. ",
" .. "
};

View File

@ -0,0 +1,24 @@
{ config, pkgs, ... }:
let wallpapers = "${config.home.homeDirectory}/Images/wallpapers/enabled";
in {
services.random-background = {
enable = true;
enableXinerama = true;
display = "fill";
imageDirectory = wallpapers;
};
systemd.user.services.xbanish = {
Unit = {
Description = "Xbanish";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
Type = "simple";
ExecStart = "${pkgs.xbanish}/bin/xbanish";
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
}

View File

@ -0,0 +1,12 @@
{ config, pkgs, ...}:
let
shell = "${pkgs.dash}/bin/dash";
xmonad = "${pkgs.haskellPackages.xmonad}/bin/xmonad";
openbox = "${pkgs.openbox}/bin/openbox";
in
pkgs.writeScriptBin "obtoxmd" ''
#!${shell}
${openbox}
${xmonad}
''

View File

@ -0,0 +1,140 @@
{ config, pkgs, ... }:
let
gruvbox-dark = {
bg = "#282828";
bg1 = "#3c3836";
bg2 = "#504945";
fg = "#ebdbb2";
fg0 = "#fbf1c7";
fg3 = "#bdae93";
red = "#cc241d";
green = "#98971a";
yellow = "#d79921";
blue = "#458588";
purple = "#b16286";
aqua = "#689d6a";
gray = "#a89984";
gray2 = "#928374";
red-light = "#fb4934";
green-light = "#b8bb26";
yellow-light = "#fabd2f";
blue-light = "#83a598";
purple-light = "#d3869b";
aqua-light = "#8ec07c";
};
colors = {
fg = gruvbox-dark.fg;
selFg = gruvbox-dark.fg0;
bg = gruvbox-dark.bg;
sel = gruvbox-dark.blue;
inactive = gruvbox-dark.gray;
inactiveBorder = gruvbox-dark.bg2;
urgent = gruvbox-dark.red;
};
rofiTransparency = "96";
font = {
name = "Inter";
size = "10";
};
monoFont = {
name = "Hack";
size = "9";
};
in {
programs.rofi = {
enable = true;
font = "${font.name} ${font.size}";
extraConfig = {
display-run = " ";
# display-drun = " ";
display-window = " ";
drun-display-format = "{name}";
modi = "window,run,drun,ssh";
show-icons = false;
};
theme = let inherit (config.lib.formats.rasi) mkLiteral;
in {
"*" = {
background-color = mkLiteral "transparent";
border = 0;
margin = 0;
padding = 0;
spacing = 0;
};
element = {
padding = 2;
orientation = "vertical";
};
"element-text" = { text-color = mkLiteral colors.fg; };
"element selected" = {
text-color = mkLiteral colors.selFg;
background-color = mkLiteral "${colors.sel}A0";
};
entry = {
padding = mkLiteral "0 0 6 3";
text-color = mkLiteral colors.fg;
};
inputbar = {
children = map mkLiteral [ "prompt" "entry" ];
border = mkLiteral "0 0 1 0";
border-color = mkLiteral gruvbox-dark.gray2;
margin = mkLiteral "0 0 5 0";
};
listview = {
columns = 1;
fixed-height = false;
};
mainbox = {
children = map mkLiteral [ "inputbar" "listview" ];
margin = 6;
};
prompt = {
padding = mkLiteral "0 0 0 6";
text-color = mkLiteral colors.fg;
background-color = mkLiteral "transparent";
};
window = {
transparency = "real";
background-color = mkLiteral "${colors.bg}D0";
y-offset = mkLiteral "-25%";
border = 2;
border-color = mkLiteral colors.sel;
};
};
terminal = "${pkgs.alacritty}/bin/alacritty";
pass = {
enable = true;
extraConfig = ''
URL_field='url'
USERNAME_field='user'
AUTOTYPE_field='autotype'
delay=2
wait=0.2
xdotool_delay=12
EDITOR='gvim -f'
BROWSER='xdg-open'
default_do='typePass' # menu, autotype, copyPass, typeUser, typePass, copyUser, copyUrl, viewEntry, typeMenu, actionMenu, copyMenu, openUrl
auto_enter='false'
notify='false'
default_autotype='user :tab pass'
help_color="${gruvbox-dark.blue-light}"
clip=primary
clip_clear=45
edit_new_pass="true"
default_user=":filename"
autotype="Alt+1"
type_user="Alt+u"
type_pass="Alt+p"
copy_name=""
copy_pass=""
'';
};
};
}

View File

@ -0,0 +1,29 @@
{ config, pkgs, ... }:
let
desktopConfig = import ./desktop_config.nix {
config = config;
pkgs = pkgs;
fontSize = "11";
monoFontSize = "13";
};
in desktopConfig // {
imports = [ ./common.nix ./autorandr/trantor.nix ];
services.picom = {
enable = true;
fade = false;
shadow = true;
backend = "glx";
shadowExclude = [ "name ~= 'stalonetray'" ];
settings.unredir-if-possible = false;
vSync = true;
};
home.file.".xinitrc".text = ''
${pkgs.xorg.xrandr}/bin/xrandr --setprovideroutputsource modesetting NVIDIA-0
${pkgs.xorg.xrandr}/bin/xrandr --auto
${pkgs.acpilight}/bin/xbacklight -set 100
exec ${config.home.homeDirectory}/.xsession
'';
}

View File

@ -0,0 +1,376 @@
module Bindings
( keybinds
, mousebinds
) where
--
-- q , w , e : screen naviagation
-- h , j , k , l : vim-style 2D navitgation
-- n , p : next/previous
-- r : run
-- t : tile
-- g : toggle spacing (gaps)
-- b " toggle bar
-- x , y : reflect
-- z : minimize
-- [ , ] : tab navigation
import System.Exit (exitSuccess)
import Data.Monoid ( appEndo )
import Data.Ratio ( (%) )
import qualified Data.Map as M
import XMonad ( (.|.) , gets )
import XMonad.Util.Types ( Direction2D (U, D, L, R) )
import XMonad.Hooks.ManageDocks ( ToggleStruts (ToggleStruts) )
import XMonad.Util.Run ( safeSpawn )
import XMonad.Util.Paste ( pasteSelection )
import XMonad.Layout.ResizableTile ( MirrorResize (MirrorShrink, MirrorExpand) )
import XMonad.Layout.Reflect ( REFLECTX (REFLECTX) , REFLECTY (REFLECTY) )
import XMonad.Layout.MultiToggle ( Toggle (Toggle) )
import XMonad.Layout.BoringWindows ( focusUp , focusDown )
import XMonad.Layout.Maximize ( maximizeRestore )
import XMonad.Actions.CopyWindow ( kill1 )
-- import XMonad.Actions.FloatKeys ( keysResizeWindow, keysMoveWindow, ChangeDim )
import XMonad.Actions.FloatKeys
import XMonad.Actions.Navigation2D ( switchLayer , windowGo , windowSwap )
import XMonad.Hooks.ManageHelpers ( doRectFloat )
import XMonad.Core
( Layout
, X
, terminal
, modMask
, layoutHook
, XConfig (XConfig)
, whenJust
, runQuery
, windowset
, io
, ScreenId
, WindowSpace
)
import XMonad.Layout.IndependentScreens
( workspaces'
, onCurrentScreen
, unmarshallS
)
import XMonad.Layout.SubLayouts
( onGroup
, pushGroup
, GroupMsg (MergeAll, UnMerge)
)
import Graphics.X11.Types
( Window , ButtonMask , KeyMask , KeySym , Button
, button1 , button2 , button3
, shiftMask , controlMask
, xK_Return , xK_Escape , xK_Insert , xK_Right , xK_Left
, xK_space , xK_plus , xK_minus , xK_comma , xK_period
, xK_bracketleft , xK_bracketright
, xK_1 , xK_9 , xK_0
, xK_b , xK_c , xK_e , xK_g , xK_h , xK_j , xK_k , xK_l , xK_m
, xK_n , xK_o , xK_p , xK_q , xK_r , xK_t , xK_u , xK_w , xK_x
, xK_y , xK_z
, xK_KP_End , xK_KP_Down , xK_KP_Next
, xK_KP_Add, xK_KP_Subtract, xK_KP_Insert, xK_KP_Enter
)
import Graphics.X11.ExtraTypes.XF86
( xF86XK_AudioMute
, xF86XK_AudioLowerVolume , xF86XK_AudioRaiseVolume
, xF86XK_AudioPlay , xF86XK_AudioStop
, xF86XK_AudioPrev , xF86XK_AudioNext
, xF86XK_RotateWindows
, xF86XK_MonBrightnessUp , xF86XK_MonBrightnessDown
)
import XMonad.Layout
( IncMasterN (..)
, Resize (Shrink, Expand)
, ChangeLayout (NextLayout)
)
import XMonad.Operations
( windows
, sendMessage
, setLayout
, withFocused
, screenWorkspace
, restart
, mouseResizeWindow
, mouseMoveWindow
, focus
, D
)
import XMonad.StackSet
( StackSet (..)
, RationalRect (..)
, Workspace (..)
, shift
, view
, swapUp
, swapDown
, sink
, view
, floating
, screen
, shiftMaster
, focusDown'
, focusUp'
)
import XMonad.Layout.Spacing
( toggleScreenSpacingEnabled
, toggleWindowSpacingEnabled
)
import XMonad.Actions.Minimize
( minimizeWindow
, withLastMinimized
, maximizeWindowAndFocus
)
import XMonad.Actions.CycleWS
( toggleWS'
, WSType (WSIs)
, shiftTo
, moveTo
, Direction1D (Next, Prev)
)
import ManageHook ( scratchpadKeybinds )
import Prompts ( promptKeybinds )
import Utils ( mkSubmap )
mousebinds :: XConfig Layout -> M.Map (KeyMask, Button) (Window -> X ())
mousebinds XConfig {modMask = modm} = M.fromList bindings
where
bindings =
[ ((modm, button1), move)
, ((modm, button2), toMaster)
, ((modm, button3), resize)
]
move = mouseDo mouseMoveWindow
resize = mouseDo mouseResizeWindow
toMaster = mouseDo return
mouseDo f w = focus w >> f w >> windows shiftMaster
keybinds :: XConfig Layout -> M.Map (ButtonMask, KeySym) (X ())
keybinds = foldr1 keyComb
[ wmBinds
, spawnBinds
, promptKeybinds
, scratchpadKeybinds
, workspaceBinds
, screenBinds
]
where
keyComb f g conf = M.union (f conf) (g conf)
spawnBinds :: XConfig Layout -> M.Map (ButtonMask, KeySym) (X ())
spawnBinds conf = M.fromList . map mkSpawn $ bindList
where
bindList = singles ++ playerctl ++ xbacklight ++ pamixer
singles =
[ ((modm, xK_Return), terminal conf, [])
, ((0, xF86XK_RotateWindows), "thinkpad-rotate", [])
, ((modm, xK_Escape), "slock", [])
]
-- mpc = withCmd "mpc"
-- [ ((0, xK_KP_End), ["prev"])
-- , ((0, xK_KP_Down), ["toggle"])
-- , ((0, xK_KP_Next), ["next"])
-- , ((0, xF86XK_AudioPlay), ["toggle"])
-- , ((0, xF86XK_AudioStop), ["stop"])
-- , ((0, xF86XK_AudioPrev), ["prev"])
-- , ((0, xF86XK_AudioNext), ["next"])
-- ]
playerctl = withCmd "playerctl"
[ ((0, xK_KP_End), ["previous"])
, ((0, xK_KP_Down), ["play-pause"])
, ((0, xK_KP_Next), ["next"])
, ((0, xF86XK_AudioPlay), ["play-pause"])
, ((0, xF86XK_AudioStop), ["stop"])
, ((0, xF86XK_AudioPrev), ["previous"])
, ((0, xF86XK_AudioNext), ["next"])
]
xbacklight = withCmd "xbacklight"
[ ((0, xF86XK_MonBrightnessUp), ["-inc", "10"])
, ((0, xF86XK_MonBrightnessDown), ["-dec", "10"])
]
pamixer = withCmd "pamixer"
[ ((0, xK_KP_Subtract), ["--decrease", "5"])
, ((0, xK_KP_Add), ["--increase", "5", "--allow-boost"])
, ((0, xK_KP_Enter), ["--set-volume", "100"])
, ((0, xK_KP_Insert), ["--togle-mute"])
, ((0, xF86XK_AudioLowerVolume), ["--decrease", "5"])
, ((0, xF86XK_AudioRaiseVolume), ["--increase", "5", "--allow-boost"])
, ((0, xF86XK_AudioMute), ["--toggle-mute"])
]
mkSpawn (comb,cmd,args) = (comb, safeSpawn cmd args)
withCmd cmd = map (\(comb,args) -> (comb,cmd,args))
modm = modMask conf
wmBinds :: XConfig Layout -> M.Map (ButtonMask, KeySym) (X ())
wmBinds conf@XConfig {modMask = modm} = M.fromList
[ ((0, xK_Insert), pasteSelection)
, ((modm .|. shiftMask, xK_o), restart "obtoxmd" True)
, ((modm .|. shiftMask, xK_r), restart "xmonad" True)
, ((modm .|. shiftMask, xK_Escape), io exitSuccess)
-- navigating windows
, ((modm, xK_j), windowGo D False)
, ((modm, xK_k), windowGo U False)
, ((modm, xK_h), windowGo L False)
, ((modm, xK_l), windowGo R False)
, ((modm, xK_n), focusDown)
, ((modm, xK_p), focusUp)
-- sublayout things
, ((modm .|. controlMask, xK_m), withFocused (sendMessage . MergeAll))
, ((modm .|. controlMask, xK_u), withFocused (sendMessage . UnMerge))
, ((modm .|. controlMask, xK_h), sendMessage $ pushGroup L)
, ((modm .|. controlMask, xK_l), sendMessage $ pushGroup R)
, ((modm .|. controlMask, xK_k), sendMessage $ pushGroup U)
, ((modm .|. controlMask, xK_j), sendMessage $ pushGroup D)
, ((modm, xK_bracketleft), onGroup focusUp')
, ((modm, xK_bracketright), onGroup focusDown')
-- moving windows
, ((modm .|. shiftMask, xK_j), move M.! "D")
, ((modm .|. shiftMask, xK_k), move M.! "U")
, ((modm .|. shiftMask, xK_h), move M.! "L")
, ((modm .|. shiftMask, xK_l), move M.! "R")
, ((modm .|. shiftMask, xK_n), windows swapDown)
, ((modm .|. shiftMask, xK_p), windows swapUp)
-- resizing windows
, ((modm, xK_plus ), resize M.! "+")
, ((modm, xK_minus), resize M.! "-")
, ((modm .|. shiftMask .|. controlMask, xK_h), resize M.! "L")
, ((modm .|. shiftMask .|. controlMask, xK_l), resize M.! "R")
, ((modm .|. shiftMask .|. controlMask, xK_j), resize M.! "D")
, ((modm .|. shiftMask .|. controlMask, xK_k), resize M.! "U")
, ((modm .|. controlMask, xK_space), switchLayer)
, ((modm .|. shiftMask, xK_c ), kill1)
, ((modm, xK_space ), sendMessage NextLayout)
, ((modm .|. shiftMask, xK_space ), setLayout $ layoutHook conf)
, ((modm, xK_x ), sendMessage $ Toggle REFLECTX)
, ((modm, xK_y ), sendMessage $ Toggle REFLECTY)
, ((modm, xK_z ), withFocused minimizeWindow)
, ((modm .|. shiftMask, xK_z ), unminimize)
, ((modm, xK_m ), toggleMax)
, ((modm, xK_t ), withFocused $ windows . sink)
, ((modm .|. shiftMask, xK_t ), untile)
, ((modm, xK_comma ), sendMessage (IncMasterN 1))
, ((modm, xK_period), sendMessage (IncMasterN (-1)))
, ((modm, xK_g ), toggleSpacing)
, ((modm, xK_b ), sendMessage ToggleStruts)
, ((modm, xK_Right ), moveTo Next spacesOnCurrentScreen)
, ((modm, xK_Left ), moveTo Prev spacesOnCurrentScreen)
, ((modm .|. shiftMask, xK_Right ), shiftTo Next spacesOnCurrentScreen)
, ((modm .|. shiftMask, xK_Left ), shiftTo Prev spacesOnCurrentScreen)
, ((modm, xK_0), toggleWS' ["NSP"])
]
where
toggleSpacing = toggleWindowSpacingEnabled >> toggleScreenSpacingEnabled
toggleMax = withFocused (sendMessage . maximizeRestore)
unminimize = withLastMinimized maximizeWindowAndFocus
untile = withFocused rectFloatFocused
where
rectFloatFocused focused = action focused >>= windows
action = fmap appEndo . doIt
doIt = runQuery $ doRectFloat rect
rect = RationalRect 0.05 0.05 0.9 0.9
resize :: M.Map [Char] (X())
resize = M.intersectionWith onFloat flt tilling
where
flt :: M.Map [Char] (Window -> X())
flt = M.fromList
[ ("L", keysResizeWindow (-n, 0) (0, 0))
, ("R", keysResizeWindow ( n, 0) (0, 0))
, ("D", keysResizeWindow ( 0, n) (0, 0))
, ("U", keysResizeWindow ( 0, -n) (0, 0))
, ("+", keysResizeWindow ( n, n) (1%2, 1%2))
, ("-", keysResizeWindow (-n, -n) (1%2, 1%2))
]
tilling :: M.Map [Char] (X())
tilling = M.fromList
[ ("L", sendMessage Shrink)
, ("R", sendMessage Expand)
, ("D", sendMessage MirrorShrink)
, ("U", sendMessage MirrorExpand)
, ("+", return ())
, ("-", return ())
]
n = 10
move :: M.Map [Char] (X())
move = M.intersectionWith onFloat flt tilling
where
flt :: M.Map [Char] (Window -> X())
flt = M.fromList
[ ("L", keysMoveWindow (-n, 0))
, ("R", keysMoveWindow ( n, 0))
, ("D", keysMoveWindow ( 0, n))
, ("U", keysMoveWindow ( 0, -n))
]
tilling :: M.Map [Char] (X())
tilling = M.fromList
[ ("L", windowSwap L False)
, ("R", windowSwap R False)
, ("D", windowSwap D False)
, ("U", windowSwap U False)
]
n = 10
onFloat a b = withFocused $ ifFloat a (const b)
where
ifFloat x y w = isFloat w >>= picker x y w
picker x _ w True = x w
picker _ y w False = y w
isFloat :: Window -> X Bool
isFloat w = M.member w . floating <$> gets windowset
spacesOnCurrentScreen :: WSType
spacesOnCurrentScreen = WSIs $ isOnScreen <$> currentScreen
where
isOnScreen :: ScreenId -> WindowSpace -> Bool
isOnScreen s = (s ==) . unmarshallS . tag
currentScreen :: X ScreenId
currentScreen = gets $ screen . current . windowset
workspaceBinds :: XConfig Layout -> M.Map (ButtonMask, KeySym) (X ())
workspaceBinds conf@XConfig {modMask = modm} = M.fromList $
[((m .|. modm, k), windows $ onCurrentScreen f i)
| (i, k) <- zip (workspaces' conf) [xK_1 .. xK_9]
, (f, m) <- [(view, 0), (shift, shiftMask)]]
screenBinds :: XConfig Layout -> M.Map (ButtonMask, KeySym) (X ())
screenBinds XConfig {modMask = modm} = M.fromList $
[((m .|. modm, k), screenWorkspace i >>= flip whenJust (windows . f))
| (i, k) <- zip [0,1] [xK_w, xK_e]
, (f, m) <- [(view, 0), (shift, shiftMask)]]

View File

@ -0,0 +1,85 @@
module DefaultConfig
( mkPP
, wsNamer
, defaultPP
) where
import MyConfig
( workspaceLog
, layoutLog
, taskbar
)
import Theme
( inactiveColor
, urgentColor
, selFg
, selectionColor
)
import GHC.IO.Handle.Types (Handle)
import XMonad.Hooks.DynamicLog
( ppCurrent
, ppOutput
, ppExtras
, ppVisible
, ppHidden
, ppHiddenNoWindows
, ppUrgent
, ppOrder
, ppTitle
, ppSep
, ppLayout
, PP
, xmobarColor
, wrap
, shorten
)
import XMonad.Config (def)
import XMonad.Util.Run (hPutStrLn)
mkPP :: (String -> String) -> Bool -> Handle -> Int -> PP
mkPP workspaceNamer complete bar screen = common
{ ppOutput = hPutStrLn bar
, ppExtras = extras complete
}
where
common = def
{ ppCurrent = const ""
, ppVisible = const ""
, ppHidden = const ""
, ppHiddenNoWindows = const ""
, ppUrgent = xmobarColor urgentColor ""
, ppOrder = order complete
, ppTitle = title complete
, ppSep = xmobarColor inactiveColor "" "|"
, ppLayout = const ""
}
extras True =
[ workspaceLog workspaceNamer screen
, layoutLog screen
, taskbar screen
]
extras False =
[ workspaceLog workspaceNamer screen
, layoutLog screen
]
order True (_:_:_:xs) = xs
order False (_:_:t:ws:l:_) = [ws, l, t]
order _ _ = []
title True = const ""
title False = wrap " " "" . xmobarColor selFg selectionColor . wrap " " " " . shorten 80
wsNamer :: String -> String
wsNamer "NSP" = ""
wsNamer x = x
defaultPP :: Handle -> Int -> PP
defaultPP = mkPP wsNamer True

View File

@ -0,0 +1,124 @@
{-# LANGUAGE FlexibleContexts #-}
{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
module Layouts (myLayoutHook) where
import Text.Printf (printf)
import XMonad.Config (def)
import XMonad.Core ( LayoutClass )
import XMonad.Hooks.ManageDocks (avoidStruts)
import XMonad.Layout ( Mirror (Mirror) , (|||) )
import XMonad.Layout.PerWorkspace ( onWorkspaces )
import XMonad.Layout.LayoutModifier ( ModifiedLayout , LayoutModifier )
import XMonad.Layout.BoringWindows ( boringWindows )
import XMonad.Layout.Decoration ( Theme , DefaultShrinker , Decoration )
import XMonad.Layout.Maximize ( maximizeWithPadding )
import XMonad.Layout.Minimize ( minimize )
import XMonad.Layout.MultiToggle ( mkToggle , single )
import XMonad.Layout.Renamed ( renamed, Rename (Replace) )
import XMonad.Layout.NoBorders ( smartBorders )
import XMonad.Layout.ResizableTile ( ResizableTall (..) )
import XMonad.Layout.Spacing ( Spacing , spacingRaw , Border (..) )
import XMonad.Layout.WindowNavigation ( windowNavigation )
import XMonad.Layout.SubLayouts ( subLayout , Sublayout )
import XMonad.Layout.Simplest ( Simplest(Simplest) )
import XMonad.Layout.Grid ( Grid(Grid) )
import XMonad.Layout.Reflect
( REFLECTX (REFLECTX)
, REFLECTY (REFLECTY)
)
import XMonad.Layout.Tabbed
( shrinkText
, addTabs
, TabbedDecoration
)
import qualified XMonad.Layout.Tabbed as T
( activeColor
, inactiveColor
, activeBorderColor
, inactiveBorderColor
, urgentColor
, activeTextColor
, inactiveTextColor
, urgentTextColor
, fontName
)
import XMonad.Layout.PositionStoreFloat (positionStoreFloat)
import XMonad.Layout.NoFrillsDecoration (noFrillsDeco)
import XMonad.Layout.BorderResize (borderResize)
import HostConfig
( FontConfig
, fontName
, fontSize
, ColorConfig
, fgColor
, selFgColor
, bgColor
, selColor
, inactiveColor
, inactiveBorderColor
, urgentColor
, colorConfig
, fontConfig
)
named :: String -> l a -> ModifiedLayout Rename l a
named x = renamed [Replace x]
myLayoutHook = commonMods mainLayouts
where
tileMods = mkToggle (single REFLECTX) . mkToggle (single REFLECTY)
. smartBorders
. windowNavigation . mySubTabbed theme
. spaces
commonMods = avoidStruts
. maximizeWithPadding 0
. minimize
. boringWindows
tLayouts = tileMods $ named "tall" tall ||| named "mtall" mtall
mainLayouts = tLayouts ||| floating theme
floating theme = named "float" . floatingDeco . borderResize $ positionStoreFloat
where
floatingDeco = noFrillsDeco shrinkText theme
mySubTabbed
:: (Eq a, LayoutModifier (Sublayout Simplest) a, LayoutClass l a)
=> Theme
-> l a
-> ModifiedLayout
(Decoration TabbedDecoration DefaultShrinker)
(ModifiedLayout (Sublayout Simplest) l)
a
mySubTabbed theme x = addTabs shrinkText theme $ subLayout [] Simplest x
spaces :: l a -> ModifiedLayout Spacing l a
spaces = spacingRaw False b False b False
where
b = Border defSpacing defSpacing defSpacing defSpacing
defSpacing = 5
tall :: ResizableTall a
tall = ResizableTall 1 (3/100) (1/2) []
mtall :: Mirror ResizableTall a
mtall = Mirror tall
theme :: Theme
theme = def
{ T.activeColor = selColor colorConfig
, T.activeBorderColor = inactiveColor colorConfig
, T.activeTextColor = selFgColor colorConfig
, T.inactiveColor = bgColor colorConfig
, T.inactiveBorderColor = inactiveBorderColor colorConfig
, T.inactiveTextColor = fgColor colorConfig
, T.urgentColor = urgentColor colorConfig
, T.urgentTextColor = urgentColor colorConfig
, T.fontName = printf "xft:%s:size=%d" (fontName fontConfig) (fontSize fontConfig)
}

View File

@ -0,0 +1,135 @@
module ManageHook
( myManageHook
, scratchpadKeybinds
) where
import Text.Printf (printf)
import qualified Data.Map as M
import XMonad.Core
( ManageHook
, X
, XConfig(XConfig)
, modMask
, Layout
)
import XMonad.StackSet (RationalRect (RationalRect))
import XMonad.Hooks.ManageHelpers (isFullscreen, doFullFloat)
import Graphics.X11.Types
( KeySym , ButtonMask
, xK_s , xK_t , xK_m
, xK_Return
)
import XMonad.ManageHook
( className
, (=?)
, resource
, composeAll
, (-->)
, doFloat
, doShift
, stringProperty
)
import XMonad.Util.NamedScratchpad
( NamedScratchpad (NS)
, customFloating
, namedScratchpadManageHook
, namedScratchpadAction
)
import Utils ( mkSubmap )
scratchpadKeybinds :: XConfig Layout -> M.Map (ButtonMask, KeySym) (X ())
scratchpadKeybinds XConfig {modMask = modm} = M.fromList
[ ((modm, xK_s), mkSubmap modm . map buildSubmap $
[ (xK_Return, "scratchpad")
, (xK_m, "mixer")
-- , (xK_p, "player")
, (xK_t, "top")
-- , (xK_w, "whatsapp")
-- , (xK_g, "hangouts")
])
]
where
buildSubmap (key,name) = ((0,key), namedScratchpadAction myScratchpads name)
myScratchpads :: [NamedScratchpad]
myScratchpads =
[ termApp "scratchpad" "zsh" mngTopScratch
, termApp "top" "top" mngBigFloat
--, termApp "player" "ncmpcpp" mngBiggerFloat
--, NS "mixer" "pavucontrol" (className =? "Pavucontrol") mngSmallerFloat
-- , chromiumApp "whatsapp" "web.whatsapp.com" mngSmallFloat
-- , chromiumApp "hangouts" "hangouts.google.com" mngSmallFloat
]
myManageHook :: ManageHook
myManageHook = mkManageHook myScratchpads
termApp :: String -> String -> ManageHook -> NamedScratchpad
termApp name app = NS name cmd findIt
where
cmd = printf fmt name name app
fmt = "alacritty --class %s --command tmux new -A -s %s %s"
findIt = resource =? name
--chromiumApp :: String -> String -> ManageHook -> NamedScratchpad
--chromiumApp name url = NS name cmd findIt
-- where
-- cmd = printf "chromium --app=https://%s" url
-- findIt = resource =? url
--mngSmallerFloat :: ManageHook
--mngSmallerFloat = centeredFloat 0.6
--mngSmallFloat :: ManageHook
--mngSmallFloat = centeredFloat 0.7
mngBigFloat :: ManageHook
mngBigFloat = centeredFloat 0.8
--mngBiggerFloat :: ManageHook
--mngBiggerFloat = centeredFloat 0.9
centeredFloat :: Rational -> ManageHook
centeredFloat s = customFloating $ RationalRect p p s s
where
p = (1-s) / 2
mngTopScratch :: ManageHook
mngTopScratch = customFloating $ RationalRect l t w h
where
h = 0.3 -- height, 30%
w = 1 -- width, 100%
t = 0 -- distance from top edge, 0%
l = 1 - w -- distance from left edge, 0%
mkManageHook :: [NamedScratchpad] -> ManageHook
mkManageHook scratchpads = composeAll
[ isFullscreen --> doFullFloat
, className =? "MPlayer" --> doFloat
, className =? "VirtualBox" --> doFloat
, className =? "Pinentry" --> doFloat
, className =? "qjackctl" --> doFloat
, className =? "Xmessage" --> doFloat
, className =? "SuperCollider" --> doFloat
, role =? "gimp-dock" --> doFloat
, role =? "GtkFileChooserDialog" --> doFloat
--, className =? "Signal" --> doShift "msg"
--, className =? "Slack" --> doShift "msg"
--, className =? "Element" --> doShift "msg"
--, className =? "TelegramDesktop" --> doShift "msg"
--, resource =? "hangouts.google.com" --> doShift "msg"
--, resource =? "web.whatsapp.com" --> doShift "msg"
, namedScratchpadManageHook scratchpads
]
where
role = stringProperty "WM_WINDOW_ROLE"

View File

@ -0,0 +1,60 @@
module Polybar (polybarLogHook, mkDbusClient) where
import XMonad.Hooks.DynamicLog
import Text.Printf (printf)
import XMonad.Layout.IndependentScreens (marshallPP)
import qualified DBus as D
import qualified DBus.Client as D
import qualified Codec.Binary.UTF8.String as UTF8
mkDbusClient :: IO D.Client
mkDbusClient = do
dbus <- D.connectSession
D.requestName dbus (D.busName_ "org.xmonad.log") opts
return dbus
where
opts = [D.nameAllowReplacement, D.nameReplaceExisting, D.nameDoNotQueue]
monitorMsg :: Int -> String -> String
monitorMsg = printf "{\"%d\": \"%s\"}"
-- Emit a DBus signal on log updates
dbusOutput :: D.Client -> String -> IO ()
dbusOutput dbus str =
let opath = D.objectPath_ "/org/xmonad/Log"
iname = D.interfaceName_ "org.xmonad.Log"
mname = D.memberName_ "Update"
signal = D.signal opath iname mname
body = [D.toVariant $ UTF8.decodeString $ monitorMsg 0 str]
in D.emit dbus $ signal { D.signalBody = body }
polybarFmt :: String -> String -> String -> String
polybarFmt var color elem = "%{" ++ var ++ color ++ "}" ++ elem ++ "%{" ++ var ++ "-}"
polybarFg :: String -> String -> String
polybarFg = polybarFmt "F"
polybarBg :: String -> String -> String
polybarBg = polybarFmt "B"
polybarBgFg :: String -> String -> String -> String
polybarBgFg bg fg = polybarBg bg . polybarFg fg
polybarHook :: D.Client -> PP
polybarHook dbus = def
{ ppOutput = dbusOutput dbus
, ppCurrent = polybarBgFg "#458588" "#fbf1c7"
, ppVisible = polybarFg "#ebdbb2"
, ppUrgent = polybarBgFg "#cc241d" "#fbf1c7"
, ppHidden = polybarFg "#ebdbb2"
, ppLayout = const ""
, ppHiddenNoWindows = const ""
, ppTitle = shorten 100 . polybarFg "#fbf1c7"
, ppSep = polybarFg "#a89974" " | "
}
polybarLogHook dbus = dynamicLogWithPP $ (marshallPP 0 . polybarHook) dbus

View File

@ -0,0 +1,92 @@
module Prompts ( promptKeybinds ) where
import Text.Printf (printf)
import qualified Data.Map as M ( Map , fromList )
import Graphics.X11.Types
( KeySym , ButtonMask
, xK_Tab
, xK_a , xK_b , xK_c , xK_p , xK_r , xK_s , xK_u , xK_t
)
import Graphics.X11.ExtraTypes.XF86 ( xF86XK_Launch1 )
import XMonad.Core ( X , modMask , XConfig(XConfig) , Layout )
import XMonad.Util.Run ( safeSpawn )
import qualified XMonad.Prompt as P
( XPConfig
, def
, font
, bgColor
, fgColor
, bgHLight
, fgHLight
, bgColor
, borderColor
, promptBorderWidth
, alwaysHighlight
, defaultPrompter
)
import HostConfig
( ColorConfig
, FontConfig
, fontConfig
, colorConfig
, fontName
, fontSize
, bgColor
, fgColor
, selColor
, selFgColor
)
import Utils ( mkSubmap )
promptKeybinds :: XConfig Layout -> M.Map (ButtonMask, KeySym) (X ())
promptKeybinds XConfig {modMask = modm} = M.fromList
[ ((0, xF86XK_Launch1), run)
, ((modm, xK_r), run)
, ((modm, xK_a) , subMapMaker
[ ( xK_r , drun )
, ( xK_p , pass )
, ( xK_Tab , window )
, ( xK_t , todo )
, ( xK_c , clipmenu )
, ( xK_b , buku )
, ( xK_s , ssh )
])
]
where
run = safeSpawn "rofi" ["-show", "run"]
drun = safeSpawn "rofi" ["-show", "drun"]
pass = safeSpawn "rofi-pass" []
buku = safeSpawn "rofi-buku" []
ssh = safeSpawn "rofi" ["-show", "ssh"]
window = safeSpawn "rofi" ["-show", "window"]
clipmenu = safeSpawn "clipmenu" dmenuArgs
todo = safeSpawn "todo-rofi" []
subMapMaker = mkSubmap modm . map (\(key,action) -> ((0,key),action))
dmenuArgs :: [String]
dmenuArgs =
[ "-b" -- bottom
, "-fn", printf "%s:size=%d" (fontName fontConfig) (fontSize fontConfig)
, "-nb", bgColor colorConfig -- normal background
, "-nf", fgColor colorConfig -- normal foreground
, "-sb", selColor colorConfig -- selected background
, "-sf", selFgColor colorConfig -- selected foreground
]
theme :: P.XPConfig
theme = P.def
{ P.font = printf "xft:%s:size=%d" (fontName fontConfig) (fontSize fontConfig)
, P.bgColor = bgColor colorConfig
, P.fgColor = fgColor colorConfig
, P.bgHLight = selColor colorConfig
, P.fgHLight = selFgColor colorConfig
, P.borderColor = bgColor colorConfig
, P.promptBorderWidth = 0
, P.alwaysHighlight = True
, P.defaultPrompter = const ""
}

View File

@ -0,0 +1,15 @@
module Utils ( mkSubmap ) where
import qualified Data.Map as M ( fromList )
import XMonad ( (.|.) )
import Graphics.X11.Types ( KeyMask , KeySym , ButtonMask )
import XMonad.Core ( X )
import XMonad.Actions.Submap ( submap )
mkSubmap :: ButtonMask -> [((KeyMask, KeySym), X ())] -> X ()
mkSubmap modm = submap . M.fromList . concatMap buildSubmaps
where
buildSubmaps x = map (buildSubmap x) [0,modm]
buildSubmap ((modKey,key),action) m = ((modKey .|. m,key),action)

View File

@ -0,0 +1,119 @@
module Xmobar (mkBars) where
import XMonad.Layout.IndependentScreens (marshallPP)
import GHC.IO.Handle.Types (Handle)
import Text.Printf (printf)
import Data.List (intercalate, isPrefixOf)
import Graphics.X11.Types (Window)
import XMonad.Core
( Layout
, ScreenDetail
, ScreenId (S)
, withWindowSet
, WorkspaceId
, WindowSet
, description
, X
)
import XMonad (MonadIO)
import XMonad.Config (def)
import XMonad.Util.Run (hPutStrLn, spawnPipe)
import XMonad.Util.NamedWindows (getName)
import XMonad.Util.Loggers (Logger)
import XMonad.StackSet ( Workspace (..) , screen , workspace , current )
import qualified XMonad.StackSet as S
import XMonad.Hooks.DynamicLog
( PP
, ppCurrent
, ppExtras
, ppHidden
, ppHiddenNoWindows
, ppLayout
, ppOrder
, ppOutput
, ppSep
, ppTitle
, ppUrgent
, ppVisible
, shorten
, wrap
, xmobarAction
, xmobarColor
, dynamicLogWithPP
)
import HostConfig
( colorConfig
, fontConfig
, FontConfig
, fontName
, fontSize
, ColorConfig
, bgColor
, fgColor
, selFgColor
, selColor
, inactiveColor
, urgentColor
)
mkBars :: MonadIO m => [Int] -> m (X ())
mkBars screens = do
xmprocs <- mkXmprocs screens
return $ mapM_ dynamicLogWithPP $ zipWith mkPP xmprocs screens
mkXmprocs :: MonadIO m => [Int] -> m [Handle]
mkXmprocs = mapM (spawnPipe . printf "xmobar --screen='%d'")
mkPP :: Handle -> Int -> PP
mkPP bar nscreen = marshallPP (S nscreen) $ def
{ ppOutput = hPutStrLn bar
, ppCurrent = xmobarColor (selFgColor colorConfig) (selColor colorConfig)
, ppVisible = xmobarColor (fgColor colorConfig) ""
, ppHidden = xmobarColor (fgColor colorConfig) ""
, ppHiddenNoWindows = const ""
, ppUrgent = xmobarColor (urgentColor colorConfig) ""
, ppLayout = getLayoutIcon . layoutNameCleaner
, ppTitle = xmobarColor (selFgColor colorConfig) "" . shorten 100
, ppSep = xmobarColor (inactiveColor colorConfig) "" " | "
}
layoutNameCleaner = unwords . filter (not . (`elem` toClean)) . words
where
toClean =
[ "Simple"
, "Simplest"
, "Minimize"
, "Maximize"
, "ImageButtonDeco"
, "DefaultDecoration"
, "Spacing"
, "ReflectX"
, "ReflectY"
, "Tabbed"
, "0"
]
getLayoutIcon :: String -> String
getLayoutIcon "empty" = ""
getLayoutIcon x
| x `elem` icons = printf "<icon=%s/%s.xpm/>" iconsDir x
| otherwise = x
where
iconsDir = "/home/rilla/.xmonad/icons"
icons =
[ "3cols"
, "float"
, "full"
, "grid"
, "mtall"
, "tabs"
, "tall"
]

View File

@ -0,0 +1,92 @@
import XMonad ( xmonad )
import XMonad.Core
( ScreenId (S)
, terminal
, modMask
, borderWidth
, normalBorderColor
, focusedBorderColor
, workspaces
, keys
, mouseBindings
, layoutHook
, manageHook
, XConfig
( logHook
, focusFollowsMouse
, startupHook
, handleEventHook
)
)
import XMonad.Config ( def )
import XMonad.Hooks.ServerMode ( serverModeEventHook )
import XMonad.Hooks.EwmhDesktops ( ewmh )
import XMonad.Hooks.ManageDocks ( docks )
import XMonad.Hooks.SetWMName ( setWMName )
import XMonad.Layout.IndependentScreens ( countScreens , withScreens )
import XMonad.Util.Replace ( replace )
import XMonad.Actions.UpdatePointer ( updatePointer )
import XMonad.Actions.Navigation2D
( withNavigation2DConfig
, Navigation2DConfig
, centerNavigation
, singleWindowRect
, defaultTiledNavigation
, layoutNavigation
, unmappedWindowRect
)
import Graphics.X11.Types ( mod4Mask )
import HostConfig
( colorConfig
, selColor
, inactiveBorderColor
)
import ManageHook ( myManageHook )
import Xmobar ( mkBars )
import Bindings ( keybinds, mousebinds )
import Layouts ( myLayoutHook )
main :: IO ()
main = do
replace
nscreens <- countScreens
let
myScreens = [0 .. nscreens-1]
wsLs = withScreens (S nscreens) myWorkspaces
bars <- mkBars myScreens
xmonad $ opts def
{ terminal = "alacritty"
, modMask = mod4Mask
, borderWidth = 4
, normalBorderColor = inactiveBorderColor colorConfig
, focusedBorderColor = selColor colorConfig
, workspaces = wsLs
, keys = keybinds
, mouseBindings = mousebinds
, layoutHook = myLayoutHook
, manageHook = myManageHook
, logHook = bars >> updatePtr
, focusFollowsMouse = True
, handleEventHook = serverModeEventHook
, startupHook = setWMName "LG3D"
}
where
opts = docks . ewmh . withNavigation2DConfig myNav2DConf
updatePtr = updatePointer (0.9, 0.9) (0, 0)
myNav2DConf :: Navigation2DConfig
myNav2DConf = def
{ defaultTiledNavigation = centerNavigation
, layoutNavigation = [("Full", centerNavigation)]
, unmappedWindowRect = [("Full", singleWindowRect)]
}
myWorkspaces :: [String]
myWorkspaces = map show ids
where ids :: [Int]
ids = [1..9]

10
home/echidna.nix Normal file
View File

@ -0,0 +1,10 @@
{ config, pkgs, ... }:
{
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
imports = [ ./neovim ];
home.stateVersion = "22.11";
}

18
home/fonts/default.nix Normal file
View File

@ -0,0 +1,18 @@
{ config, pkgs, ... }:
{
home.packages = with pkgs; [
(nerdfonts.override {
fonts = [
"Hack" # my default monospace font
"MPlus" # to display symbols on xmobar
"InconsolataGo" # sometimes I use it as a change from Hack
"CascadiaCode" # used by rofi; todo: set fontconfig to use MPlus instead
];
})
inter # Inter is my default sans-serif font
hack-font # Hack is my default monospace font
libertinus # Libertinus Serif is my default serif font
];
#fonts.fontconfig.enable = true;
}

View File

@ -1,14 +1,14 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ let woodpecker-cli = pkgs.callPackage ./woodpecker-cli.nix { inherit pkgs; };
home.packages = [ pkgs.diff-so-fancy pkgs.tig pkgs.tea ]; in {
home.packages = [ pkgs.diff-so-fancy pkgs.tig pkgs.tea woodpecker-cli ];
programs.git = { programs.git = {
enable = true; enable = true;
userName = "Ricard Illa"; userName = "Ricard Illa";
userEmail = "rilla@monotremata.xyz";
signing = { signing = {
key = "0x101F79336E07C850"; key = "0x8333CFB0B9D3244D";
signByDefault = true; signByDefault = true;
}; };
# delta = maybe? # delta = maybe?

6
home/git/default.nix Normal file
View File

@ -0,0 +1,6 @@
{ config, pkgs, ... }:
{
imports = [ ./common.nix ];
programs.git.userEmail = "rilla@monotremata.xyz";
}

6
home/git/echidna.nix Normal file
View File

@ -0,0 +1,6 @@
{ config, pkgs, ... }:
{
imports = [ ./common.nix ];
programs.git.userEmail = "ricard@trkkn.com";
}

View File

@ -0,0 +1,15 @@
{ pkgs, ... }:
let
hostname = "woodpecker.monotremata.xyz";
shell = "${pkgs.dash}/bin/dash";
pass = "${pkgs.pass}/bin/pass";
woodpecker-cli = "${pkgs.woodpecker-cli}/bin/woodpecker-cli";
in pkgs.writeScriptBin "woodpecker-cli" ''
#!${shell}
WOODPECKER_SERVER="https://${hostname}"
WOODPECKER_TOKEN=$(${pass} "${hostname}/token")
export WOODPECKER_SERVER
export WOODPECKER_TOKEN
${woodpecker-cli} "$@"
''

7
home/lf/cleaner.nix Normal file
View File

@ -0,0 +1,7 @@
{ config, pkgs, ... }:
let printf = "${pkgs.coreutils-full}/bin/printf";
in
pkgs.writeShellScript "lf-cleaner.sh" ''
[ -n "$FIFO_UEBERZUG" ] && ${printf} '{"action": "remove", "identifier": "PREVIEW"}\n' > "$FIFO_UEBERZUG"
''

View File

@ -3,9 +3,9 @@
let let
pv = pkgs.callPackage ./pv.nix { inherit config pkgs; }; pv = pkgs.callPackage ./pv.nix { inherit config pkgs; };
lf-wrapper = pkgs.callPackage ./lf-wrapper.nix { inherit config pkgs; }; lf-wrapper = pkgs.callPackage ./lf-wrapper.nix { inherit config pkgs; };
cleaner = pkgs.callPackage ./cleaner.nix { inherit config pkgs; };
in in {
{
home.packages = [ lf-wrapper ]; home.packages = [ lf-wrapper ];
programs.lf = { programs.lf = {
enable = true; enable = true;
@ -24,5 +24,8 @@ in
}} }}
''; '';
}; };
extraConfig = ''
set cleaner ${cleaner}
'';
}; };
} }

View File

@ -5,6 +5,7 @@ let
lf = "${pkgs.lf}/bin/lf"; lf = "${pkgs.lf}/bin/lf";
rm = "${pkgs.coreutils-full}/bin/rm"; rm = "${pkgs.coreutils-full}/bin/rm";
mkdir = "${pkgs.coreutils-full}/bin/mkdir"; mkdir = "${pkgs.coreutils-full}/bin/mkdir";
mkfifo = "${pkgs.coreutils-full}/bin/mkfifo";
lfcache = "${config.home.homeDirectory}/.cache/lf"; lfcache = "${config.home.homeDirectory}/.cache/lf";
in pkgs.writeScriptBin "lf-wrapper" '' in pkgs.writeScriptBin "lf-wrapper" ''
#!${shell} #!${shell}

View File

@ -6,7 +6,28 @@ let
personalSignature = '' personalSignature = ''
Ricard Illa Ricard Illa
https://monotremata.xyz https://monotremata.xyz
public key fingerprint: 2E0A7CADFF84D08BA94273AA101F79336E07C850 http://zswm576cm7wgmgcwluy4l4ixkfasj25taqbn2r5pnrrj552l263ff2qd.onion
public key fingerprint: B51D4548A4846E3C8D115C808333CFB0B9D3244D
'';
workSignature = ''
Ricard Illa
Data Engineer
Trakken GmbH
- Sucursal en España
Carrer de Sardenya 229
08013 Barcelona
E-mail:ricard@trkkn.com
Web:www.trkkn.com
___________________________________________________________
HRB 104862, Amtsgericht Hamburg
Managing Directors: Timo Aden, Lennart Paulsen
___________________________________________________________
''; '';
accountSignature = { showSignature ? "append", text ? "" }: { accountSignature = { showSignature ? "append", text ? "" }: {
@ -16,12 +37,9 @@ let
pwCmd = x: "${pkgs.pass}/bin/pass ${x}"; pwCmd = x: "${pkgs.pass}/bin/pass ${x}";
defaultAccountSettings = defaultAccountSettings = { accountEmail
{ accountEmail
, mailboxes ? ''"=Inbox" "=Archive" "=Drafts" "=Junk" "=Sent" "=Trash"'' , mailboxes ? ''"=Inbox" "=Archive" "=Drafts" "=Junk" "=Sent" "=Trash"''
, smtpHost ? "mail.monotremata.xyz" , smtpHost ? "mail.monotremata.xyz", imapHost ? "mail.monotremata.xyz" }: {
, imapHost ? "mail.monotremata.xyz"
}: {
primary = false; primary = false;
realName = "Ricard Illa"; realName = "Ricard Illa";
@ -77,9 +95,7 @@ let
"<enter-command>source ${config.xdg.configHome}/neomutt/${x}<enter><change-folder>!<enter><check-stats>"; "<enter-command>source ${config.xdg.configHome}/neomutt/${x}<enter><change-folder>!<enter><check-stats>";
}; };
in in {
{
home.packages = [ pkgs.mutt-wizard pkgs.urlscan pkgs.abook ];
accounts.email.accounts = { accounts.email.accounts = {
"rilla@monotremata.xyz" = "rilla@monotremata.xyz" =
@ -88,8 +104,7 @@ in
passwordCommand = pwCmd "mail.monotremata.xyz/rilla@monotremata.xyz"; passwordCommand = pwCmd "mail.monotremata.xyz/rilla@monotremata.xyz";
}; };
"r.illa.pujagut@gmail.com" = defaultAccountSettings "r.illa.pujagut@gmail.com" = defaultAccountSettings {
{
accountEmail = "r.illa.pujagut@gmail.com"; accountEmail = "r.illa.pujagut@gmail.com";
mailboxes = '' mailboxes = ''
"=INBOX" "=[Gmail].Drafts" "=[Gmail].Sent Mail" "=[Gmail].Trash" "=[Gmail].Spam" "=[Gmail].All Mail"''; "=INBOX" "=[Gmail].Drafts" "=[Gmail].Sent Mail" "=[Gmail].Trash" "=[Gmail].Spam" "=[Gmail].All Mail"'';
@ -99,6 +114,18 @@ in
passwordCommand = pwCmd "google.com/mutt/r.illa.pujagut@gmail.com"; passwordCommand = pwCmd "google.com/mutt/r.illa.pujagut@gmail.com";
}; };
"ricard@trkkn.com" = defaultAccountSettings {
accountEmail = "ricard@trkkn.com";
mailboxes = ''
"=INBOX" "=[Gmail].Drafts" "=[Gmail].Sent Mail" "=[Gmail].Trash" "=[Gmail].Spam" "=[Gmail].All Mail"'';
smtpHost = "smtp.gmail.com";
imapHost = "imap.gmail.com";
} // {
signature = accountSignature { text = workSignature; };
aliases = [ "ricard@trakken.es" ];
passwordCommand = pwCmd "trakken/google.com/mutt/ricard@trkkn.com";
};
"accounts@monotremata.xyz" = "accounts@monotremata.xyz" =
defaultAccountSettings { accountEmail = "accounts@monotremata.xyz"; } // { defaultAccountSettings { accountEmail = "accounts@monotremata.xyz"; } // {
realName = "monotremata.xyz"; realName = "monotremata.xyz";
@ -236,7 +263,6 @@ in
send_charset = "utf-8:iso-8859-1:us-ascii"; send_charset = "utf-8:iso-8859-1:us-ascii";
charset = "utf-8"; charset = "utf-8";
arrow_cursor = "no"; # Change `color indicator` depending arrow_cursor = "no"; # Change `color indicator` depending
query_command = ''"${pkgs.abook}/bin/abook --mutt-query '%s'"'';
}; };
binds = [ binds = [
{ {
@ -491,6 +517,7 @@ in
] ++ [ ] ++ [
(switchAccountMacro "1" "rilla@monotremata.xyz") (switchAccountMacro "1" "rilla@monotremata.xyz")
(switchAccountMacro "2" "r.illa.pujagut@gmail.com") (switchAccountMacro "2" "r.illa.pujagut@gmail.com")
(switchAccountMacro "3" "ricard@trkkn.com")
(switchAccountMacro "4" "accounts@monotremata.xyz") (switchAccountMacro "4" "accounts@monotremata.xyz")
(switchAccountMacro "5" "admin@monotremata.xyz") (switchAccountMacro "5" "admin@monotremata.xyz")
]; ];
@ -503,5 +530,4 @@ in
programs.mbsync.enable = true; programs.mbsync.enable = true;
programs.msmtp.enable = true; programs.msmtp.enable = true;
programs.alot.enable = true;
} }

10
home/mail/default.nix Normal file
View File

@ -0,0 +1,10 @@
{ config, pkgs, ... }:
let mailsync = pkgs.callPackage ./mailsync.nix { inherit config pkgs; };
in {
imports = [ ./common.nix ];
home.packages = [ mailsync pkgs.urlscan pkgs.abook ];
programs.neomutt.settings.query_command =
''"${pkgs.abook}/bin/abook --mutt-query '%s'"'';
programs.alot.enable = true;
}

132
home/mail/mailsync.nix Normal file
View File

@ -0,0 +1,132 @@
{ config, pkgs, ... }:
let
shell = "${pkgs.dash}/bin/dash";
pidof = "${pkgs.procps}/bin/pidof";
pgrep = "${pkgs.procps}/bin/pgrep";
grep = "${pkgs.gnugrep}/bin/grep";
sed = "${pkgs.gnused}/bin/sed";
awk = "${pkgs.gawk}/bin/awk";
perl = "${pkgs.perl}/bin/perl";
find = "${pkgs.findutils}/bin/find";
notifySend = "${pkgs.libnotify}/bin/notify-send";
notmuch = "${pkgs.notmuch}/bin/notmuch";
head = "${pkgs.coreutils}/bin/head";
touch = "${pkgs.coreutils}/bin/touch";
tr = "${pkgs.coreutils}/bin/tr";
mbsyncrc = "${config.home.homeDirectory}/.mbsyncrc";
mbsync = "${pkgs.isync}/bin/mbsync -c ${mbsyncrc}";
maildir = "${config.home.homeDirectory}/Maildir";
passwordStoreDir = "${config.home.homeDirectory}/.password-store";
notmuchConfig = "${config.home.homeDirectory}/.config/notmuch/default/config";
gnupghome = "${config.home.homeDirectory}/.gnupg";
lastrun = "${config.home.homeDirectory}/.mailsynclastrun";
in pkgs.writeScriptBin "mailsync" ''
#!${shell}
# Run only if not already running in other instance
${pidof} mbsync >/dev/null && {
echo "mbsync is already running."
exit
}
export PASSWORD_STORE_DIR="${passwordStoreDir}"
export NOTMUCH_CONFIG="${notmuchConfig}"
export GNUPGHOME="${gnupghome}"
export GPG_TTY=$TTY
notify() {
pgrepoutput="$(${pgrep} -a X\(org\|wayland\))"
displays="$(echo "$pgrepoutput" | ${grep} -wo "[0-9]*:[0-9]\+" | sort -u)"
[ -n "$pgrepoutput" ] && for x in ''${displays:-0:}; do
export DISPLAY=$x
${notifySend} \
--app-name="email" \
"email" \
"📬 $2 new mail(s) in \`$1\` account."
done
}
messageinfo() {
from="$1"
subject="$2"
pgrepoutput="$(${pgrep} -a X\(org\|wayland\))"
displays="$(echo "$pgrepoutput" | ${grep} -wo "[0-9]*:[0-9]\+" | sort -u)"
[ -n "$pgrepoutput" ] && for x in ''${displays:-0:}; do
export DISPLAY=$x
${notifySend} \
--app-name="email" \
"📧$from:" \
"$subject"
done
}
# Check account for new mail. Notify if there is new content.
syncandnotify() {
accounts="$1"
acc="$(echo "$account" | ${sed} "s/.*\///")"
if [ -z "$opts" ]; then
${mbsync} "$acc"
else
${mbsync} "$opts" "$acc"
fi
new=$(
${find} \
"${maildir}/$acc/INBOX/new/" \
"${maildir}/$acc/Inbox/new/" \
"${maildir}/mail/$acc/inbox/new/" \
-type f \
-newer "${lastrun}" \
2> /dev/null
)
newcount=$(echo "$new" | ${sed} '/^\s*$/d' | wc -l)
if [ "$newcount" -gt 5 ]; then
notify "$acc" "$newcount"
elif [ "$newcount" -gt 0 ]; then
for file in $new; do
# Extract subject and sender from mail.
from=$(
${awk} '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | \
${perl} -CS -MEncode -ne 'print decode("MIME-Header", $_)' | \
${awk} '{ $1=""; if (NF>=3)$NF=""; print $0 }' | \
${sed} 's/^[[:blank:]]*[\"'\'''\<]*//;s/[\"'\'''\>]*[[:blank:]]*$//'
)
subject=$(
${awk} '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | \
${head} -n 1 | ${perl} -CS -MEncode -ne 'print decode("MIME-Header", $_)' | \
${sed} 's/^Subject: //' | \
${sed} 's/^{[[:blank:]]*[\"'\'''\<]*//;s/[\"'\'''\>]*[[:blank:]]*$//' | \
${tr} -d '\n'
)
messageinfo "$from" "$subject" &
done
fi
}
# Sync accounts passed as argument or all.
if [ "$#" -eq "0" ]; then
accounts="$(${awk} '/^Channel/ {print $2}' "${mbsyncrc}")"
else
for arg in "$@"; do
[ "''${arg%''${arg#?}}" = '-' ] && \
opts="''${opts:+''${opts} }''${arg}" && \
shift 1
done
accounts=$*
fi
# Parallelize multiple accounts
for account in $accounts; do
syncandnotify "''${account}" &
done
wait
${notmuch} new 2>/dev/null
#Create a touch file that indicates the time of the last run of mailsync
${touch} "${lastrun}"
''

View File

@ -1,42 +1,11 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
let let musicDir = "${config.home.homeDirectory}/Music";
musicDir = "${config.home.homeDirectory}/Music"; in {
master-host = "music.monotremata.xyz"; home.packages = [ pkgs.mpc_cli ];
in
{
home.packages = with pkgs; [ mpc_cli mpdris2 playerctl ];
services.mpd = {
enable = true;
musicDirectory = "https://${master-host}";
dbFile = null;
network = {
listenAddress = "any";
port = 6600;
};
extraConfig = ''
audio_output {
type "pipewire"
name "pipewire audio"
}
audio_output {
type "fifo"
name "my_fifo"
path "/tmp/mpd.fifo"
format "44100:16:2"
}
database {
plugin "proxy"
host "${master-host}"
port "6600"
}
'';
};
programs.ncmpcpp = { programs.ncmpcpp = {
enable = true; enable = true;
mpdMusicDir = null;
bindings = [ bindings = [
{ key = "+"; command = "show_clock"; } { key = "+"; command = "show_clock"; }
{ key = "="; command = "volume_up"; } { key = "="; command = "volume_up"; }
@ -98,12 +67,4 @@ in
empty_tag_marker = ""; empty_tag_marker = "";
}; };
}; };
services.mpdris2 = {
enable = true;
notifications = false;
mpd = {
host = "localhost";
musicDirectory = null;
};
};
} }

42
home/mpd/default.nix Normal file
View File

@ -0,0 +1,42 @@
{ config, pkgs, ... }:
let master-host = "music.monotremata.xyz";
in {
imports = [ ./common.nix ];
home.packages = [ pkgs.mpc_cli pkgs.mpdris2 ];
services.mpdris2 = {
enable = true;
notifications = false;
mpd = {
host = "localhost";
musicDirectory = null;
};
};
services.mpd = {
enable = true;
musicDirectory = "https://${master-host}";
dbFile = null;
network = {
listenAddress = "any";
port = 6600;
};
extraConfig = ''
audio_output {
type "pipewire"
name "pipewire audio"
}
audio_output {
type "fifo"
name "my_fifo"
path "/tmp/mpd.fifo"
format "44100:16:2"
}
database {
plugin "proxy"
host "${master-host}"
port "6600"
}
'';
};
programs.ncmpcpp.mpdMusicDir = null;
}

View File

@ -9,7 +9,6 @@
pkgs.signal-desktop pkgs.signal-desktop
pkgs.tdesktop pkgs.tdesktop
pkgs.whatsapp-for-linux pkgs.whatsapp-for-linux
pkgs.slack
]; ];
home.file.".local/share/applications/userapp-Telegram Desktop.desktop".text = home.file.".local/share/applications/userapp-Telegram Desktop.desktop".text =
'' ''

View File

@ -5,9 +5,6 @@
# wafConfigureFlags = old.wafConfigureFlags ++ [ "--windows-vst" ]; # wafConfigureFlags = old.wafConfigureFlags ++ [ "--windows-vst" ];
# }); # });
#in #in
let
home = config.home.homeDirectory;
in
{ {
home.packages = [ home.packages = [
pkgs.ardour pkgs.ardour
@ -30,10 +27,4 @@ in
pkgs.zynaddsubfx pkgs.zynaddsubfx
# pkgs.haskellPackages.tidal-midi # pkgs.haskellPackages.tidal-midi
]; ];
home.sessionVariables = {
LV2_PATH = "${home}/.nix-profile/lib/lv2:${home}/Audio/plugins/lv2:/run/current-system/sw/lib/lv2";
LXVST_PATH = "${home}/.nix-profile/lib/lxvst:${home}/Audio/plugins/lxvst:/run/current-system/sw/lib/lxvst";
LADSPA_PATH = "${home}/.nix-profile/lib/ladspa:${home}/Audio/plugins/ladspa:/run/current-system/sw/lib/ladspa";
};
} }

27
home/neovim/default.nix Normal file
View File

@ -0,0 +1,27 @@
{ config, pkgs, ... }:
{
programs.neovim = {
enable = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
withPython3 = true;
extraPackages = with pkgs; [
black
efm-langserver
hlint
jq
lua54Packages.luacheck
nixfmt
nodePackages.pyright
pylint
ruff
shfmt
stylua
];
extraPython3Packages = pyPkgs: with pyPkgs; [ pylint ];
plugins = [ pkgs.vimPlugins.packer-nvim ];
extraLuaConfig = builtins.readFile ./init.lua;
};
}

262
home/neovim/init.lua Normal file
View File

@ -0,0 +1,262 @@
-- luacheck: globals vim
require("packer").startup(function(use)
use("tpope/vim-sensible")
use("vimwiki/vimwiki")
use("freitass/todo.txt-vim")
use("ledger/vim-ledger")
use("Shougo/deoplete.nvim")
use("dense-analysis/ale")
use("psliwka/vim-smoothie")
-- navigation
use("easymotion/vim-easymotion")
use("tpope/vim-unimpaired")
use("tpope/vim-surround")
use("christoomey/vim-tmux-navigator")
-- fern
use("lambdalisue/fern.vim")
use("lambdalisue/nerdfont.vim")
use("lambdalisue/fern-renderer-nerdfont.vim")
use("lambdalisue/glyph-palette.vim")
use("lambdalisue/fern-git-status.vim")
use("lambdalisue/fern-mapping-git.vim") -- to check
use("lambdalisue/fern-hijack.vim")
-- airline
use("vim-airline/vim-airline")
use("vim-airline/vim-airline-themes")
use("tpope/vim-fugitive")
use("airblade/vim-gitgutter")
use("honza/vim-snippets")
use("SirVer/ultisnips")
use("junegunn/fzf.vim")
use("junegunn/goyo.vim")
use("junegunn/limelight.vim")
use("preservim/nerdcommenter")
use("luochen1990/rainbow")
use("ap/vim-css-color")
use("Yggdroot/indentLine")
use("gruvbox-community/gruvbox")
-- language support
use("darrikonn/vim-gofmt")
use("Glench/Vim-Jinja2-Syntax")
use("preservim/vim-markdown")
use("LnL7/vim-nix")
use("hashivim/vim-terraform")
use("LaTeX-Box-Team/LaTeX-Box")
use("vito-c/jq.vim")
use("tpope/vim-haml")
use({ "psf/black", branch = "stable" })
use("elzr/vim-json")
use("z0mbix/vim-shfmt")
use("ckipp01/stylua-nvim")
use("jpalardy/vim-slime")
use("neovim/nvim-lspconfig")
use("lukas-reineke/lsp-format.nvim")
use("sheerun/vim-polyglot")
end)
local o = vim.opt
local function map(mode, shortcut, command)
vim.api.nvim_set_keymap(mode, shortcut, command, { noremap = true, silent = true })
end
local function nmap(shortcut, command)
map("n", shortcut, command)
end
--local function imap(shortcut, command)
-- map("i", shortcut, command)
--end
o.wrap = false
o.number = true
o.compatible = false
o.mouse = "a" -- mouse support
o.showcmd = true -- show incomplete cmds down the bottom
o.showmode = true -- show current mode
o.showmatch = true -- set show matching parenthesis
o.visualbell = true -- no sounds
o.autoread = true -- reload files changed outside of vim
o.backspace = [[indent,eol,start]] -- allow backspacing over everything in insert mode
o.ignorecase = true -- ignore case when searching
o.shiftround = true -- use multiple of shiftwidth when indenting with '<' and '>'
o.smartcase = true -- ignore case if searching pattern is all lowecase, case-sensitive otherwise
o.smarttab = true -- insert tabs on the start of a line according to shiftwidth, not tabstop
o.hlsearch = true -- highlight search terms
o.incsearch = true -- show search matches as you type
o.hidden = true
o.ruler = true
o.clipboard = "unnamed" -- system clipboard
o.colorcolumn = "80"
vim.cmd("syntax on")
vim.cmd("filetype plugin on")
if vim.fn.has("multi_byte") == 1 and vim.o.encoding == "utf-8" then
o.listchars = [[tab:▸ ,extends:,precedes:,nbsp:±,trail:…]]
else
o.listchars = [[tab:> ,extends:>,precedes:<,nbsp:.,trail:_]]
end
vim.g.mapleader = ","
vim.g.maplocaleader = "\\"
o.splitbelow = true
o.splitright = true
nmap("<A-r>", "<C-w>r")
nmap("<A-1>", "1gt")
nmap("<A-2>", "2gt")
nmap("<A-3>", "3gt")
nmap("<A-4>", "4gt")
nmap("<A-5>", "5gt")
nmap("<A-6>", "6gt")
nmap("<A-7>", "7gt")
nmap("<A-8>", "8gt")
nmap("<A-9>", ":tablast<cr>")
nmap("<C-l>", ":nohl<CR><C-l>")
-- todo: try to do it with `vim.api.nvim_set_hl`
vim.cmd("hi CursorLine cterm=NONE,underline ctermbg=NONE") -- highlight line when in insert mode
o.timeoutlen = 1000
o.ttimeoutlen = 0
vim.cmd("autocmd InsertEnter * :set cursorline")
vim.cmd("autocmd InsertLeave * :set nocursorline")
-- indentation
vim.cmd("filetype indent on")
o.softtabstop = 4
o.expandtab = true
o.shiftwidth = 4
o.tabstop = 4
o.autoindent = true
o.copyindent = true
-- folds
o.foldmethod = "indent"
o.foldnestmax = 3
o.foldenable = false
o.termguicolors = true
vim.g.gruvbox_contrast_dark = "hard"
vim.g.gruvbox_contrast_light = "hard"
vim.g.gruvbox_italic = 1
vim.g.gruvbox_invert_indent_guides = 1
vim.g.gruvbox_vert_split = "bg1"
vim.cmd("colorscheme gruvbox")
o.background = "dark"
vim.g.markdown_syntax_conceal = 0
o.updatetime = 100 -- to make gigutter more responsive
vim.g["fern#renderer"] = "nerdfont"
vim.cmd([[
function! s:init_fern() abort
nmap <buffer> T <Plug>(fern-action-open:tab)
nmap <buffer> S <Plug>(fern-action-open:split)
nmap <buffer> V <Plug>(fern-action-open:vsplit)
nmap <buffer> <Space> <Plug>(fern-action-mark:toggle)
endfunction
augroup fern-custom
autocmd! *
autocmd FileType fern call s:init_fern()
augroup END
augroup my-glyph-palette
autocmd! *
autocmd FileType fern call glyph_palette#apply()
autocmd FileType nerdtree,startify call glyph_palette#apply()
augroup END
]])
nmap("<leader>t", ":Fern . -drawer -toggle<cr>")
nmap("<leader>f", ":Files<cr>")
nmap("<leader>rg", ":Rg<cr>")
nmap("<leader><Bs>", ": cd ..<cr>")
nmap("<leader>b", ": Buffers<cr>")
vim.g["indentLine_char"] = ""
vim.g["indentLine_setConceal"] = 0
vim.g["slime_target"] = "tmux"
vim.g["slime_python_ipython"] = 1
vim.g["tmux_navigator_no_mappings"] = 1
nmap("<A-h>", ":TmuxNavigateLeft<cr>")
nmap("<A-j>", ":TmuxNavigateDown<cr>")
nmap("<A-k>", ":TmuxNavigateUp<cr>")
nmap("<A-l>", ":TmuxNavigateRight<cr>")
vim.g["airline_theme"] = "base16_gruvbox_dark_hard"
vim.g["airline#extensions#tabline#enabled"] = 1
vim.g["airline#extensions#ale#enabled"] = 1
vim.g["ale_lint_on_text_changed"] = "never"
vim.g["ale_lint_on_insert_leave"] = 0
vim.g["ale_lint_on_enter"] = 0
vim.g["deoplete#enable_at_startup"] = 1
-- vim.g["black_virtualenv"] = "/Users/rilla/virtualenvs/black"
vim.g["shfmt_extra_args"] = "-i 4"
vim.g["NERDDefaultAlign"] = "left"
vim.g["UltiSnipsExpandTrigger"] = "<tab>"
vim.g["UltiSnipsJumpForwardTrigger"] = "<c-b>"
vim.g["UltiSnipsJumpBackwardTrigger"] = "<c-z>"
local formatters = {
go = ":GoFmt<CR>",
json = ":%!jq --indent 4 .<CR>",
nix = ":%!nixfmt < %<CR>",
-- python = ":Black<CR>",
python = [[<cmd>lua vim.lsp.buf.format()<CR>]],
sh = ":Shfmt<CR>",
sql = ":%!sqlfluff fix -<CR>",
terraform = ":TerraformFmt<CR>",
lua = [[<cmd>lua require("stylua-nvim").format_file()<CR>]],
}
for pattern, command in pairs(formatters) do
vim.api.nvim_create_autocmd("FileType", {
pattern = pattern,
callback = function()
nmap("<C-f>", command)
end,
})
end
require("lspconfig").pyright.setup({})
require("lspconfig").efm.setup({
init_options = { documentFormatting = true },
settings = {
rootMarkers = { ".git/", "pyproject.toml" },
languages = {
python = { { formatCommand = "black -", formatStdin = true } },
},
},
})

278
home/nixos-common.nix Normal file
View File

@ -0,0 +1,278 @@
{ config, inputs, pkgs, stablePkgs, ... }:
{
nixpkgs.config = { allowUnfree = true; };
nixpkgs.overlays = [
# (self: super: {
# # use lf fork with support for sixel graphics
# lf = super.lf.overrideAttrs (old: {
# src = super.fetchFromGitHub {
# owner = "horriblename";
# repo = "lf";
# rev = "8997e5b03772d5628ed6a490777048581d978674";
# sha256 = "rJq2Tv3py6HvRI1O2odTdGb1ksdijhO3FcJsPj5dm34=";
# };
# });
# })
(self: super: {
kile-wl = super.rustPlatform.buildRustPackage rec {
pname = "kile-wl";
version = "v2-2023-05-19";
src = super.fetchFromGitLab {
owner = "snakedye";
repo = "kile";
rev = "625f91010b920587dbf0ee23113eb8aa51cc6ec3";
sha256 = "sha256-4sfzF2g2kSz+Q55gTCePjM+7kvfrEJ2uLKyy/V+SLF4=";
};
cargoLock = {
lockFile = src + "/Cargo.lock";
outputHashes = {
"kilexpr-0.1.0" =
"sha256-wclffEkPr1rIYdeRTIb1FZhMbX5LhLy8yB0qMEDmx0k=";
};
};
meta = with super.lib; {
description = "A tiling layout generator for river";
homepage = "https://gitlab.com/snakedye/kile";
license = licenses.mit;
platforms =
platforms.linux; # It's meant for river, a wayland compositor
mainProgram = "kile";
};
};
})
# These packages seem to be broken on the unstable channel, so I'm using
# the stable versions for now. Currently this is not happening for any
# package that I use :)
];
# Let Home Manager install and manage itself.
# programs.home-manager.enable = true;
# Home Manager needs a bit of information about you and the
# paths it should manage.
home.username = "rilla";
home.homeDirectory = "/home/rilla";
imports = [
./arduino
./barrier
./browsers
./cheat
./dav
./drawterm
./fonts
./git
./gotify
./gpg
./idasen
./lf
./mail
./maker
# ./minidisc
./mpd
./msg
./music
./neovim
./nsxiv
./pass
./rss
./snapcast
./sound
./ssh
./syncthing
./tmux
./vitetris
./wallets
./wine
./xdg
./zsh
];
home.persistence = {
"/mnt/data/${config.home.homeDirectory}" = {
directories = [
"Audio"
"Calendars"
"Contacts"
"Documents"
"Downloads"
"Images"
"Maildir"
"Monero"
"code"
"misc"
"workspace"
];
allowOther = true;
};
"/mnt/vfs_share/${config.home.homeDirectory}" = {
directories = [ "vfs_share" ];
allowOther = true;
};
"/mnt/persist/${config.home.homeDirectory}" = {
directories = [
".Slic3r"
".abook"
".bitmonero"
".config/Element"
".config/Nextcloud"
".config/Signal"
".config/SuperCollider"
".config/ardour6"
".config/chromium"
".config/kdeconnect"
".config/kicad"
".config/nvim/plugin"
".config/syncthing"
".config/tea"
".config/whatsapp-for-linux"
".electrum"
".gnupg"
".hydrogen"
".john"
".kube"
".librewolf"
".local/share/Bisq"
".local/share/Nextcloud"
".local/share/Steam"
".local/share/SuperCollider"
".local/share/TelegramDesktop"
".local/share/nvim"
{
directory = ".local/share/containers";
method = "symlink";
}
".local/share/dino"
".local/share/direnv"
".local/share/gopass/stores"
".local/share/keyrings"
".local/share/mpd"
".local/share/tor-browser"
".local/share/webkitgtk"
".local/state/wireplumber"
".local/state/zsh"
".mozilla"
".newsboat"
".password-store"
".platformio"
".vagrant.d"
".vdirsyncer"
".virtualenvs"
".wine"
"Nextcloud"
"configs"
# ".cache"
];
files = [ ".mailsynclastrun" ".ssh/known_hosts" ".lmmsrc.xml" ];
allowOther = true;
};
};
home.sessionVariables = {
EDITOR = "${pkgs.neovim}/bin/nvim";
VISUAL = "${pkgs.neovim}/bin/nvim";
BROWSER = "${pkgs.firefox}/bin/firefox";
# OPENER = "todo"; # todo
TERMINAL = "${pkgs.alacritty}/bin/alacritty";
CM_LAUNCHER = "rofi"; # for clipmenu
LEDGER_FILE = "${config.home.homeDirectory}/finance/2021.journal";
};
home.packages = with pkgs; [
# calibre
R
acpi
android-tools
ansible
bind.dnsutils
# pyenv
docker-compose
file
gimp
gnumake
html-tidy
htop
inetutils # telnet
j2cli
john
jq
killall
kubectl
libnotify
libreoffice
lxqt.pcmanfm-qt
mosh
mpv
neofetch
pynitrokey
networkmanagerapplet
nextcloud-client
pandoc
podman-compose
pv
ripgrep
sassc
screen
shellcheck
signify
unzip
vagrant
virt-manager
virtiofsd
wget
];
# services.kdeconnect = {
# enable = true;
# indicator = true;
# };
programs.bat = {
enable = true;
config = { theme = "gruvbox-dark"; };
};
programs.fzf = {
enable = true;
enableZshIntegration = true;
# defaultOptions = [
# "--preview --preview 'bat --color=always --style=header,grid --line-range :300 {}'"
# ];
tmux.enableShellIntegration = true;
};
services.gnome-keyring = {
enable = true;
components = [ "secrets" ];
};
#services.nextcloud-client = {
# enable = true;
# startInBackground = true;
#};
dconf.settings = {
"org/virt-manager/virt-manager/connections" = {
"autoconnect" = [ "qemu:///system" ];
"uris" = [ "qemu:///system" ];
};
};
programs.direnv = {
enable = true;
enableZshIntegration = true;
nix-direnv.enable = true;
};
home.stateVersion = "22.11";
}

200
home/nsxiv/config.h Normal file
View File

@ -0,0 +1,200 @@
#ifdef _WINDOW_CONFIG
/* default window dimensions (overwritten via -g option): */
static const int WIN_WIDTH = 800;
static const int WIN_HEIGHT = 600;
/* colors and font can be overwritten via X resource properties.
* See nsxiv(1), X(7) section Resources and xrdb(1) for more information.
*/
static const char *DEFAULT_WIN_BG = "#282828";
static const char *DEFAULT_WIN_FG = "#ebdbb2";
static const char *DEFAULT_MARK_COLOR = NULL; /* NULL means it will default to window foreground */
#if HAVE_LIBFONTS
static const char *DEFAULT_BAR_BG = "#282828"; /* NULL means it will default to window background */
static const char *DEFAULT_BAR_FG = "#ebdbb2"; /* NULL means it will default to window foreground */
static const char *DEFAULT_FONT = "Inter:size=9";
/* if true, statusbar appears on top of the window */
static const bool TOP_STATUSBAR = false;
#endif /* HAVE_LIBFONTS */
#endif
#ifdef _IMAGE_CONFIG
/* levels (in percent) to use when zooming via '-' and '+':
* (first/last value is used as min/max zoom level)
*/
static const float zoom_levels[] = {
12.5, 25.0, 50.0, 75.0,
100.0, 150.0, 200.0, 400.0, 800.0
};
/* default slideshow delay (in sec, overwritten via -S option): */
static const int SLIDESHOW_DELAY = 5;
/* gamma correction: the user-visible ranges [-GAMMA_RANGE, 0] and
* (0, GAMMA_RANGE] are mapped to the ranges [0, 1], and (1, GAMMA_MAX].
*/
static const double GAMMA_MAX = 10.0;
static const int GAMMA_RANGE = 32;
/* command i_scroll pans image 1/PAN_FRACTION of screen width/height */
static const int PAN_FRACTION = 5;
/* if false, pixelate images at zoom level != 100%,
* toggled with 'a' key binding
*/
static const bool ANTI_ALIAS = true;
/* if true, use a checkerboard background for alpha layer,
* toggled with 'A' key binding
*/
static const bool ALPHA_LAYER = false;
/* percentage of memory to use for imlib2's cache size.
* 3 means use 3% of total memory which is about 245MiB on 8GiB machine.
* 0 or less means disable cache.
* 100 means use all available memory (but not above CACHE_SIZE_LIMIT).
*/
static const int CACHE_SIZE_MEM_PERCENTAGE = 3; /* use 3% of total memory for cache */
static const int CACHE_SIZE_LIMIT = 256 * 1024 * 1024; /* but not above 256MiB */
static const int CACHE_SIZE_FALLBACK = 32 * 1024 * 1024; /* fallback to 32MiB if we can't determine total memory */
#endif
#ifdef _THUMBS_CONFIG
/* thumbnail sizes in pixels (width == height): */
static const int thumb_sizes[] = { 32, 64, 96, 128, 160 };
/* thumbnail size at startup, index into thumb_sizes[]: */
static const int THUMB_SIZE = 3;
#endif
#ifdef _MAPPINGS_CONFIG
/* these modifiers will be used when processing keybindings */
static const unsigned int USED_MODMASK = ShiftMask | ControlMask | Mod1Mask;
/* abort the keyhandler */
static const KeySym KEYHANDLER_ABORT = XK_Escape;
/* keyboard mappings for image and thumbnail mode: */
static const keymap_t keys[] = {
/* modifiers key function argument */
{ 0, XK_q, g_quit, 0 },
{ 0, XK_Return, g_switch_mode, None },
{ 0, XK_f, g_toggle_fullscreen, None },
{ 0, XK_b, g_toggle_bar, None },
{ ControlMask, XK_x, g_prefix_external, None },
{ 0, XK_g, g_first, None },
{ 0, XK_G, g_n_or_last, None },
{ 0, XK_r, g_reload_image, None },
{ 0, XK_D, g_remove_image, None },
{ ControlMask, XK_h, g_scroll_screen, DIR_LEFT },
{ ControlMask, XK_Left, g_scroll_screen, DIR_LEFT },
{ ControlMask, XK_j, g_scroll_screen, DIR_DOWN },
{ ControlMask, XK_Down, g_scroll_screen, DIR_DOWN },
{ ControlMask, XK_k, g_scroll_screen, DIR_UP },
{ ControlMask, XK_Up, g_scroll_screen, DIR_UP },
{ ControlMask, XK_l, g_scroll_screen, DIR_RIGHT },
{ ControlMask, XK_Right, g_scroll_screen, DIR_RIGHT },
{ 0, XK_plus, g_zoom, +1 },
{ 0, XK_KP_Add, g_zoom, +1 },
{ 0, XK_minus, g_zoom, -1 },
{ 0, XK_KP_Subtract, g_zoom, -1 },
{ 0, XK_m, g_toggle_image_mark, None },
{ 0, XK_M, g_mark_range, None },
{ ControlMask, XK_m, g_reverse_marks, None },
{ ControlMask, XK_u, g_unmark_all, None },
{ 0, XK_N, g_navigate_marked, +1 },
{ 0, XK_P, g_navigate_marked, -1 },
{ 0, XK_braceleft, g_change_gamma, -1 },
{ 0, XK_braceright, g_change_gamma, +1 },
{ ControlMask, XK_g, g_change_gamma, 0 },
{ 0, XK_h, t_move_sel, DIR_LEFT },
{ 0, XK_Left, t_move_sel, DIR_LEFT },
{ 0, XK_j, t_move_sel, DIR_DOWN },
{ 0, XK_Down, t_move_sel, DIR_DOWN },
{ 0, XK_k, t_move_sel, DIR_UP },
{ 0, XK_Up, t_move_sel, DIR_UP },
{ 0, XK_l, t_move_sel, DIR_RIGHT },
{ 0, XK_Right, t_move_sel, DIR_RIGHT },
{ 0, XK_R, t_reload_all, None },
{ 0, XK_n, i_navigate, +1 },
{ 0, XK_n, i_scroll_to_edge, DIR_LEFT | DIR_UP },
{ 0, XK_space, i_navigate, +1 },
{ 0, XK_p, i_navigate, -1 },
{ 0, XK_p, i_scroll_to_edge, DIR_LEFT | DIR_UP },
{ 0, XK_BackSpace, i_navigate, -1 },
{ 0, XK_bracketright, i_navigate, +10 },
{ 0, XK_bracketleft, i_navigate, -10 },
{ ControlMask, XK_6, i_alternate, None },
{ ControlMask, XK_n, i_navigate_frame, +1 },
{ ControlMask, XK_p, i_navigate_frame, -1 },
{ ControlMask, XK_space, i_toggle_animation, None },
{ ControlMask, XK_a, i_toggle_animation, None },
{ 0, XK_h, i_scroll, DIR_LEFT },
{ 0, XK_Left, i_scroll, DIR_LEFT },
{ 0, XK_j, i_scroll, DIR_DOWN },
{ 0, XK_Down, i_scroll, DIR_DOWN },
{ 0, XK_k, i_scroll, DIR_UP },
{ 0, XK_Up, i_scroll, DIR_UP },
{ 0, XK_l, i_scroll, DIR_RIGHT },
{ 0, XK_Right, i_scroll, DIR_RIGHT },
{ 0, XK_H, i_scroll_to_edge, DIR_LEFT },
{ 0, XK_J, i_scroll_to_edge, DIR_DOWN },
{ 0, XK_K, i_scroll_to_edge, DIR_UP },
{ 0, XK_L, i_scroll_to_edge, DIR_RIGHT },
{ 0, XK_z, i_scroll_to_center, None },
{ 0, XK_equal, i_set_zoom, 100 },
{ 0, XK_w, i_fit_to_win, SCALE_DOWN },
{ 0, XK_W, i_fit_to_win, SCALE_FIT },
{ 0, XK_F, i_fit_to_win, SCALE_FILL },
{ 0, XK_e, i_fit_to_win, SCALE_WIDTH },
{ 0, XK_E, i_fit_to_win, SCALE_HEIGHT },
{ 0, XK_less, i_rotate, DEGREE_270 },
{ 0, XK_greater, i_rotate, DEGREE_90 },
{ 0, XK_question, i_rotate, DEGREE_180 },
{ 0, XK_bar, i_flip, FLIP_HORIZONTAL },
{ 0, XK_underscore, i_flip, FLIP_VERTICAL },
{ 0, XK_a, i_toggle_antialias, None },
{ 0, XK_A, i_toggle_alpha, None },
{ 0, XK_s, i_slideshow, None },
};
/* mouse button mappings for image mode: */
static const button_t buttons_img[] = {
/* modifiers button function argument */
{ 0, 1, i_cursor_navigate, None },
{ ControlMask, 1, i_drag, DRAG_RELATIVE },
{ 0, 2, i_drag, DRAG_ABSOLUTE },
{ 0, 3, g_switch_mode, None },
{ 0, 4, g_zoom, +1 },
{ 0, 5, g_zoom, -1 },
};
/* mouse button mappings for thumbnail mode: */
static const button_t buttons_tns[] = {
/* modifiers button function argument */
{ 0, 1, t_select, None },
{ 0, 3, t_drag_mark_image, None },
{ 0, 4, t_scroll, DIR_UP },
{ 0, 5, t_scroll, DIR_DOWN },
{ ControlMask, 4, g_scroll_screen, DIR_UP },
{ ControlMask, 5, g_scroll_screen, DIR_DOWN },
};
/* true means NAV_WIDTH is relative (33%), false means absolute (33 pixels) */
static const bool NAV_IS_REL = true;
/* width of navigation area, 0 disables cursor navigation, */
static const unsigned int NAV_WIDTH = 33;
/* mouse cursor on left, middle and right part of the window */
static const cursor_t imgcursor[3] = {
CURSOR_LEFT, CURSOR_ARROW, CURSOR_RIGHT
};
#endif

5
home/nsxiv/default.nix Normal file
View File

@ -0,0 +1,5 @@
{ config, pkgs, ... }:
# https://raw.githubusercontent.com/nsxiv/nsxiv/master/config.def.h
let config = builtins.readFile ./config.h;
in { home.packages = [ (pkgs.nsxiv.override { conf = config; }) ]; }

View File

@ -2,14 +2,14 @@
let let
password-store = "${config.home.homeDirectory}/.password-store"; password-store = "${config.home.homeDirectory}/.password-store";
in stores = "${config.home.homeDirectory}/.local/share/gopass/stores";
{ in {
programs.password-store = { programs.password-store = {
enable = true; enable = true;
package = pkgs.pass.withExtensions (exts: [ exts.pass-otp ]); package = pkgs.pass.withExtensions (exts: [ exts.pass-otp ]);
settings = { settings = {
PASSWORD_STORE_DIR = password-store; PASSWORD_STORE_DIR = password-store;
PASSWORD_STORE_KEY = "2E0A7CADFF84D08BA94273AA101F79336E07C850"; PASSWORD_STORE_KEY = "B51D4548A4846E3C8D115C808333CFB0B9D3244D";
}; };
}; };
home.packages = [ pkgs.zbar pkgs.gopass ]; home.packages = [ pkgs.zbar pkgs.gopass ];
@ -26,6 +26,7 @@ in
parsing = true; parsing = true;
path = password-store; path = password-store;
safecontent = false; safecontent = false;
mounts = { lan = "${stores}/lan"; };
}; };
}; };
} }

View File

@ -4,9 +4,10 @@ let
url = "nextcloud.monotremata.xyz"; url = "nextcloud.monotremata.xyz";
dir = "${config.home.homeDirectory}/.newsboat"; dir = "${config.home.homeDirectory}/.newsboat";
user = "rilla"; user = "rilla";
rsssync = pkgs.callPackage ./rsssync.nix { inherit config pkgs; };
in in
{ {
home.packages = [ pkgs.rss-sync ]; home.packages = [rsssync];
programs.newsboat = { programs.newsboat = {
enable = true; enable = true;
autoReload = true; autoReload = true;

10
home/rss/rsssync.nix Normal file
View File

@ -0,0 +1,10 @@
{ config, pkgs, ... }:
let
shell = "${pkgs.dash}/bin/dash";
newsboat = "${pkgs.newsboat}/bin/newsboat";
in
pkgs.writeScriptBin "rsssync" ''
#!${shell}
${newsboat} --execute="reload"
''

21
home/snapcast/default.nix Normal file
View File

@ -0,0 +1,21 @@
{ config, pkgs, ... }:
let snapserver_ip = "192.168.1.144";
in
{
home.packages = [ pkgs.snapcast ];
systemd.user.services.snapclient = {
Unit = {
After = [ "pipewire.service" ];
};
Service = {
Type = "simple";
ExecStart = "${pkgs.snapcast}/bin/snapclient --host ${snapserver_ip}";
};
Install = {
WantedBy = [ "pipewire.service" ];
};
};
}

View File

@ -3,18 +3,14 @@
let let
defaultBlock = { defaultBlock = {
identitiesOnly = true; identitiesOnly = true;
identityFile = "~/.ssh/id_rsa_gpg.pub"; identityFile = "~/.ssh/id_rsa_yubikey.pub";
certificateFile = "~/.ssh/id_rsa_gpg-cert.pub"; certificateFile = "~/.ssh/id_rsa_yubikey-cert.pub";
forwardAgent = true; forwardAgent = true;
port = 22; port = 22;
}; };
in in {
{ home.file.".ssh/id_rsa_yubikey.pub".source = ./id_rsa_yubikey.pub;
home.file.".ssh/id_rsa_gpg.pub".source = ./id_rsa_gpg.pub; home.file.".ssh/id_rsa_yubikey-cert.pub".source = ./id_rsa_yubikey-cert.pub;
home.file.".ssh/id_rsa_gpg-cert.pub".source = ./id_rsa_gpg-cert.pub;
home.file.".ssh/bitbucket_ed25519.pub".source = ./bitbucket_ed25519.pub;
programs.ssh = { programs.ssh = {
enable = true; enable = true;
matchBlocks = { matchBlocks = {
@ -29,8 +25,8 @@ in
"suricata" = defaultBlock; "suricata" = defaultBlock;
"lb" = defaultBlock; "lb" = defaultBlock;
"cuina" = defaultBlock;
"capibara" = defaultBlock; "capibara" = defaultBlock;
"echidna" = defaultBlock;
"pikvm" = defaultBlock; "pikvm" = defaultBlock;
"narwhal" = defaultBlock; "narwhal" = defaultBlock;
"trantor" = defaultBlock; "trantor" = defaultBlock;
@ -40,7 +36,7 @@ in
"bitbucket.org" = defaultBlock // { "bitbucket.org" = defaultBlock // {
user = "git"; user = "git";
identityFile = "~/.ssh/bitbucket_ed25519"; identityFile = "~/.ssh/bitbucket_rsa";
}; };
}; };

View File

@ -0,0 +1 @@
ssh-rsa-cert-v01@openssh.com AAAAHHNzaC1yc2EtY2VydC12MDFAb3BlbnNzaC5jb20AAAAg/2+dgwO+Ofq3Wvy8Vzx2NdEOdqx4b10w2lGINu318G4AAAADAQABAAACAQDaiwmnSKC4DpznZlode1987DvGVLWqkvDZXZ6ey/LOZhRHvNnr5lP4Ke034R17mHHuTlzzuTKUKTN6JcIxBURGUwjWgNQO5z+7SapdOvPpw7M8wOlgp92CbIMiE/tReNbUi2e584Y5NR4tMCQm+FPvQ7c7nY/WoxJ6VSiKBbXzN+IrB9H6ZAVyfAlzHpxhwXeuP5xFwTtapzyzyc4phvuIhbXUc9NOZHXwoAR2La/0TVOgDyktEmCq6aGet03Azz6KPRptdnf4g9V3u8YivccXfd9WTrJr9fj1fWjDU9bBKVU6GtdcSwfqKwa6X4sQIZfONKvVEfqbIIEB70FsXHcdfnm3EN5L1PWbC441Q8bB1zvu/GnlXTlxDFmzByxnbLWTSPLuQyKq5sv9va8Jl9QEVpS3qWJbPHYBTevgboTExyLmpEfsCI+Of86Oxb8PNjyhX1/oWiy8S3w+5oQgAb+yNfSVPnX7CO4oGQhnttoXHA94LzxArYr9zZIp2asRMlc4VVWVH/jQ4FdLDjvKNARYiytOplZBPvFOHJiGb/rfjZKbMPPE+3V1WQPZ6B2nlWN5QxTpnLgTQnONr5rlSrvzFPY8BISUAYcdOCErG4agHDkHFZqWn8u+51wUZUnXo4NI+rty4Nzmc/kPfqWyv/8mSJfihidfuuHGEEzCk1qVdQAAAAAAAAAAAAAAAQAAAAd5dWJpa2V5AAAAIgAAAAVyaWxsYQAAAAdhbnNpYmxlAAAACndvb2RwZWNrZXIAAAAAAAAAAP//////////AAAAAAAAAIIAAAAVcGVybWl0LVgxMS1mb3J3YXJkaW5nAAAAAAAAABdwZXJtaXQtYWdlbnQtZm9yd2FyZGluZwAAAAAAAAAWcGVybWl0LXBvcnQtZm9yd2FyZGluZwAAAAAAAAAKcGVybWl0LXB0eQAAAAAAAAAOcGVybWl0LXVzZXItcmMAAAAAAAAAAAAAADMAAAALc3NoLWVkMjU1MTkAAAAgdagSWswPONV2NxMqMFGoz+6IG2BMdoHBsEwwXId5P5AAAABTAAAAC3NzaC1lZDI1NTE5AAAAQGBK6cVFrPbg1/NgOYNYUKuCgNjCsJaIMXWaIt0lW5V8GRDQjdxfzNlEAlJv6+z0s58Ar4sartbuxxWyJGnL9wk= cardno:000611073199

View File

@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDaiwmnSKC4DpznZlode1987DvGVLWqkvDZXZ6ey/LOZhRHvNnr5lP4Ke034R17mHHuTlzzuTKUKTN6JcIxBURGUwjWgNQO5z+7SapdOvPpw7M8wOlgp92CbIMiE/tReNbUi2e584Y5NR4tMCQm+FPvQ7c7nY/WoxJ6VSiKBbXzN+IrB9H6ZAVyfAlzHpxhwXeuP5xFwTtapzyzyc4phvuIhbXUc9NOZHXwoAR2La/0TVOgDyktEmCq6aGet03Azz6KPRptdnf4g9V3u8YivccXfd9WTrJr9fj1fWjDU9bBKVU6GtdcSwfqKwa6X4sQIZfONKvVEfqbIIEB70FsXHcdfnm3EN5L1PWbC441Q8bB1zvu/GnlXTlxDFmzByxnbLWTSPLuQyKq5sv9va8Jl9QEVpS3qWJbPHYBTevgboTExyLmpEfsCI+Of86Oxb8PNjyhX1/oWiy8S3w+5oQgAb+yNfSVPnX7CO4oGQhnttoXHA94LzxArYr9zZIp2asRMlc4VVWVH/jQ4FdLDjvKNARYiytOplZBPvFOHJiGb/rfjZKbMPPE+3V1WQPZ6B2nlWN5QxTpnLgTQnONr5rlSrvzFPY8BISUAYcdOCErG4agHDkHFZqWn8u+51wUZUnXo4NI+rty4Nzmc/kPfqWyv/8mSJfihidfuuHGEEzCk1qVdQ== cardno:000611073199

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