Cursed refactor.

This commit is contained in:
kat witch 2021-03-05 00:36:51 +00:00
parent 20b4bafa85
commit 5845debc95
No known key found for this signature in database
GPG key ID: 1B477797DCA5EC72
83 changed files with 1000 additions and 804 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
/result
secrets.nix
!config/profiles/common/nixos/secrets.nix

View file

@ -1,92 +0,0 @@
{ config, lib, pkgs, sources, ... }:
{
imports = [
../users
(sources.home-manager + "/nixos")
];
boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
boot.loader.grub.configurationLimit = 8;
boot.loader.systemd-boot.configurationLimit = 8;
nixpkgs.config = { allowUnfree = true; };
nix = {
nixPath = [
"nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos"
"nixpkgs-unstable=${sources.nixpkgs-unstable}"
"nixpkgs-mozilla=${sources.nixpkgs-mozilla}"
"NUR=${sources.NUR}"
"arc=${sources.arc-nixexprs}"
];
binaryCaches = [ "https://arc.cachix.org" ];
binaryCachePublicKeys =
[ "arc.cachix.org-1:DZmhclLkB6UO0rc0rBzNpwFbbaeLfyn+fYccuAy7YVY=" ];
gc.automatic = lib.mkDefault true;
gc.options = lib.mkDefault "--delete-older-than 1w";
trustedUsers = [ "root" "@wheel" ];
};
secrets = {
root = "/var/lib/kat/secrets";
persistentRoot = "/var/lib/kat/secrets";
external = true;
};
services.journald.extraConfig = "SystemMaxUse=512M";
environment.variables = {
EDITOR = "emacs";
TERMINFO_DIRS = "${pkgs.kitty.terminfo.outPath}/share/terminfo";
};
services.openssh = {
enable = true;
ports = lib.mkDefault [ 62954 ];
passwordAuthentication = false;
challengeResponseAuthentication = false;
permitRootLogin = lib.mkDefault "prohibit-password";
kexAlgorithms = [ "curve25519-sha256@libssh.org" ];
extraConfig = ''
StreamLocalBindUnlink yes
LogLevel VERBOSE
'';
};
security.sudo.wheelNeedsPassword = lib.mkForce false;
i18n.defaultLocale = "en_GB.UTF-8";
time.timeZone = "Europe/London";
console = {
font = "Lat2-Terminus16";
keyMap = "uk";
};
services.tailscale.enable = true;
environment.systemPackages = with pkgs; [
smartmontools
hddtemp
lm_sensors
htop
cachix
ripgrep
git
kitty.terminfo
nixfmt
mprime
wget
rsync
pv
pinentry-curses
progress
bc
zstd
file
whois
fd
exa
socat
tmux
gnupg
];
}

10
config/home.nix Normal file
View file

@ -0,0 +1,10 @@
{ pkgs, config, lib, witch, ... }:
let
homeModules = witch.modList {
modulesDir = ./profiles;
defaultFile = "home.nix";
};
in {
imports = lib.attrValues homeModules ++ [ ../modules/home ];
}

View file

@ -23,7 +23,7 @@
./matrix.nix
];
deploy.profiles = [ ];
deploy.profiles = [ "kat" ];
deploy.ssh.host = "athame.kittywit.ch";
boot.loader.grub.enable = true;

View file

@ -6,7 +6,7 @@
#./wireguard.nix
];
deploy.profiles = [ ];
deploy.profiles = [ "kat" ];
deploy.ssh.host = "boline.kittywit.ch";
boot.loader.grub.enable = true;

View file

@ -9,7 +9,7 @@
./torrenting.nix
];
deploy.profiles = [ "desktop" "development" "sway" "gaming" "network" ];
deploy.profiles = [ "gui" "sway" "kat" ];
deploy.ssh.host = "192.168.1.135";
# libvirtd is used for our virtual machine

View file

@ -29,7 +29,7 @@ qemu:
#routing: qmp # (default) does not require extra configuration or dependencies
#routing: spice # no external requirements # CURRENTLY UNIMPLEMENTED
#routing: input-linux # requires uinput
#routing: virtio-host # requires uinput, recommended for performance, requires vioinput drivers in guest
routing: virtio-host # requires uinput, recommended for performance, requires vioinput drivers in guest
#driver: ps2 # use PS/2 in the guest for all input devices (absolute mouse mode unsupported)
#driver: usb # use USB keyboard/mouse/tablet in the guest
#driver: virtio # Recommended but vioinput drivers must be installed in guest
@ -39,7 +39,7 @@ qemu:
#driver: virtio
#relative_driver: virtio
qmp_socket: /tmp/vfio-qmp # path to QMP socket
#ga_socket: /tmp/vfio-qga # path to Guest Agent socket
ga_socket: /tmp/vfio-qga # path to Guest Agent socket
key_remap: # Arbitrary keys can be remapped in the guest
# See https://docs.rs/input-linux/*/input_linux/enum.Key.html for a list of key names available (mouse buttons can also be used)
@ -47,12 +47,6 @@ key_remap: # Arbitrary keys can be remapped in the guest
RightAlt: LeftMeta # remap right alt to trigger the windows key
hotkeys: # Trigger various events on key combinations
- triggers: [G]
modifiers: [LeftMeta]
on_release: false # trigger on downpress of key
global: false # optionally trigger even when not in focus # CURRENTLY UNIMPLEMENTED
events: # Select which events to trigger with this hotkey
- toggle_grab: xcore # Standard Xorg window grab
#- toggle_grab:y
# xdevice: # CURRENTLY UNIMPLEMENTED
# devices: # Only grab specific devices from Xorg
@ -65,10 +59,12 @@ hotkeys: # Trigger various events on key combinations
#- shutdown # safely shuts the guest system down
#- reboot # reboots the guest
#- exit # quits screenstub
- triggers: [Y]
- triggers: [G]
modifiers: [LeftMeta]
events:
- toggle_grab: xcore # Confine input/mouse to window
- toggle_grab:
x:
mouse: false # Confine input/mouse to window
- toggle_grab:
evdev: # evdev grab is useful for playing games that don't work with absolute mouse events
exclusive: false # grab exclusive access from the device(s)

View file

@ -3,7 +3,7 @@
{
imports = [ ./hardware.nix ../../services/zfs.nix ];
deploy.profiles = [ "desktop" "development" "sway" "gaming" "network" ];
deploy.profiles = [ "gui" "sway" "kat" "laptop" ];
deploy.ssh.host = "192.168.1.92";
boot.loader.systemd-boot.enable = true;

39
config/nixos.nix Normal file
View file

@ -0,0 +1,39 @@
{ pkgs, config, lib, sources, witch, options, ... }:
let
nixosModules = witch.modList {
modulesDir = ./profiles;
defaultFile = "nixos.nix";
};
in {
imports = lib.attrValues nixosModules;
options.home-manager.users = lib.mkOption {
type = lib.types.attrsOf (lib.types.submoduleWith {
modules = [ ];
specialArgs = {
inherit sources witch;
superConfig = config;
};
});
};
config = {
home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
users = {
kat = {
imports = [ ./home.nix ];
deploy.profile = lib.mkMerge (map (prof: {
${if options ? deploy.profile.${prof} then prof else null} = true;
}) config.deploy.profiles);
};
};
};
};
}

View file

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

View file

@ -0,0 +1,5 @@
{ config, lib, pkgs, sources, ... }:
{
imports = [ ./nixos ];
}

View file

