Add initial legacy configuration

This commit is contained in:
Fabian Hauser 2025-02-22 20:27:25 +02:00
parent febfe1d970
commit db07652d99
64 changed files with 3287 additions and 13 deletions

View file

@ -0,0 +1,4 @@
{ ... }:
{
catppuccin.flavor = "mocha";
}

View file

@ -0,0 +1,12 @@
{ pkgs, ... }:
{
programs.vscode = {
enable = true;
package = pkgs.vscodium;
extensions = with pkgs.vscode-extensions; [
mkhl.direnv
jnoortheen.nix-ide
];
};
}

View file

@ -0,0 +1,126 @@
{
config,
pkgs,
lib,
...
}:
{
imports = [
./catppuccin.nix
./codium.nix
./emanote.nix
./evolution.nix
./firefox.nix
./gammastep.nix
./git.nix
./gpg.nix
./kanshi.nix
./kitty.nix
./mako.nix
./psql.nix
./scripts.nix
./shell.nix
./ssh.nix
./sway.nix
./swaylock.nix
./vim.nix
./waybar.nix
./webapps.nix
./zed-editor.nix
];
services = {
network-manager-applet.enable = true;
nextcloud-client = {
enable = true;
startInBackground = true;
};
pasystray.enable = true;
blueman-applet.enable = true;
};
home = {
sessionVariables = {
NIXOS_OZONE_WL = "1";
};
packages =
with pkgs;
[
# Networking
transmission_4 # GUI Tools, maybe extract...
]
++ [
# Desktop Environment Applications
google-chrome
chromium
nextcloud-client
xfce.thunar
xfce.thunar-archive-plugin
xfce.xfce4-appfinder
xfce.mousepad
bitwarden-desktop
pinentry-rofi # Required by gnupg
]
++ [
# office
libreoffice-fresh # TODO: Dictionaries, nixos/nixpkgs#14430
tectonic
pandoc
texliveSmall
simple-scan
gnome-online-accounts
gnome-control-center
todoist-electron
obsidian
smile
qdigidoc
]
++ [
# Communication
jitsi-meet-electron
teams-for-linux
rdesktop
davinci-resolve
]
++ [
# Development
virt-manager
modemmanager # TODO: makes sense here?
modem-manager-gui
tealdeer
llm
];
#TODO: Write module
activation.statefulConfigSymlinks = config.lib.dag.entryAfter [ "writeBoundary" ] ''
set -eo pipefail
STATEFUL_ROOT="$HOME/.stateful"
if [ ! -d "$STATEFUL_ROOT" ]; then
$DRY_RUN_CMD mkdir "$STATEFUL_ROOT"
fi
STATEFUL_CONFS=(
".config/spotify"
".mozilla"
".password-store"
)
for STATEFUL_CONF in ''${STATEFUL_CONFS[@]}; do
if [ -e "$STATEFUL_CONF" ] && [ ! -h "$STATEFUL_CONF" ]; then
echo "File $STATEFUL_CONF already exists, exiting!" >&2
exit 1
fi
if [ -h "$STATEFUL_CONF" ]; then
$DRY_RUN_CMD rm "$STATEFUL_CONF"
fi
STATEFUL_CONF_DIR="$STATEFUL_ROOT/$STATEFUL_CONF"
$DRY_RUN_CMD mkdir -p "$STATEFUL_CONF_DIR"
$DRY_RUN_CMD ln -s $VERBOSE_ARG "$STATEFUL_CONF_DIR" "$HOME/$STATEFUL_CONF"
done
'';
};
}

View file

@ -0,0 +1,17 @@
{
inputs,
...
}:
{
imports = [
inputs.emanote.homeManagerModule
];
services.emanote = {
enable = true;
host = "127.0.0.1";
port = 7000;
notes = [
"/home/fhauser/cloud/Notes"
];
};
}

View file

@ -0,0 +1,4 @@
{ ... }:
{
dconf.settings."org/gnome/evolution-data-server/calendar".notify-enable-audio = false;
}

View file

@ -0,0 +1,11 @@
{ pkgs, ... }:
{
programs.firefox = {
enable = true;
package = pkgs.firefox;
};
home.sessionVariables = {
MOZ_ENABLE_WAYLAND = "true";
MOZ_DBUS_REMOTE = "1";
};
}

View file

