machines: Add trek
, my Framework laptop
.. and with it, all the infrastructure for desktop systems; as well as laptop-specific things like WiFi and TLP. Signed-off-by: Christoph Heiss <christoph@c8h4.io>
This commit is contained in:
parent
b5990b079a
commit
6955ea6a96
2
Makefile
2
Makefile
|
@ -20,7 +20,7 @@ lint:
|
|||
find . -type f -name '*.nix' -exec $(NIXFMT) --check {} +
|
||||
|
||||
build-all:
|
||||
for m in name; do $(MAKE) build M=$$m; done
|
||||
for m in name trek; do $(MAKE) build M=$$m; done
|
||||
|
||||
upload-secrets-all:
|
||||
$(MORPH) upload-secrets --passwd ./default.nix
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
* `name`: LXC container running unbound + blocky.
|
||||
|
||||
* `trek`: Framework laptop.
|
||||
|
||||
* `pkgs`: Custom packages.
|
||||
|
||||
* `secrets`: Secrects encrypted using [git-crypt](https://github.com/AGWA/git-crypt).
|
||||
|
|
|
@ -3,5 +3,4 @@
|
|||
{
|
||||
services.fstrim.enable = true;
|
||||
services.irqbalance.enable = !config.boot.isContainer;
|
||||
services.fwupd.enable = !config.boot.isContainer;
|
||||
}
|
||||
|
|
11
default.nix
11
default.nix
|
@ -3,12 +3,19 @@ let
|
|||
pkgs = import (fetchTarball
|
||||
"https://github.com/NixOS/nixpkgs/archive/${nixpkgsCommit}.zip") { };
|
||||
in {
|
||||
network.description = "c8h4.io infrastructure";
|
||||
network.pkgs = pkgs;
|
||||
network = {
|
||||
inherit pkgs;
|
||||
description = "c8h4.io infrastructure";
|
||||
};
|
||||
|
||||
name = {
|
||||
_module.args.machineName = "name.c8h4.io";
|
||||
imports = [ ./machines/name.nix ];
|
||||
};
|
||||
|
||||
trek = {
|
||||
_module.args.machineName = "trek.c8h4.io";
|
||||
imports = [ ./machines/trek.nix ];
|
||||
};
|
||||
}
|
||||
|
||||
|
|
BIN
extra/sway/background.jpg
Normal file
BIN
extra/sway/background.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.1 MiB |
61
extra/waybar/style.css
Normal file
61
extra/waybar/style.css
Normal file
|
@ -0,0 +1,61 @@
|
|||
* {
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
font-family: "Jetbrains Mono", "Font Awesome 6 Free Solid";
|
||||
font-size: 15px;
|
||||
box-shadow: none;
|
||||
text-shadow: none;
|
||||
transition-duration: 0s;
|
||||
}
|
||||
|
||||
window {
|
||||
color: rgba(217, 216, 216, 1);
|
||||
background: rgba(35, 31, 32, 0.8);
|
||||
}
|
||||
|
||||
#workspaces {
|
||||
margin: 0 5px;
|
||||
}
|
||||
|
||||
#workspaces button {
|
||||
padding: 0 5px;
|
||||
color: rgba(217, 216, 216, 0.4);
|
||||
}
|
||||
|
||||
#workspaces button.visible {
|
||||
color: rgba(217, 216, 216, 1);
|
||||
border-top: 1px solid rgba(0, 0, 0, 0);
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
#workspaces button.focused {
|
||||
border-top: 2px solid rgba(217, 216, 216, 1);
|
||||
border-bottom: unset;
|
||||
}
|
||||
|
||||
#workspaces button:hover {
|
||||
background: rgba(167, 171, 176, 0.6);
|
||||
color: rgba(255, 255, 255, 1);
|
||||
}
|
||||
|
||||
#workspaces button.urgent {
|
||||
color: rgba(238, 46, 36, 1);
|
||||
}
|
||||
|
||||
#mode, #battery, #cpu, #memory, #network, #pulseaudio, #idle_inhibitor, #backlight, #custom-spotify {
|
||||
margin: 0px 6px 0px 10px;
|
||||
min-width: 25px;
|
||||
}
|
||||
|
||||
#clock {
|
||||
margin: 0px 16px 0px 10px;
|
||||
min-width: 140px;
|
||||
}
|
||||
|
||||
#battery.warning {
|
||||
color: rgba(255, 210, 4, 1);
|
||||
}
|
||||
|
||||
#battery.critical {
|
||||
color: rgba(238, 46, 36, 1);
|
||||
}
|
39
extra/wofi/style.css
Normal file
39
extra/wofi/style.css
Normal file
|
@ -0,0 +1,39 @@
|
|||
* {
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
window {
|
||||
background-color: #7c818c;
|
||||
}
|
||||
|
||||
#input {
|
||||
margin: 5px;
|
||||
border-radius: 0px;
|
||||
border: none;
|
||||
border-bottom: 3px solid black;
|
||||
background-color: #383c4a;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#inner-box {
|
||||
background-color: #383C4A;
|
||||
}
|
||||
|
||||
#outer-box {
|
||||
margin: 5px;
|
||||
padding:20px;
|
||||
background-color: #383C4A;
|
||||
}
|
||||
|
||||
#text {
|
||||
padding: 5px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#entry:nth-child(even){
|
||||
background-color: #404552;
|
||||
}
|
||||
|
||||
#entry:selected {
|
||||
background-color: #5291e2;
|
||||
}
|
51
machines/trek.nix
Normal file
51
machines/trek.nix
Normal file
|
@ -0,0 +1,51 @@
|
|||
let
|
||||
nixosHardwareCommit = "a6aa8174fa61e55bd7e62d35464d3092aefe0421";
|
||||
nixosHardware = fetchTarball
|
||||
"https://github.com/NixOS/nixos-hardware/archive/${nixosHardwareCommit}.zip";
|
||||
in {
|
||||
imports = [
|
||||
"${nixosHardware}/framework/12th-gen-intel"
|
||||
../common
|
||||
../system/desktop.nix
|
||||
../system/laptop.nix
|
||||
../system/ucode-intel.nix
|
||||
../system/wifi.nix
|
||||
];
|
||||
|
||||
system.stateVersion = "23.05";
|
||||
|
||||
boot.initrd.luks.devices."cryptlvm".device =
|
||||
"/dev/disk/by-uuid/f2901f09-5100-47ad-939b-6aa6ee5b0519";
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "sd_mod" ];
|
||||
boot.initrd.kernelModules = [ "dm-snapshot" "i915" ];
|
||||
boot.kernelParams = [ "i915.force_probe=46a6" ];
|
||||
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-uuid/ec22a0d8-2ae0-4266-b67d-a30bf6957b91";
|
||||
fsType = "btrfs";
|
||||
};
|
||||
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-uuid/1182-30BA";
|
||||
fsType = "vfat";
|
||||
};
|
||||
|
||||
fileSystems."/home" = {
|
||||
device = "/dev/disk/by-uuid/1eb8c5aa-c833-4513-9f0b-54e29986deb6";
|
||||
fsType = "btrfs";
|
||||
};
|
||||
|
||||
console.keyMap = "dvorak";
|
||||
powerManagement.cpuFreqGovernor = "powersave";
|
||||
|
||||
home-manager.users.christoph.wayland.windowManager.sway.config = {
|
||||
gaps.outer = 1;
|
||||
input."type:touchpad" = {
|
||||
dwt = "enabled";
|
||||
tap = "enabled";
|
||||
natural_scroll = "enabled";
|
||||
};
|
||||
input."type:keyboard".xkb_layout = "us(dvorak),at";
|
||||
output."*".scale = "1.5";
|
||||
};
|
||||
}
|
BIN
secrets/email.nix
Normal file
BIN
secrets/email.nix
Normal file
Binary file not shown.
133
system/desktop.nix
Normal file
133
system/desktop.nix
Normal file
|
@ -0,0 +1,133 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [ ../common ../services/openssh.nix ./home-manager/desktop.nix ];
|
||||
|
||||
boot.kernelPackages = pkgs.linuxPackages_zen;
|
||||
boot.kernelParams = [ "audit=0" ];
|
||||
|
||||
documentation = {
|
||||
man.generateCaches = true;
|
||||
man.man-db.enable = true;
|
||||
dev.enable = true;
|
||||
nixos.enable = true;
|
||||
};
|
||||
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
alsa.enable = true;
|
||||
pulse.enable = true;
|
||||
};
|
||||
|
||||
security.rtkit.enable = true;
|
||||
|
||||
# Fixes swaylock installed through home-manager.
|
||||
# https://github.com/NixOS/nixpkgs/issues/158025#issuecomment-1344766809
|
||||
security.pam.services.swaylock = { };
|
||||
|
||||
fonts = {
|
||||
enableDefaultFonts = true;
|
||||
fonts = with pkgs; [
|
||||
font-awesome
|
||||
noto-fonts
|
||||
noto-fonts-emoji
|
||||
noto-fonts-extra
|
||||
jetbrains-mono
|
||||
];
|
||||
fontconfig.defaultFonts.monospace = [ "Jetbrains Mono" ];
|
||||
fontconfig.localConf = ''
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
|
||||
<fontconfig>
|
||||
<description>Disable ligatures for monospaced fonts</description>
|
||||
<match target="font">
|
||||
<test name="family" compare="eq" ignore-blanks="true">
|
||||
<string>Jetbrains Mono</string>
|
||||
</test>
|
||||
<edit name="fontfeatures" mode="append">
|
||||
<string>liga off</string>
|
||||
<string>dlig off</string>
|
||||
</edit>
|
||||
</match>
|
||||
</fontconfig>
|
||||
'';
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
bitwarden-cli
|
||||
blender
|
||||
cargo-bloat
|
||||
cargo-edit
|
||||
cargo-expand
|
||||
cargo-flamegraph
|
||||
cargo-geiger
|
||||
cargo-license
|
||||
cargo-watch
|
||||
clang
|
||||
cmake
|
||||
easyeffects
|
||||
gcc
|
||||
gdb
|
||||
git
|
||||
git-crypt
|
||||
krita
|
||||
libreoffice-fresh
|
||||
librespot
|
||||
linuxPackages.cpupower
|
||||
lldb
|
||||
lm_sensors
|
||||
meson
|
||||
ninja
|
||||
pavucontrol
|
||||
powertop
|
||||
rustup
|
||||
smartmontools
|
||||
spotify-qt
|
||||
texlive.combined.scheme-medium
|
||||
wally-cli
|
||||
imv
|
||||
wl-clipboard
|
||||
];
|
||||
|
||||
environment.pathsToLink = [ "/share/zsh" ];
|
||||
|
||||
hardware.keyboard.zsa.enable = true;
|
||||
hardware.opengl.enable = true;
|
||||
|
||||
programs.firefox = {
|
||||
enable = true;
|
||||
languagePacks = [ "en-US" ];
|
||||
};
|
||||
|
||||
programs.ssh.pubkeyAcceptedKeyTypes = [ "ssh-ed25519" ];
|
||||
|
||||
programs.gnupg.agent = {
|
||||
enable = true;
|
||||
enableSSHSupport = true;
|
||||
};
|
||||
|
||||
services.flatpak.enable = true;
|
||||
services.fwupd.enable = true;
|
||||
|
||||
virtualisation.podman = {
|
||||
enable = true;
|
||||
autoPrune.enable = true;
|
||||
};
|
||||
|
||||
xdg.mime = {
|
||||
enable = true;
|
||||
defaultApplications = {
|
||||
"x-scheme-handler/http" = "org.mozilla.firefox.desktop";
|
||||
"x-scheme-handler/https" = "org.mozilla.firefox.desktop";
|
||||
"application/pdf" = "org.pwmt.zathura.desktop";
|
||||
"image/png" = "imv.desktop";
|
||||
"image/bmp" = "imv.desktop";
|
||||
"image/tiff" = "imv.desktop";
|
||||
"image/jpeg" = "imv.desktop";
|
||||
"image/gif" = "imv.desktop";
|
||||
"text/html" = "org.mozilla.firefox.desktop";
|
||||
};
|
||||
};
|
||||
|
||||
xdg.portal.wlr.enable = true;
|
||||
}
|
|
@ -87,9 +87,7 @@ in {
|
|||
shellAliases = {
|
||||
n = "nvim";
|
||||
rg = "rg --no-heading";
|
||||
# PostgreSQL
|
||||
lpsql = "psql -U postgres -h localhost";
|
||||
# misc
|
||||
diff = "diff -u -p -r -N --color=auto";
|
||||
ip = "ip --color";
|
||||
journalctl-clean = "journalctl --vacuum-time=7d";
|
||||
|
|
90
system/home-manager/desktop.nix
Normal file
90
system/home-manager/desktop.nix
Normal file
|
@ -0,0 +1,90 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
cursorSettings = {
|
||||
package = pkgs.apple-cursor;
|
||||
name = "macOS-Monterey";
|
||||
};
|
||||
in {
|
||||
home-manager.users.christoph = {
|
||||
imports = [ ./email.nix ./sway.nix ./terminal.nix ];
|
||||
|
||||
home.sessionVariables = { GIT_EDITOR = "$EDITOR"; };
|
||||
home.pointerCursor = cursorSettings;
|
||||
gtk.cursorTheme = cursorSettings;
|
||||
|
||||
programs.git = {
|
||||
enable = true;
|
||||
package = pkgs.gitAndTools.gitFull;
|
||||
signing = {
|
||||
signByDefault = true;
|
||||
key = "9C561D6430B28D6BDCBC9CEB73D5E7FDEE3DE49A";
|
||||
};
|
||||
extraConfig = {
|
||||
user.name = "Christoph Heiss";
|
||||
user.email = "christoph@c8h4.io";
|
||||
format.signoff = true;
|
||||
pull.rebase = true;
|
||||
rebase.autoStash = true;
|
||||
rebase.autoSquash = true;
|
||||
alias = {
|
||||
fixes = "show -s --pretty='format:Fixes: %h (\"%s\")'";
|
||||
fixup =
|
||||
"!git log -n 50 --pretty=format:'%h %s' --no-merges | fzf | cut -c -7 | xargs -o git commit --fixup";
|
||||
reported-by = ''
|
||||
!n="$(git shortlog -sne | cut -f2- | fzf)"; echo "Reported-by: $n"'';
|
||||
difflog = ''
|
||||
!f() { local h="$(git log --format='%h' $1)"; git shortlog $1; git diff --stat $h^ HEAD; }; PAGER= f'';
|
||||
};
|
||||
sendemail = {
|
||||
annotate = true;
|
||||
confirm = "always";
|
||||
suppresscc = "self";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
programs.yt-dlp.enable = true;
|
||||
|
||||
programs.zsh.shellAliases = {
|
||||
# git
|
||||
gc = "git commit --verbose --signoff";
|
||||
"gcan!" =
|
||||
"git commit --verbose --signoff --amend --date now --reset-author";
|
||||
gfp = "git format-patch";
|
||||
gsm = "git send-email";
|
||||
gsmc = "git send-email --compose";
|
||||
gsm-lkml = ''
|
||||
git send-email \
|
||||
--to-cmd="$(pwd)/scripts/get_maintainer.pl --nogit --nogit-fallback --norolestats --nol" \
|
||||
--cc-cmd="$(pwd)/scripts/get_maintainer.pl --nogit --nogit-fallback --norolestats --nom"
|
||||
'';
|
||||
# Rust
|
||||
cb = "cargo build";
|
||||
cnb = "cargo +nightly build";
|
||||
cr = "cargo run";
|
||||
cnr = "cargo +nightly run";
|
||||
ccl = "cargo clippy";
|
||||
# Misc
|
||||
m = "make";
|
||||
weather = "curl wttr.in";
|
||||
yt-dlp-mp3 =
|
||||
"yt-dlp -o '%(title)s.%(ext)s' -i -x --audio-quality 320K --audio-format mp3";
|
||||
yt-dlp-video =
|
||||
"yt-dlp -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio' --merge-output-format mp4";
|
||||
};
|
||||
|
||||
services.gpg-agent = {
|
||||
enable = true;
|
||||
enableScDaemon = false;
|
||||
enableSshSupport = true;
|
||||
pinentryFlavor = "tty";
|
||||
};
|
||||
|
||||
xdg.configFile."latexmk/latexmkrc".text = ''
|
||||
$pdf_previewer = '${pkgs.zathura}/bin/zathura';
|
||||
$latex = 'latex -interaction=nonstopmode';
|
||||
$pdflatex = 'pdflatex -interaction=nonstopmode';
|
||||
'';
|
||||
};
|
||||
}
|
33
system/home-manager/email.nix
Normal file
33
system/home-manager/email.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
imports = [ ../../secrets/email.nix ];
|
||||
|
||||
accounts.email.maildirBasePath = "$HOME/.maildir";
|
||||
|
||||
programs.neomutt = {
|
||||
enable = true;
|
||||
sort = "date";
|
||||
settings = {
|
||||
# IMAP
|
||||
imap_idle = "yes";
|
||||
imap_check_subscribed = "yes";
|
||||
mbox_type = "Maildir";
|
||||
mail_check = "90";
|
||||
timeout = "15";
|
||||
header_cache = "~/.cache/neomutt/headers";
|
||||
message_cachedir = "~/.cache/neomutt/bodies";
|
||||
certificate_file = "~/.cache/neomutt/certificates";
|
||||
# SMTP
|
||||
smtp_user = "$imap_user";
|
||||
smtp_pass = "$imap_pass";
|
||||
ssl_force_tls = "yes";
|
||||
# Composition
|
||||
edit_headers = "yes";
|
||||
charset = "UTF-8";
|
||||
# Sender, email address, and sign-off line must match
|
||||
realname = "'Christoph Heiss'";
|
||||
use_domain = "no";
|
||||
use_from = "yes";
|
||||
use_threads = "threads";
|
||||
};
|
||||
};
|
||||
}
|
317
system/home-manager/sway.nix
Normal file
317
system/home-manager/sway.nix
Normal file
|
@ -0,0 +1,317 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let backgroundImgPath = "~/.local/share/sway/background.jpg";
|
||||
in {
|
||||
imports = [ ./wofi.nix ];
|
||||
|
||||
wayland.windowManager.sway = {
|
||||
enable = true;
|
||||
systemdIntegration = true;
|
||||
extraSessionCommands = ''
|
||||
export MOZ_ENABLE_WAYLAND=1
|
||||
export QT_QPA_PLATFORM=wayland-egl
|
||||
export CLUTTER_BACKEND=wayland
|
||||
export ECORE_EVAS_ENGINE=wayland-egl
|
||||
export ELM_ENGINE=wayland_egl
|
||||
export SDL_VIDEODRIVER=wayland
|
||||
export _JAVA_AWT_WM_NONREPARENTING=1
|
||||
export NO_AT_BRIDGE=1
|
||||
export XDG_CURRENT_DESKTOP=sway
|
||||
'';
|
||||
xwayland = false;
|
||||
config = {
|
||||
modifier = "Mod4";
|
||||
menu =
|
||||
"${pkgs.wofi}/bin/wofi | sed 's/%u//' | xargs ${pkgs.sway}/bin/swaymsg exec --";
|
||||
terminal = "${pkgs.foot}/bin/foot";
|
||||
bars = [{ command = "${pkgs.waybar}/bin/waybar"; }];
|
||||
colors.focused = {
|
||||
border = "#4c7899";
|
||||
background = "#286677";
|
||||
text = "#ffffff";
|
||||
indicator = "#2e9ef4";
|
||||
childBorder = "#5d8aa8";
|
||||
};
|
||||
focus.mouseWarping = "container";
|
||||
gaps = {
|
||||
outer = lib.mkDefault 2;
|
||||
inner = 10;
|
||||
smartBorders = "on";
|
||||
};
|
||||
floating = { border = 10; };
|
||||
keybindings = let
|
||||
cfg = config.wayland.windowManager.sway.config;
|
||||
mod = cfg.modifier;
|
||||
in {
|
||||
"${mod}+Return" = "exec ${cfg.terminal}";
|
||||
"${mod}+u" = "exec ${cfg.menu}";
|
||||
"${mod}+l" = "exec ${pkgs.swaylock}/bin/swaylock";
|
||||
"${mod}+c" =
|
||||
''exec ${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)"'';
|
||||
"${mod}+p" = "exec ${pkgs.wl-color-picker}/bin/wl-color-picker";
|
||||
|
||||
"${mod}+w" = "exec systemctl --user start wlsunset.service";
|
||||
"${mod}+Shift+w" = "exec systemctl --user stop wlsunset.service";
|
||||
|
||||
"${mod}+Shift+c" = "reload";
|
||||
"${mod}+Shift+e" =
|
||||
"exec swaynag -t warning -m 'Exit sway?' -B 'Yes, exit' 'swaymsg exit'";
|
||||
|
||||
"${mod}+s" = "layout toggle stacking tabbed";
|
||||
"${mod}+b" = "layout splith";
|
||||
"${mod}+v" = "layout splitv";
|
||||
"${mod}+Shift+g" = "floating toggle";
|
||||
"${mod}+g" = "focus mode_toggle";
|
||||
"${mod}+a" = "focus parent";
|
||||
"${mod}+f" = "fullscreen toggle";
|
||||
|
||||
"XF86AudioRaiseVolume" =
|
||||
"exec ~/.local/share/sway/set-sink-volume.sh +5%";
|
||||
"XF86AudioLowerVolume" =
|
||||
"exec ~/.local/share/sway/set-sink-volume.sh -5%";
|
||||
"XF86AudioMute" =
|
||||
"exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle";
|
||||
"XF86AudioMicMute" =
|
||||
"exec ${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle";
|
||||
"XF86MonBrightnessDown" =
|
||||
"exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-";
|
||||
"XF86MonBrightnessUp" =
|
||||
"exec ${pkgs.brightnessctl}/bin/brightnessctl set +5%";
|
||||
"XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
|
||||
"XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next";
|
||||
"XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous";
|
||||
|
||||
"${mod}+${cfg.left}" = "focus left";
|
||||
"${mod}+${cfg.down}" = "focus down";
|
||||
"${mod}+${cfg.up}" = "focus up";
|
||||
"${mod}+${cfg.right}" = "focus right";
|
||||
|
||||
"${mod}+Left" = "focus left";
|
||||
"${mod}+Down" = "focus down";
|
||||
"${mod}+Up" = "focus up";
|
||||
"${mod}+Right" = "focus right";
|
||||
|
||||
"${mod}+Shift+${cfg.left}" = "move left";
|
||||
"${mod}+Shift+${cfg.down}" = "move down";
|
||||
"${mod}+Shift+${cfg.up}" = "move up";
|
||||
"${mod}+Shift+${cfg.right}" = "move right";
|
||||
|
||||
"${mod}+Shift+Left" = "move left";
|
||||
"${mod}+Shift+Down" = "move down";
|
||||
"${mod}+Shift+Up" = "move up";
|
||||
"${mod}+Shift+Right" = "move right";
|
||||
|
||||
"${mod}+1" = "workspace number 1";
|
||||
"${mod}+2" = "workspace number 2";
|
||||
"${mod}+3" = "workspace number 3";
|
||||
"${mod}+4" = "workspace number 4";
|
||||
"${mod}+5" = "workspace number 5";
|
||||
"${mod}+6" = "workspace number 6";
|
||||
"${mod}+7" = "workspace number 7";
|
||||
"${mod}+8" = "workspace number 8";
|
||||
"${mod}+9" = "workspace number 9";
|
||||
|
||||
"${mod}+Shift+1" = "move container to workspace number 1";
|
||||
"${mod}+Shift+2" = "move container to workspace number 2";
|
||||
"${mod}+Shift+3" = "move container to workspace number 3";
|
||||
"${mod}+Shift+4" = "move container to workspace number 4";
|
||||
"${mod}+Shift+5" = "move container to workspace number 5";
|
||||
"${mod}+Shift+6" = "move container to workspace number 6";
|
||||
"${mod}+Shift+7" = "move container to workspace number 7";
|
||||
"${mod}+Shift+8" = "move container to workspace number 8";
|
||||
"${mod}+Shift+9" = "move container to workspace number 9";
|
||||
|
||||
"${mod}+Shift+minus" = "move scratchpad";
|
||||
"${mod}+minus" = "scratchpad show";
|
||||
|
||||
"${mod}+r" = "mode resize";
|
||||
};
|
||||
input."type:keyboard" = {
|
||||
xkb_layout = lib.mkDefault "us,at";
|
||||
xkb_options = "grp:alt_space_toggle,caps:escape";
|
||||
repeat_delay = "200";
|
||||
repeat_rate = "45";
|
||||
};
|
||||
output."*".background = "${backgroundImgPath} fill #5fb2d0";
|
||||
left = "d";
|
||||
down = "h";
|
||||
up = "t";
|
||||
right = "n";
|
||||
window = {
|
||||
border = 2;
|
||||
titlebar = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
xdg.dataFile."sway/background.jpg".source = ../../extra/sway/background.jpg;
|
||||
|
||||
xdg.dataFile."sway/set-sink-volume.sh" = {
|
||||
executable = true;
|
||||
text = ''
|
||||
#!/usr/bin/env sh
|
||||
|
||||
MAX_VOLUME=100
|
||||
default_sink="$(${pkgs.pulseaudio}/bin/pactl get-default-sink)"
|
||||
channels=($(${pkgs.pulseaudio}/bin/pactl -f json list sinks | \
|
||||
${pkgs.jq}/bin/jq -r ".[] | select(.name == \"$default_sink\") | .volume[].value_percent | sub(\"%\"; \"\")"))
|
||||
|
||||
# Calculate max of all channels
|
||||
volume=$(echo $channels | awk '{max=0; for(i=1;i<=NF;i++) if($i>max) max=$i; print max;}')
|
||||
|
||||
# Add the passed inc-/decrement
|
||||
volume=$(( $volume ''${1::1} ''${1:1:-1} ))
|
||||
|
||||
# Clamp to positive value
|
||||
volume=$(( $volume < 0 ? 0 : $volume ))
|
||||
|
||||
# Clamp to max volume
|
||||
volume=$(( $volume > $MAX_VOLUME ? $MAX_VOLUME : $volume ))
|
||||
|
||||
exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume "$default_sink" $volume%
|
||||
'';
|
||||
};
|
||||
|
||||
services.swayidle = {
|
||||
enable = true;
|
||||
events = [{
|
||||
event = "before-sleep";
|
||||
command = "${pkgs.swaylock}/bin/swaylock";
|
||||
}];
|
||||
timeouts = [
|
||||
{
|
||||
timeout = 300;
|
||||
command = "${pkgs.swaylock}/bin/swaylock";
|
||||
}
|
||||
{
|
||||
timeout = 600;
|
||||
command =
|
||||
"${pkgs.sway}/bin/swaymsg 'output * dpms off' resume 'output * dpms on'";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
programs.swaylock.settings = {
|
||||
daemonize = true;
|
||||
ignore-empty-password = true;
|
||||
image = backgroundImgPath;
|
||||
scaling = "fill";
|
||||
show-keyboard-layout = true;
|
||||
};
|
||||
|
||||
services.wlsunset = {
|
||||
enable = true;
|
||||
latitude = "48.2";
|
||||
longitude = "16.4";
|
||||
temperature.night = 2500;
|
||||
};
|
||||
|
||||
programs.waybar = {
|
||||
enable = true;
|
||||
style = builtins.readFile ../../extra/waybar/style.css;
|
||||
settings.mainBar = {
|
||||
position = "top";
|
||||
modules-left = [ "sway/workspaces" "sway/mode" ];
|
||||
modules-center = [ ];
|
||||
modules-right = [
|
||||
"tray"
|
||||
"backlight"
|
||||
"pulseaudio"
|
||||
"network"
|
||||
"battery"
|
||||
"idle_inhibitor"
|
||||
"sway/language"
|
||||
"clock"
|
||||
];
|
||||
backlight = {
|
||||
format = "{percent}% {icon}";
|
||||
format-icons = [ "" ];
|
||||
};
|
||||
battery = {
|
||||
format = "{capacity}% {icon}";
|
||||
format-charging = "{capacity}% ";
|
||||
format-icons = [ "" "" "" "" "" ];
|
||||
interval = 10;
|
||||
states = {
|
||||
critical = 10;
|
||||
warning = 20;
|
||||
};
|
||||
};
|
||||
clock = {
|
||||
format = "{:%a %d %b %H:%M}";
|
||||
tooltip-format = ''
|
||||
<big>{:%Y %B}</big>
|
||||
<tt><small>{calendar}</small></tt>'';
|
||||
};
|
||||
idle_inhibitor = {
|
||||
format = "{icon}";
|
||||
format-icons = {
|
||||
activated = "";
|
||||
deactivated = "";
|
||||
};
|
||||
tooltip = false;
|
||||
};
|
||||
network = {
|
||||
format = "{icon}";
|
||||
format-disconnected = "";
|
||||
format-icons = {
|
||||
ethernet = "";
|
||||
wifi = "";
|
||||
};
|
||||
tooltip-format = "{ifname}: {ipaddr}/{cidr} via {gwaddr}";
|
||||
tooltip-format-wifi = ''
|
||||
{ifname}: {ipaddr}/{cidr} via {gwaddr}
|
||||
AP: {essid} ({signalStrength}%)
|
||||
'';
|
||||
};
|
||||
pulseaudio = {
|
||||
format = "{volume}% {icon}";
|
||||
format-icons = {
|
||||
default = [ "" "" "" ];
|
||||
phone = [ " " " " " " " " ];
|
||||
};
|
||||
format-muted = "";
|
||||
on-click = "pkill pavucontrol || ${pkgs.pavucontrol}/bin/pavucontrol";
|
||||
scroll-step = 10;
|
||||
tooltip = false;
|
||||
};
|
||||
"sway/language".tooltip-format = "{long}";
|
||||
"sway/mode".format = " {}";
|
||||
"sway/workspaces" = {
|
||||
disable-scroll = true;
|
||||
format = "{name}";
|
||||
};
|
||||
tray.icon-size = 18;
|
||||
};
|
||||
};
|
||||
|
||||
services.fnott = {
|
||||
enable = true;
|
||||
# TODO: Temporary until upstream is updated
|
||||
# https://github.com/NixOS/nixpkgs/pull/225224
|
||||
package = pkgs.fnott.overrideAttrs (_: rec {
|
||||
version = "1.4.0";
|
||||
src = pkgs.fetchFromGitea {
|
||||
domain = "codeberg.org";
|
||||
owner = "dnkl";
|
||||
repo = "fnott";
|
||||
rev = version;
|
||||
sha256 = "sha256-cJ7XmnC4x8lhZ+JRqobeQxTTps4Oz95zYdlFtr3KC1A=";
|
||||
};
|
||||
});
|
||||
settings.main = {
|
||||
selection-helper = "${pkgs.wofi}/bin/wofi";
|
||||
default-timeout = 5;
|
||||
};
|
||||
};
|
||||
|
||||
programs.wofi = {
|
||||
enable = true;
|
||||
style = builtins.readFile ../../extra/wofi/style.css;
|
||||
settings = {
|
||||
mode = "drun";
|
||||
drun-print_command = true;
|
||||
insensitive = true;
|
||||
};
|
||||
};
|
||||
}
|
42
system/home-manager/terminal.nix
Normal file
42
system/home-manager/terminal.nix
Normal file
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
programs.foot = {
|
||||
enable = true;
|
||||
settings = {
|
||||
main = {
|
||||
shell = "tmux";
|
||||
font = "Jetbrains Mono:size=9:weight=semibold,Noto Color Emoji:size=9";
|
||||
font-bold =
|
||||
"Jetbrains Mono:size=9:weight=extrabold,Noto Color Emoji:size=9";
|
||||
};
|
||||
scrollback.lines = 0;
|
||||
cursor = {
|
||||
style = "underline";
|
||||
color = "ffffff ffffff";
|
||||
underline-thickness = 1;
|
||||
};
|
||||
mouse.hide-when-typing = "yes";
|
||||
colors = {
|
||||
foreground = "c0caf5";
|
||||
background = "1a1b26";
|
||||
regular0 = "15161e"; # black
|
||||
regular1 = "f7768e"; # red
|
||||
regular2 = "9ece6a"; # green
|
||||
regular3 = "e0af68"; # yellow
|
||||
regular4 = "7aa2f7"; # blue
|
||||
regular5 = "bb9af7"; # magenta
|
||||
regular6 = "7dcfff"; # cyan
|
||||
regular7 = "a9b1d6"; # white
|
||||
bright0 = "414868"; # bright black
|
||||
bright1 = "f7768e"; # bright red
|
||||
bright2 = "9ece6a"; # bright green
|
||||
bright3 = "e0af68"; # bright yellow
|
||||
bright4 = "7aa2f7"; # bright blue
|
||||
bright5 = "bb9af7"; # bright magenta
|
||||
bright6 = "7dcfff"; # bright cyan
|
||||
bright7 = "c0caf5"; # bright white
|
||||
dim0 = "ff9e64";
|
||||
dim1 = "db4b4b";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
81
system/home-manager/wofi.nix
Normal file
81
system/home-manager/wofi.nix
Normal file
|
@ -0,0 +1,81 @@
|
|||
# TODO: Temporary until upstream module is merged:
|
||||
# https://github.com/nix-community/home-manager/pull/3786
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.programs.wofi;
|
||||
|
||||
mkValueString = value:
|
||||
if isBool value then
|
||||
if value then "true" else "false"
|
||||
else if isInt value then
|
||||
toString value
|
||||
else if isString value then
|
||||
value
|
||||
else
|
||||
abort "Unhandled value type ${builtins.typeOf value}";
|
||||
|
||||
mkKeyValue = name: value: "${name}=${mkValueString value}";
|
||||
|
||||
toConfig = attrs:
|
||||
''
|
||||
# Generated by Home Manager.
|
||||
'' + concatStringsSep "\n"
|
||||
(mapAttrsToList mkKeyValue (filterAttrs (_: value: value != null) attrs));
|
||||
in {
|
||||
meta.maintainers = [ maintainers.christoph-heiss ];
|
||||
|
||||
options.programs.wofi = {
|
||||
enable = mkEnableOption
|
||||
"wofi: A launcher/menu program for wlroots based wayland compositors such as sway";
|
||||
|
||||
package = mkOption {
|
||||
default = pkgs.wofi;
|
||||
type = types.package;
|
||||
defaultText = literalExpression "pkgs.wofi";
|
||||
description = ''
|
||||
Package providing the <command>wofi</command> binary.
|
||||
'';
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
default = { };
|
||||
type = types.attrs;
|
||||
description = "Configuration options for wofi. See wofi(5).";
|
||||
example = literalExpression ''
|
||||
{
|
||||
location = "bottom-right";
|
||||
allow_markup = true;
|
||||
width = 250;
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
style = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr types.str;
|
||||
description = "CSS style for wofi to use as a stylesheet. See wofi(7).";
|
||||
example = ''
|
||||
* {
|
||||
font-family: monospace;
|
||||
}
|
||||
window {
|
||||
background-color: #7c818c;
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions =
|
||||
[ (hm.assertions.assertPlatform "programs.wofi" pkgs platforms.linux) ];
|
||||
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.configFile."wofi/config".text = toConfig cfg.settings;
|
||||
xdg.configFile."wofi/style.css".text = cfg.style;
|
||||
};
|
||||
}
|
17
system/laptop.nix
Normal file
17
system/laptop.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
services.tlp = {
|
||||
enable = true;
|
||||
settings = {
|
||||
# Audio
|
||||
SOUND_POWER_SAVE_ON_AC = 0;
|
||||
# File systems
|
||||
MAX_LOST_WORK_SECS_ON_AC = 10;
|
||||
MAX_LOST_WORK_SECS_ON_BAT = 30;
|
||||
# Radio devices
|
||||
DEVICES_TO_DISABLE_ON_STARTUP = "bluetooth wwan";
|
||||
# USB
|
||||
USB_EXCLUDE_AUDIO = 0;
|
||||
USB_EXCLUDE_PHONE = 1;
|
||||
};
|
||||
};
|
||||
}
|
6
system/ucode-intel.nix
Normal file
6
system/ucode-intel.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
environment.systemPackages = [ pkgs.microcodeIntel ];
|
||||
hardware.cpu.intel.updateMicrocode = true;
|
||||
}
|
7
system/wifi.nix
Normal file
7
system/wifi.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
environment.systemPackages = [ pkgs.iw ];
|
||||
networking.networkmanager.enable = true;
|
||||
users.users.christoph.extraGroups = [ "networkmanager" ];
|
||||
}
|
Loading…
Reference in a new issue