@ -1,9 +1,7 @@
{ pkgs, config, ... }:
{ config, lib, pkgs, sources, ... }:
{
imports = [
./kat
];
security.sudo.wheelNeedsPassword = lib.mkForce false;
users.users.root = {
openssh.authorizedKeys.keys = with pkgs.lib;

View file

@ -0,0 +1,14 @@
{ config, lib, pkgs, sources, ... }:
{
imports = [
./system.nix
./net.nix
./access.nix
./locale.nix
./nix.nix
./ssh.nix
./packages.nix
./secrets.nix
];
}

View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, sources, ... }:
{
i18n.defaultLocale = "en_GB.UTF-8";
time.timeZone = "Europe/London";
console = {
font = "Lat2-Terminus16";
keyMap = "uk";
};
}

View file

@ -0,0 +1,5 @@
{ config, lib, pkgs, sources, ... }:
{
services.tailscale.enable = true;
}

View file

@ -0,0 +1,23 @@
{ config, lib, pkgs, sources, ... }:
{
boot.loader.grub.configurationLimit = 8;
boot.loader.systemd-boot.configurationLimit = 8;
nixpkgs.config = { allowUnfree = true; };
nix = {
nixPath = [
"nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos"
"nixpkgs-unstable=${sources.nixpkgs-unstable}"
"nixpkgs-mozilla=${sources.nixpkgs-mozilla}"
"NUR=${sources.NUR}"
"arc=${sources.arc-nixexprs}"
];
binaryCaches = [ "https://arc.cachix.org" ];
binaryCachePublicKeys =
[ "arc.cachix.org-1:DZmhclLkB6UO0rc0rBzNpwFbbaeLfyn+fYccuAy7YVY=" ];
gc.automatic = lib.mkDefault true;
gc.options = lib.mkDefault "--delete-older-than 1w";
trustedUsers = [ "root" "@wheel" ];
};
}

View file

@ -0,0 +1,30 @@
{ config, lib, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
smartmontools
hddtemp
lm_sensors
htop
cachix
ripgrep
git
kitty.terminfo
nixfmt
mprime
wget
rsync
pv
pinentry-curses
progress
bc
zstd
file
whois
fd
exa
socat
tmux
gnupg
];
}

View file

@ -0,0 +1,9 @@
{ config, lib, pkgs, ... }:
{
secrets = {
root = "/var/lib/kat/secrets";
persistentRoot = "/var/lib/kat/secrets";
external = true;
};
}

View file

@ -0,0 +1,16 @@
{ config, lib, pkgs, ... }:
{
services.openssh = {
enable = true;
ports = lib.mkDefault [ 62954 ];
passwordAuthentication = false;
challengeResponseAuthentication = false;
permitRootLogin = lib.mkDefault "prohibit-password";
kexAlgorithms = [ "curve25519-sha256@libssh.org" ];
extraConfig = ''
StreamLocalBindUnlink yes
LogLevel VERBOSE
'';
};
}

View file

@ -0,0 +1,8 @@
{ config, lib, pkgs, sources, ... }:
{
#imports = [ (sources.home-manager + "/nixos") ];
boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
services.journald.extraConfig = "SystemMaxUse=512M";
}

View file

@ -0,0 +1,7 @@
{ lib, ... }:
{
imports = [ ./home ];
options = { deploy.profile.gui = lib.mkEnableOption "graphical system"; };
}

View file

@ -0,0 +1,12 @@
{ ... }:
{
imports = [
./firefox
./kitty.nix
./packages.nix
./nextcloud.nix
./gpg.nix
./gtk.nix
];
}

View file