@ -0,0 +1,14 @@
{ ... }:
{
services.gammastep = {
enable = true;
settings.general.brightness-night = "0.9";
temperature.day = 6300;
temperature.night = 5500;
latitude = "47.2";
longitude = "8.8";
tray = true;
};
}

View file

@ -0,0 +1,104 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
git-absorb
git-trim
];
programs.git = {
enable = true;
package = pkgs.gitAndTools.gitFull;
aliases = {
s = "status --short --branch";
a = "add --patch";
c = "commit --message";
l = "log --color --graph --pretty=format:'%Cred%h%Creset - %C(bold)%s%Creset%C(yellow)%d%Creset %C(green)%an%Creset %C(cyan)%cr%Creset (S: %G?)' --abbrev-commit";
d = "diff";
fup = "commit --fixup";
fuprebase = "rebase --interactive --autosquash";
ignore = "update-index --skip-worktree";
unignore = "update-index --no-skip-worktree";
ignored = ''!git ls-files -v | grep "^S"'';
};
#delta = {
# enable = true;
# catppuccin.enable = true;
# options = {
# side-by-side = "true";
# line-numbers = "true";
# line-numbers-minus-style = "#444444";
# line-numbers-zero-style = "#444444";
# line-numbers-plus-style = "#444444";
# line-numbers-left-format = "{nm:>4}┊";
# line-numbers-right-format = "{np:>4}│";
# line-numbers-left-style = "blue";
# line-numbers-right-style = "blue";
# };
#};
extraConfig = {
init.defaultBranch = "main";
core = {
packedGitWindowSize = "16m";
packedGitLimit = "64m";
};
pack = {
windowMemory = "64m";
packSizeLimit = "64m";
thread = "1";
deltaCacheSize = "1m";
};
color = {
branch = "auto";
diff = "auto";
status = "auto";
};
push = {
default = "current";
autoSetupRemote = true;
};
pull.rebase = "true";
branch.autosetuprebase = "always";
log.follow = true;
rerere.enabled = true;
fetch.recurseSubmodules = "on-demand";
credential.helper = [
"libsecret"
"cache --timeout 21600"
];
};
ignores = [
"*~"
"*.swp"
".direnv/"
];
lfs.enable = true;
includes =
let
mkConfig = (
dir: {
condition = "gitdir:${dir}";
contents = {
user = {
signingkey = "0x8A52A140BEBF7D2C";
email = "fabian@fh2.ch";
name = "Fabian Hauser";
};
};
}
);
in
map mkConfig [
"~/private/"
"~/projects/"
"/etc/nixos/"
"~/.password-store/"
"~/.stateful/"
"~/shares/cloud.qo.is/"
"~/shares/drive.switch.ch/"
];
};
programs.git-credential-oauth.enable = true;
}

View file

@ -0,0 +1,86 @@
{
pkgs,
lib,
...
}:
{
#TODO: ENV variabls for agent
programs.gpg = {
enable = true;
package = pkgs.gnupg;
settings = {
"use-agent" = true;
"trust-model" = "tofu";
"no-emit-version" = true;
"no-comments" = true;
"sig-notation" = "issuer-fpr@notations.openpgp.fifthhorseman.net=%g";
"keyserver" = "hkps://keys.openpgp.org";
"keyserver-options" = "auto-key-retrieve no-honor-keyserver-url";
"personal-cipher-preferences" = "AES256 AES192 AES CAST5";
"cert-digest-algo" = "SHA512";
"personal-digest-preferences" = "SHA512 SHA384 SHA256 SHA224";
"default-preference-list" =
"SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed";
"display-charset" = "utf-8";
"fixed-list-mode" = true;
"with-fingerprint" = true;
"keyid-format" = "0xlong";
"verify-options" = "show-uid-validity";
"list-options" = "show-uid-validity";
};
scdaemonSettings = {
disable-ccid = true;
};
# TODO: Complete this list and maybe transfer to managed configuration?
#publicKeys = [
# { source = "./fabian.hauser@qo.is.pub"; trust = 5; }
#];
};
services.gpg-agent = {
enable = true;
enableScDaemon = true;
enableSshSupport = true;
enableExtraSocket = true;
# TODO: pinentryPackage =
extraConfig =
let
pinentryBemenu = pkgs.writeShellApplication {
name = "pinentry-bemenu-with-env";
text = ''
PATH="$PATH:${pkgs.coreutils}/bin:${pkgs.bemenu}/bin"
"${pkgs.pinentry-bemenu}/bin/pinentry-bemenu" "$@"
'';
};
in
''
pinentry-program ${pinentryBemenu}/bin/pinentry-bemenu-with-env
'';
sshKeys = [
"638143D3F6421377E9D4C7F1D2EDC5AA0A860351" # 0x3E957C9C8CB5D6B2 / fabian.hauser@qo.is
];
};
systemd.user.sockets.yubikey-touch-detector = {
Unit.Description = "Unix socket activation for YubiKey touch detector service";
Socket = {
ListenStream = "%t/yubikey-touch-detector.socket";
RemoveOnStop = true;
};
Install.WantedBy = [ "sockets.target" ];
};
systemd.user.services.yubikey-touch-detector = {
Unit = {
Description = "Detects when your YubiKey is waiting for a touch";
Requires = "yubikey-touch-detector.socket";
};
Service = {
ExecStart = "${lib.getExe pkgs.yubikey-touch-detector} --libnotify";
EnvironmentFile = "-%E/yubikey-touch-detector/service.conf";
};
Install = {
Also = "yubikey-touch-detector.socket";
WantedBy = [ "default.target" ];
};
};
}

