From e8de6cfa5351ea3b02c0514750f64c181c436a32 Mon Sep 17 00:00:00 2001 From: Sijmen Date: Fri, 31 Mar 2023 14:17:02 +0200 Subject: [PATCH] Many updates --- common/configuration.nix | 8 +- common/dconf.nix | 8 +- common/home-manager.nix | 301 ++++++++++++++++++++++----- common/home-manager/gtk.nix | 10 +- common/home-manager/home.nix | 89 ++++++-- common/nvim.lua | 6 + framework/configuration.nix | 68 ++++-- framework/hardware-configuration.nix | 11 +- thinkpad/configuration.nix | 4 + 9 files changed, 398 insertions(+), 107 deletions(-) diff --git a/common/configuration.nix b/common/configuration.nix index cc2fc05..2ecfa44 100644 --- a/common/configuration.nix +++ b/common/configuration.nix @@ -34,7 +34,7 @@ users.users.sijmen = { isNormalUser = true; - extraGroups = [ "wheel" "docker" ]; + extraGroups = [ "wheel" "docker" "wireshark" "video" "dialout" "libvirt" ]; description = "Sijmen"; }; @@ -53,7 +53,9 @@ openssh = { enable = true; - passwordAuthentication = false; + settings = { + PasswordAuthentication = false; + }; }; syncthing = { @@ -64,6 +66,7 @@ }; fonts.fonts = with pkgs; [ + corefonts dejavu_fonts iosevka nerdfonts @@ -73,5 +76,6 @@ powerline-fonts source-han-sans ubuntu_font_family + vistafonts ]; } diff --git a/common/dconf.nix b/common/dconf.nix index c73d997..3156b76 100644 --- a/common/dconf.nix +++ b/common/dconf.nix @@ -10,7 +10,7 @@ "org/gnome/tweaks".show-extensions-notice = false; "org/gnome/desktop/wm/preferences" = { - button-layout = "appmenu:minimize,close"; + button-layout = ":"; resize-with-right-button = true; }; @@ -27,6 +27,7 @@ "org/gnome/desktop/interface" = { clock-show-weekday = true; show-battery-percentage = true; + color-scheme = "prefer-light"; }; "org/gnome/desktop/notifications/application/telegramdesktop" = { @@ -52,14 +53,15 @@ "org.gnome.Nautilus.desktop" "firefox.desktop" "telegramdesktop.desktop" - "org.gnome.Terminal.desktop" + "org.gnome.Console.desktop" "org.gnome.Settings.desktop" ]; disable-user-extensions = false; enabled-extensions = [ - "openweather-extension@jenslody.de" + "batterytime@typeof.pw" "nightthemeswitcher@romainvigier.fr" + "openweather-extension@jenslody.de" ]; }; diff --git a/common/home-manager.nix b/common/home-manager.nix index 1aa5106..1914b5a 100644 --- a/common/home-manager.nix +++ b/common/home-manager.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, pkgs, lib, ... }: { imports = [ @@ -15,38 +15,64 @@ home.stateVersion = config.system.stateVersion; programs = { - alacritty = { - enable = false; + bash = { + enable = true; + initExtra = '' + source ${pkgs.fetchurl { + url = "https://raw.githubusercontent.com/rupa/z/b82ac78a2d4457d2ca09973332638f123f065fd1/z.sh"; + sha256 = "98e4438cd31afb3ce594130335e7fbd8be5d75d9a53e4f3e084d97e6b8d19b0e"; + }} + + # SSH agent + eval $(${pkgs.openssh}/bin/ssh-agent) > /dev/null + trap 'test -n "$SSH_AUTH_SOCK" && eval $(${pkgs.openssh}/bin/ssh-agent -k)' 0 + ''; + sessionVariables = { + PYTHON_KEYRING_BACKEND = "keyring.backends.null.Keyring"; + }; + }; + + firefox = { + enable = true; + package = pkgs.firefox-wayland; + }; + + ncmpcpp = { + enable = true; settings = { - window.decorations = "none"; + colors_enabled = false; + }; + }; + + foot = { + enable = true; + settings = { + main = { + term = "xterm-256color"; + font = "Iosevka:size=12"; + }; colors = { - primary = { - background = "0xfafafa"; - foreground = "0x383a42"; - }; + background = "fafafa"; + foreground = "383a42"; - normal = { - black = "0x383a42"; - red = "0xe45649"; - green = "0x50a14f"; - yellow = "0xc18401"; - blue = "0x0184bc"; - magenta = "0xa626a4"; - cyan = "0x0997b3"; - white = "0xfafafa"; - }; + regular0 = "383a42"; + regular1 = "e45649"; + regular2 = "50a14f"; + regular3 = "c18401"; + regular4 = "0184bc"; + regular5 = "a626a4"; + regular6 = "0997b3"; + regular7 = "fafafa"; - bright = { - black = "0x383a42"; - red = "0xe45649"; - green = "0x50a14f"; - yellow = "0xc18401"; - blue = "0x0184bc"; - magenta = "0xa626a4"; - cyan = "0x0997b3"; - white = "0xfafafa"; - }; + bright0 = "383a42"; + bright1 = "e45649"; + bright2 = "50a14f"; + bright3 = "c18401"; + bright4 = "0184bc"; + bright5 = "a626a4"; + bright6 = "0997b3"; + bright7 = "fafafa"; }; }; }; @@ -73,13 +99,13 @@ }; }; - firefox = { + mpv = { enable = true; - package = pkgs.firefox-wayland; + config = { + script-opts = "ytdl_hook-ytdl_path=${pkgs.yt-dlp}/bin/yt-dlp"; + }; }; - chromium.enable = true; - neovim = { enable = true; vimAlias = true; @@ -116,6 +142,7 @@ plenary-nvim vim-closetag vim-nix + vim-startify vim-startuptime ]; }; @@ -130,38 +157,189 @@ ''; }; - alot.enable = true; - gpg.enable = true; - home-manager.enable = true; - mbsync.enable = true; - password-store.enable = true; - msmtp.enable = true; - - bash = { - enable = true; - initExtra = '' - source ${pkgs.fetchurl { url = "https://raw.githubusercontent.com/rupa/z/v1.11/z.sh"; sha256 = "f24e0791ba10f6a8301461da3fc50333eee2e009a19e5d0e9f3661f0d0446767"; }} - ''; - }; - - mpv = { - enable = true; - config = { - script-opts = "ytdl_hook-ytdl_path=${pkgs.yt-dlp}/bin/yt-dlp"; - }; - }; - yt-dlp = { enable = true; settings = { sponsorblock-mark = "sponsor,selfpromo,intro,outro,poi_highlight"; }; }; + + waybar = { + enable = true; + }; + + beets = { + enable = true; + settings = { + paths.default = "$albumartist/$year - $album%aunique{}/$track $title"; + }; + }; + + ssh = { + enable = true; + matchBlocks = { + # Home + "rpi" = { + user = "root"; + hostname = "cloud.sijmenschoon.nl"; + }; + "desktop" = { + user = "vijfhoek"; + hostname = "192.168.1.99"; + proxyJump = "cloud.sijmenschoon.nl"; + }; + "nas" = { + user = "sijmen"; + hostname = "192.168.1.123"; + proxyJump = "cloud.sijmenschoon.nl"; + }; + # Servers + "hermes" = { + user = "ubuntu"; + hostname = "hermes.sijmenschoon.nl"; + }; + # Scintilla + "linscin" = { + user = "sijmens"; + hostname = "linscin.scintilla.utwente.nl"; + }; + "britt" = { + user = "sijmens"; + hostname = "britt.scintilla.utwente.nl"; + proxyJump = "linscin"; + }; + "*.scintilla.utwente.nl" = { + user = "sijmens"; + }; + "*.scintilla.nl" = { + user = "sijmens"; + }; + # Uni + "xoc2" = { + user = "s2639149"; + hostname = "xoc2.ewi.utwente.nl"; + proxyJump = "sijmens@linscin.scintilla.utwente.nl"; + }; + "noc2" = { + user = "s2639149"; + hostname = "noc2.ewi.utwente.nl"; + proxyJump = "sijmens@linscin.scintilla.utwente.nl"; + }; + "hidde" = { + user = "hidde"; + hostname = "84.245.15.16"; + }; + }; + extraConfig = '' + AddKeysToAgent 15m + ''; + }; + + alot.enable = true; + chromium.enable = true; + gpg.enable = true; + home-manager.enable = true; + mbsync.enable = true; + msmtp.enable = true; + password-store.enable = true; }; - services.gpg-agent = { + wayland.windowManager.sway = { enable = true; - pinentryFlavor = "qt"; + config = let + scintillaDellOutput = { pos = "0 0"; }; + scintillaHpOutput = { pos = "0 120"; }; + in rec { + modifier = "Mod4"; + terminal = "foot"; + fonts = { + names = [ "Ubuntu" ]; + style = "Regular"; + size = 11.0; + }; + input = { + "type:touchpad" = { + natural_scroll = "enabled"; + dwt = "disabled"; + click_method = "clickfinger"; + }; + "type:keyboard" = { + xkb_layout = "us,kr"; + xkb_options = "grp:alt_caps_toggle"; + }; + "type:mouse" = { + accel_profile = "flat"; + }; + }; + output = { + "*" = { + bg = "~/Pictures/berg.jpg fill"; + subpixel = "none"; + }; + "Unknown 0x095F 0x00000000" = { pos = "92 1200"; scale = "1.3"; }; # framework + "Dell Inc. DELL U2410 F525M13318GL" = scintillaDellOutput; # bibi + "Dell Inc. DELL U2410 F525M12P08RL" = scintillaDellOutput; # fabienne + "Hewlett Packard HP E222 CNK6110ZM2" = scintillaHpOutput; # floortje + "Hewlett Packard HP E222 CNK6110ZM7" = scintillaHpOutput; + "Hewlett Packard HP E222 CNK6110ZMF" = scintillaHpOutput; # tamara + "Hewlett Packard HP E222 CNK6110ZR8" = scintillaHpOutput; # megan + "Hewlett Packard HP E222 CNK611104P" = scintillaHpOutput; # charissa + "Hewlett Packard HP E222 CNK611104X" = scintillaHpOutput; + "Hewlett Packard HP E222 CNK6111052" = scintillaHpOutput; # ilona + "Goldstar Company Ltd LG Ultra HD 0x00008520" = { mode = "2560x1440@60Hz"; }; # thuis rechts + "Dell Inc. DELL S2722DGM 3P84Z83" = { mode = "2560x1440@144Hz"; }; # thuis links (hdmi) + }; + keybindings = lib.mkOptionDefault { + XF86MonBrightnessDown = "exec ${pkgs.light}/bin/light -U 5"; + XF86MonBrightnessUp = "exec ${pkgs.light}/bin/light -A 5"; + "shift+XF86MonBrightnessDown" = "exec ${pkgs.light}/bin/light -U 1"; + "shift+XF86MonBrightnessUp" = "exec ${pkgs.light}/bin/light -A 1"; + XF86AudioRaiseVolume = "exec '${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +5%'"; + XF86AudioLowerVolume = "exec '${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -5%'"; + XF86AudioMute = "exec '${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle'"; + Print = "exec '${pkgs.grim}/bin/grim -g \"$(${pkgs.slurp}/bin/slurp)\" - | wl-copy -t image/png'"; + + "${modifier}+alt+l" = "exec '${pkgs.swaylock}/bin/swaylock -c 000000 -i eDP-1:Pictures/vista32.jpg'"; + "${modifier}+ctrl+Return" = "exec '${pkgs.gnome.nautilus}/bin/nautilus'"; + + "${modifier}+ctrl+Down" = "move workspace to down"; + "${modifier}+ctrl+Up" = "move workspace to up"; + "${modifier}+ctrl+Left" = "move workspace to left"; + "${modifier}+ctrl+Right" = "move workspace to right"; + "${modifier}+ctrl+j" = "move workspace to down"; + "${modifier}+ctrl+k" = "move workspace to up"; + "${modifier}+ctrl+h" = "move workspace to left"; + "${modifier}+ctrl+l" = "move workspace to right"; + + "${modifier}+ctrl+f" = "exec '${pkgs.python3}/bin/python /etc/nixos/common/sway/next_free.py | xargs swaymsg -- workspace number'"; + "${modifier}+comma" = "workspace prev_on_output"; + "${modifier}+period" = "workspace next_on_output"; + }; + }; + }; + + services = { + gpg-agent = { + enable = true; + pinentryFlavor = "qt"; + }; + + gnome-keyring = { + enable = true; + components = ["secrets" "ssh"]; + }; + + mpd = { + enable = true; + musicDirectory = "/home/sijmen/Music"; + }; + + mako = { + enable = true; + font = "Ubuntu 11"; + defaultTimeout = 5000; + groupBy = "app-name,summary"; + }; }; accounts.email.accounts.Personal = { @@ -186,5 +364,18 @@ msmtp.enable = true; }; + + accounts.email.accounts.Scintilla = { + primary = false; + + address = "sijmens@scintilla.utwente.nl"; + aliases = [ "sschoon@scintilla.utwente.nl" ]; + realName = "Sijmen Schoon"; + + userName = "sijmens"; + passwordCommand = "pass show email/scintilla"; + + folders.inbox = "INBOX"; + }; }; } diff --git a/common/home-manager/gtk.nix b/common/home-manager/gtk.nix index ddd009e..2951dd9 100644 --- a/common/home-manager/gtk.nix +++ b/common/home-manager/gtk.nix @@ -17,12 +17,14 @@ gtk3.bookmarks = [ "file:///home/sijmen/Sync" "file:///home/sijmen/Sync/Scintilla Scintilla" - "smb://10.100.0.1/docs/ NAS" - "smb://10.100.0.1/docs/users/sijmen sijmen" - "smb://10.100.0.1/docs/media Media" - "sftp://sijmens@virtuscin.scintilla.utwente.nl/data Scintilla Drive" + "file:///home/sijmen/Sync/Study Study" + "smb://192.168.1.123/docs/ NAS" + "smb://192.168.1.123/docs/users/sijmen sijmen" + "smb://192.168.1.123/docs/media Media" + "sftp://sijmens@virtuscin.scintilla.utwente.nl/data Scintilla" "sftp://sijmens@virtuscin.scintilla.utwente.nl/data/commissies/spock/SPOCK7 SPOCK7" "sftp://sijmens@virtuscin.scintilla.utwente.nl/data/commissies/sot sot" + "smb://britt.scintilla.utwente.nl/music britt" ]; gtk3.extraConfig = { diff --git a/common/home-manager/home.nix b/common/home-manager/home.nix index 440849e..b1c5a90 100644 --- a/common/home-manager/home.nix +++ b/common/home-manager/home.nix @@ -8,6 +8,8 @@ libreoffice-fresh obsidian thunderbird + pandoc + texlive.combined.scheme-full # Programming bacon @@ -17,59 +19,91 @@ tig vscode-fhs + poetry + cargo + # Graphics gimp graphicsmagick inkscape + imv # Internet discord + element-desktop + gnome.epiphany + httpie - remmina - tdesktop - w3m wget + remmina + x2goclient + # Sound & Video + cantata easyeffects + pavucontrol spotify + ncmpcpp # Gaming prismlauncher + heroic # System Tools borgbackup - fd - file - gnome.gnome-system-monitor - htop - iotop - killall - lsof - ncdu - pika-backup - powertop - s-tui + dconf + dmenu + grim + light screen - silver-searcher + slurp smartmontools + swaylock sysstat - tree usbutils virt-manager wl-clipboard yubikey-manager + watchexec + wine + xfce.thunar + gnome.nautilus + nnn + home-manager + gnome.evince + gnome.gnome-characters + gnome.gnome-keyring + gnome.gnome-system-monitor gnome.gnome-tweaks - gnomeExtensions.openweather - gnomeExtensions.night-theme-switcher + pika-backup + + dua + fd + file + killall + lsof + ncdu + silver-searcher + tree + + htop + iotop + powertop + s-tui libarchive p7zip unrar unzip zip + + php + python311 + python311Packages.i3ipc + ruby ]; shellAliases = { @@ -78,9 +112,9 @@ "...." = "cd ../../.."; "....." = "cd ../../../.."; - o = "xdg-open"; + o = "${pkgs.xdg-utils}/bin/xdg-open"; - ncdu = "ncdu --color dark"; + ncdu = "${pkgs.ncdu}/bin/ncdu --color dark"; config = "vim /etc/nixos/configuration.nix"; hmconf = "vim /etc/nixos/common/home-manager.nix"; @@ -93,6 +127,8 @@ cdnix = "cd /etc/nixos"; + pvim = "${pkgs.poetry}/bin/poetry run vim"; + ga = "${pkgs.git}/bin/git add"; gb = "${pkgs.git}/bin/git branch"; gba = "${pkgs.git}/bin/git branch -a"; @@ -120,6 +156,19 @@ tigs = "${pkgs.tig}/bin/tig status"; oath = "${pkgs.yubikey-manager}/bin/ykman oath accounts code"; + + dc = "${pkgs.docker-compose}/bin/docker-compose"; + dclf = "${pkgs.docker-compose}/bin/docker-compose logs --tail 100 -f"; + }; + + pointerCursor = { + name = "Adwaita"; + package = pkgs.gnome.adwaita-icon-theme; + size = 24; + x11 = { + enable = true; + defaultCursor = "Adwaita"; + }; }; }; } diff --git a/common/nvim.lua b/common/nvim.lua index ee4e806..4f9d148 100644 --- a/common/nvim.lua +++ b/common/nvim.lua @@ -143,8 +143,13 @@ cmp.setup { require("leap").add_default_mappings() +vim.opt.termguicolors = true +require("bufferline").setup() + vim.api.nvim_set_keymap("n", "", ":NvimTreeToggle", { noremap = true, silent = true }) +vim.cmd "colorscheme onehalflight" +--[[ local update_theme = function() local file = io.popen("dconf read /org/gnome/desktop/interface/color-scheme") local theme = file:read("*all") @@ -159,3 +164,4 @@ end update_theme() vim.loop.new_timer():start(0, 750, vim.schedule_wrap(update_theme)) +--]] diff --git a/framework/configuration.nix b/framework/configuration.nix index 95901ca..73954d2 100644 --- a/framework/configuration.nix +++ b/framework/configuration.nix @@ -1,5 +1,16 @@ { config, pkgs, ... }: +let + greetdSwayConfig = pkgs.writeText "greetd-sway-config" '' + # `-l` activates layer-shell mode. Notice that `swaymsg exit` will run after gtkgreet. + exec "${pkgs.greetd.gtkgreet}/bin/gtkgreet -l -c sway; swaymsg exit" + bindsym Mod4+shift+e exec swaynag \ + -t warning \ + -m 'What do you want to do?' \ + -b 'Poweroff' 'systemctl poweroff' \ + -b 'Reboot' 'systemctl reboot' + ''; +in { imports = [ @@ -7,7 +18,13 @@ ../common/configuration.nix ]; - virtualisation.docker.enable = true; + virtualisation = { + virtualisation.docker.enable = true; + virtualisation.libvirtd.enable = true; + virtualisation.spiceUSBRedirection.enable = true; + #virtualisation.waydroid.enable = true; + #virtualisation.lxd.enable = true; + }; hardware = { bluetooth.enable = true; @@ -36,7 +53,7 @@ "splash" "vga=current" "udev.log_level=3" - "i915.enable_psr=0" + "i915.enable_psr=1" "nvme.noacpi=1" "resume=/dev/disk/by-uuid/7e88d61f-5581-45fb-82f1-29a0e0caf4c0" ]; @@ -60,6 +77,9 @@ 22000 # syncthing sync 51414 # transmission 57621 # spotify connect + 1313 + 8000 + 8080 ]; allowedUDPPorts = [ @@ -82,11 +102,17 @@ }; }; + environment.etc."greetd/environments".text = '' + sway + bash + ''; + services = { - xserver = { + greetd = { enable = true; - displayManager.gdm.enable = true; - desktopManager.gnome.enable = true; + settings = { + default_session.command = "${pkgs.sway}/bin/sway --config ${greetdSwayConfig}"; + }; }; syncthing = { @@ -106,30 +132,41 @@ }; }; - fprintd.enable = true; pipewire = { enable = true; alsa = { enable = true; support32Bit = true; }; pulse.enable = true; }; - flatpak.enable = true; - ratbagd.enable = true; - - logind.lidSwitchDocked = "suspend"; - - power-profiles-daemon.enable = false; tlp = { enable = true; settings = { CPU_ENERGY_PERF_POLICY_ON_AC = "64"; CPU_ENERGY_PERF_POLICY_ON_BAT = "140"; PCIE_ASPM_ON_BAT = "powersupersave"; + + # Bus 001 Device 040: ID 1050:0407 Yubico.com Yubikey 4/5 OTP+U2F+CCID + # Bus 001 Device 038: ID 32ac:0002 Framework HDMI Expansion Card + USB_ALLOWLIST="1050:0407 32ac:0002"; }; }; + + avahi = { + enable = true; + nssmdns = true; + openFirewall = true; + }; + + fwupd.extraRemotes = [ "lvfs-testing" ]; + fprintd.enable = true; + ratbagd.enable = true; + logind.lidSwitchDocked = "suspend"; + power-profiles-daemon.enable = false; }; security.pam.services.login.fprintAuth = true; + security.pam.services.swaylock = {}; + security.polkit.enable = true; environment = { gnome.excludePackages = (with pkgs; [ @@ -162,8 +199,11 @@ dedicatedServer.openFirewall = true; }; - nixpkgs.config.packageOverrides = pkgs: { - vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; }; + nixpkgs.config = { + packageOverrides = pkgs: { + vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; }; + }; + permittedInsecurePackages = [ "electron-18.1.0" ]; }; home-manager.users.sijmen.imports = [ ../common/dconf.nix ]; diff --git a/framework/hardware-configuration.nix b/framework/hardware-configuration.nix index d34636f..ba4f77e 100644 --- a/framework/hardware-configuration.nix +++ b/framework/hardware-configuration.nix @@ -8,7 +8,7 @@ [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usbhid" ]; + boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; @@ -32,17 +32,10 @@ # 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.br-07391a631710.useDHCP = lib.mkDefault true; - # networking.interfaces.br-25489814654a.useDHCP = lib.mkDefault true; - # networking.interfaces.br-6a09bcb636d7.useDHCP = lib.mkDefault true; - # networking.interfaces.br-e4e3b736637d.useDHCP = lib.mkDefault true; - # networking.interfaces.docker0.useDHCP = lib.mkDefault true; - # networking.interfaces.wg0.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s13f0u3c2.useDHCP = lib.mkDefault true; # networking.interfaces.wlp166s0.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; - # high-resolution display - hardware.video.hidpi.enable = lib.mkDefault true; } diff --git a/thinkpad/configuration.nix b/thinkpad/configuration.nix index 6de69e1..5a721b0 100644 --- a/thinkpad/configuration.nix +++ b/thinkpad/configuration.nix @@ -103,6 +103,10 @@ }; }; }; + + fwupd = { + enableTestRemote = true; + }; }; environment = {