diff --git a/hosts/dunamis/rebuild-with-x86_64-v3.nix b/hosts/dunamis/rebuild-with-x86_64-v3.nix new file mode 100644 index 0000000..5826625 --- /dev/null +++ b/hosts/dunamis/rebuild-with-x86_64-v3.nix @@ -0,0 +1,9 @@ +let + gcc.arch = "x86-64-v3"; +in { + nix.settings.system-features = ["gccarch-${gcc.arch}"]; + nixpkgs.hostPlatform = { + system = "x86_64-linux"; + inherit gcc; + }; +} diff --git a/modules/home/desktop/jay/default.nix b/modules/home/desktop/jay/default.nix new file mode 100644 index 0000000..b3878ff --- /dev/null +++ b/modules/home/desktop/jay/default.nix @@ -0,0 +1,649 @@ +{ + perSystem, + osConfig, + config, + pkgs, + lib, + ... +}: let + inherit (lib) mkIf mkEnableOption mkDefault mkForce getExe; + inherit (osConfig.networking) hostId; + inherit (config.lib.stylix) colors; + cfg = config.desktop.niri; + cursorSize = config.stylix.cursor.size; + cursorName = config.stylix.cursor.name; + keyboard = + if hostId == "eldrid" + then "chromeos" + else "platform"; + xdgPics = + config.xdg.userDirs.pictures; + ifLaptop = mkIf (hostId != "c7f6c4a1"); + # TODO: make terminal depent on thing outside a module + terminal = getExe pkgs.wezterm; + launcher = getExe pkgs.fuzzel; + browser = "app.zen_browser.zen"; + lockscreen = getExe pkgs.gtklock; +in { + options = { + desktop.jay.enable = + mkEnableOption "enable jay desktop"; + }; + config = mkIf cfg.enable { + stylix.targets = { + waybar.enable = false; + wpaperd.enable = true; + qt.enable = false; + }; + services = { + copyq.enable = true; + network-manager-applet.enable = true; + playerctld.enable = true; + swayosd = { + enable = true; + topMargin = 0.8; + }; + wpaperd.enable = true; + gnome-keyring = { + enable = true; + components = ["secrets"]; + }; + gammastep = { + enable = true; + provider = "manual"; + latitude = 49.6; + longitude = 36.1; + tray = true; + temperature = { + day = 6500; + night = 3000; + }; + }; + udiskie = { + enable = true; + automount = false; + notify = true; + tray = "auto"; + }; + swaync = { + enable = true; + settings = { + cssPriority = "user"; + image-visibility = "when-available"; + keyboard-shortcut = true; + relative-timestamps = true; + timeout = 5; + timeout-low = 5; + timeout-critical = 0; + script-fail-notify = true; + transition-time = 200; + + # Layer settings + layer-shell = true; + layer = "overlay"; + control-center-layer = "overlay"; + + # Notification settings + positionX = "right"; + positionY = "top"; + notification-2fa-action = true; + notification-inline-replies = false; + notification-icon-size = 32; + notification-body-image-height = 100; + notification-body-image-width = 200; + notification-window-width = 400; + + # Control center settings + control-center-positionX = "right"; + control-center-positionY = "top"; + control-center-width = 500; + control-center-exclusive-zone = true; + fit-to-screen = true; + hide-on-action = true; + hide-on-clear = false; + + # Widget settings + widgets = [ + "title" + "dnd" + "notifications" + "mpris" + ]; + + widget-config = { + title = { + text = "Notifications"; + clear-all-button = true; + button-text = "Clear All"; + }; + dnd = { + text = "Do Not Disturb"; + }; + mpris = { + image-size = 96; + image-radius = 12; + blur = true; + }; + }; + }; + style = '' + /*** Global ***/ + progress, + progressbar, + trough { + border-radius: 16px; + } + + .app-icon, + .image { + -gtk-icon-effect: none; + } + + .notification-action { + border-radius: 12px; + margin: 0.5rem; + } + + .close-button { + margin: 24px; + padding: 0.2rem; + border-radius: 16px; + } + + /*** Notifications ***/ + .notification-group.collapsed + .notification-row:not(:last-child) + .notification-action, + .notification-group.collapsed + .notification-row:not(:last-child) + .notification-default-action { + opacity: 0; + } + + .trough { + margin: 4px; + border-radius: 7px; + } + + .notification, + .notification.low, + .notification.normal, + .notification.critical, + .control-center { + margin: 16px; + border-radius: 7px; + } + + .floating-notifications, + .notification-content { + border-radius: 7px; + } + + .control-center-list { + background: transparent; + } + + /*** Widgets ***/ + /* Title widget */ + .widget-title { + margin: 0.5rem; + } + + .widget-title > label { + font-weight: bold; + } + + .widget-title > button { + border-radius: 16px; + padding: 0.5rem; + } + + /* DND Widget */ + .widget-dnd { + margin: 0.5rem; + } + + .widget-dnd > label { + font-weight: bold; + } + + .widget-dnd > switch { + border-radius: 16px; + } + + .widget-dnd > switch slider { + border-radius: 16px; + padding: 0.25rem; + } + + /* Mpris widget */ + .widget-mpris .widget-mpris-player { + border-radius: 16px; + margin: 0.5rem; + padding: 0.5rem; + } + + .widget-mpris .widget-mpris-player .widget-mpris-album-art { + border-radius: 16px; + } + + .widget-mpris .widget-mpris-player .widget-mpris-title { + font-weight: bold; + } + + .widget-mpris .widget-mpris-player .widget-mpris-subtitle { + font-weight: normal; + } + + .widget-mpris .widget-mpris-player > box > button { + border: 1px solid transparent; + border-radius: 16px; + padding: 0.25rem; + } + ''; + }; + }; + programs.fuzzel = { + enable = true; + settings = { + main = { + terminal = terminal + " -e"; + fields = "filename,name,generic,keywords,categories,exec"; + dpi-aware = true; + horizontal-pad = 12; + vertical-pad = 12; + show-actions = true; + match-mode = "fuzzy"; + icon-theme = config.dconf.settings."org/gnome/desktop/interface".icon-theme; + }; + border = mkDefault { + width = 3; + radius = 12; + }; + }; + }; + programs.i3status-rust = { + enable = true; + bars = { + default = { + theme = "plain"; + blocks = [ + { + alert = 10.0; + block = "disk_space"; + info_type = "available"; + interval = 60; + path = "/"; + warning = 20.0; + } + { + block = "memory"; + format = " $icon mem_used_percents "; + format_alt = " $icon $swap_used_percents "; + } + { + block = "cpu"; + interval = 1; + } + { + block = "load"; + format = " $icon $1m "; + interval = 1; + } + { + block = "sound"; + } + { + block = "time"; + format = " $timestamp.datetime(f:'%a %d/%m %R') "; + interval = 60; + } + ]; + }; + }; + }; + xdg.configFile.jay = { + target = "jay/config.toml"; + recursive = true; + source = (pkgs.formats.toml {}).generate "jay-config" { + keymap = '' + xkb_keymap { + xkb_keycodes { include "evdev+aliases(qwerty)" }; + xkb_types { include "complete" }; + xkb_compat { include "complete" }; + xkb_symbols { include "pc+us+inet(evdev)" }; + }; + ''; + on-graphics-initialized = [ + { + type = "exec"; + exec = "${perSystem.self.wl-tray-bridge}/bin/wl-tray-bridge"; + } + ]; + outputs = [ + { + match.connector = "eDP-1"; + scale = 1.2; + } + { + match.connector = "DP-2"; + scale = 1.33; + } + ]; + vrr = { + mode = "always"; + cursor-hz = 75; + }; + repeat-rate = { + rate = 50; + delay = 200; + }; + theme = { + bg-color = "#${colors.base00}"; + bar-bg-color = "#${colors.base00}"; + border-color = "#${colors.base0D}"; + separator-color = "#${colors.base01}"; + bar-status-text-color = "#${colors.base05}"; + focused-title-text-color = "#${colors.base07}"; + focused-title-bg-color = "#${colors.base00}"; + focused-inactive-title-text-color = "#${colors.base03}"; + focused-inactive-title-bg-color = "#${colors.base00}"; + unfocused-title-text-color = "#${colors.base03}"; + unfocused-title-bg-color = "#${colors.base01}"; + attention-requested-bg-color = "#${colors.base09}"; + font = "${config.stylix.fonts.serif.name}"; + border-width = 2; + title-height = config.stylix.fonts.serif.size; + }; + status = { + # format = "pango"; + exec = ["${getExe pkgs.i3status-rs}" "config-default"]; + }; + window-management-key = "Super_L"; + shortcuts = let + left = "n"; + down = "e"; + up = "i"; + right = "o"; + in { + "logo-${left}" = "focus-left"; + "logo-${down}" = "focus-down"; + "logo-${up}" = "focus-up"; + "logo-${right}" = "focus-right"; + "logo-shift-${left}" = "move-left"; + "logo-shift-${down}" = "move-down"; + "logo-shift-${up}" = "move-up"; + "logo-shift-${right}" = "move-right"; + logo-d = "split-horizontal"; + logo-v = "split-vertical"; + logo-t = "toggle-split"; + logo-m = "toggle-mono"; + logo-shift-m = "toggle-fullscreen"; + logo-f = "focus-parent"; + logo-q = "close"; + logo-shift-f = "toggle-floating"; + logo-Return = { + type = "exec"; + exec = "wezterm"; + }; + logo-space = { + type = "exec"; + exec = launcher; + }; + logo-shift-ctrl-q = "quit"; + logo-shift-r = "reload-config-toml"; + ctrl-alt-F1 = { + type = "switch-to-vt"; + num = 1; + }; + ctrl-alt-F2 = { + type = "switch-to-vt"; + num = 2; + }; + ctrl-alt-F3 = { + type = "switch-to-vt"; + num = 3; + }; + ctrl-alt-F4 = { + type = "switch-to-vt"; + num = 4; + }; + ctrl-alt-F5 = { + type = "switch-to-vt"; + num = 5; + }; + ctrl-alt-F6 = { + type = "switch-to-vt"; + num = 6; + }; + ctrl-alt-F7 = { + type = "switch-to-vt"; + num = 7; + }; + ctrl-alt-F8 = { + type = "switch-to-vt"; + num = 8; + }; + ctrl-alt-F9 = { + type = "switch-to-vt"; + num = 9; + }; + ctrl-alt-F10 = { + type = "switch-to-vt"; + num = 10; + }; + ctrl-alt-F11 = { + type = "switch-to-vt"; + num = 11; + }; + ctrl-alt-F12 = { + type = "switch-to-vt"; + num = 12; + }; + logo-1 = { + type = "show-workspace"; + name = "1"; + }; + logo-2 = { + type = "show-workspace"; + name = "2"; + }; + logo-3 = { + type = "show-workspace"; + name = "3"; + }; + logo-4 = { + type = "show-workspace"; + name = "4"; + }; + logo-5 = { + type = "show-workspace"; + name = "5"; + }; + logo-6 = { + type = "show-workspace"; + name = "6"; + }; + logo-7 = { + type = "show-workspace"; + name = "7"; + }; + logo-8 = { + type = "show-workspace"; + name = "8"; + }; + logo-9 = { + type = "show-workspace"; + name = "9"; + }; + logo-0 = { + type = "show-workspace"; + name = "10"; + }; + logo-shift-1 = { + type = "move-to-workspace"; + name = "1"; + }; + logo-shift-2 = { + type = "move-to-workspace"; + name = "2"; + }; + logo-shift-3 = { + type = "move-to-workspace"; + name = "3"; + }; + logo-shift-4 = { + type = "move-to-workspace"; + name = "4"; + }; + logo-shift-5 = { + type = "move-to-workspace"; + name = "5"; + }; + logo-shift-6 = { + type = "move-to-workspace"; + name = "6"; + }; + logo-shift-7 = { + type = "move-to-workspace"; + name = "7"; + }; + logo-shift-8 = { + type = "move-to-workspace"; + name = "8"; + }; + logo-shift-9 = { + type = "move-to-workspace"; + name = "9"; + }; + logo-shift-0 = { + type = "move-to-workspace"; + name = "10"; + }; + }; + }; + }; + home.packages = with pkgs; [ + jay + (ifLaptop brightnessctl) + nautilus + helvum + loupe + papers + junction + celluloid + mission-center + dconf + libnotify + playerctl + wdisplays + pwvucontrol + wl-clipboard-rs + libqalculate + ]; + + # gtk = { + # enable = true; + # iconTheme = { + # name = + # if config.stylix.polarity == "dark" + # then "Papirus-Dark" + # else "Papirus-Light"; + # package = + # if osConfig.module.stylix.theme == "nord" + # then pkgs.papirus-nord + # else pkgs.papirus-icon-theme; + # }; + # }; + qt = { + enable = true; + platformTheme.name = "gtk3"; + }; + # dconf.settings = { + # "org/gnome/desktop/interface" = { + # icon-theme = config.gtk.iconTheme.name; + # }; + # }; + xdg = { + mime.enable = true; + mimeApps = { + enable = true; + defaultApplications = let + file_manager = ["org.gnome.Nautilus.desktop"]; + image_viewer = ["org.gnome.Loupe.desktop"]; + pdf_reader = ["org.gnome.Papers.desktop"]; + video_player = ["io.github.celluloid_player.Celluloid.desktop"]; + web_browser = ["re.sonny.Junction.desktop"]; + in { + "application/pdf" = pdf_reader; + "image/jpeg" = image_viewer; + "image/png" = image_viewer; + "inode/directory" = file_manager; + "text/html" = web_browser; + "video/mp4" = video_player; + "video/mpeg" = video_player; + "video/x-matroska" = video_player; + "video/x-mpeg" = video_player; + "x-scheme-handler/about" = web_browser; + "x-scheme-handler/http" = web_browser; + "x-scheme-handler/https" = web_browser; + "x-scheme-handler/unknown" = web_browser; + }; + }; + }; + systemd.user = { + settings.Manager.DefaultEnvironment = { + QT_QPA_PLATFORM = "wayland"; + DISPLAY = ":123"; + }; + targets.tray.Unit.Description = "Home Manager System Tray"; # workaround for udiskie + services = let + mkGraphicalService = config: graphicalService // config; + graphicalService = { + Install.WantedBy = ["niri.service"]; + Unit = { + Requisite = ["graphical-session.target"]; + PartOf = ["graphical-session.target"]; + After = ["graphical-session.target"]; + }; + Service = { + Restart = "on-failure"; + TimeoutStopSec = 10; + RestartSec = 1; + }; + }; + in { + udiskie = mkGraphicalService {}; + waybar = mkGraphicalService {}; + network-manager-applet = mkGraphicalService {}; + copyq = mkGraphicalService { + Service = + graphicalService.Service + // { + Environment = mkForce "QT_QPA_PLATFORM=wayland"; + }; + }; + xwayland-satellite = mkGraphicalService { + Service = + graphicalService.Service + // { + Type = "simple"; + ExecStart = getExe pkgs.xwayland-satellite + " :123"; + }; + }; + wpaperd = mkGraphicalService { + Service = + mkDefault graphicalService.Service; + }; + gnome-polkit-agent = mkGraphicalService { + Service = + graphicalService.Service + // { + Type = "simple"; + ExecStart = pkgs.polkit_gnome + "/libexec/polkit-gnome-authentication-agent-1"; + }; + }; + }; + }; + }; +} diff --git a/modules/nixos/desktop/jay.nix b/modules/nixos/desktop/jay.nix new file mode 100644 index 0000000..3a87650 --- /dev/null +++ b/modules/nixos/desktop/jay.nix @@ -0,0 +1,73 @@ +{ + config, + pkgs, + lib, + ... +}: let + inherit (lib) mkIf mkEnableOption getExe; + cfg = config.desktop.niri; +in { + options = { + desktop.niri.enable = + mkEnableOption "enable niri desktop"; + }; + config = mkIf cfg.enable { + sound.pipewire.enable = true; + programs.niri.enable = true; # wayland compositor in rust + environment.systemPackages = with pkgs; [ + brightnessctl + gcr_4 + ]; + fonts.fontDir.enable = true; + security.pam = { + services.greetd.enableGnomeKeyring = true; + services.gtklock = {}; + loginLimits = [ + { + domain = "@users"; + item = "rtprio"; + type = "-"; + value = 1; + } + ]; + }; + services = { + gnome.gnome-keyring.enable = true; + udisks2.enable = true; + dbus = { + apparmor = "enabled"; + implementation = "broker"; + }; + }; + programs = { + dconf.enable = true; + seahorse.enable = true; + }; + xdg.portal = { + enable = true; + extraPortals = with pkgs; [xdg-desktop-portal-gtk]; + config.jay = { + default = ["gtk"]; + "org.freedesktop.impl.portal.ScreenCast" = "jay"; + "org.freedesktop.impl.portal.RemoteDesktop" = "jay"; + "org.freedesktop.impl.portal.Inhibit" = "none"; + "org.freedesktop.impl.portal.FileChooser" = "gtk4"; + "org.freedesktop.impl.portal.Secret" = ["gnome-keyring"]; + }; + }; + programs.regreet.enable = true; + services.greetd = { + enable = true; + vt = 6; + settings = { + default_session = { + command = "${pkgs.cage}/bin/cage -s -m last -- ${getExe pkgs.greetd.regreet}"; + }; + initial_session = { + user = "user"; + command = "${pkgs.jay}/bin/jay run"; + }; + }; + }; + }; +} diff --git a/packages/aim/default.nix b/packages/aim/default.nix new file mode 100644 index 0000000..92bc403 --- /dev/null +++ b/packages/aim/default.nix @@ -0,0 +1,53 @@ +{pkgs}: let + inherit + (pkgs) + lib + rustPlatform + fetchFromGitHub + pkg-config + openssl + zlib + stdenv + darwin + ; +in + rustPlatform.buildRustPackage rec { + pname = "aim"; + version = "1.8.6"; + + src = fetchFromGitHub { + owner = "mihaigalos"; + repo = "aim"; + rev = version; + hash = "sha256-+oeyaPBsgQ+eNEGx9lRnNKjTSowLd0T+8WUln1UizBA="; + }; + + cargoHash = "sha256-LeFhaXtzCSujlVuqaIiXYL2TlhlpgqsN9+fACv9iEmY="; + + nativeBuildInputs = [ + pkg-config + ]; + + buildInputs = + [ + openssl + zlib + ] + ++ lib.optionals stdenv.isDarwin [ + darwin.apple_sdk.frameworks.Security + darwin.apple_sdk.frameworks.SystemConfiguration + ]; + + env = { + OPENSSL_NO_VENDOR = true; + }; + + meta = { + description = "A command line download/upload tool with resume"; + homepage = "https://github.com/mihaigalos/aim"; + changelog = "https://github.com/mihaigalos/aim/blob/${src.rev}/CHANGELOG.md"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; []; + mainProgram = "aim"; + }; + } diff --git a/packages/bt/default.nix b/packages/bt/default.nix new file mode 100644 index 0000000..610c699 --- /dev/null +++ b/packages/bt/default.nix @@ -0,0 +1,26 @@ +{pkgs}: let + inherit (pkgs) lib buildGoModule fetchFromGitHub; +in + buildGoModule rec { + pname = "bt"; + version = "1.1.0"; + + src = fetchFromGitHub { + owner = "LeperGnome"; + repo = "bt"; + rev = "v${version}"; + hash = "sha256-q6vi9dxKWz+mCqRQ11BA/rjXGEOGcHIsmsQSuyWtaLk="; + }; + + vendorHash = "sha256-nBswqk3XAPvjW1qRMHq1waqXLKwXYXVXFpGcByqSS2k="; + + ldflags = ["-s" "-w"]; + + meta = { + description = "Interactive tree-like terminal file manager"; + homepage = "https://github.com/LeperGnome/bt"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; []; + mainProgram = "bt"; + }; + } diff --git a/packages/pillager/default.nix b/packages/pillager/default.nix new file mode 100644 index 0000000..3605256 --- /dev/null +++ b/packages/pillager/default.nix @@ -0,0 +1,33 @@ +{pkgs}: let + inherit (pkgs) lib buildGoModule fetchFromGitHub; +in + buildGoModule rec { + pname = "pillager"; + version = "0.11.6"; + + src = fetchFromGitHub { + owner = "brittonhayes"; + repo = "pillager"; + rev = "v${version}"; + hash = "sha256-GHjAm6x96m79pnberfYKiUujnlahsVqNixY4I9R7AOc="; + }; + + vendorHash = "sha256-uNPNUsD1hEvHKGb5EyEjDanc21ro6dm68ecdyG/+hlk="; + + ldflags = [ + "-s" + "-w" + "-X=github.com/brittonhayes/pillager/internal/commands/version.version=${version}" + "-X=main.commit=${src.rev}" + "-X=main.date=1970-01-01T00:00:00Z" + "-X=main.builtBy=goreleaser" + ]; + + meta = { + description = "Pillage filesystems for sensitive information with Go"; + homepage = "https://github.com/brittonhayes/pillager"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; []; + mainProgram = "pillager"; + }; + } diff --git a/packages/wl-tray-bridge/default.nix b/packages/wl-tray-bridge/default.nix new file mode 100644 index 0000000..cca45b7 --- /dev/null +++ b/packages/wl-tray-bridge/default.nix @@ -0,0 +1,44 @@ +{pkgs}: let + inherit + (pkgs) + lib + rustPlatform + fetchFromGitHub + pkg-config + cairo + glib + pango + wayland + ; +in + rustPlatform.buildRustPackage rec { + pname = "wl-tray-bridge"; + version = "unstable-2024-10-24"; + + src = fetchFromGitHub { + owner = "mahkoh"; + repo = "wl-tray-bridge"; + rev = "5ea5bbddcf1dbb2ab4836b00b300803c928469c5"; + hash = "sha256-ewoHopL9/hgErshUWZBZ4H6MKt7iQD7x+4MebNzDdXQ="; + }; + + cargoHash = "sha256-yvuHE3LdFUSZkcBZH3zangFUfCZNAlkDeW8qFyU/LgU="; + + nativeBuildInputs = [ + pkg-config + ]; + + buildInputs = [ + cairo + glib + pango + wayland + ]; + + meta = { + description = ""; + homepage = "https://github.com/mahkoh/wl-tray-bridge"; + license = lib.licenses.gpl3Only; + mainProgram = "wl-tray-bridge"; + }; + }