View file

@ -0,0 +1,87 @@
{
pkgs,
lib,
...
}:
{
# systemd.user.services.kanshi.Install.WantedBy = "home-manager-fhauser.service"; # TODO: Upstream array type of systemdTarget
services.kanshi = {
enable = true;
settings =
let
mkScreen = display: position: {
inherit (display.output) criteria;
inherit position;
status = "enable";
};
mkProfile = name: outputs: {
profile = {
inherit name outputs;
exec = backgroundCommand;
};
};
# Can be applied by profile.exec
backgroundPicturePath = "~/shares/cloud.qo.is/pictures/backgrounds";
backgroundCommand = ''
${pkgs.sway}/bin/swaymsg "output * bg `find ${backgroundPicturePath} -type f | shuf -n 1` fill"
'';
screens = {
x1-screen.output = {
criteria = "California Institute of Technology 0x1404 Unknown";
scale = null;
};
tallinn-4k.output = {
criteria = "HP Inc. HP Z27 CN482201RP";
scale = 1.2;
};
chur-dell.output = {
criteria = "Dell Inc. DELL P2720DC 22JPK53";
scale = null;
};
chur-small.output = {
criteria = "Eizo Nanao Corporation EV2450 92395086";
scale = null;
};
tallinn-thinkvision.output = {
criteria = "Lenovo Group Limited LEN P24h-20 V307DA61";
scale = null;
};
tallinn-tv.output = {
criteria = "Samsung Electric Company SAMSUNG 0x01000E00";
scale = 2.0;
};
walrueti-buero.output = {
criteria = "Dell Inc. DELL U2719D 12DGV13";
scale = null;
};
};
in
with lib;
(attrValues screens)
++ (with screens; [
(mkProfile "mobile-only" [
(mkScreen x1-screen "0,0")
])
(mkProfile "desktop-oly" [
(mkScreen tallinn-4k "0,0")
])
(mkProfile "home-dock" [
(mkScreen x1-screen "0,120")
(mkScreen tallinn-4k "1920,0")
])
(mkProfile "saba-desk" [
(mkScreen x1-screen "0,0")
(mkScreen tallinn-thinkvision "1920,0")
])
(mkProfile "tv" [
((mkScreen x1-screen "0,0") // { status = "disable"; })
(mkScreen tallinn-tv "0,0")
])
(mkProfile "walrueti" [
(mkScreen x1-screen "0,0")
(mkScreen walrueti-buero "1920,0")
])
]);
};
}

View file

@ -0,0 +1,8 @@
{ ... }:
{
programs.kitty = {
enable = true;
settings.term = "xterm";
};
catppuccin.kitty.enable = true;
}

View file

@ -0,0 +1,16 @@
{ ... }:
{
services.mako = {
enable = true;
#backgroundColor = "#CCCCCCCC"; # TODO: Make layout colors in a central place
borderSize = 0;
#borderColor = "#4C7899FF";
defaultTimeout = 1500;
#ignoreTimeout = true;
#textColor = "#FFFFFFFF";
#width = 300;
#height = 100;
#font = "monospace 10";
}; # TODO
catppuccin.mako.enable = true;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

View file

@ -0,0 +1,21 @@
{ ... }:
{
home.file.".psqlrc".text = ''
\set QUIET 1
\pset linestyle unicode
\pset border 2
\set null [null]
\set COMP_KEYWORD_CASE upper
\set ON_ERROR_ROLLBACK interactive
\set PROMPT1 '%[%033[1m%]%M/%/%R%[%033[0m%]%# '
\set PROMPT2 ''''
\set VERBOSITY verbose
\timing
\x auto
\unset QUIET
\conninfo
'';
}

View file

@ -0,0 +1,66 @@
{ pkgs, ... }:
let
suspend = pkgs.writeScriptBin "suspend" ''
#!${pkgs.stdenv.shell}
${pkgs.systemd}/bin/systemctl suspend
'';
passbemenu = pkgs.writeScriptBin "passbemenu" ''
#!${pkgs.stdenv.shell}
shopt -s nullglob globstar
typeit=0
if [[ $1 == "--type" ]]; then
typeit=1
shift
fi
export BEMENU_BACKEND=wayland
prefix=''${PASSWORD_STORE_DIR-~/.password-store}
password_files=( $(find -L "$prefix" -type f -name '*.gpg') )
password_files=( "''${password_files[@]#"$prefix"/}" )
password_files=( "''${password_files[@]%.gpg}" )
password=$(printf '%s\n' "''${password_files[@]}" | \
${pkgs.bemenu}/bin/bemenu --list 20 --ignorecase --prompt 'Pass: ' "$@")
[[ -n $password ]] || exit
password_value=$(${pkgs.pass-wayland}/bin/pass show "$password" | tail -1 2>/dev/null)
${pkgs.wtype}/bin/wtype "''${password_value}"
'';
bt-connect = pkgs.writeShellApplication {
name = "bt";
meta.description = "Connect known Bluetooth device";
runtimeInputs = [ pkgs.bluez ];
text = ''
COMMAND="connect"
if [[ $1 == "--disconnect" ]]; then
COMMAND="disconnect"
shift
fi
DEVICE="";
case "$1" in
headset)
DEVICE="88:C9:E8:7A:11:C2"
;;
*)
echo "Unknown Device" >&2
exit 1
;;
esac
exec bluetoothctl $COMMAND $DEVICE
'';
};
in
{
home.packages = [
passbemenu
suspend
bt-connect
];
}

View file

@ -0,0 +1,72 @@
{ ... }:
{
programs = {
bash = {
enable = true;
historyIgnore = [
"ls"
"cd"
"exit"
"j"
];
shellAliases = {
# Sane defaults
l = "ls -lah";
cp = "cp --reflink=auto";
pwgen = "pwgen -c -n -s -N 30";
bc = "bc --mathlib";
cal = "cal -m";
curl = "curl -L";
ack = "rg";
# Git helpers
git-fetch-pr = "git config --add remote.origin.fetch '+refs/pull/*/head:refs/remotes/origin/pr/*'";
git-config-fetchall = ''git config --add remote.origin.fetch "+refs/pull/*/head:refs/remotes/origin/pr/*"'';
git-enable-signing = "git config commit.gpgsign true && git config tag.gpgsign true";
# Common Typos
gits = "git s";
};
initExtra = ''
function o(){
xdg-open "$*" >/dev/null 2>&1 &
}
'';
shellOptions = [
"autocd"
"checkjobs"
"dotglob"
"globstar"
"histappend"
];
sessionVariables = {
#TODO: Some of these should be migrated to the according application.
GPG_TTY = "$(tty)";
PGDATABASE = "postgres";
NIXOS_OZONE_WL = "1";
};
};
autojump = {
enable = true;
enableBashIntegration = true;
};
powerline-go = {
enable = true;
settings = {
hostname-only-if-ssh = true;
numeric-exit-codes = true;
colorize-hostname = true;
cwd-max-depth = 4;
cwd-max-dir-size = 48;
cwd-mode = "semifancy";
modules = "ssh,host,root,cwd,perms,dotenv,venv,nix-shell,git,jobs";
};
};
direnv = {
enable = true;
enableBashIntegration = true;
nix-direnv.enable = true;
};
};
}

View file

@ -0,0 +1,26 @@
{ pkgs, ... }:
{
programs.ssh =
let
forceIdentityPrivate = {
identityFile = toString (
pkgs.writeText "fabian.hauser@qo.is.pub" ''
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDIPF8ZV7vhpbVvLxiKq8ANVusNUHMbtii5MuvjxCbVz7vSNVPo9OOLvYyDqhbRAWMTdQeGZVAaALBufKKmprDTRFMpnA7Ut4TFrdz/5DTaR2KEjJ7P75moH+0xooR/GsbzFGsNBSQSXK3u1igndPYEC/PqCHN++32kDo2wLqTB4VLrEovU3iq8BMckn329Bu1fGbXKTgDpEvUEEwFO2brQZLMmzILGF/v4B9ImEGtinAUNgDSfEpgPN23sdWQH9rwEClGv95JmWNf05tuVomhZzOBtCFoAno3XB1nj16avjsqJ3aGFY2CCcfsNrwKzhIotmm82bcI4BJuJIVRIKbZ1 cardno:000610954665
''
);
identitiesOnly = true;
};
in
{
enable = true;
matchBlocks = {
"github.com" = forceIdentityPrivate // {
user = "git";
};
};
extraConfig = ''
IdentityAgent /run/user/1000/gnupg/S.gpg-agent.ssh
'';
#TODO: Authorized keys implementation, see https://github.com/nix-community/home-manager/pull/9
};
}

View file

@ -0,0 +1,171 @@
{
pkgs,
lib,
config,
...
}:
let
adhereTheSwayTarget = {
Install.WantedBy = lib.mkForce [ "sway-session.target" ];
Unit.PartOf = lib.mkForce [ "sway-session.target" ];
};
# TODO: active screen with -m $active_screen
bemenuLauncher = pkgs.writeScriptBin "bemenuLauncher" ''
#!${pkgs.stdenv.shell}
#active_screen=$(swaymsg -r -t get_outputs | \
# ${pkgs.jq}/bin/jq '. [] | select (.focused == true) | .name | split ("-") | last')
${pkgs.dmenu}/bin/dmenu_path | \
${pkgs.bemenu}/bin/bemenu --list 20 --ignorecase --prompt 'Start: ' | \
xargs swaymsg exec --
'';
in
rec {
home.packages = with pkgs; [
sway-contrib.grimshot
wl-clipboard
libappindicator
adwaita-icon-theme
gnome-icon-theme
hicolor-icon-theme # TODO: Move these requirements?
fuzzel # Required for rofimoji
];
xsession.preferStatusNotifierItems = true;
wayland.windowManager.sway = {
enable = true;
systemd.enable = true;
xwayland = true;
wrapperFeatures = {
gtk = true;
};
extraSessionCommands = ''
#export XDG_CURRENT_DESKTOP=Unity
export XDG_CURRENT_DESKTOP=sway
export XDG_SESSION_TYPE="wayland"
export _JAVA_AWT_WM_NONREPARENTING=1
export QT_QPA_PLATFORM=wayland
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
# TODO: QTpie
export WLR_DRM_NO_MODIFIERS=1
export WLR_NO_HARDWARE_CURSORS=1
'';
config = {
input = {
"type:keyboard" = {
xkb_layout = "ch,de";
xkb_options = "eurosign:e";
};
"*" = {
xkb_numlock = "enable";
};
};
terminal = "${pkgs.kitty}/bin/kitty";
menu = "${bemenuLauncher}/bin/bemenuLauncher";
gaps.inner = 8;
modifier = "Mod4";
window.border = 0;
#colors.focused.border = "#323232";
#TODO: Workspace Programm assignment: Not working properly
assigns = {
"10" = [ { app_id = "^firefox$"; } ];
"11" = [ { app_id = "^(claws-mail|thunderbird|evolution)$"; } ];
"12" = [
{
class = "^Chromium-browser$";
instance = "^web.threema.ch";
}
];
"13" = [ { class = "^Spotify$"; } ];
};
keybindings =
let
mod = wayland.windowManager.sway.config.modifier;
playerctl = "${pkgs.playerctl}/bin/playerctl";
wpctl = "${pkgs.wireplumber}/bin/wpctl";
light = "${pkgs.light}/bin/light";
in
lib.mkOptionDefault {
"${mod}+p" = "exec passbemenu";
"${mod}+Shift+d" = "exec ${pkgs.rofimoji}/bin/rofimoji --action clipboard --selector fuzzel";
"${mod}+x" = "move workspace to output right";
"${mod}+y" = "move workspace to output left";
"${mod}+section" = "workspace 0";
"${mod}+0" = "workspace 10";
"${mod}+apostrophe" = "workspace 11";
"${mod}+dead_circumflex" = "workspace 12";
"${mod}+dead_diaeresis" = "workspace 13";
"${mod}+dollar" = "workspace 14";
"${mod}+Shift+section" = "move container to workspace 0";
"${mod}+Shift+0" = "move container to workspace 10";
"${mod}+Shift+apostrophe" = "move container to workspace 11";
"${mod}+Shift+dead_circumflex" = "move container to workspace 12";
"${mod}+Shift+dead_diaeresis" = "move container to workspace 13";
"${mod}+Shift+dollar" = "move container to workspace 14";
"Ctrl+mod1+l" = "exec ${pkgs.systemd}/bin/loginctl lock-session";
"Ctrl+mod1+Shift+L" = "exec ${pkgs.systemd}/bin/systemctl suspend";
# pulse audio volume control
XF86AudioLowerVolume = "exec ${wpctl} set-volume @DEFAULT_AUDIO_SINK@ 3%-";
XF86AudioRaiseVolume = "exec ${wpctl} set-volume @DEFAULT_AUDIO_SINK@ 3%+";
XF86AudioMute = "exec ${wpctl} set-mute @DEFAULT_AUDIO_SINK@ toggle";
XF86AudioMicMute = "exec ${wpctl} set-mute @DEFAULT_AUDIO_SOURCE@ toggle";
# Spotify control
XF86AudioPause = "exec ${playerctl} play-pause";
XF86AudioPlay = "exec ${playerctl} play-pause";
XF86AudioNext = "exec ${playerctl} next";
XF86AudioPrev = "exec ${playerctl} previous";
# screen brightness
XF86MonBrightnessUp = "exec ${light} -A 10";
XF86MonBrightnessDown = "exec ${light} -U 5";
# screenshot
Print = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot copy area";
};
};
extraConfig = ''
# Disable the laptop screen when the lid is closed.
bindswitch --reload lid:on output eDP-1 disable
bindswitch --reload lid:off output eDP-1 enable
# Workaround for https://bugs.chromium.org/p/chromium/issues/detail?id=1338554
for_window [app_id="^chrome-.*-.*$"] shortcuts_inhibitor disable
output "*" bg ${./mountain.jpg} fill
'';
};
catppuccin.sway.enable = true;
systemd.user.services.network-manager-applet = adhereTheSwayTarget;
systemd.user.services.nextcloud-client = adhereTheSwayTarget // {
# For trayicon to work:
Unit.After = lib.mkForce [ "waybar.service" ];
Service = {
ExecStartPre = "${pkgs.coreutils}/bin/sleep 3";
Environment = lib.mkForce "PATH=${config.home.profileDirectory}/bin XDG_CURRENT_DESKTOP=Unity";
};
};
systemd.user.services.pasystray = adhereTheSwayTarget;
gtk = {
iconTheme = {
# package = pkgs.gnome-icon-theme;
# name = "gnome";
package = pkgs.hicolor_icon_theme;
name = "hicolor";
};
gtk3.extraConfig.gtk-menu-images = true;
};
catppuccin.gtk.enable = true;
dconf.settings = {
"org/gnome/desktop/interface".menus-have-icons = true;
};
}

View file

@ -0,0 +1,36 @@
{ pkgs, ... }:
{
systemd.user.services.swayidle =
let
lock = "${pkgs.swaylock}/bin/swaylock --hide-keyboard-layout --daemonize --show-failed-attempts --color=000000";
logTimeCmd = "${pkgs.coreutils}/bin/date --rfc-3339=seconds >> ~/locklog";
idleCmd = (action: ''${pkgs.sway}/bin/swaymsg "output * dpms ${action}" && ${logTimeCmd}'');
timeout-screens-off = 600;
timeout-lock = 630;
timeout-suspend = 1800;
in
{
Unit = {
Description = "Idle Manager for Wayland";
Documentation = [ "man:swayidle(1)" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
Environment = "PATH=${pkgs.bash}/bin";
ExecStart = ''
${pkgs.swayidle}/bin/swayidle -w -d \
timeout ${toString timeout-lock} '${lock}' \
timeout ${toString timeout-screens-off} '${idleCmd "off"}' \
resume '${idleCmd "on"}' \
timeout ${toString timeout-suspend} '${pkgs.systemd}/bin/systemctl suspend' \
lock '${lock}' \
before-sleep '${lock}';
''; # TODO: Make this configurable and add home-manager module. (Requires sway with systemd-target support)
};
Install = {
WantedBy = [ "sway-session.target" ];
};
};
catppuccin.swaylock.enable = true;
}

View file

@ -0,0 +1,58 @@
{ pkgs, ... }:
{
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
extraConfig = ''
" colorscheme elflord
set autoindent
set ruler
set pastetoggle=<F2>
set splitbelow
set splitright
set mouse=
set hidden
set expandtab
set tabstop=2
set softtabstop=2
set listchars="eol:¬,tab:>·,trail:~,extends:>,precedes:<,space:"
set grepprg=ack\ -k
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_mode_map = { 'mode': 'passive', 'active_filetypes': [],'passive_filetypes': [] }
"nnoremap <C-w>E :SyntasticCheck<CR> :SyntasticToggleMode<CR>
" Rust
"let g:rustfmt_autosave = 1
let g:racer_cmd="~/.cargo/bin/racer"
"let g:racer_experimental_completer = 1
au FileType rust nmap gd <Plug>(rust-def)
au FileType rust nmap gs <Plug>(rust-def-split)
au FileType rust nmap gx <Plug>(rust-def-vertical)
au FileType rust nmap <leader>gd <Plug>(rust-doc)
" Typescript
au BufRead,BufNewFile *.ts setfiletype typescript
" Options
filetype plugin indent on
syntax on
'';
plugins = with pkgs.vimPlugins; [
vim-sensible
vim-airline
];
};
catppuccin.nvim.enable = true;
}

View file

@ -0,0 +1,348 @@
{
config,
...
}:
{
xsession.preferStatusNotifierItems = true;
wayland.windowManager.sway.config.bars = [ ];
programs.waybar = {
enable = true;
systemd = {
enable = true;
target = "tray.target";
};
settings = [
{
position = "top";
#height =
modules-left = [
"sway/mode"
"sway/workspaces"
];
modules-center = [ "sway/window" ];
modules-right = [
"idle_inhibitor"
"backlight"
"battery"
"pulseaudio"
"tray"
"clock"
];
backlight.format = " {percent}%";
disk.format = " {percentage_used}%";
clock.format = "{:%Y-%m-%d%H:%M}";
"sway/workspaces" = {
disable-scroll-wraparound = true;
enable-bar-scroll = true;
numeric-first = true;
};
battery = {
interval = 60;
states = {
warning = 15;
critical = 10;
};
format = " {capacity}% {time}"; # Icon: bolt
format-discharging = "{icon} {capacity}% {time}";
format-time = "{H}:{M}";
format-icons = [
"" # Icon: battery-full
"" # Icon: battery-three-quarters
"" # Icon: battery-half
"" # Icon: battery-quarter
"" # Icon: battery-empty
];
tooltip = "true";
};
cpu = {
interval = "5";
format = " {usage}% ({load})"; # Icon: microchip
states = {
warning = "70";
critical = "90";
};
};
memory = {
interval = "5";
format = " {}%"; # Icon: microchip
states = {
warning = "70";
critical = "90";
};
};
"sway/mode" = {
format = ''<span style="italic"> {}</span>''; # Icon: expand-arrows-alt
tooltip = "false";
};
"sway/window" = {
format = "{}";
max-length = "120";
};
"sway/workspaces" = {
all-outputs = false;
disable-scroll = true;
format = "{icon}";
format-icons = {
"10" = " 10";
"11" = " 11";
"12" = " 12";
"13" = " 13";
};
};
pulseaudio = {
scroll-step = 3;
format = "{icon} {volume}%";
format-bluetooth = "{icon} {volume}%";
format-muted = "🔇";
format-icons = {
headphones = "";
handsfree = "";
headset = "";
phone = "";
portable = "";
car = "";
default = [
""
""
""
];
};
on-click = "pavucontrol";
};
idle_inhibitor = {
format = "{icon}";
format-icons = {
activated = " active";
deactivated = "";
};
};
tray = {
icon-size = "21";
spacing = "10";
};
}
];
style = ''
/* =============================================================================
*
* Waybar configuration
*
* Configuration reference: https://github.com/Alexays/Waybar/wiki/Configuration
*
* =========================================================================== */
/* -----------------------------------------------------------------------------
* Keyframes
* -------------------------------------------------------------------------- */
@keyframes blink-warning {
70% {
color: white;
}
to {
color: white;
background-color: orange;
}
}
@keyframes blink-critical {
70% {
color: white;
}
to {
color: white;
background-color: red;
}
}
/* -----------------------------------------------------------------------------
* Base styles
* -------------------------------------------------------------------------- */
/* Reset all styles */
* {
border: none;
border-radius: 0;
min-height: 0;
margin: 0;
padding: 0;
}
/* The whole bar */
#waybar {
background: #323232;
color: white;
/*font-family: Cantarell, Noto Sans, sans-serif;*/
font-size: 13px;
}
/* Each module */
#battery,
#clock,
#cpu,
#custom-keyboard-layout,
#memory,
#mode,
#network,
#pulseaudio,
#temperature,
#backlight,
#idle_inhibitor,
#tray {
margin-left: 5px;
margin-right: 5px;
padding-left: 5px;
padding-right: 5px;
/*border-right: solid 1px black;*/
}
#backlight {
margin-right: 0;
padding-right: 0;
}
#idle_inhibiter {
margin-left: 0;
padding-left: 0;
}
/* -----------------------------------------------------------------------------
* Module styles
* -------------------------------------------------------------------------- */
#battery {
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#battery.warning {
color: orange;
}
#battery.critical {
color: red;
}
#battery.warning.discharging {
animation-name: blink-warning;
animation-duration: 4s;
}
#battery.critical.discharging {
animation-name: blink-critical;
animation-duration: 3s;
}
#clock {
font-weight: bold;
}
#cpu {
/* No styles */
}
#cpu.warning {
color: orange;
}
#cpu.critical {
color: red;
}
#memory {
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#memory.warning {
color: orange;
}
#memory.critical {
color: red;
animation-name: blink-critical;
animation-duration: 2s;
}
#mode {
background: #64727D;
border-top: 2px solid white;
/* To compensate for the top border and still have vertical centering */
padding-bottom: 2px;
}
#network {
/* No styles */
}
#network.disconnected {
color: orange;
}
#pulseaudio {
/* No styles */
}
#pulseaudio.muted {
/* No styles */
}
#custom-spotify {
color: rgb(102, 220, 105);
}
#temperature {
/* No styles */
}
#temperature.critical {
color: red;
}
#tray {
/* No styles */
}
#window {
font-weight: bold;
}
#workspaces button {
border-top: 2px solid transparent;
/* To compensate for the top border and still have vertical centering */
padding-bottom: 2px;
padding-left: 10px;
padding-right: 10px;
color: #888888;
}
#workspaces button.focused {
border-color: #4c7899;
color: white;
background-color: #285577;
}
#workspaces button.urgent {
border-color: #c9545d;
color: #c9545d;
}
'';
};
}

View file

@ -0,0 +1,18 @@
{ pkgs, ... }:
let
web-app =
name: url:
pkgs.writeScriptBin name ''
#!${pkgs.stdenv.shell}
exec ${pkgs.chromium}/bin/chromium --user-data-dir=$HOME/.config/chromium-app-${name} --app="${url}"
'';
whatsapp = web-app "whatsapp" "https://web.whatsapp.com/";
threema = web-app "threema" "https://web-beta.threema.ch/";
in
{
home.packages = [
whatsapp
threema
];
}

View file

@ -0,0 +1,53 @@
{ pkgs, ... }:
{
programs.zed-editor = {
enable = true;
extensions = [
"nix"
"cspell"
"latex"
"sql"
"toml"
"plantuml"
"helm"
"html"
"svelte"
"java"
"kotlin"
];
extraPackages = with pkgs; [
nixd
nodePackages.cspell
direnv
];
userSettings = {
assistant = {
default_model = {
provider = "openai";
model = "o1-mini";
};
version = "2";
};
vim_mode = false;
ui_font_size = 16;
buffer_font_size = 16;
theme = {
mode = "system";
light = "Andromeda";
dark = "One Dark";
};
telemetry = {
diagnostics = false;
metrics = false;
};
languages = {
Markdown.remove_trailing_whitespace_on_save = false;
Markdown-Inline.remove_trailing_whitespace_on_save = false;
};
};
};
}