@ -1,10 +1,9 @@
{ config, lib, pkgs, ... }:
{ config, lib, pkgs, sources, superConfig, ... }:
let
sources = import ../../../../nix/sources.nix;
commonSettings = {
"app.update.auto" = false;
"identity.fxaccounts.account.device.name" = config.networking.hostName;
"identity.fxaccounts.account.device.name" = superConfig.networking.hostName;
"signon.rememberSignons" = false;
"browser.urlbar.placeholderName" = "DuckDuckGo";
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
@ -12,7 +11,7 @@ let
"https://sync.kittywit.ch/token/1.0/sync/1.5";
};
in {
home-manager.users.kat = {
config = lib.mkIf config.deploy.profile.gui {
programs.fish.shellAliases = {
ff-pm = "firefox --ProfileManager";
ff-main = "firefox -P main";

View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, sources, ... }:
{
config = lib.mkIf config.deploy.profile.gui {
home.file.".gnupg/gpg-agent.conf".text = ''
enable-ssh-support
pinentry-program ${pkgs.pinentry.gtk2}/bin/pinentry
'';
};
}

View file

@ -0,0 +1,17 @@
{ config, lib, pkgs, ... }:
{
config = lib.mkIf config.deploy.profile.gui {
gtk = {
enable = true;
iconTheme = {
name = "Numix-Square";
package = pkgs.numix-icon-theme-square;
};
theme = {
name = "Arc-Dark";
package = pkgs.arc-theme;
};
};
};
}

View file

@ -0,0 +1,27 @@
{ config, lib, pkgs, witch, ... }:
{
config = lib.mkIf config.deploy.profile.gui {
home.sessionVariables.TERMINFO_DIRS =
"${pkgs.kitty.terminfo.outPath}/share/terminfo";
programs.kitty = {
enable = true;
font.name = witch.style.font.name;
settings = {
font_size = witch.style.font.size;
background = witch.style.base16.color0;
background_opacity = "0.7";
foreground = witch.style.base16.color7;
selection_background = witch.style.base16.color7;
selection_foreground = witch.style.base16.color0;
url_color = witch.style.base16.color3;
cursor = witch.style.base16.color7;
active_border_color = "#75715e";
active_tab_background = "#9900ff";
active_tab_foreground = witch.style.base16.color7;
inactive_tab_background = "#3a3a3a";
inactive_tab_foreground = "#665577";
} // witch.style.base16;
};
};
}

View file

@ -0,0 +1,7 @@
{ config, lib, pkgs, ... }:
{
config = lib.mkIf config.deploy.profile.gui {
services.nextcloud-client.enable = true;
};
}

View file

@ -0,0 +1,47 @@
{ config, lib, pkgs, ... }:
{
config = lib.mkIf config.deploy.profile.gui {
home.packages = with pkgs; [
_1password
bitwarden
mpv
element-desktop
mumble
obs-studio
xfce.ristretto
audacity
avidemux
vlc
ffmpeg-full
thunderbird
unstable.syncplay
unstable.youtube-dl
unstable.google-chrome
v4l-utils
transmission-gtk
lm_sensors
baresip
psmisc
unstable.discord
tdesktop
yubikey-manager
pinentry.gtk2
dino
libnotify
nextcloud-client
vegur
nitrogen
terminator
pavucontrol
gparted
scrot
gimp-with-plugins
vscode
cryptsetup
pcmanfm
neofetch
htop
];
};
}

View file

@ -0,0 +1,7 @@
{ config, lib, pkgs, ... }:
{
imports = [ ./nixos ];
options = { deploy.profile.gui = lib.mkEnableOption "graphical system"; };
}

View file

@ -0,0 +1,13 @@
{ ... }:
{
imports = [
./fonts.nix
./gpg.nix
./firefox.nix
./dns.nix
./nixpkgs.nix
./mingetty.nix
./sound.nix
];
}

View file

@ -1,5 +1,5 @@
{ config, lib, pkgs, ... }: {
config = lib.mkIf (lib.elem "network" config.deploy.profiles) {
config = lib.mkIf config.deploy.profile.gui {
networking = {
networkmanager.enable = true;
resolvconf.useLocalResolver = true;

View file

@ -0,0 +1,16 @@
{ config, pkgs, lib, witch, ... }:
{
config = lib.mkIf config.deploy.profile.gui {
xdg = {
portal = {
enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-wlr
xdg-desktop-portal-gtk
];
gtkUsePortal = true;
};
};
};
}

View file

@ -0,0 +1,13 @@
{ config, pkgs, lib, ... }:
{
config = lib.mkIf config.deploy.profile.gui {
fonts.fontconfig.enable = true;
fonts.fonts = with pkgs; [
font-awesome
nerdfonts
iosevka
emacs-all-the-icons-fonts
];
};
}

View file

@ -0,0 +1,8 @@
{ config, pkgs, lib, ... }:
{
config = lib.mkIf config.deploy.profile.gui {
services.pcscd.enable = true;
services.udev.packages = [ pkgs.yubikey-personalization ];
};
}

View file

@ -0,0 +1,37 @@
{ config, lib, pkgs, ... }:
let
c1 = "\\e[22;34m";
c2 = "\\e[1;35m";
nixos_logo = [
" ${c1} ::::. ${c2}'::::: ::::' "
" ${c1} '::::: ${c2}':::::. ::::' "
" ${c1} ::::: ${c2}'::::.::::: "
" ${c1} .......:::::..... ${c2}:::::::: "
" ${c1} ::::::::::::::::::. ${c2}:::::: ${c1}::::. "
" ${c1} ::::::::::::::::::::: ${c2}:::::. ${c1}.::::' "
" ${c2} ..... ::::' ${c1}:::::' "
" ${c2} ::::: '::' ${c1}:::::' "
" ${c2} ........::::: ' ${c1}:::::::::::. "
" ${c2}::::::::::::: ${c1}::::::::::::: "
" ${c2} ::::::::::: ${c1}.. ${c1}::::: "
" ${c2} .::::: ${c1}.::: ${c1}::::: "
" ${c2} .::::: ${c1}::::: ${c1}''''' ${c2}..... "
" ${c2} ::::: ${c1}':::::. ${c2}......:::::::::::::' "
" ${c2} ::: ${c1}::::::. ${c2}':::::::::::::::::' "
" ${c1} .:::::::: ${c2}':::::::::: "
" ${c1} .::::''::::. ${c2}'::::. "
" ${c1} .::::' ::::. ${c2}'::::. "
" ${c1} .:::: :::: ${c2}'::::. "
];
in {
config = lib.mkIf config.deploy.profile.gui {
services.mingetty = {
greetingLine = ''
\e[H\e[2J
\e[9;10]'' + lib.concatStringsSep "\n" nixos_logo + "\n\n"
+ "\\e[1;32m>>> NixOS ${config.system.nixos.label} (Linux \\r) - \\l\\e[0m";
helpLine = lib.mkForce "";
};
};
}

View file

@ -0,0 +1,9 @@
{ pkgs, config, lib, ... }:
{
nixpkgs.config = {
allowUnfree = true;
mumble.speechdSupport = true;
pulseaudio = true;
};
}

View file

@ -0,0 +1,20 @@
{ config, lib, pkgs, ... }:
{
config = lib.mkIf config.deploy.profile.gui {
sound = {
enable = true;
extraConfig = ''
defaults.pcm.rate_converter "speexrate_best"
'';
};
hardware.pulseaudio = {
enable = true;
daemon.config = {
default-sample-format = "s24le";
default-sample-rate = 96000;
resample-method = "soxr-vhq";
};
};
};
}

View file

@ -0,0 +1,12 @@
{ lib, ... }:
{
imports = [ ./home ];
#home-manager.useGlobalPkgs = true;
#home-manager.users.kat = {
# imports = [ ../../../modules/home ];
#};
options = { deploy.profile.kat = lib.mkEnableOption "uhh meow"; };
}

View file

@ -0,0 +1,5 @@
{ ... }:
{
imports = [ ./shell.nix ./git.nix ./tmux.nix ./ssh.nix ./emacs ];
}

View file

@ -1,6 +1,5 @@
{ config, lib, pkgs, ... }:
{ config, lib, pkgs, sources, ... }:
let
sources = import ../../../nix/sources.nix;
emacs = pkgs.callPackage sources.nix-doom-emacs {
doomPrivateDir = "${./doom.d}";
emacsPackagesOverlay = self: super: {
@ -9,8 +8,9 @@ let
};
};
in {
users.users.kat.packages = [ emacs ];
home-manager.users.kat = {
config = lib.mkIf config.deploy.profile.kat {
home.sessionVariables.EDITOR = "emacs";
home.packages = [ emacs ];
home.file.".emacs.d/init.el".text = ''
(load "default.el")
'';

View file

@ -0,0 +1,19 @@
{ config, pkgs, lib, ... }:
{
config = lib.mkIf config.deploy.profile.kat {
home.packages = with pkgs; [ git-crypt gitAndTools.gitRemoteGcrypt ];
programs.git = {
enable = true;
package = pkgs.gitAndTools.gitFull;
userName = "kat witch";
userEmail = "kat@kittywit.ch";
extraConfig = { protocol.gcrypt.allow = "always"; };
signing = {
key = "01F50A29D4AA91175A11BDB17248991EFA8EFBEE";
signByDefault = true;
};
};
};
}

View file

@ -1,11 +1,11 @@
{ config, lib, pkgs, ... }:
{
home-manager.users.kat = {
config = lib.mkIf config.deploy.profile.kat {
programs.fish = {
enable = true;
interactiveShellInit = ''
${if (lib.elem "desktop" config.deploy.groups) then
${if (config.deploy.profile.gui) then
"export SSH_AUTH_SOCK=(gpgconf --list-dirs agent-ssh-socket)"
else
""}
@ -22,10 +22,15 @@
};
}];
};
programs.starship = {
enable = true;
enableFishIntegration = true;
};
programs.direnv = {
enable = true;
enableFishIntegration = true;
enableNixDirenvIntegration = true;
};
programs.bat.enable = true;
};
}

View file

@ -1,7 +1,7 @@
{ configs, pkgs, ... }:
{ config, pkgs, lib, ... }:
{
home-manager.users.kat = {
config = lib.mkIf config.deploy.profile.kat {
programs.ssh = {
enable = true;
controlMaster = "auto";

View file

@ -0,0 +1,43 @@
{ config, lib, pkgs, ... }:
{
config = lib.mkIf config.deploy.profile.kat {
programs.fish.shellAliases = {
tne = "tmux new -s";
tat = "tmux attach -t";
};
programs.tmux = {
enable = true;
extraConfig = ''
# modes
setw -g clock-mode-colour colour5
setw -g mode-style 'fg=colour1 bg=colour18 bold'
# panes
set -g pane-border-style 'fg=colour19 bg=colour0'
set -g pane-active-border-style 'bg=colour0 fg=colour9'
# statusbar
set -g status-position bottom
set -g status-justify left
set -g status-style 'bg=colour18 fg=colour137 dim'
set -g status-left '''
set -g status-right '#[fg=colour233,bg=colour19] %F #[fg=colour233,bg=colour8] %H:%M:%S %Z'
set -g status-right-length 50
set -g status-left-length 20
setw -g window-status-current-style 'fg=colour1 bg=colour19 bold'
setw -g window-status-current-format ' #I#[fg=colour249]:#[fg=colour255]#W#[fg=colour249]#F '
setw -g window-status-style 'fg=colour9 bg=colour18'
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '
setw -g window-status-bell-style 'fg=colour255 bg=colour1 bold'
# messages
set -g message-style 'fg=colour232 bg=colour16 bold'
'';
};
};
}

View file

@ -0,0 +1,17 @@
{ config, pkgs, lib, ... }:
{
config = lib.mkIf config.deploy.profile.kat {
users.users.kat = {
uid = 1000;
isNormalUser = true;
openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCocjQqiDIvzq+Qu3jkf7FXw5piwtvZ1Mihw9cVjdVcsra3U2c9WYtYrA3rS50N3p00oUqQm9z1KUrvHzdE+03ZCrvaGdrtYVsaeoCuuvw7qxTQRbItTAEsfRcZLQ5c1v/57HNYNEsjVrt8VukMPRXWgl+lmzh37dd9w45cCY1QPi+JXQQ/4i9Vc3aWSe4X6PHOEMSBHxepnxm5VNHm4PObGcVbjBf0OkunMeztd1YYA9sEPyEK3b8IHxDl34e5t6NDLCIDz0N/UgzCxSxoz+YJ0feQuZtud/YLkuQcMxW2dSGvnJ0nYy7SA5DkW1oqcy6CGDndHl5StOlJ1IF9aGh0gGkx5SRrV7HOGvapR60RphKrR5zQbFFka99kvSQgOZqSB3CGDEQGHv8dXKXIFlzX78jjWDOBT67vA/M9BK9FS2iNnBF5x6shJ9SU5IK4ySxq8qvN7Us8emkN3pyO8yqgsSOzzJT1JmWUAx0tZWG/BwKcFBHfceAPQl6pwxx28TM3BTBRYdzPJLTkAy48y6iXW6UYdfAPlShy79IYjQtEThTuIiEzdzgYdros0x3PDniuAP0KOKMgbikr0gRa6zahPjf0qqBnHeLB6nHAfaVzI0aNbhOg2bdOueE1FX0x48sjKqjOpjlIfq4WeZp9REr2YHEsoLFOBfgId5P3BPtpBQ== cardno:000612078454"
];
shell = pkgs.fish;
extraGroups = [ "wheel" "video" ];
};
};
options = { deploy.profile.kat = lib.mkEnableOption "uhh meow"; };
}

View file

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

View file

@ -0,0 +1,7 @@
{ lib, ... }:
{
imports = [ ./nixos ];
options = { deploy.profile.laptop = lib.mkEnableOption "lappytop"; };
}

View file

@ -0,0 +1,5 @@
{ ... }:
{
imports = [ ./light.nix ./wifi.nix ];
}

View file

@ -0,0 +1,6 @@
{ config, lib, pkgs, ... }:
{
config =
lib.mkIf config.deploy.profile.laptop { programs.light.enable = true; };
}

View file

@ -0,0 +1,5 @@
{ config, lib, pkgs, ... }:
{
config = lib.mkIf config.deploy.profile.laptop { };
}

View file

@ -0,0 +1,7 @@
{ lib, ... }:
{
imports = [ ./home ];
options = { deploy.profile.sway = lib.mkEnableOption "sway wm"; };
}

View file

@ -0,0 +1,5 @@
{ config, pkgs, sources, ... }:
{
imports = [ ./waybar ./mako.nix ./sway.nix ];
}

View file

@ -0,0 +1,28 @@
{ config, pkgs, lib, witch, ... }:
{
config = lib.mkIf config.deploy.profile.sway {
systemd.user.services = {
mako = {
Unit = {
Description = "mako";
X-Restart-Triggers =
[ (toString config.xdg.configFile."mako/config".source) ];
};
Service = {
ExecStart = "${pkgs.mako}/bin/mako";
Restart = "always";
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
};
programs.mako = {
enable = true;
defaultTimeout = 3000;
borderColor = witch.style.base16.color7;
backgroundColor = "${witch.style.base16.color0}70";
textColor = witch.style.base16.color7;
};
};
}

View file

@ -0,0 +1,210 @@
{ config, pkgs, lib, witch, ... }:
{
config = lib.mkIf config.deploy.profile.sway {
home.sessionVariables = {
MOZ_ENABLE_WAYLAND = 1;
XDG_CURRENT_DESKTOP = "sway";
XDG_SESSION_TYPE = "wayland";
};
home.packages = with pkgs; [ grim slurp ];
wayland.windowManager.sway = {
enable = true;
config = let
dmenu =
"${pkgs.bemenu}/bin/bemenu --fn '${witch.style.font.name} ${witch.style.font.size}' --nb '${witch.style.base16.color0}' --nf '${witch.style.base16.color7}' --sb '${witch.style.base16.color1}' --sf '${witch.style.base16.color7}' -l 5 -m -1 -i";
lockCommand = "swaylock -i ${./wallpapers/main.png} -s fill";
cfg = config.wayland.windowManager.sway.config;
in {
bars = [{ command = "${pkgs.waybar}/bin/waybar"; }];
output = let
left = {
res = "1920x1080";
pos = "0 0";
bg = "${./wallpapers/left.jpg} fill";
};
middle = {
res = "1920x1080";
pos = "1920 0";
bg = "${./wallpapers/main.png} fill";
};
right = {
res = "1920x1080";
pos = "3840 0";
bg = "${./wallpapers/right.jpg} fill";
};
laptop = {
res = "1920x1080";
pos = "0 0";
bg = "${./wallpapers/main.png} fill";
};
in {
"DP-1" = left;
"DVI-D-1" = middle;
"HDMI-A-1" = right;
"eDP-1" = laptop;
};
input = {
"1739:33362:Synaptics_TM3336-002" = {
dwt = "enabled";
tap = "enabled";
natural_scroll = "enabled";
middle_emulation = "enabled";
click_method = "clickfinger";
};
"*" = {
xkb_layout = "gb";
# xkb_variant = "nodeadkeys";
# xkb_options = "ctrl:nocaps";
};
};
fonts = [ "${witch.style.font.name} ${witch.style.font.size}" ];
terminal = "${pkgs.kitty}/bin/kitty";
# TODO: replace with wofi
menu =
"${pkgs.j4-dmenu-desktop}/bin/j4-dmenu-desktop --dmenu=\"${dmenu}\" --term='${cfg.terminal}'";
modifier = "Mod4";
startup = [
{
command = "systemctl --user restart mako";
always = true;
}
{
command =
"${pkgs.swayidle}/bin/swayidle -w before-sleep '${lockCommand}'";
}
];
window = {
border = 1;
titlebar = true;
};
keybindings = {
"${cfg.modifier}+Return" = "exec ${cfg.terminal}";
"${cfg.modifier}+Left" = "focus left";
"${cfg.modifier}+Down" = "focus down";
"${cfg.modifier}+Up" = "focus up";
"${cfg.modifier}+Right" = "focus right";
"${cfg.modifier}+Shift+Left" = "move left";
"${cfg.modifier}+Shift+Down" = "move down";
"${cfg.modifier}+Shift+Up" = "move up";
"${cfg.modifier}+Shift+Right" = "move right";
"${cfg.modifier}+Shift+space" = "floating toggle";
"${cfg.modifier}+space" = "focus mode_toggle";
"${cfg.modifier}+1" = "workspace 1";
"${cfg.modifier}+2" = "workspace 2";
"${cfg.modifier}+3" = "workspace 3";
"${cfg.modifier}+4" = "workspace 4";
"${cfg.modifier}+5" = "workspace 5";
"${cfg.modifier}+6" = "workspace 6";
"${cfg.modifier}+7" = "workspace 7";
"${cfg.modifier}+8" = "workspace 8";
"${cfg.modifier}+9" = "workspace 9";
"${cfg.modifier}+0" = "workspace 10";
"${cfg.modifier}+Shift+1" = "move container to workspace 1";
"${cfg.modifier}+Shift+2" = "move container to workspace 2";
"${cfg.modifier}+Shift+3" = "move container to workspace 3";
"${cfg.modifier}+Shift+4" = "move container to workspace 4";
"${cfg.modifier}+Shift+5" = "move container to workspace 5";
"${cfg.modifier}+Shift+6" = "move container to workspace 6";
"${cfg.modifier}+Shift+7" = "move container to workspace 7";
"${cfg.modifier}+Shift+8" = "move container to workspace 8";
"${cfg.modifier}+Shift+9" = "move container to workspace 9";
"${cfg.modifier}+Shift+0" = "move container to workspace 10";
"XF86AudioRaiseVolume" =
"exec pactl set-sink-volume $(pacmd list-sinks |awk '/* index:/{print $3}') +5%";
"XF86AudioLowerVolume" =
"exec pactl set-sink-volume $(pacmd list-sinks |awk '/* index:/{print $3}') -5%";
"XF86AudioMute" =
"exec pactl set-sink-mute $(pacmd list-sinks |awk '/* index:/{print $3}') toggle";
"XF86AudioMicMute" =
"exec pactl set-source-mute $(pacmd list-sources |awk '/* index:/{print $3}') toggle";
"XF86MonBrightnessDown" = "exec ${pkgs.light}/bin/light -U 5";
"XF86MonBrightnessUp" = "exec ${pkgs.light}/bin/light -A 5";
"${cfg.modifier}+d" = "exec ${cfg.menu}";
"${cfg.modifier}+x" = "exec ${lockCommand}";
"${cfg.modifier}+i" = "move workspace to output left";
"${cfg.modifier}+o" = "move workspace to output left";
"${cfg.modifier}+b" = "splith";
"${cfg.modifier}+v" = "splitv";
"${cfg.modifier}+s" = "layout stacking";
"${cfg.modifier}+w" = "layout tabbed";
"${cfg.modifier}+e" = "layout toggle split";
"${cfg.modifier}+f" = "fullscreen";
"${cfg.modifier}+Shift+q" = "kill";
"${cfg.modifier}+Shift+c" = "reload";
"${cfg.modifier}+r" = "mode resize";
"${cfg.modifier}+Delete" = ''
mode "System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown"'';
};
modes = {
"System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown" =
{
"l" = "exec ${lockCommand}, mode default";
"e" = "exec swaymsg exit, mode default";
"s" = "exec systemctl suspend, mode default";
"h" = "exec systemctl hibernate, mode default";
"r" = "exec systemctl reboot, mode default";
"Shift+s" = "exec systemctl shutdown, mode default";
"Return" = "mode default";
"Escape" = "mode default";
};
};
colors = {
focused = {
border = witch.style.base16.color8;
background = witch.style.base16.color4;
text = witch.style.base16.color0;
indicator = witch.style.base16.color2;
childBorder = witch.style.base16.color8;
};
focusedInactive = {
border = witch.style.base16.color0;
background = witch.style.base16.color11;
text = witch.style.base16.color12;
indicator = witch.style.base16.color2;
childBorder = witch.style.base16.color8;
};
unfocused = {
border = witch.style.base16.color0;
background = witch.style.base16.color8;
text = witch.style.base16.color12;
indicator = witch.style.base16.color8;
childBorder = witch.style.base16.color8;
};
urgent = {
border = witch.style.base16.color8;
background = witch.style.base16.color9;
text = witch.style.base16.color0;
indicator = witch.style.base16.color1;
childBorder = witch.style.base16.color8;
};
};
};
wrapperFeatures.gtk = true;
extraConfig = ''
seat seat0 xcursor_theme breeze_cursors 20
'';
};
};
}

View file

Before

Width:  |  Height:  |  Size: 451 KiB

After

Width:  |  Height:  |  Size: 451 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 5.1 MiB

After

Width:  |  Height:  |  Size: 5.1 MiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

Before After
Before After

View file

@ -0,0 +1,76 @@
{ config, lib, pkgs, witch, ... }:
{
config = lib.mkIf config.deploy.profile.sway {
programs.waybar = {
enable = true;
style = import ./waybar.css.nix {
style = witch.style;
hextorgba = witch.colorhelpers.hextorgba;
};
settings = [{
modules-left = [ "sway/workspaces" "sway/mode" "sway/window" ];
modules-center = [ "clock" "custom/weather" ];
modules-right = [
"pulseaudio"
"network"
"cpu"
"memory"
"temperature"
"backlight"
"battery"
"tray"
];
modules = {
"custom/weather" = {
format = "{}";
interval = 3600;
on-click = "xdg-open 'https://google.com/search?q=weather'";
exec = "nix-shell --command 'python ${
../../../../../scripts/weather/weather.py
} ${witch.secrets.profiles.sway.city} ${witch.secrets.profiles.sway.api_key}' ${
../../../../../scripts/weather
}";
};
cpu = { format = " {usage}%"; };
memory = { format = " {percentage}%"; };
temperature = { format = " {temperatureC}°C"; };
backlight = {
format = "{icon} {percent}%";
format-icons = [ "" "" ];
on-scroll-up = "${pkgs.light}/bin/light -A 1";
on-scroll-down = "${pkgs.light}/bin/light -U 1";
};
battery = {
states = {
good = 90;
warning = 30;
critical = 15;
};
format = "{icon} {capacity}%";
format-charging = " {capacity}%";
format-plugged = " {capacity}%";
format-alt = "{icon} {time}";
format-icons = [ "" "" "" "" "" ];
};
pulseaudio = {
format = " {volume}%";
on-click = "pavucontrol";
};
network = {
format-wifi = " {essid} ({signalStrength}%)";
format-ethernet = " {ifname}: {ipaddr}/{cidr}";
format-linked = " {ifname} (No IP)";
format-disconnected = " Disconnected ";
format-alt = " {ifname}: {ipaddr}/{cidr}";
};
clock = {
format = " {:%A, %F %T %Z}";
interval = 1;
};
};
}];
};
};
}

View file

@ -0,0 +1,7 @@
{ lib, ... }:
{
imports = [ ./nixos ];
options = { deploy.profile.sway = lib.mkEnableOption "sway wm"; };
}

View file

@ -0,0 +1,5 @@
{ config, pkgs, sources, ... }:
{
imports = [ ./sway.nix ];
}

View file

@ -0,0 +1,5 @@
{ config, pkgs, lib, sources, ... }:
{
config = lib.mkIf config.deploy.profile.sway { programs.sway.enable = true; };
}

View file

@ -1,100 +0,0 @@
{ config, pkgs, sources, ... }:
{
imports = [
../../../modules/home
./ssh.nix
./desktop.nix
./sound.nix
./gaming.nix
./network.nix
./sway.nix
./waybar
./kitty.nix
./emacs.nix
];
users.users.kat = {
uid = 1000;
isNormalUser = true;
openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCocjQqiDIvzq+Qu3jkf7FXw5piwtvZ1Mihw9cVjdVcsra3U2c9WYtYrA3rS50N3p00oUqQm9z1KUrvHzdE+03ZCrvaGdrtYVsaeoCuuvw7qxTQRbItTAEsfRcZLQ5c1v/57HNYNEsjVrt8VukMPRXWgl+lmzh37dd9w45cCY1QPi+JXQQ/4i9Vc3aWSe4X6PHOEMSBHxepnxm5VNHm4PObGcVbjBf0OkunMeztd1YYA9sEPyEK3b8IHxDl34e5t6NDLCIDz0N/UgzCxSxoz+YJ0feQuZtud/YLkuQcMxW2dSGvnJ0nYy7SA5DkW1oqcy6CGDndHl5StOlJ1IF9aGh0gGkx5SRrV7HOGvapR60RphKrR5zQbFFka99kvSQgOZqSB3CGDEQGHv8dXKXIFlzX78jjWDOBT67vA/M9BK9FS2iNnBF5x6shJ9SU5IK4ySxq8qvN7Us8emkN3pyO8yqgsSOzzJT1JmWUAx0tZWG/BwKcFBHfceAPQl6pwxx28TM3BTBRYdzPJLTkAy48y6iXW6UYdfAPlShy79IYjQtEThTuIiEzdzgYdros0x3PDniuAP0KOKMgbikr0gRa6zahPjf0qqBnHeLB6nHAfaVzI0aNbhOg2bdOueE1FX0x48sjKqjOpjlIfq4WeZp9REr2YHEsoLFOBfgId5P3BPtpBQ== cardno:000612078454"
];
shell = pkgs.fish;
extraGroups = [ "wheel" "video" ];
packages = with pkgs; [ git-crypt gitAndTools.gitRemoteGcrypt ];
};
home-manager.useGlobalPkgs = true;
home-manager.users.kat = {
programs.fish = {
enable = true;
shellAliases = {
nixdirfmt = "fd --color=never .nix | xargs nixfmt";
tmne = "tmux new -s";
tmat = "tmux attach -t";
};
plugins = [{
name = "bass";
src = pkgs.fetchFromGitHub {
owner = "edc";
repo = "bass";
rev = "d63054b24c2f63aaa3a08fb9ec9d0da4c70ab922";
sha256 = "0pwci5xxm8308nrb52s5nyxijk0svar8nqrdfvkk2y34z1cg319b";
};
}];
};
programs.starship = {
enable = true;
enableFishIntegration = true;
};
programs.git = {
enable = true;
package = pkgs.gitAndTools.gitFull;
userName = "kat witch";
userEmail = "kat@kittywit.ch";
extraConfig = { protocol.gcrypt.allow = "always"; };
signing = {
key = "01F50A29D4AA91175A11BDB17248991EFA8EFBEE";
signByDefault = true;
};
};
programs.bat.enable = true;
programs.tmux = {
enable = true;
extraConfig = ''
# modes
setw -g clock-mode-colour colour5
setw -g mode-style 'fg=colour1 bg=colour18 bold'
# panes
set -g pane-border-style 'fg=colour19 bg=colour0'
set -g pane-active-border-style 'bg=colour0 fg=colour9'
# statusbar
set -g status-position bottom
set -g status-justify left
set -g status-style 'bg=colour18 fg=colour137 dim'
set -g status-left '''
set -g status-right '#[fg=colour233,bg=colour19] %F #[fg=colour233,bg=colour8] %H:%M:%S %Z'
set -g status-right-length 50
set -g status-left-length 20
setw -g window-status-current-style 'fg=colour1 bg=colour19 bold'
setw -g window-status-current-format ' #I#[fg=colour249]:#[fg=colour255]#W#[fg=colour249]#F '
setw -g window-status-style 'fg=colour9 bg=colour18'
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '
setw -g window-status-bell-style 'fg=colour255 bg=colour1 bold'
# messages
set -g message-style 'fg=colour232 bg=colour16 bold'
'';
};
};
}

View file

@ -1,133 +0,0 @@
{ config, lib, pkgs, ... }:
let sources = import ../../../nix/sources.nix;
in {
imports = [ ./firefox ];
config = lib.mkIf (lib.elem "desktop" config.deploy.profiles) {
nixpkgs.config = {
mumble.speechdSupport = true;
pulseaudio = true;
};
services.xserver.enable = true;
services.xserver.displayManager.lightdm.enable = true;
programs.light.enable = true;
services.tumbler.enable = true;
xdg = {
portal = {
enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-wlr
xdg-desktop-portal-gtk
];
gtkUsePortal = true;
};
};
users.users.kat = {
packages = with pkgs; [
_1password
bitwarden
mpv
element-desktop
mumble
obs-studio
xfce.ristretto
audacity
avidemux
vlc
ffmpeg-full
thunderbird
unstable.syncplay
unstable.youtube-dl
unstable.google-chrome
v4l-utils
transmission-gtk
lm_sensors
baresip
psmisc
unstable.discord
tdesktop
yubikey-manager
pinentry.gtk2
dino
nextcloud-client
vegur
nitrogen
terminator
pavucontrol
gparted
scrot
gimp-with-plugins
vscode
cryptsetup
pcmanfm
neofetch
htop
];
};
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
pinentryFlavor = "gtk2";
};
home-manager.users.kat = {
home.sessionVariables = {
MOZ_ENABLE_WAYLAND = 1;
XDG_CURRENT_DESKTOP = "sway";
XDG_SESSION_TYPE = "wayland";
};
home.file.".gnupg/gpg-agent.conf".text = ''
enable-ssh-support
pinentry-program ${pkgs.pinentry.gtk2}/bin/pinentry
'';
services.nextcloud-client.enable = true;
services.kdeconnect = {
enable = true;
indicator = true;
};
gtk = {
enable = true;
iconTheme = {
name = "Numix-Square";
package = pkgs.numix-icon-theme-square;
};
theme = {
name = "Arc-Dark";
package = pkgs.arc-theme;
};
};
};
services.pcscd.enable = true;
services.udev.packages = [ pkgs.yubikey-personalization ];
fonts.fontconfig.enable = true;
fonts.fonts = [ pkgs.nerdfonts pkgs.corefonts ];
# KDE Connect
networking.firewall = {
allowedTCPPortRanges = [{
from = 1714;
to = 1764;
}];
allowedUDPPortRanges = [{
from = 1714;
to = 1764;
}];
};
sound.enable = true;
hardware.pulseaudio.enable = true;
hardware.opengl.enable = true;
services.xserver.libinput.enable = true;
};
}

View file

@ -1,13 +0,0 @@
{ config, lib, pkgs, ... }:
{
config = lib.mkIf (lib.elem "gaming" config.deploy.profiles) {
hardware.opengl.driSupport32Bit = true;
hardware.opengl.extraPackages32 = with pkgs.pkgsi686Linux; [ libva ];
hardware.pulseaudio.support32Bit = true;
home-manager.users.kat = {
home.packages = [ pkgs.lutris pkgs.steam-run ];
};
};
}

View file

@ -1,28 +0,0 @@
{ config, lib, pkgs, witch, ... }:
{
config = lib.mkIf (lib.elem "desktop" config.deploy.profiles) {
home-manager.users.kat = {
programs.kitty = {
enable = true;
font.name = witch.style.font.name;
settings = {
font_size = witch.style.font.size;
background = witch.style.base16.color0;
background_opacity = "0.7";
foreground = witch.style.base16.color7;
selection_background = witch.style.base16.color7;
selection_foreground = witch.style.base16.color0;
url_color = witch.style.base16.color3;
cursor = witch.style.base16.color7;
active_border_color = "#75715e";
active_tab_background = "#9900ff";
active_tab_foreground = witch.style.base16.color7;
inactive_tab_background = "#3a3a3a";
inactive_tab_foreground = "#665577";
} // witch.style.base16;
};
};
};
}

View file

@ -1,14 +0,0 @@
{ config, lib, pkgs, ... }:
{
config = lib.mkIf (lib.elem "desktop" config.deploy.profiles) {
sound.extraConfig = ''
defaults.pcm.rate_converter "speexrate_best"
'';
hardware.pulseaudio.daemon.config = {
default-sample-format = "s24le";
default-sample-rate = 96000;
resample-method = "soxr-vhq";
};
};
}

View file

@ -1,231 +0,0 @@
{ config, pkgs, lib, witch, ... }:
let
secrets = import ../../../secrets.nix;
in {
config = lib.mkIf (lib.elem "sway" config.deploy.profiles) {
fonts.fonts = with pkgs; [
font-awesome
nerdfonts
iosevka
emacs-all-the-icons-fonts
];
programs.sway.enable = true;
users.users.kat.packages = with pkgs; [ grim slurp ];
systemd.user.services.mako = {
serviceConfig.ExecStart = "${pkgs.mako}/bin/mako";
restartTriggers =
[ config.home-manager.users.kat.xdg.configFile."mako/config".source ];
};
home-manager.users.kat = {
programs.mako = {
enable = true;
defaultTimeout = 3000;
borderColor = witch.style.base16.color7;
backgroundColor = "${witch.style.base16.color0}70";
textColor = witch.style.base16.color7;
};
wayland.windowManager.sway = {
enable = true;
config = let
dmenu =
"${pkgs.bemenu}/bin/bemenu --fn '${witch.style.font.name} ${witch.style.font.size}' --nb '${witch.style.base16.color0}' --nf '${witch.style.base16.color7}' --sb '${witch.style.base16.color1}' --sf '${witch.style.base16.color7}' -l 5 -m -1 -i";
lockCommand = "swaylock -i ${./wallpapers/main.png} -s fill";
cfg = config.home-manager.users.kat.wayland.windowManager.sway.config;
in {
bars = [{ command = "${pkgs.waybar}/bin/waybar"; }];
output = let
left = {
res = "1920x1080";
pos = "0 0";
bg = "${./wallpapers/left.jpg} fill";
};
middle = {
res = "1920x1080";
pos = "1920 0";
bg = "${./wallpapers/main.png} fill";
};
right = {
res = "1920x1080";
pos = "3840 0";
bg = "${./wallpapers/right.jpg} fill";
};
laptop = {
res = "1920x1080";
pos = "0 0";
bg = "${./wallpapers/main.png} fill";
};
in {
"DP-1" = left;
"DVI-D-1" = middle;
"HDMI-A-1" = right;
"eDP-1" = laptop;
};
input = {
"1739:33362:Synaptics_TM3336-002" = {
dwt = "enabled";
tap = "enabled";
natural_scroll = "enabled";
middle_emulation = "enabled";
click_method = "clickfinger";
};
"*" = {
xkb_layout = "gb";
# xkb_variant = "nodeadkeys";
# xkb_options = "ctrl:nocaps";
};
};
fonts = [ "${witch.style.font.name} ${witch.style.font.size}" ];
terminal = "${pkgs.kitty}/bin/kitty";
# TODO: replace with wofi
menu =
"${pkgs.j4-dmenu-desktop}/bin/j4-dmenu-desktop --dmenu=\"${dmenu}\" --term='${cfg.terminal}'";
modifier = "Mod4";
startup = [
{
command = "systemctl --user restart mako";
always = true;
}
{
command =
"${pkgs.swayidle}/bin/swayidle -w before-sleep '${lockCommand}'";
}
];
window = {
border = 1;
titlebar = true;
};
keybindings = {
"${cfg.modifier}+Return" = "exec ${cfg.terminal}";
"${cfg.modifier}+Left" = "focus left";
"${cfg.modifier}+Down" = "focus down";
"${cfg.modifier}+Up" = "focus up";
"${cfg.modifier}+Right" = "focus right";
"${cfg.modifier}+Shift+Left" = "move left";
"${cfg.modifier}+Shift+Down" = "move down";
"${cfg.modifier}+Shift+Up" = "move up";
"${cfg.modifier}+Shift+Right" = "move right";
"${cfg.modifier}+Shift+space" = "floating toggle";
"${cfg.modifier}+space" = "focus mode_toggle";
"${cfg.modifier}+1" = "workspace 1";
"${cfg.modifier}+2" = "workspace 2";
"${cfg.modifier}+3" = "workspace 3";
"${cfg.modifier}+4" = "workspace 4";
"${cfg.modifier}+5" = "workspace 5";
"${cfg.modifier}+6" = "workspace 6";
"${cfg.modifier}+7" = "workspace 7";
"${cfg.modifier}+8" = "workspace 8";
"${cfg.modifier}+9" = "workspace 9";
"${cfg.modifier}+0" = "workspace 10";
"${cfg.modifier}+Shift+1" = "move container to workspace 1";
"${cfg.modifier}+Shift+2" = "move container to workspace 2";
"${cfg.modifier}+Shift+3" = "move container to workspace 3";
"${cfg.modifier}+Shift+4" = "move container to workspace 4";
"${cfg.modifier}+Shift+5" = "move container to workspace 5";
"${cfg.modifier}+Shift+6" = "move container to workspace 6";
"${cfg.modifier}+Shift+7" = "move container to workspace 7";
"${cfg.modifier}+Shift+8" = "move container to workspace 8";
"${cfg.modifier}+Shift+9" = "move container to workspace 9";
"${cfg.modifier}+Shift+0" = "move container to workspace 10";
"XF86AudioRaiseVolume" =
"exec pactl set-sink-volume $(pacmd list-sinks |awk '/* index:/{print $3}') +5%";
"XF86AudioLowerVolume" =
"exec pactl set-sink-volume $(pacmd list-sinks |awk '/* index:/{print $3}') -5%";
"XF86AudioMute" =
"exec pactl set-sink-mute $(pacmd list-sinks |awk '/* index:/{print $3}') toggle";
"XF86AudioMicMute" =
"exec pactl set-source-mute $(pacmd list-sources |awk '/* index:/{print $3}') toggle";
"XF86MonBrightnessDown" = "exec ${pkgs.light}/bin/light -U 5";
"XF86MonBrightnessUp" = "exec ${pkgs.light}/bin/light -A 5";
"${cfg.modifier}+d" = "exec ${cfg.menu}";
"${cfg.modifier}+x" = "exec ${lockCommand}";
"${cfg.modifier}+i" = "move workspace to output left";
"${cfg.modifier}+o" = "move workspace to output left";
"${cfg.modifier}+b" = "splith";
"${cfg.modifier}+v" = "splitv";
"${cfg.modifier}+s" = "layout stacking";
"${cfg.modifier}+w" = "layout tabbed";
"${cfg.modifier}+e" = "layout toggle split";
"${cfg.modifier}+f" = "fullscreen";
"${cfg.modifier}+Shift+q" = "kill";
"${cfg.modifier}+Shift+c" = "reload";
"${cfg.modifier}+r" = "mode resize";
"${cfg.modifier}+Delete" = ''
mode "System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown"'';
};
modes = {
"System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown" =
{
"l" = "exec ${lockCommand}, mode default";
"e" = "exec swaymsg exit, mode default";
"s" = "exec systemctl suspend, mode default";
"h" = "exec systemctl hibernate, mode default";
"r" = "exec systemctl reboot, mode default";
"Shift+s" = "exec systemctl shutdown, mode default";
"Return" = "mode default";
"Escape" = "mode default";
};
};
colors = {
focused = {
border = witch.style.base16.color8;
background = witch.style.base16.color4;
text = witch.style.base16.color0;
indicator = witch.style.base16.color2;
childBorder = witch.style.base16.color8;
};
focusedInactive = {
border = witch.style.base16.color0;
background = witch.style.base16.color11;
text = witch.style.base16.color12;
indicator = witch.style.base16.color2;
childBorder = witch.style.base16.color8;
};
unfocused = {
border = witch.style.base16.color0;
background = witch.style.base16.color8;
text = witch.style.base16.color12;
indicator = witch.style.base16.color8;
childBorder = witch.style.base16.color8;
};
urgent = {
border = witch.style.base16.color8;
background = witch.style.base16.color9;
text = witch.style.base16.color0;
indicator = witch.style.base16.color1;
childBorder = witch.style.base16.color8;
};
};
};
wrapperFeatures.gtk = true;
extraConfig = ''
seat seat0 xcursor_theme breeze_cursors 20
'';
};
};
};
}

View file

@ -1,80 +0,0 @@
{ config, lib, pkgs, witch, ... }:
let
secrets = import ../../../../secrets.nix;
in {
config = lib.mkIf (lib.elem "sway" config.deploy.profiles) {
home-manager.users.kat = {
programs.waybar = {
enable = true;
style = import ./waybar.css.nix {
style = witch.style;
hextorgba = witch.colorhelpers.hextorgba;
};
settings = [{
modules-left = [ "sway/workspaces" "sway/mode" "sway/window" ];
modules-center = [ "clock" "custom/weather" ];
modules-right = [
"pulseaudio"
"network"
"cpu"
"memory"
"temperature"
"backlight"
"battery"
"tray"
];
modules = {
"custom/weather" = {
format = "{}";
interval = 3600;
on-click = "xdg-open 'https://google.com/search?q=weather'";
exec = "nix-shell --command 'python ${
../../../../scripts/weather/weather.py
} ${secrets.profiles.sway.city} ${secrets.profiles.sway.api_key}' ${
../../../../scripts/weather
}";
};
cpu = { format = " {usage}%"; };
memory = { format = " {percentage}%"; };
temperature = { format = " {temperatureC}°C"; };
backlight = {
format = "{icon} {percent}%";
format-icons = [ "" "" ];
on-scroll-up = "${pkgs.light}/bin/light -A 1";
on-scroll-down = "${pkgs.light}/bin/light -U 1";
};
battery = {
states = {
good = 90;
warning = 30;
critical = 15;
};
format = "{icon} {capacity}%";
format-charging = " {capacity}%";
format-plugged = " {capacity}%";
format-alt = "{icon} {time}";
format-icons = [ "" "" "" "" "" ];
};
pulseaudio = {
format = " {volume}%";
on-click = "pavucontrol";
};
network = {
format-wifi = " {essid} ({signalStrength}%)";
format-ethernet = " {ifname}: {ipaddr}/{cidr}";
format-linked = " {ifname} (No IP)";
format-disconnected = " Disconnected ";
format-alt = " {ifname}: {ipaddr}/{cidr}";
};
clock = {
format = " {:%A, %F %T %Z}";
interval = 1;
};
};
}];
};
};
};
}

View file

@ -9,6 +9,6 @@ rec {
deploy = import ./lib/deploy.nix {
inherit pkgs;
inherit (hosts) hosts profiles;
inherit (hosts) hosts groups;
};
}

View file

@ -1,9 +1,9 @@
{ pkgs, hosts, profiles }:
{ pkgs, hosts, groups }:
with pkgs.lib;
(mapAttrs (name: hosts:
pkgs.writeScript "deploy-profile-${name}" ''
pkgs.writeScript "deploy-group-${name}" ''
#!${pkgs.runtimeShell}
export PATH=
${concatMapStrings (host: ''
@ -14,5 +14,5 @@ with pkgs.lib;
# FIXME: remove jobs from PIDLIST once they finish
trap "kill $PID_LIST" SIGINT
wait $PID_LIST
'') profiles)
'') groups)
// (mapAttrs (name: host: host.config.system.build.deployScript) hosts)

View file

@ -1,12 +1,6 @@
{
pkgs,
hostsDir ? ../config/hosts,
privateHostsDir ? ../config/private/hosts,
commonImports ? [ ../config/common ../modules/nixos ],
pkgsPath ? ../pkgs,
sources ? {},
witch ? {}
}:
{ pkgs, hostsDir ? ../config/hosts, privateHostsDir ? ../config/private/hosts
, commonImports ? [ ../config/nixos.nix ../modules/nixos ], pkgsPath ? ../pkgs
, sources ? { }, witch ? { } }:
with pkgs.lib;
@ -14,41 +8,38 @@ rec {
hostNames = attrNames
(filterAttrs (name: type: type == "directory") (builtins.readDir hostsDir));
hostConfig = hostName: { config, ... }: {
_module.args = {
inherit hosts profiles;
};
hostConfig = hostName:
{ config, ... }: {
_module.args = { inherit hosts groups; };
imports = [
(import (hostsDir + "/${hostName}/configuration.nix"))
(import (privateHostsDir + "/${hostName}/configuration.nix"))
../modules/nixos/deploy
] ++ commonImports;
networking = {
inherit hostName;
networking = { inherit hostName; };
nixpkgs.pkgs = import pkgsPath {
inherit (config.nixpkgs) config;
inherit sources;
};
nixpkgs.pkgs = import pkgsPath { inherit (config.nixpkgs) config; inherit sources; };
};
hosts = listToAttrs (
map (
hostName: nameValuePair hostName (
import (pkgs.path + "/nixos/lib/eval-config.nix") {
hosts = listToAttrs (map (hostName:
nameValuePair hostName (import (pkgs.path + "/nixos/lib/eval-config.nix") {
modules = [
(hostConfig hostName)
(if sources ? home-manager then sources.home-manager + "/nixos" else {})
(if sources ? home-manager then
sources.home-manager + "/nixos"
else
{ })
];
specialArgs = { inherit sources witch; };
}
)
) hostNames
);
})) hostNames);
profileNames = unique (concatLists
(mapAttrsToList (name: host: host.config.deploy.profiles) hosts));
groupNames = unique (concatLists
(mapAttrsToList (name: host: host.config.deploy.groups) hosts));
profiles = listToAttrs (map (profileName:
nameValuePair profileName
(filter (host: elem profileName host.config.deploy.profiles)
(attrValues hosts))) profileNames);
groups = listToAttrs (map (groupName:
nameValuePair groupName
(filter (host: elem groupName host.config.deploy.groups)
(attrValues hosts))) groupNames);
}

View file

@ -1,22 +1,23 @@
{
modulesDir,
defaultFile ? "default.nix",
importAll ? false
}:
{ modulesDir, defaultFile ? "default.nix", importAll ? false }:
with builtins;
let
filterAttrNamesToList = filter: set: foldl' (a: b: a ++ b) [] (
map (e: if (filter e set.${e}) then [ e ] else []) (attrNames set)
);
filterAttrNamesToList = filter: set:
foldl' (a: b: a ++ b) [ ]
(map (e: if (filter e set.${e}) then [ e ] else [ ]) (attrNames set));
nameValuePair = name: value: { inherit name value; };
listToAttrs = foldl' (acc: val: acc // { ${val.name} = val.value; }) { };
directories = filterAttrNamesToList (_: type: type == "directory") (readDir modulesDir);
files = map (dir: nameValuePair dir (modulesDir + "/${dir}/${defaultFile}")) directories;
directories =
filterAttrNamesToList (_: type: type == "directory") (readDir modulesDir);
files = map (dir: nameValuePair dir (modulesDir + "/${dir}/${defaultFile}"))
directories;
modules = map ({ name, value }:
# if the file contains a function, assume it to be a module and pass the path
# (for dedup and such). if it contains anything else, pass that.
let m = import value; in { inherit name; value = if (isFunction m) && !importAll then value else m; }
) files;
let m = import value;
in {
inherit name;
value = if (isFunction m) && !importAll then value else m;
}) files;
in (listToAttrs modules)

View file

@ -3,4 +3,6 @@
{
style = import ./style.nix;
colorhelpers = import ./colorhelpers.nix { inherit lib; };
secrets = import ./secrets.nix;
modList = import ./modules.nix;
}

View file

@ -1,9 +1,5 @@
{ sources, ... }:
{
home-manager.users.kat = {
imports = [
(sources.tf-nix + "/modules/home/secrets.nix")
];
};
imports = [ (sources.tf-nix + "/modules/home/secrets.nix") ];
}

View file

@ -1,4 +1,4 @@
{ config, pkgs, lib, ... }:
{ config, pkgs, lib, options, ... }:
with lib;
@ -35,11 +35,18 @@ in {
type = with types; listOf str;
default = [ ];
};
groups = mkOption {
type = with types; listOf str;
default = [ ];
};
};
};
config = mkIf cfg.enable {
deploy.profiles = [ "all" ];
deploy.profile = mkMerge (map (prof: {
${if options ? deploy.profile.${prof} then prof else null} = true;
}) config.deploy.profiles);
deploy.groups = [ "all" ];
system.build.deployScript =
pkgs.writeScript "deploy-${config.networking.hostName}" ''

View file

@ -1,4 +1,5 @@
{ fetchFromGitHub, rustPlatform, pkg-config, lib, libxcb, udev, python3 }:
rustPlatform.buildRustPackage rec {
pname = "screenstub";
version = "2021-01-08";

View file

@ -3,9 +3,12 @@
** TODO Add dork.dev to mailserver
** TODO Migrate non-PGSQL services to PGSQL
** TODO Gitea theme + resources overwrite - See PBB gitea
** Replace current display manager.
** Move network config away from network manager.
** Change profile structure.
** TODO Move network config away from network manager.
** TODO Separate home-manager closure
** TODO Nixfiles working outside of NixOS, e.g. Fedora + macOS
** TODO Investigate nix-darwin
** TODO Investigate pipewire
** TODO Investigate audio source switching (Arctis 5, integrated front, integrated back)
* Secrets handling