diff --git a/absol/configuration.nix b/absol/configuration.nix new file mode 100755 index 0000000..67ee2a3 --- /dev/null +++ b/absol/configuration.nix @@ -0,0 +1,252 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, lib, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + # optimize power usage + powerManagement.enable = true; + + # prevent overheat + services.thermald.enable = true; + + services.tlp = { + enable = true; + settings = { + CPU_SCALING_GOVERNOR_ON_AC = "performance"; + CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; + + CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; + CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; + + CPU_MIN_PERF_ON_AC = 0; + CPU_MAX_PERF_ON_AC = 100; + CPU_MIN_PERF_ON_BAT = 0; + CPU_MAX_PERF_ON_BAT = 20; + + #Optional helps save long term battery health + START_CHARGE_THRESH_BAT0 = 40; # 40 and bellow it starts to charge + STOP_CHARGE_THRESH_BAT0 = 80; # 80 and above it stops charging + + }; + }; + + # optimize storage + nix.optimise.automatic = true; + + # Bootloader. + boot.loader.efi.canTouchEfiVariables = true; + boot.loader.efi.efiSysMountPoint = "/boot"; + boot.loader.systemd-boot.enable = true; + + # udev for brillo + services.udev.extraRules = '' + ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="intel_backlight", MODE="0666", RUN+="${pkgs.coreutils}/bin/chmod a+w /sys/class/backlight/%k/brightness" + ''; + + services.logind.extraConfig = '' + # don’t shutdown when power button is short-pressed + HandlePowerKey=lock + ''; + services.logind.lidSwitch = "lock"; + + networking.hostName = "absol"; + # networking.wireless.enable = true; + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "Europe/Berlin"; + + i18n.supportedLocales = [ + "en_US.UTF-8/UTF-8" + "de_DE.UTF-8/UTF-8" + ]; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LANG = "en_US.UTF-8"; + LC_ALL = "en_US.UTF-8"; + LANGUAGE = "en_US.UTF-8"; + LC_ADDRESS = "de_DE.UTF-8"; + LC_IDENTIFICATION = "de_DE.UTF-8"; + LC_MEASUREMENT = "de_DE.UTF-8"; + LC_MONETARY = "de_DE.UTF-8"; + LC_NAME = "de_DE.UTF-8"; + LC_NUMERIC = "de_DE.UTF-8"; + LC_PAPER = "de_DE.UTF-8"; + LC_TELEPHONE = "de_DE.UTF-8"; + LC_TIME = "de_DE.UTF-8"; + }; + + services.greetd = { + enable = true; + settings = { + default_session = { + command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --remember --cmd Hyprland"; + user = "greeter"; + }; + }; + }; + + # Configure console keymap + console.keyMap = "us"; + + # Enable CUPS to print documents. + services.avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; + }; + services.printing = { + enable = true; + }; + + # bluetooth + hardware.bluetooth.enable = true; + hardware.bluetooth.powerOnBoot = true; + services.blueman.enable = true; + + # Enable sound with pipewire. + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + # Define a user account. + users.users.leonv = { + isNormalUser = true; + description = "Leon Vatthauer"; + extraGroups = [ "networkmanager" "wheel" ]; + initialPassword = "leonv"; # just for setup + }; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # List packages installed in system profile. + environment.systemPackages = + with pkgs; + let + catp-gtk = pkgs.catppuccin-gtk.override { + accents = [ "flamingo" ]; # You can specify multiple accents here to output multiple themes + size = "compact"; + tweaks = [ "rimless" "black" ]; # You can also specify multiple tweaks here + variant = "macchiato"; + }; + in [ + texliveFull + # for connecting to nas + nfs-utils + + # some standards for convenience + vim + parted + os-prober + qpdfview + swww + + # greeter + greetd.gtkgreet + catp-gtk + + # deps for hyprland / eww + socat + xdg-desktop-portal-hyprland + ]; + + system.stateVersion = "24.05"; + + # NFS setup + services.rpcbind.enable = true; # needed for NFS + systemd.mounts = [{ + type = "nfs"; + mountConfig = { + Options = "noatime"; + }; + what = "192.168.178.20:/volume1/MiniDrive"; + where = "/MiniDrive"; + }]; + + systemd.automounts = [{ + wantedBy = [ "multi-user.target" ]; + automountConfig = { + TimeoutIdleSec = "10"; + }; + where = "/MiniDrive"; + }]; + + # source zsh + programs.zsh.enable = true; + users.defaultUserShell = pkgs.zsh; + + nix.settings.substituters = [ + "https://aseipp-nix-cache.global.ssl.fastly.net" + ]; + + # environment variables + environment.sessionVariables = { + ## disable logging when direnv changes + DIRENV_LOG_FORMAT = []; + # GTK theme (set here for greetd) + GTK_THEME = "Catppuccin-Macchiato-Compact-Flamingo-Dark"; + }; + + # fonts + fonts = { + packages = with pkgs; [ + ((nerdfonts.override { fonts = [ "Hack" "DejaVuSansMono" "DroidSansMono" "Noto" ]; })) + mononoki + # noto-fonts + noto-fonts-cjk + noto-fonts-emoji + ]; + enableDefaultPackages = true; + fontconfig = { + defaultFonts = { + monospace = [ "Berkeley Mono Nerd Font" ]; + sansSerif = [ "NotoSans Nerd Font" ]; + serif = [ "NotoSans Nerd Font" ]; + emoji = [ "Noto Color Emoji" ]; + }; + }; + }; + + # enable flakes + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + # hyprland + programs.hyprland.enable = true; + + # ssh + programs.ssh.startAgent = true; + programs.ssh.extraConfig = '' + AddKeysToAgent yes + IdentityFile ~/.ssh/git + ''; + + programs.steam.enable = true; + + # thunar + programs.thunar = { + enable = true; + plugins = with pkgs.xfce; [ + thunar-archive-plugin + thunar-volman + ]; + }; + services.gvfs.enable = true; # Mount, trash, and others + services.tumbler.enable = true; # thumbnail support for images +} diff --git a/absol/eww/config/eww.scss b/absol/eww/config/eww.scss new file mode 100644 index 0000000..d506ee5 --- /dev/null +++ b/absol/eww/config/eww.scss @@ -0,0 +1,115 @@ +// catppuccin colors +$rosewater: #f4dbd6; +$flamingo: #f0c6c6; +$pink: #f5bde6; +$mauve: #c6a0f6; +$red: #ed8796; +$maroon: #ee99a0; +$peach: #f5a97f; +$yellow: #eed49f; +$green: #a6da95; +$teal: #8bd5ca; +$sky: #91d7e3; +$sapphire: #7dc4e4; +$blue: #8aadf4; +$lavender: #b7bdf8; +$accent: $flamingo; +$text: #cad3f5; +$subtext1: #b8c0e0; +$subtext0: #a5adcb; +$overlay2: #939ab7; +$overlay1: #8087a2; +$overlay0: #6e738d; +$surface2: #5b6078; +$surface1: #494d64; +$surface0: #363a4f; +$base: #24273a; +$mantle: #1e2030; +$crust: #181926; + +*{ + all: unset; + font-family: "monospace"; +} + +// .bar { +// background-color: $base; +// border-radius: 16px; +// } + +.container { + background-color: $base; + border-radius: 16px; +} + +tooltip.background { + background-color: #0f0f17; + font-size: 18px; + border-radius: 10px; + color: #bfc9db; +} + +tooltip label { + margin: 6px; +} + +.time { + font-size: 18px; + margin: 0px 20px 0px 10px; + color: $teal; + font-weight: bold; +} + +.volume_text { + font-size: 18px; + color: $maroon; + margin: 0px 10px 0px 10px; +} + +.network_icon { + font-size: 18px; + color: $green; + margin: 0px 10px 0px 10px; +} +.bluetooth_icon { + font-size: 18px; + color: $blue; + margin: 0px 10px 0px 10px; +} +.cpu_text { + font-size: 18px; + color: $maroon; + margin: 0px 10px 0px 10px; +} +.mem_text { + font-size: 18px; + color: $yellow; + margin: 0px 10px 0px 10px; +} + +.battery_text { + font-size: 18px; + color: $yellow; + margin: 0px 10px 0px 10px; +} + +.workspaces-widget { + color: $sky; + font-size: 22px; +} + +.workspaces-widget .empty { + color: rgba($sky, 0.3); +} + +.title { + color: $mauve; + font-size: 16px; + padding: 0px 5px 0px 5px; +} + +.nixos-icon { + font-size: 22px; + color: #7CB5DE; + margin: 0px 10px 0px 10px; +} diff --git a/absol/eww/config/eww.yuck b/absol/eww/config/eww.yuck new file mode 100644 index 0000000..76561ca --- /dev/null +++ b/absol/eww/config/eww.yuck @@ -0,0 +1,58 @@ +; inspired by https://github.com/saimoomedits/eww-widgets/tree/main + +(include "./widgets/workspaces/eww.yuck") +(include "./widgets/window-title/eww.yuck") +(include "./widgets/resources/eww.yuck") + +(defwindow top-bar + :monitor 0 + :geometry (geometry :x "0%" + :y "10px" + :width "98.8%" + :height "30px" + :anchor "top center") + :stacking "fg" + :exclusive true + (centerbox + :class "bar" + (left) +; (center) + "" + (right) + ) +) + +(defwidget left [] + (box + :space-evenly false + :halign "start" + :class "container" + (label :text "" :class "nixos-icon") + (workspaces) + ) +) + +(defwidget center [] + (box + :space-evenly false + :halign "center" + :class "container" + :visible {strlength(window) != 0} + (windowtitle) + ) +) + +(defwidget right [] + (box + :space-evenly false + :halign "end" + :class "container" + (volume) + (cpu) + (mem) + (battery) + (network) + (bluetooth) + (datetime) + ) +) diff --git a/absol/eww/config/widgets/resources/eww.yuck b/absol/eww/config/widgets/resources/eww.yuck new file mode 100644 index 0000000..8384839 --- /dev/null +++ b/absol/eww/config/widgets/resources/eww.yuck @@ -0,0 +1,104 @@ +; for unicode symbols: https://jrgraphix.net/r/Unicode/E000-F8FF + +; VARIABLES + +(defvar GB 1024000000) +(defvar MB 1024000) + +; DATE + TIME + +(defpoll time :interval "5s" + :initial "" +`date +%H:%M`) +(defpoll date :interval "60s" + :initial "" +`date "+%A | %m-%d-%+4Y"`) + +(defwidget datetime [] + (eventbox + :tooltip date + (label + :class "text time" + :text time) + )) + +; CPU + +(defwidget cpu [] + (box + :active true + :tooltip "${round(EWW_CPU.cores[0].freq/1000,2)} GHz" + (label + :class "cpu_text" + :text " ${round(EWW_CPU.avg,0)}%") + ) +) + +; BATTERY +(defwidget battery [] + (box + :active true + :tooltip "battery" + (label + :class "battery_text" + :text "${EWW_BATTERY.BAT0.capacity}%" + ) + ) +) + +; MEMORY +(defwidget mem [] + (box + :active true + :tooltip {EWW_RAM.used_mem / GB < 1 ? "${round(EWW_RAM.used_mem / MB, 1)} M used" : "${round(EWW_RAM.used_mem / GB, 1)} G used"} + (label + :class "mem_text" + :text " ${round(EWW_RAM.used_mem_perc,0)}%") + ) +) + +; TEMP +; TODO temperature widget (hover to show all times sorted nicely) +;  + +; NETWORK + +(defpoll hostname :interval "1m" :initial "" "hostname") +(defpoll status-icon :interval "5s" :initial "" "./widgets/resources/network.sh") + +(defwidget network [] + (eventbox + :active true + :onclick "/usr/bin/env nm-connection-editor &" + :tooltip hostname + (label + :text status-icon + :class "network_icon"))) + +; BLUETOOTH +(defwidget bluetooth [] + (eventbox + :active true + :onclick "blueman-manager &" + (label + :text "" + :class "bluetooth_icon"))) + +; VOLUME + +(defpoll volume_percent :interval "0.1s" :initial "40" "amixer sget Master | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%'") + +(defwidget volume [] + (eventbox + :active true + :onclick "/usr/bin/env pavucontrol &" + :onscroll "if [ {} = 'up' ]; then wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+; else wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-; fi" ; wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%- + (box + :space-evenly false + :orientation "h" + :spacing "3" + (label + :class "volume_text" + :text "${volume_percent <= 33 ? "" : volume_percent <= 66 ? "" : ""} ${volume_percent}%") + ))) +; TODO add mic widget diff --git a/absol/eww/config/widgets/resources/network.sh b/absol/eww/config/widgets/resources/network.sh new file mode 100755 index 0000000..a42907f --- /dev/null +++ b/absol/eww/config/widgets/resources/network.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +status=$(nmcli g | grep -oE "disconnected") + +if [ $status ] ; then + echo "✘" +else + echo "" +fi diff --git a/absol/eww/config/widgets/window-title/eww.yuck b/absol/eww/config/widgets/window-title/eww.yuck new file mode 100644 index 0000000..66ff506 --- /dev/null +++ b/absol/eww/config/widgets/window-title/eww.yuck @@ -0,0 +1,7 @@ +(deflisten window :initial "" "sh ./widgets/window-title/get-window-title.sh") +(defwidget windowtitle [] + (box :class "title" + (label :text {window == "null" ? "" : window} :class "title" + ) + ) +) \ No newline at end of file diff --git a/absol/eww/config/widgets/window-title/get-window-title.sh b/absol/eww/config/widgets/window-title/get-window-title.sh new file mode 100644 index 0000000..f5a494a --- /dev/null +++ b/absol/eww/config/widgets/window-title/get-window-title.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +hyprctl activewindow -j | jq --raw-output .title +socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | stdbuf -o0 awk -F '>>|,' '/^activewindow>>/{print $3}' \ No newline at end of file diff --git a/absol/eww/config/widgets/workspaces/change-active-workspace.sh b/absol/eww/config/widgets/workspaces/change-active-workspace.sh new file mode 100644 index 0000000..19b559a --- /dev/null +++ b/absol/eww/config/widgets/workspaces/change-active-workspace.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +function clamp { + min=$1 + max=$2 + val=$3 + python -c "print(max($min, min($val, $max)))" +} + +direction=$1 +current=$2 +if test "$direction" = "down" +then + target=$(clamp 1 10 $(($current+1))) + echo "jumping to $target" + hyprctl dispatch workspace $target +elif test "$direction" = "up" +then + target=$(clamp 1 10 $(($current-1))) + echo "jumping to $target" + hyprctl dispatch workspace $target +fi \ No newline at end of file diff --git a/absol/eww/config/widgets/workspaces/eww.yuck b/absol/eww/config/widgets/workspaces/eww.yuck new file mode 100644 index 0000000..b361931 --- /dev/null +++ b/absol/eww/config/widgets/workspaces/eww.yuck @@ -0,0 +1,18 @@ +(deflisten workspaces :initial "[]" "bash ./widgets/workspaces/get-workspaces.sh") +(deflisten current_workspace :initial "1" "bash ./widgets/workspaces/get-active-workspace.sh") + +(defwidget workspaces [] + (eventbox :onscroll "bash ./widgets/workspaces/change-active-workspace.sh {} ${current_workspace}" :class "workspaces-widget" + (box :space-evenly true + (label :text "${workspaces}${current_workspace}" :visible false) + (for workspace in workspaces + (eventbox :onclick "hyprctl dispatch workspace ${workspace.id}" + (box :width "30" :height "30" :class "workspace-entry ${workspace.id == current_workspace ? "current" : ""} ${workspace.windows > 0 ? "occupied" : "empty"}" + (label :text {workspace.id == current_workspace ? "" : workspace.windows > 0 ? "" : ""} + ) + ) + ) + ) + ) + ) +) \ No newline at end of file diff --git a/absol/eww/config/widgets/workspaces/get-active-workspace.sh b/absol/eww/config/widgets/workspaces/get-active-workspace.sh new file mode 100755 index 0000000..0ebac7b --- /dev/null +++ b/absol/eww/config/widgets/workspaces/get-active-workspace.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +hyprctl monitors -j | jq '.[] | select(.focused) | .activeWorkspace.id' + +socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | + stdbuf -o0 awk -F '>>|,' -e '/^workspace>>/ {print $2}' -e '/^focusedmon>>/ {print $3}' \ No newline at end of file diff --git a/absol/eww/config/widgets/workspaces/get-workspaces.sh b/absol/eww/config/widgets/workspaces/get-workspaces.sh new file mode 100755 index 0000000..fa7d904 --- /dev/null +++ b/absol/eww/config/widgets/workspaces/get-workspaces.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +spaces (){ + WORKSPACE_WINDOWS=$(hyprctl workspaces -j | jq 'map({key: .id | tostring, value: .windows}) | from_entries') + seq 1 10 | jq --argjson windows "${WORKSPACE_WINDOWS}" --slurp -Mc 'map(tostring) | map({id: ., windows: ($windows[.]//0)})' +} + +spaces +socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | while read -r line; do + spaces +done \ No newline at end of file diff --git a/absol/eww/default.nix b/absol/eww/default.nix new file mode 100644 index 0000000..0d6db80 --- /dev/null +++ b/absol/eww/default.nix @@ -0,0 +1,7 @@ +{ pkgs, ... }: +{ + programs.eww = { + enable = true; + configDir = ./config; + }; +} diff --git a/absol/hardware-configuration.nix b/absol/hardware-configuration.nix new file mode 100644 index 0000000..7068bca --- /dev/null +++ b/absol/hardware-configuration.nix @@ -0,0 +1,37 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "vmd" "nvme" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/ccdbc5d1-a548-4d3e-ab1e-d0bdd7b9df45"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/F6C7-421D"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = [{ + device = "/swapfile"; + size = 32 * 1024; + }]; + + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.wlo1.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/absol/hypr/catppuccin-macchiato.rasi b/absol/hypr/catppuccin-macchiato.rasi new file mode 100644 index 0000000..696d769 --- /dev/null +++ b/absol/hypr/catppuccin-macchiato.rasi @@ -0,0 +1,111 @@ +* { + bg-col: #24273a; + bg-col-light: #24273a; + border-col: #24273a; + selected-col: #24273a; + blue: #8aadf4; + fg-col: #cad3f5; + fg-col2: #ed8796; + grey: #6e738d; + + width: 600; + font: "JetBrainsMono Nerd Font 14"; +} + +element-text, element-icon , mode-switcher { + background-color: inherit; + text-color: inherit; +} + +window { + height: 360px; + border: 3px; + border-color: @border-col; + background-color: @bg-col; +} + +mainbox { + background-color: @bg-col; +} + +inputbar { + children: [prompt,entry]; + background-color: @bg-col; + border-radius: 5px; + padding: 2px; +} + +prompt { + background-color: @blue; + padding: 6px; + text-color: @bg-col; + border-radius: 3px; + margin: 20px 0px 0px 20px; +} + +textbox-prompt-colon { + expand: false; + str: ":"; +} + +entry { + padding: 6px; + margin: 20px 0px 0px 10px; + text-color: @fg-col; + background-color: @bg-col; +} + +listview { + border: 0px 0px 0px; + padding: 6px 0px 0px; + margin: 10px 0px 0px 20px; + columns: 2; + lines: 5; + background-color: @bg-col; +} + +element { + padding: 5px; + background-color: @bg-col; + text-color: @fg-col ; +} + +element-icon { + size: 25px; +} + +element selected { + background-color: @selected-col ; + text-color: @fg-col2 ; +} + +mode-switcher { + spacing: 0; + } + +button { + padding: 10px; + background-color: @bg-col-light; + text-color: @grey; + vertical-align: 0.5; + horizontal-align: 0.5; +} + +button selected { + background-color: @bg-col; + text-color: @blue; +} + +message { + background-color: @bg-col-light; + margin: 2px; + padding: 2px; + border-radius: 5px; +} + +textbox { + padding: 6px; + margin: 20px 0px 0px 20px; + text-color: @blue; + background-color: @bg-col-light; +} diff --git a/absol/hypr/hypridle.conf b/absol/hypr/hypridle.conf new file mode 100644 index 0000000..f040781 --- /dev/null +++ b/absol/hypr/hypridle.conf @@ -0,0 +1,34 @@ +general { + lock_cmd = pidof hyprlock || hyprlock # avoid starting multiple hyprlock instances. + before_sleep_cmd = loginctl lock-session # lock before suspend. + after_sleep_cmd = hyprctl dispatch dpms on # to avoid having to press a key twice to turn on the display. +} + +#listener { +# timeout = 150 # 2.5min. +# on-timeout = brightnessctl -s set 10 # set monitor backlight to minimum, avoid 0 on OLED monitor. +# on-resume = brightnessctl -r # monitor backlight restore. +#} + +# turn off keyboard backlight, comment out this section if you dont have a keyboard backlight. +#listener { +# timeout = 150 # 2.5min. +# on-timeout = brightnessctl -sd rgb:kbd_backlight set 0 # turn off keyboard backlight. +# on-resume = brightnessctl -rd rgb:kbd_backlight # turn on keyboard backlight. +#} + +listener { + timeout = 300 # 5min + on-timeout = loginctl lock-session # lock screen when timeout has passed +} + +listener { + timeout = 330 # 5.5min + on-timeout = hyprctl dispatch dpms off # screen off when timeout has passed + on-resume = hyprctl dispatch dpms on # screen on when activity is detected after timeout has fired. +} + +listener { + timeout = 1800 # 30min + on-timeout = systemctl suspend # suspend pc +} diff --git a/absol/hypr/hyprland.nix b/absol/hypr/hyprland.nix new file mode 100644 index 0000000..a5d4084 --- /dev/null +++ b/absol/hypr/hyprland.nix @@ -0,0 +1,277 @@ +{ pkgs, ... }: +{ + # hyprland setup + wayland.windowManager.hyprland = { + enable = true; + xwayland.enable = true; + settings = { + env = [ + "HYPRCURSOR_THEME,Bibata-Original-Classic" + "HYPRCURSOR_SIZE,48" + "XCURSOR_THEME,Catppuccin-Macchiato-Red" + "XCURSOR_SIZE,48" + ]; + workspace = [ + "1, monitor:HDMI-A-1, default:true, persistent:true" + "2, monitor:DP-1 , default:true, persistent:true" + "special:scratchpad, on-created-empty:foot" + ]; + monitor = [ + "eDP-1, 2880x1800@120, 0x0, 2" + ]; + input = { + kb_layout = "de"; + kb_variant = "us"; + follow_mouse = 1; + }; + "$mod" = "SUPER"; + "$modd" = "SUPER_SHIFT"; + general = { + gaps_in = 8; + gaps_out = 15; + border_size = 3; + + resize_on_border = true; + layout = "dwindle"; + + "col.active_border" = "rgba(cba6f7ff) rgba(89b4faff) rgba(94e2d5ff) 10deg"; + "col.inactive_border" = "0xff45475a"; + "col.nogroup_border" = "0xff89dceb"; + "col.nogroup_border_active" = "0xfff9e2af"; + }; + decoration = { + blur = { + new_optimizations = true; + size = 1; + passes = 1; + }; + drop_shadow = true; + shadow_range = 100; + shadow_render_power = 5; + "col.shadow" = "0x33000000"; + "col.shadow_inactive" = "0x22000000"; + rounding = 15; + }; + animations = { + enabled = 1; + bezier = "overshot,0.13,0.99,0.29,1.1"; + animation = [ + "windows,1,4,overshot,slide" + "border,1,10,default" + "fade,1,10,default" + "workspaces,1,6,overshot,slidevert" + ]; + }; + misc = { + disable_hyprland_logo = true; + }; + bind = [ + # opening programs + "$mod, Return, exec, foot" + "$mod, D, exec, wofi" + "$mod, M, exit, " + "$mod, Q, killactive, " + + # moving around + "$mod, left , movefocus, l" + "$mod, right, movefocus, r" + "$mod, down , movefocus, d" + "$mod, up , movefocus, u" + + # moving windows + "$modd, left , movewindow, l" + "$modd, right, movewindow, r" + "$modd, down , movewindow, d" + "$modd, up , movewindow, u" + + # workspaces + "$mod, 1, workspace, 1" + "$mod, 2, workspace, 2" + "$mod, 3, workspace, 3" + "$mod, 4, workspace, 4" + "$mod, 5, workspace, 5" + "$mod, 6, workspace, 6" + "$modd, 1, movetoworkspacesilent, 1" + "$modd, 2, movetoworkspacesilent, 2" + "$modd, 3, movetoworkspacesilent, 3" + "$modd, 4, movetoworkspacesilent, 4" + "$modd, 5, movetoworkspacesilent, 5" + "$modd, 6, movetoworkspacesilent, 6" + + # fullscreen + "$mod, F11, fullscreen, 0" + # "$mod, m, fullscreen, 1" # maximize + + # floating + "$mod, F, togglefloating, active" + + # screenshot + ", Print, exec, grimblast copysave area $HOME\"/screenshots/\"$(date +'%F-%T.png');" + + # scratchpad + "$mod, C, togglespecialworkspace, scratchpad" + + # status bar + "$mod, T, exec, eww open --toggle top-bar" + ]; + bindm = [ + "$mod, mouse:272, movewindow" + ]; + bindle = [ + # volume + ", XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+" + ", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%-" + ", XF86AudioMute, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 0%" + # screen brightness + ", XF86MonBrightnessUp, exec, brillo -q -A 5" + ", XF86MonBrightnessDown, exec, brillo -q -U 5" + ]; + exec-once = [ + "/home/leonv/Git/nixos/absol/hypr/killer.sh" + "/home/leonv/Git/nixos/absol/hypr/start.sh" + "hyprctl setcursor Bibata-Original-Classic 48" + "systemctl --user import-environment" + "hypridle" + ]; + }; + }; + + # tell electron to use wayland + home.sessionVariables.NIXOS_OZONE_WL = "1"; + + # terminal + programs.foot = { + enable = true; + settings = { + main = { + font = "monospace:size=12"; + dpi-aware = "yes"; + }; + colors = { + foreground = "cad3f5"; + background = "24273a"; + regular0 = "494d64"; + regular1 = "ed8796"; + regular3 = "eed49f"; + regular4 = "8aadf4"; + regular5 = "f5bde6"; + regular6 = "8bd5ca"; + regular7 = "b8c0e0"; + bright0 = "5b6078"; + bright1 = "ed8796"; + bright3 = "eed49f"; + bright4 = "8aadf4"; + bright5 = "f5bde6"; + bright6 = "8bd5ca"; + bright7 = "a5adcb"; + }; + }; + }; + + programs.wofi = { + enable = true; + settings = { + width = 600; + height = 365; + location = "center"; + show = "drun"; + prompt = "Search..."; + filter_rate = 100; + allow_markup = true; + no_actions = true; + halign = "fill"; + orientation = "vertical"; + content_halign = "fill"; + insensitive = true; + allow_images = true; + image_size = 40; + gtk_dark = true; + layer = "overlay"; + }; + style = '' + window { + margin: 0px; + border: 2px solid #b59dc3; + background-color: #282a36; + border-radius: 18px; + + + } + + #input { + margin: 5px; + border: none; + color: #f8f8f2; + border-radius: 15px; + background-color: #44475a; + } + + #inner-box { + margin: 5px; + border: none; + border-radius: 15px; + background-color: #282a36; + } + + #outer-box { + margin: 5px; + border: none; + border-radius: 15px; + background-color: #282a36; + } + + #scroll { + margin: 0px; + border-radius: 15px; + border: none; + } + + #text { + border-radius: 15px; + margin: 5px; + border: none; + color: #f8f8f2; + } + + #entry.activatable #text { + color: #282a36; + } + + #entry > * { + color: #f8f8f2; + } + + #entry:selected { + border-radius: 15px; + background-color: #44475a; + } + + #entry:selected #text { + border-radius: 15px; + } + ''; + }; + + services.mako = { + enable = true; + extraConfig = '' + background-color=#24273a + text-color=#cad3f5 + border-color=#8aadf4 + progress-color=over #363a4f + sort=-time + layer=overlay + width=300 + height=110 + border-size=2 + border-radius=15 + max-icon-size=64 + default-timeout=5000 + ignore-timeout=1 + + [urgency=high] + border-color=#f5a97f + ''; + }; + +} diff --git a/absol/hypr/hyprlock.conf b/absol/hypr/hyprlock.conf new file mode 100644 index 0000000..1bc2625 --- /dev/null +++ b/absol/hypr/hyprlock.conf @@ -0,0 +1,70 @@ +# GENERAL +general { + disable_loading_bar = true + hide_cursor = true +} + +# BACKGROUND +background { + monitor = + path = /home/leonv/Git/nixos/absol/hypr/wallpaper.jpg + blur_passes = 2 +} + +# TIME +label { + monitor = + text = cmd[update:30000] echo "$(date +"%R")" + # color = $text + font_size = 90 + # font_family = $font + position = -130, -100 + halign = right + valign = top + shadow_passes = 2 +} + +# DATE +label { + monitor = + text = cmd[update:43200000] echo "$(date +"%A, %d %B %Y")" + # color = $text + font_size = 25 + # font_family = $font + position = -130, -250 + halign = right + valign = top + shadow_passes = 2 +} + +input-field { + monitor = + size = 200, 50 + outline_thickness = 3 + dots_size = 0.33 # Scale of input-field height, 0.2 - 0.8 + dots_spacing = 0.15 # Scale of dots' absolute size, 0.0 - 1.0 + dots_center = false + dots_rounding = -1 # -1 default circle, -2 follow input-field rounding + outer_color = rgb(151515) + inner_color = rgb(200, 200, 200) + font_color = rgb(10, 10, 10) + fade_on_empty = true + fade_timeout = 1000 # Milliseconds before fade_on_empty is triggered. + placeholder_text = Input Password... # Text rendered in the input box when it's empty. + hide_input = false + rounding = -1 # -1 means complete rounding (circle/oval) + check_color = rgb(204, 136, 34) + fail_color = rgb(204, 34, 34) # if authentication failed, changes outer_color and fail message color + fail_text = $FAIL ($ATTEMPTS) # can be set to empty + fail_transition = 300 # transition time in ms between normal outer_color and fail_color + capslock_color = -1 + numlock_color = -1 + bothlock_color = -1 # when both locks are active. -1 means don't change outer color (same for above) + invert_numlock = false # change color if numlock is off + swap_font_color = false # see below + + position = 0, -20 + halign = center + valign = center +} + diff --git a/absol/hypr/hyprpaper.conf b/absol/hypr/hyprpaper.conf new file mode 100644 index 0000000..c2bcb79 --- /dev/null +++ b/absol/hypr/hyprpaper.conf @@ -0,0 +1,4 @@ +preload = ~/Git/nixos/absol/hypr/wallpaper.jpg + +#set the default wallpaper(s) seen on inital workspace(s) --depending on the number of monitors used +wallpaper = monitor1,~/Git/nixos/absol/hypr/wallpaper.jpg diff --git a/absol/hypr/killer.sh b/absol/hypr/killer.sh new file mode 100755 index 0000000..bea0005 --- /dev/null +++ b/absol/hypr/killer.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +sleep 1 +killall -e xdg-desktop-portal-hyprland +killall -e xdg-desktop-portal-wlr +killall xdg-desktop-portal +/usr/lib/xdg-desktop-portal-hyprland & +sleep 2 +/usr/lib/xdg-desktop-portal & diff --git a/absol/hypr/start.sh b/absol/hypr/start.sh new file mode 100755 index 0000000..fada238 --- /dev/null +++ b/absol/hypr/start.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +# init nmapplet +# TODO add back once eww supports tray +# nm-applet --indicator & +swww init +swww img /home/leonv/Git/nixos/absol/hypr/wallpaper.jpg + +# notification +mako & diff --git a/absol/hypr/wallpaper.jpg b/absol/hypr/wallpaper.jpg new file mode 100644 index 0000000..8a719a2 Binary files /dev/null and b/absol/hypr/wallpaper.jpg differ diff --git a/absol/hypr/wallpaper_old.jpg b/absol/hypr/wallpaper_old.jpg new file mode 100644 index 0000000..c36b7fd Binary files /dev/null and b/absol/hypr/wallpaper_old.jpg differ diff --git a/absol/leonv.nix b/absol/leonv.nix new file mode 100755 index 0000000..19bb06d --- /dev/null +++ b/absol/leonv.nix @@ -0,0 +1,143 @@ +{ config, pkgs, inputs, ... }: +{ + imports = [ + ./../common + ./hypr/hyprland.nix + ./eww + ]; + /* The home.stateVersion option does not have a default and must be set */ + home.stateVersion = "24.05"; + home.username = "leonv"; + home.homeDirectory = "/home/leonv"; + + home.packages = with pkgs; [ + brillo + # theme for gtk applications + orchis-theme + + # stuff + jq + vlc + openvpn + signal-desktop + webcord + firefox-wayland + ungoogled-chromium + thunderbird + gimp + qpdfview + wget + fontforge + gparted + eza + ripgrep + fd + zoom-us + obsidian + zotero + + # development + gnumake + ghostscript + jdk11 + coq + gcc + ghc + cabal-install + haskell-language-server + python3 + python3Packages.pygments + nodejs_20 + unifont + anki + pandoc + + # hyprland + kitty + #networkmanagerapplet + mako + libnotify + pavucontrol + hyprpaper + qimgv + playerctl + hyprpicker + hypridle + hyprlock + wev + inputs.hyprland-contrib.packages.${pkgs.system}.grimblast + bluez + htop + archiver + #gnome.file-roller + zip + unzip + emacs + shellcheck + + # yubikey + yubico-pam + yubikey-manager + + # agda + (agda.withPackages [ + agdaPackages.standard-library + agdaPackages.agda-categories + ]) + + lean4 + + # for emacs + texlab + ]; + + programs.home-manager.enable = true; + + xdg.configHome = /home/leonv/.config; + xdg.configFile."hypr/hypridle.conf".source = ./hypr/hypridle.conf; + xdg.configFile."hypr/hyprlock.conf".source = ./hypr/hyprlock.conf; + + programs.zsh = { + enable = true; + shellAliases = { + clean = "sudo nix-env --delete-generations old --profile /nix/var/nix/profiles/system && sudo /nix/var/nix/profiles/system/bin/switch-to-configuration switch && sudo nix-store --gc"; + ls = "eza"; + ll = "eza -l"; + l = "eza -lah"; + code = "codium"; + alg = "code ~/Git/algprog/tex"; + nixos = "code ~/Git/nixos"; + }; + initExtra = '' + function rebuild () { + sudo nixos-rebuild switch --flake /home/leonv/Git/nixos + sudo cp -r /home/leonv/Git/nixos /etc/ + } + ''; + oh-my-zsh.enable = true; + }; + + gtk = { + enable = true; + theme = { + name = "Catppuccin-Macchiato-Compact-Flamingo-Dark"; + package = pkgs.catppuccin-gtk.override { + accents = [ "flamingo" ]; + size = "compact"; + tweaks = [ "rimless" "black" ]; + variant = "macchiato"; + }; + }; + iconTheme = { + name = "Dracula"; + package = pkgs.dracula-icon-theme; + }; + font = { + name = "NotoSans Nerd Font"; + }; + }; + home.sessionVariables.GTK_THEME = "Catppuccin-Macchiato-Compact-Flamingo-Dark"; + home.sessionPath = [ "$HOME/.config/emacs/bin" ]; + + services.mpris-proxy.enable = true; +} diff --git a/dafoe/README.md b/dafoe/README.md new file mode 100644 index 0000000..7a1a1cf --- /dev/null +++ b/dafoe/README.md @@ -0,0 +1,20 @@ +# Willem + +Willem is a server running on a Raspberry Pi 400 offering the following services: +- [Gitea](git.vatthauer.xyz) +- [Vaultwarden](bitwarden.vatthauer.xyz) + +There are daily backups of the Gitea instance using Restic via B2. +## Installation on Raspberry Pi 400 +### Resources +- https://nixos.wiki/wiki/NixOS_on_ARM/Raspberry_Pi_4 +- https://nixos.wiki/wiki/NixOS_on_ARM#Installation + +### Step by step +1. Follow the [generic installation steps](https://nixos.wiki/wiki/NixOS_on_ARM#Installation) to get NixOS up and running on the Pi. +2. Generate the default `configuration.nix` via `sudo nixos-generate-config` and do a first rebuild `sudo nixos-rebuild switch` +3. Somehow get this repository onto the machine and `cd` into it +4. We need git: `nix-shell -p git` +5. Build the flake via `sudo nixos-rebuild switch --flake .` +6. At this point you can restart +7. Login, set password, move the repository to `/home/leonv/nixos` \ No newline at end of file diff --git a/dafoe/configuration.nix b/dafoe/configuration.nix new file mode 100644 index 0000000..bd5b462 --- /dev/null +++ b/dafoe/configuration.nix @@ -0,0 +1,100 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running 'nixos-help'). + +{ config, pkgs, lib, inputs, ... }: +{ + imports = + [ + ./hardware-configuration.nix + ./services + ./programs + ]; + + # enable flakes + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + # Use the extlinux boot loader. (NixOS wants to enable GRUB by default) + boot.loader.grub.enable = true; + boot.loader.grub.device = "/dev/sda"; + + networking.hostName = "dafoe"; # Define your hostname. + + # open ports for servers + networking.firewall.allowedTCPPorts = [ 22 80 443 631 8096 8920 ]; + networking.firewall.allowedUDPPorts = [ 22 80 443 631 1900 7359 ]; + + # static ipv6 (hetzner cant manage ipv6 via dhcp) + networking.interfaces = { + ens3.ipv6.addresses = [{ + address = "2a01:4f8:1c1e:83ae::"; + prefixLength = 64; + }]; + }; + networking.defaultGateway6 = { + address = "fe80::1"; + interface = "ens3"; + }; + + # Set your time zone. + time.timeZone = "Europe/Berlin"; + + # Define a user account. Don't forget to set a password with 'passwd'. + users.users.leonv = { + isNormalUser = true; + initialPassword = "leonv"; + extraGroups = [ "wheel" "nginx" ]; # Enable 'sudo' for the user. + packages = with pkgs; [ + ]; + }; + users.defaultUserShell = pkgs.zsh; + + # List packages installed in system profile. + environment.systemPackages = with pkgs; [ + wget + zsh + oh-my-zsh + restic + # for hugo website + hugo + go + ]; + environment.variables = { + EDITOR = "vim"; + + # bitwarden key + YUBICO_CLIENT_ID = "${../nix-secrets/willem/vaultwarden/yubico-id}"; + YUBICO_SECRET_KEY = "${../nix-secrets/willem/vaultwarden/yubico-secret}"; + }; + environment.shells = [ pkgs.zsh ]; + + programs.git = { + enable = true; + lfs.enable = true; + config = { + init = { + defaultBranch = "main"; + }; + commit = { + gpgsign = true; + }; + gpg = { + format = "ssh"; + }; + user = { + email = "leon.vatthauer@fau.de"; + name = "Leon Vatthauer"; + signingkey = "~/.ssh/git"; + }; + }; + }; + + nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ + "plexmediaserver" + ]; + + services.jellyfin.enable = true; + + system.stateVersion = "23.11"; # Did you read the comment? +} + diff --git a/dafoe/hardware-configuration.nix b/dafoe/hardware-configuration.nix new file mode 100644 index 0000000..72881ed --- /dev/null +++ b/dafoe/hardware-configuration.nix @@ -0,0 +1,33 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ata_piix" "virtio_pci" "virtio_scsi" "xhci_pci" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/40245dca-bf9c-4f39-ad96-8c2fee4b7b2e"; + fsType = "ext4"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/d8d1edd9-e549-4d92-94d5-8ac5af126a5b"; } + ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.ens3.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/dafoe/programs/default.nix b/dafoe/programs/default.nix new file mode 100644 index 0000000..5316865 --- /dev/null +++ b/dafoe/programs/default.nix @@ -0,0 +1,8 @@ +{ + imports = [ + ./neovim.nix + ./ssh.nix + ./starship.nix + ./zsh.nix + ]; +} diff --git a/dafoe/programs/neovim.nix b/dafoe/programs/neovim.nix new file mode 100644 index 0000000..37a1ea9 --- /dev/null +++ b/dafoe/programs/neovim.nix @@ -0,0 +1,14 @@ +{ pkgs, ... }: +{ + programs.neovim = { + enable = true; + configure = { + customRC = ''''; + packages.myVimPackage = with pkgs.vimPlugins; { + start = [ vim-nix ]; + }; + }; + viAlias = true; + vimAlias = true; + }; +} \ No newline at end of file diff --git a/dafoe/programs/ssh.nix b/dafoe/programs/ssh.nix new file mode 100644 index 0000000..e4c886d --- /dev/null +++ b/dafoe/programs/ssh.nix @@ -0,0 +1,6 @@ +{ + programs.ssh.startAgent = true; + programs.ssh.extraConfig = '' + AddKeysToAgent yes + ''; +} \ No newline at end of file diff --git a/dafoe/programs/starship.nix b/dafoe/programs/starship.nix new file mode 100644 index 0000000..a2d4525 --- /dev/null +++ b/dafoe/programs/starship.nix @@ -0,0 +1,8 @@ +{ + programs.starship = { + enable = true; + settings = { + gradle.symbol = "🐘"; + }; + }; +} \ No newline at end of file diff --git a/dafoe/programs/zsh.nix b/dafoe/programs/zsh.nix new file mode 100644 index 0000000..f783f10 --- /dev/null +++ b/dafoe/programs/zsh.nix @@ -0,0 +1,19 @@ +{ + programs.zsh = { + enable = true; + shellAliases = { + clean = "sudo nix-env --delete-generations old --profile /nix/var/nix/profiles/system && sudo /nix/var/nix/profiles/system/bin/switch-to-configuration switch && sudo nix-store --gc"; + }; + shellInit = '' + function rebuild () { + sudo nixos-rebuild switch --flake "/home/leonv/nixos?submodules=1" + sudo cp -r /home/leonv/nixos /etc/ + } + ''; + ohMyZsh = { + enable = true; + plugins = [ "git" ]; + theme = "dpoggi"; + }; + }; +} diff --git a/dafoe/services/acme.nix b/dafoe/services/acme.nix new file mode 100644 index 0000000..f8fa687 --- /dev/null +++ b/dafoe/services/acme.nix @@ -0,0 +1,10 @@ +{ + security.acme.acceptTerms = true; + security.acme.certs = { + "git.vatthauer.xyz".email = "leonvatthauer@outlook.com"; + "vaultwarden.vatthauer.xyz".email = "leonvatthauer@outlook.com"; + "video.vatthauer.xyz".email = "leonvatthauer@outlook.com"; + "files.vatthauer.xyz".email = "leonvatthauer@outlook.com"; + "www.vatthauer.xyz".email = "leonvatthauer@outlook.com"; + }; +} diff --git a/dafoe/services/ddns.nix b/dafoe/services/ddns.nix new file mode 100644 index 0000000..76d79d0 --- /dev/null +++ b/dafoe/services/ddns.nix @@ -0,0 +1,16 @@ +{ pkgs, ... }: +{ + # dynamic dns + users.users.ddns = { + isSystemUser = true; + group = "ddns"; + }; + users.groups.ddns = {}; + systemd.services.ddns-updater = { + enable = true; + serviceConfig.User = "ddns"; + path = [ pkgs.curl ]; + script = "${../../nix-secrets/willem/ddns/update}"; + startAt = "hourly"; + }; +} diff --git a/dafoe/services/default.nix b/dafoe/services/default.nix new file mode 100644 index 0000000..7791043 --- /dev/null +++ b/dafoe/services/default.nix @@ -0,0 +1,13 @@ +{ lib, pkgs, inputs, ... }: +{ + imports = [ + ./acme.nix + ./ddns.nix + ./nginx.nix + ./forgejo.nix + #./printing.nix + ./restic.nix + ./ssh.nix + ./vaultwarden.nix + ]; +} diff --git a/dafoe/services/forgejo.nix b/dafoe/services/forgejo.nix new file mode 100644 index 0000000..6e1ffa1 --- /dev/null +++ b/dafoe/services/forgejo.nix @@ -0,0 +1,23 @@ +{ pkgs, ...}: +{ + services.forgejo = { + enable = true; + settings.DEFAULT.APP_NAME = "Lambda-Git"; + package = pkgs.forgejo; + stateDir = "/forgejo"; + database = { + type = "sqlite3"; + }; + dump = { + enable = true; + interval = "02:00"; + }; + settings.server = { + ROOT_URL = "https://git.vatthauer.xyz"; + HTTP_PORT = 3001; + DOMAIN = "git.vatthauer.xyz"; + }; + settings.session.COOKIE_SECURE = true; + settings.service.DISABLE_REGISTRATION = true; + }; +} diff --git a/dafoe/services/nginx.nix b/dafoe/services/nginx.nix new file mode 100644 index 0000000..79637c3 --- /dev/null +++ b/dafoe/services/nginx.nix @@ -0,0 +1,48 @@ +{ lib, pkgs, inputs, ... }: +{ + services.nginx = { + enable = true; + recommendedGzipSettings = true; + recommendedOptimisation = true; + recommendedProxySettings = true; + recommendedTlsSettings = true; + }; + + services.nginx.virtualHosts."git.vatthauer.xyz" = { + enableACME = true; + forceSSL = true; + locations."/" = { + proxyPass = "http://localhost:3001/"; + }; + }; + + services.nginx.virtualHosts."vaultwarden.vatthauer.xyz" = { + enableACME = true; + forceSSL = true; + locations."/" = { + proxyPass = "http://localhost:8222/"; + }; + }; + + services.nginx.virtualHosts."video.vatthauer.xyz" = { + enableACME = true; + forceSSL = false; + locations."/" = { + proxyPass = "http://localhost:8096"; + }; + }; + services.nginx.virtualHosts."www.vatthauer.xyz" = { + serverAliases = [ "vatthauer.xyz" ]; + forceSSL = true; + enableACME = true; + root = pkgs.callPackage ./resumee-website.nix {}; + }; + services.nginx.virtualHosts."files.vatthauer.xyz" = { + forceSSL = true; + enableACME = true; + locations."/" = { + root = "/var/www"; + extraConfig = "autoindex on;"; + }; + }; +} diff --git a/dafoe/services/printing.nix b/dafoe/services/printing.nix new file mode 100644 index 0000000..321e5b2 --- /dev/null +++ b/dafoe/services/printing.nix @@ -0,0 +1,20 @@ +{ pkgs, ... }: +{ + # Enable CUPS to print documents. + services.avahi = { + enable = true; + publish.enable = true; + publish.userServices = true; + }; + services.printing = { + enable = true; + drivers = [ pkgs.splix ]; + browsing = true; + listenAddresses = [ "*:631" ]; + allowFrom = [ "all" ]; + defaultShared = true; + extraConf = '' + BrowseLocalProtocols all + ''; + }; +} diff --git a/dafoe/services/restic.nix b/dafoe/services/restic.nix new file mode 100644 index 0000000..5b7f636 --- /dev/null +++ b/dafoe/services/restic.nix @@ -0,0 +1,15 @@ +{ + services.restic.backups = { + giteaBackup = { + paths = [ "/forgejo/dump" ]; + environmentFile = "${../../nix-secrets/willem/gitea/backupCreds}"; + passwordFile = "${../../nix-secrets/willem/restic/password}"; + repository = "b2:gitea-willem"; + initialize = true; + timerConfig = { + OnCalendar = "04:00"; + Persistent = true; + }; + }; + }; +} diff --git a/dafoe/services/resumee-website.nix b/dafoe/services/resumee-website.nix new file mode 100644 index 0000000..671f2ce --- /dev/null +++ b/dafoe/services/resumee-website.nix @@ -0,0 +1,15 @@ +{ stdenv, git, go, hugo }: +stdenv.mkDerivation { + name = "resumee-website"; + version = "1.0"; + src = builtins.fetchGit { + url = "https://git.vatthauer.xyz/leonv/resumee-website.git"; + rev = "5cd0f5bb30da8d7297a15be3704e4d9efc73d8b4"; + }; + nativeBuildInputs = [ git go hugo ]; + buildPhase = "hugo -d $out"; + outputHashAlgo = "sha256"; + outputHashMode = "recursive"; + outputHash = "sha256-BReyv7kH/dSd0xcISbCA8AFing7uFkghkbjF24pU0Og="; +} + diff --git a/dafoe/services/ssh.nix b/dafoe/services/ssh.nix new file mode 100644 index 0000000..650c7fc --- /dev/null +++ b/dafoe/services/ssh.nix @@ -0,0 +1,4 @@ +{ + # Enable the OpenSSH daemon. + services.openssh.enable = true; +} diff --git a/dafoe/services/vaultwarden.nix b/dafoe/services/vaultwarden.nix new file mode 100644 index 0000000..6fe8a81 --- /dev/null +++ b/dafoe/services/vaultwarden.nix @@ -0,0 +1,19 @@ +{ + services.vaultwarden = { + enable = true; + config = { + DOMAIN = "https://vaultwarden.vatthauer.xyz"; + SIGNUPS_ALLOWED = false; + + ROCKET_ADDRESS = "127.0.0.1"; + ROCKET_PORT = 8222; + + ROCKET_LOG = "critical"; + + ADMIN_TOKEN = "${../../nix-secrets/willem/vaultwarden/admin-token}"; + + YUBICO_CLIENT_ID = "${../../nix-secrets/willem/vaultwarden/yubico-id}"; + YUBICO_SECRET_KEY = "${../../nix-secrets/willem/vaultwarden/yubico-secret}"; + }; + }; +} diff --git a/flake.lock b/flake.lock index 0301f39..223a197 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ "cask-fonts": { "flake": false, "locked": { - "lastModified": 1715165884, - "narHash": "sha256-4ZffgMka7IehFyh5eoyZr3plmiRQo/xH2TVnvvTHAcQ=", + "lastModified": 1715569399, + "narHash": "sha256-bGbC5sO3wN7UWVlaCoUUnlpp24P/9kV34LaBjvXQP9Y=", "owner": "homebrew", "repo": "homebrew-cask-fonts", - "rev": "77f61ac21cddf94a489e35afbb983bc63a197a96", + "rev": "fe9faf2469a035266992c35bed50e082420679f8", "type": "github" }, "original": { @@ -128,11 +128,11 @@ ] }, "locked": { - "lastModified": 1715077503, - "narHash": "sha256-AfHQshzLQfUqk/efMtdebHaQHqVntCMjhymQzVFLes0=", + "lastModified": 1715486357, + "narHash": "sha256-4pRuzsHZOW5W4CsXI9uhKtiJeQSUoe1d2M9mWU98HC4=", "owner": "nix-community", "repo": "home-manager", - "rev": "6e277d9566de9976f47228dd8c580b97488734d4", + "rev": "44677a1c96810a8e8c4ffaeaad10c842402647c1", "type": "github" }, "original": { @@ -144,11 +144,11 @@ "homebrew-cask": { "flake": false, "locked": { - "lastModified": 1715172991, - "narHash": "sha256-o4vHBpP0PDG21LiYLHrPoFXYA6GrNQON8ufGsXawl1Q=", + "lastModified": 1715577907, + "narHash": "sha256-K4GPPLjVdDOZZRE50tVwqLh96+WGSWnO9uZkuut/5vs=", "owner": "homebrew", "repo": "homebrew-cask", - "rev": "1661caf1f3f8b01abbdb45527d7c38fa6a9d19ec", + "rev": "3c5e18462378b0a02c110600db381ac5aefa64b8", "type": "github" }, "original": { @@ -160,11 +160,11 @@ "homebrew-core": { "flake": false, "locked": { - "lastModified": 1715174902, - "narHash": "sha256-jMjz1RS0OxhVMFNEPFX1D198ykwxphBiMh1VAQtTgNY=", + "lastModified": 1715581709, + "narHash": "sha256-S00HUZjzCMAVDxNp2WER3IHc2NYjfYaxaVjEMgm7R0k=", "owner": "homebrew", "repo": "homebrew-core", - "rev": "2edce1c6d11778a06443502c440c11674bc2ff6e", + "rev": "96a62c6b06ff5fb7ded99dac22013e1d7deb1260", "type": "github" }, "original": { @@ -341,11 +341,11 @@ }, "unstable": { "locked": { - "lastModified": 1714906307, - "narHash": "sha256-UlRZtrCnhPFSJlDQE7M0eyhgvuuHBTe1eJ9N9AQlJQ0=", + "lastModified": 1715447595, + "narHash": "sha256-VsVAUQOj/cS1LCOmMjAGeRksXIAdPnFIjCQ0XLkCsT0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "25865a40d14b3f9cf19f19b924e2ab4069b09588", + "rev": "062ca2a9370a27a35c524dc82d540e6e9824b652", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 2991826..9a78bcc 100644 --- a/flake.nix +++ b/flake.nix @@ -44,6 +44,20 @@ } ]; }; + absol = unstable.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + modules = [ + ./absol/configuration.nix + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.leonv = import ./absol/leonv.nix; + home-manager.extraSpecialArgs = { inherit inputs; }; + } + ]; + }; iso = unstable.lib.nixosSystem { system = "x86_64-linux"; specialArgs = { inherit inputs; }; @@ -57,6 +71,11 @@ specialArgs = { inherit inputs; }; modules = [ ./willem/configuration.nix ]; }; + dafoe = unstable.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + modules = [ ./dafoe/configuration.nix ]; + }; }; darwinConfigurations = { shinx = darwin.lib.darwinSystem { diff --git a/gunther/leonv.nix b/gunther/leonv.nix index 358f8f3..6d9f34e 100755 --- a/gunther/leonv.nix +++ b/gunther/leonv.nix @@ -91,6 +91,9 @@ ]) lean4 + + # for emacs + texlab ]; programs.home-manager.enable = true;