dotfiles
My PC Dotfiles & Websitegit clone https://github.com/maydayv7/dotfiles
commit f9f44114b44deb791fc0df6763bf99e073a8d5e9 parent 4cb02825643f8f8b11a28acf2ea4c751d0926ca5 Author: maydayv7 <maydayv7@gmail.com> Date: Mon, 27 Nov 2023 11:30:16 +0530 feat!: Upgrade to NixOS 23.11 Tapir - Upgrade to GNOME 45 - Allow patching Default Package Channel - Update Scripts
Diffstat:
| M | README.md | | | 3 | +++ |
| M | files/gnome/dconf.nix | | | 106 | +++++++++++++++++++++++++++++++++---------------------------------------------- |
| M | files/gnome/shortcuts.json | | | 168 | +++++++++++++++++++++++++++++++++++++++++++++---------------------------------- |
| M | files/vscode/keybindings.json | | | 2 | +- |
| M | flake.lock | | | 34 | ++++++++++++++++++++++++++-------- |
| M | flake.nix | | | 11 | +++++++---- |
| M | modules/apps/office.nix | | | 5 | ++++- |
| M | modules/gui/desktop/gnome.nix | | | 90 | +++++++++++++++++++++++++++++++++++++++++-------------------------------------- |
| M | modules/shell/zsh.nix | | | 6 | +----- |
| M | packages/README.md | | | 4 | ++++ |
| M | packages/flake.nix | | | 46 | +++++++++++++++++++++++++++++----------------- |
| M | packages/overlays/discord.nix | | | 2 | +- |
| M | packages/overlays/google-chrome.nix | | | 2 | +- |
| A | packages/patches/.keep | | | 0 | |
| A | packages/patches/gscan2pdf.patch | | | 183 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| M | scripts/packages.sh | | | 53 | ++++++++++++++++++++++++++--------------------------- |
16 files changed, 473 insertions(+), 242 deletions(-)
diff --git a/README.md b/README.md @@ -417,6 +417,8 @@ You can navigate to the `README`s present in the various directories to know mor - Improve Syntax Formatting with `treefmt-nix` and drop `pre-commit-hooks` - Fix Emoji Support - Support declarative [Flatpak](https://flatpak.org/) application install +- Allow patching Default Package Channel +- Upgrade to GNOME 45 - Miscellaneous Updates ### v13 @@ -622,6 +624,7 @@ You can navigate to the `README`s present in the various directories to know mor - Secure Boot isn't supported yet - Home Configuration can't be decoupled from System - Lack of automatic script checking +- Currently using a workaround for CI due to [NixOS/nix#3978](https://github.com/NixOS/nix/issues/3978) #### Manually Managed Packages diff --git a/files/gnome/dconf.nix b/files/gnome/dconf.nix @@ -66,6 +66,7 @@ in { "org/gnome/shell/keybindings" = { focus-active-notification = []; open-application-menu = []; + toggle-application-view = []; toggle-message-tray = []; toggle-overview = []; }; @@ -113,8 +114,6 @@ in { button-layout = "appmenu:minimize,maximize,close"; titlebar-font = "${head fonts.sansSerif} Bold 11"; visual-bell = false; - num-workspaces = 4; - workspace-names = ["Home" "School" "Work" "Play"]; }; # Core Settings @@ -124,7 +123,7 @@ in { "org/gnome/mutter" = { attach-modal-dialogs = true; center-new-windows = true; - dynamic-workspaces = false; + dynamic-workspaces = true; edge-tiling = true; focus-change-on-pointer-rest = true; workspaces-only-on-primary = true; @@ -297,6 +296,15 @@ in { # App Grid "org/gnome/shell" = { + favorite-apps = [ + "google-chrome.desktop" + "org.gnome.Geary.desktop" + "org.gnome.Nautilus.desktop" + "com.raggesilver.BlackBox.desktop" + "org.gnome.TextEditor.desktop" + "org.gnome.Settings.desktop" + ]; + disable-user-extensions = false; disable-extension-version-validation = true; disabled-extensions = ["workspace-indicator@gnome-shell-extensions.gcampax.github.com"]; @@ -308,33 +316,20 @@ in { "drive-menu@gnome-shell-extensions.gcampax.github.com" "emoji-copy@felipeftn" "forge@jmmaranan.com" - "gestureImprovements@gestures" - "gnome-ui-tune@itstime.tech" "guillotine@fopdoodle.net" "just-perfection-desktop@just-perfection" - "lock-screen-message@advendradeswanta.gitlab.com" "lockkeys@vaina.lt" "pano@elhan.io" "quick-settings-avatar@d-go" - "quick-settings-tweaks@qwreey" "rounded-window-corners@yilozt" "Shortcuts@kyle.aims.ac.za" - "space-bar@luchrioh" "status-area-horizontal-spacing@mathematical.coffee.gmail.com" - "timepp@zagortenay333" "top-bar-organizer@julian.gse.jsts.xyz" "transparent-top-bar@ftpix.com" "user-theme@gnome-shell-extensions.gcampax.github.com" "Vitals@CoreCoding.com" - "weatheroclock@CleoMenezesJr.github.io" - ]; - favorite-apps = [ - "google-chrome.desktop" - "org.gnome.Geary.desktop" - "org.gnome.Nautilus.desktop" - "com.raggesilver.BlackBox.desktop" - "org.gnome.TextEditor.desktop" - "org.gnome.Settings.desktop" + "windowgestures@extension.amarullz.com" + "window-title-is-back@fthx" ]; }; @@ -423,12 +418,8 @@ in { # Shell Extensions "org/gnome/shell/extensions/user-theme".name = "Adwaita"; - "org/gnome/shell/extensions/lock-screen-message".message = "Welcome, ${config.credentials.fullname}!"; - "com/ftpix/transparentbar".transparency = 0; "org/gnome/shell/extensions/alphabetical-app-grid".folder-order-position = "start"; - "org/gnome/shell/extensions/gestureImprovements".allow-minimize-window = true; - "org/gnome/shell/extensions/gnome-ui-tune".hide-search = false; "org/gnome/shell/extensions/lockkeys".style = "show-hide"; "org/gnome/shell/extensions/status-area-horizontal-spacing".hpadding = 4; @@ -510,14 +501,11 @@ in { "org/gnome/shell/extensions/just-perfection" = { accessibility-menu = true; - aggregate-menu = true; - animation = 4; - app-menu-icon = false; - hot-corner = false; + animation = 1; notification-banner-position = 2; - show-prefs-intro = false; - workspace-switcher-should-show = true; - workspace-background-corner-size = 58; + osd-position = 6; + window-menu-take-screenshot-button = false; + workspace-popup = false; workspace-switcher-size = 7; workspace-wrap-around = true; }; @@ -537,17 +525,6 @@ in { avatar-size = 56; }; - "org/gnome/shell/extensions/quick-settings-tweaks" = { - add-dnd-quick-toggle-enabled = false; - add-unsafe-quick-toggle-enabled = false; - datemenu-remove-notifications = false; - media-control-compact-mode = true; - media-control-enabled = true; - notifications-enabled = false; - volume-mixer-enabled = false; - volume-mixer-position = "bottom"; - }; - "org/gnome/shell/extensions/rounded-window-corners" = { custom-rounded-corner-settings = "@a{sv} {}"; focused-shadow = "{'vertical_offset': 4, 'horizontal_offset': 0, 'blur_offset': 28, 'spread_radius': 4, 'opacity': 60}"; @@ -558,6 +535,7 @@ in { }; "org/gnome/shell/extensions/shortcuts" = { + maxcolumns = 3; shortcuts-file = files.gnome.shortcuts; shortcuts-toggle-overview = ["<Super>slash"]; use-custom-shortcuts = true; @@ -565,36 +543,17 @@ in { visibility = 50; }; - "org/gnome/shell/extensions/space-bar/behavior" = { - scroll-wheel = "disabled"; - show-empty-workspaces = true; - smart-workspace-names = true; - }; - - "org/gnome/shell/extensions/timepp" = { - alarms-separate-menu = false; - panel-item-position = "Left"; - pomodoro-panel-mode = "Dynamic"; - pomodoro-show-seconds = true; - stopwatch-panel-mode = "Dynamic"; - timer-panel-mode = "Dynamic"; - timer-show-seconds = true; - todo-panel-mode = "Icon"; - todo-separate-menu = true; - unicon-mode = true; - }; - "org/gnome/shell/extensions/top-bar-organizer" = { - center-box-order = ["dateMenu" "EmojisMenu"]; + center-box-order = ["dateMenu"]; left-box-order = [ - "Space Bar" "activities" - "timepp" "guillotine" "guillotine@fopdoodle.net" "appMenu" ]; + right-box-order = [ + "emoji-copy@felipeftn" "a11y" "aggregateMenu" "drive-menu" @@ -614,5 +573,28 @@ in { show-battery = true; show-storage = false; }; + + "org/gnome/shell/extensions/windowgestures" = { + fn-fullscreen = true; + fn-maximized-snap = true; + fn-move = true; + fn-move-snap = true; + fn-resize = true; + pinch-enable = true; + pinch3-in = 0; + pinch3-out = 0; + pinch4-in = 14; + pinch4-out = 3; + swipe3-down = 1; + swipe4-updown = 22; + taphold-move = true; + three-finger = false; + use-active-window = true; + }; + + "org/gnome/shell/extensions/window-title-is-back" = { + colored-icon = true; + show-title = false; + }; }; } diff --git a/files/gnome/shortcuts.json b/files/gnome/shortcuts.json @@ -7,6 +7,10 @@ "description": "Enter Overview" }, { + "key": "Super * 2", + "description": "Enter App Grid" + }, + { "key": "Alt + F4 / Super + Q", "description": "Close window" }, @@ -19,7 +23,7 @@ "description": "Make Full screen/Restore" }, { - "key": "Super + Up/Down", + "key": "Super + ↑/↓", "description": "Maximize/Minimize window" }, { @@ -35,25 +39,75 @@ "description": "Switches between Windows of current application" }, { - "key": "Super + Left/Right", - "description": "Switch to the left/right Workspace" + "key": "Super + ←/→", + "description": "Switch Workspace" }, { "key": "Super + Home/End", "description": "Switch to first/last Workspace" }, { - "key": "Super + Ctrl + Left/Right", - "description": "Move window to left/right Workspace" + "key": "Super + Ctrl + ←/→", + "description": "Move window to specified Workspace" + }, + { + "key": "Super + Shift + ←/→", + "description": "Move window to specified Monitor" + } + ] + }, + { + "name": "System Shortcuts", + "shortcuts": [ + { + "key": "Super + Space", + "description": "Switch keyboard layout" + }, + { + "key": "Ctrl + Alt + Del", + "description": "Opens the shutdown menu" + }, + { + "key": "Super + L", + "description": "Locks the screen" + }, + { + "key": "Super + X", + "description": "Toggle zoom" + }, + { + "key": "Super + =", + "description": "Zoom in" + }, + { + "key": "Super + -", + "description": "Zoom out" + } + ] + }, + { + "name": "Screenshot Shortcuts", + "shortcuts": [ + { + "key": "Print", + "description": "Take a screenshot of a region" + }, + { + "key": "Shift + Print", + "description": "Take a full screenshot" }, { - "key": "Super + Shift + Left/Right", - "description": "Move window to left/right Monitor" + "key": "Ctrl + Print", + "description": "Take a screenshot of a window" + }, + { + "key": "Alt + Print", + "description": "Video capture desktop" } ] }, { - "name": "Tiling", + "name": "Tiling Shortcuts", "shortcuts": [ { "key": "Super + Z", @@ -73,15 +127,15 @@ }, { "key": "Super + W/A/S/D", - "description": "Focus up/left/down/right window" + "description": "Focus specified window" }, { "key": "Super + Ctrl + W/A/S/D", - "description": "Move window up/left/down/right" + "description": "Move window in specified direction" }, { "key": "Super + Shift + W/A/S/D", - "description": "Swap window up/left/down/right" + "description": "Swap window in specified direction" }, { "key": "Super + C", @@ -96,12 +150,12 @@ "description": "Pin window above all others" }, { - "key": "Super + Alt + Up/Left/Down/Right", - "description": "Increase top/left/bottom/right window size" + "key": "Super + Alt + ↑/←/↓/→", + "description": "Increase window size in specified direction" }, { - "key": "Super + Ctrl + Alt + Up/Left/Down/Right", - "description": "Decrease top/left/bottom/right window size" + "key": "Super + Ctrl + Alt + ↑/←/↓/→", + "description": "Decrease window size in specified direction" } ] }, @@ -146,36 +200,7 @@ }, { "key": "Super + /", - "description": "Show shortcuts menu" - } - ] - }, - { - "name": "System Shortcuts", - "shortcuts": [ - { - "key": "Super + Space", - "description": "Switch keyboard layout" - }, - { - "key": "Ctrl + Alt + Del", - "description": "Opens the shutdown menu" - }, - { - "key": "Super + L", - "description": "Locks the screen" - }, - { - "key": "Super + X", - "description": "Toggle zoom" - }, - { - "key": "Super + =", - "description": "Zoom in" - }, - { - "key": "Super + -", - "description": "Zoom out" + "description": "Show this shortcuts menu" } ] }, @@ -195,6 +220,10 @@ "description": "Reopen last closed tab in web browser" }, { + "key": "Ctrl + /", + "description": "Code Editor command palette" + }, + { "key": "F5", "description": "Document Viewer presentation mode" }, @@ -205,52 +234,47 @@ ] }, { - "name": "Screenshot Shortcuts", + "name": "Navigation Gestures", "shortcuts": [ { - "key": "Print", - "description": "Take a screenshot of a region" + "key": "4F ↑ Swipe (←/→)", + "description": "Maximize/fullscreen/restore(/snap) a window" }, { - "key": "Shift + Print", - "description": "Take a full screenshot" + "key": "3F ↑ Swipe", + "description": "Show overview/apps grid" }, { - "key": "Ctrl + Print", - "description": "Take a screenshot of a window" + "key": "3F ↓ Swipe", + "description": "Minimize window" }, { - "key": "Alt + Print", - "description": "Video capture desktop" - } - ] - }, - { - "name": "Gestures", - "shortcuts": [ - { - "key": "3 Finger Horizontal Swipe", - "description": "Switch windows" + "key": "3F ←/→ Swipe", + "description": "Switch workspaces" }, { - "key": "4 Finger Horizontal Swipe (2/3 in overview)", - "description": "Switch workspaces" + "key": "4F Hold then Swipe", + "description": "Move window" }, { - "key": "4 Finger Vertical Swipe", - "description": "Desktop/Overview/App Grid navigation" + "key": "3F ↓ Swipe then ←/→", + "description": "Switch to previous/next window" }, { - "key": "3 Finger Vertical Swipe", - "description": "Maximize/minimize/fullscreen a window" + "key": "4F ↓ Swipe", + "description": "Show notification center" }, { - "key": "3/4 Finger Pinch", + "key": "4F Pinch Out", "description": "Show desktop" }, { - "key": "2/3 Finger Horizontal Swipe in App Grid", - "description": "Switch app pages" + "key": "4F Pinch In", + "description": "Mute audio" + }, + { + "key": "2F ←/→ Swipe", + "description": "Switch pages or move backward/forward" } ] } diff --git a/files/vscode/keybindings.json b/files/vscode/keybindings.json @@ -1,6 +1,6 @@ [ { - "key": "meta+/", + "key": "ctrl+/", "command": "workbench.action.showCommands" }, { diff --git a/flake.lock b/flake.lock @@ -328,15 +328,16 @@ ] }, "locked": { - "lastModified": 1699783872, - "narHash": "sha256-4zTwLT2LL45Nmo6iwKB3ls3hWodVP9DiSWxki/oewWE=", + "lastModified": 1700814205, + "narHash": "sha256-lWqDPKHRbQfi+zNIivf031BUeyciVOtwCwTjyrhDB5g=", "owner": "nix-community", "repo": "home-manager", - "rev": "280721186ab75a76537713ec310306f0eba3e407", + "rev": "aeb2232d7a32530d3448318790534d196bf9427a", "type": "github" }, "original": { "owner": "nix-community", + "ref": "release-23.11", "repo": "home-manager", "type": "github" } @@ -441,16 +442,16 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1699099776, - "narHash": "sha256-X09iKJ27mGsGambGfkKzqvw5esP1L/Rf8H3u3fCqIiU=", + "lastModified": 1700921103, + "narHash": "sha256-qHqDVIBJWUPceG+oFw/i8UjvCs+OKQsdjQ4zqzxwVPk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "85f1ba3e51676fa8cc604a3d863d729026a6b8eb", + "rev": "9c85e4f1e751b4aac8c261c3c24c970e777ea205", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-unstable", + "ref": "release-23.11", "repo": "nixpkgs", "type": "github" } @@ -538,6 +539,7 @@ "sops": "sops", "stylix": "stylix", "systems": "systems_2", + "unstable": "unstable", "utils": "utils_2", "windows": "windows", "wine": "wine" @@ -637,6 +639,22 @@ "type": "github" } }, + "unstable": { + "locked": { + "lastModified": 1700390070, + "narHash": "sha256-de9KYi8rSJpqvBfNwscWdalIJXPo8NjdIZcEJum1mH0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e4ad989506ec7d71f7302cc3067abd82730a4beb", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "utils": { "inputs": { "systems": "systems" @@ -697,7 +715,7 @@ "inputs": { "flake-compat": "flake-compat_2", "nixpkgs": [ - "nixpkgs" + "unstable" ] }, "locked": { diff --git a/flake.nix b/flake.nix @@ -38,7 +38,10 @@ inputs = { ## Package Repositories ## # NixOS Packages Repository - nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable"; + nixpkgs.url = "github:NixOS/nixpkgs?ref=release-23.11"; + + # Unstable Packages Repository + unstable.url = "github:NixOS/nixpkgs?ref=nixos-unstable"; # Nix User Repository nur.url = "github:nix-community/NUR"; @@ -84,7 +87,7 @@ ## Feature Modules # User Home Manager home = { - url = "github:nix-community/home-manager"; + url = "github:nix-community/home-manager?ref=release-23.11"; inputs.nixpkgs.follows = "nixpkgs"; }; @@ -124,10 +127,10 @@ # Declarative Flatpak Wrapper flatpak.url = "github:gmodena/nix-flatpak"; - # Wine Apps Wrapper + # Windows Apps Wrapper wine = { url = "github:emmanuelrosa/erosanix"; - inputs.nixpkgs.follows = "nixpkgs"; + inputs.nixpkgs.follows = "unstable"; }; }; diff --git a/modules/apps/office.nix b/modules/apps/office.nix @@ -1,6 +1,7 @@ { config, lib, + inputs, pkgs, files, ... @@ -8,8 +9,11 @@ enable = builtins.elem "office" config.apps.list; in { ## Office Environment Configuration ## + imports = [inputs.wine.nixosModules.onlyoffice]; + config = lib.mkIf enable { # Applications + programs.onlyoffice.enable = true; environment.systemPackages = with pkgs; [ # Productivity easyeffects @@ -19,7 +23,6 @@ in { hunspellDicts.en_US-large hyphen libreoffice - onlyoffice-bin # Internet google-chrome diff --git a/modules/gui/desktop/gnome.nix b/modules/gui/desktop/gnome.nix @@ -16,12 +16,17 @@ in { config = mkIf (desktop == "gnome" || desktop == "gnome-minimal") (mkMerge [ { # Session - services.xserver = { - desktopManager.gnome.enable = true; - displayManager = { - gdm.enable = true; - defaultSession = "gnome"; + services = { + xserver = { + desktopManager.gnome.enable = true; + displayManager = { + gdm.enable = true; + defaultSession = "gnome"; + }; }; + + # Initial Setup + gnome.gnome-initial-setup.enable = mkForce false; }; # Excluded Packages @@ -52,8 +57,6 @@ in { telepathy.enable = true; gnome = { core-developer-tools.enable = true; - gnome-browser-connector.enable = true; - gnome-initial-setup.enable = true; gnome-keyring.enable = true; gnome-remote-desktop.enable = true; sushi.enable = true; @@ -84,7 +87,7 @@ in { audio = ["org.gnome.Lollypop.desktop"]; calendar = ["org.gnome.Calendar.desktop"]; directory = ["org.gnome.Nautilus.desktop"]; - image = ["org.gnome.eog.desktop"]; + image = ["org.gnome.Loupe.desktop"]; magnet = ["transmission-gtk.desktop"]; mail = ["org.gnome.Geary.desktop"]; markdown = ["org.gnome.gitlab.somas.Apostrophe.desktop"]; @@ -94,9 +97,6 @@ in { }; home.file = { - # Initial Setup - ".config/gnome-initial-setup-done".text = "yes"; - # GTK+ Bookmarks ".config/gtk-3.0/bookmarks".text = gtk.bookmarks; @@ -122,6 +122,9 @@ in { # Firefox GNOME Theme ".mozilla/firefox/default/chrome/userChrome.css".text = ''@import "${pkgs.custom.firefox-gnome-theme}/userChrome.css";''; ".mozilla/firefox/default/chrome/userContent.css".text = firefox.theme; + + # Workaround for https://github.com/NixOS/nixpkgs/issues/47340 + ".mozilla/native-messaging-hosts/org.gnome.chrome_gnome_shell.json".source = "${pkgs.chrome-gnome-shell}/lib/mozilla/native-messaging-hosts/org.gnome.chrome_gnome_shell.json"; }; ## 3rd Party Apps Configuration @@ -210,33 +213,29 @@ in { dconf2nix gnuchess ]) - ++ (with pkgs.gnomeExtensions; [ - # GNOME Shell Extensions - alphabetical-app-grid - appindicator - caffeine - coverflow-alt-tab - emoji-copy - forge - gesture-improvements - gnome-40-ui-improvements - guillotine - just-perfection - lock-keys - lock-screen-message - pano - quick-settings-tweaker - rounded-window-corners - shortcuts - space-bar - status-area-horizontal-spacing - timepp - transparent-top-bar-adjustable-transparency - top-bar-organizer - user-avatar-in-quick-settings - vitals - weather-oclock - ]); + ++ (with pkgs; + with unstable.gnomeExtensions // gnomeExtensions; [ + # GNOME Shell Extensions + alphabetical-app-grid + appindicator + caffeine + coverflow-alt-tab + emoji-copy + forge + guillotine + just-perfection + lock-keys + pano + #!#rounded-window-corners --> Wait for upstream + shortcuts + status-area-horizontal-spacing + transparent-top-bar-adjustable-transparency + top-bar-organizer + user-avatar-in-quick-settings + vitals + window-gestures + window-title-is-back + ]); }; # Persisted Files @@ -261,7 +260,6 @@ in { ".local/share/webkitgtk" ".cache/fractal" ".cache/gnome-builder" - ".cache/timepp_gnome_shell_extension" ]; }) @@ -271,13 +269,12 @@ in { services.xserver = { displayManager.gdm.autoSuspend = false; desktopManager.gnome = { + extraGSettingsOverrides = gnome.iso; + extraGSettingsOverridePackages = [pkgs.gnome.gnome-settings-daemon]; favoriteAppsOverride = '' [org.gnome.shell] favorite-apps=[ 'org.gnome.Epiphany.desktop', 'nixos-manual.desktop', 'org.gnome.Console.desktop', 'org.gnome.Nautilus.desktop', 'gparted.desktop' ] ''; - - extraGSettingsOverrides = gnome.iso; - extraGSettingsOverridePackages = [pkgs.gnome.gnome-settings-daemon]; }; }; @@ -293,7 +290,14 @@ in { # Additional Excluded Packages xdg.portal.enable = mkForce false; qt.enable = mkForce false; - services.gnome.core-utilities.enable = mkForce false; + + services.gnome = { + core-utilities.enable = mkForce false; + gnome-browser-connector.enable = mkForce false; + gnome-remote-desktop.enable = mkForce false; + gnome-user-share.enable = mkForce false; + }; + environment.gnome.excludePackages = with pkgs.gnome; [ gnome-backgrounds gnome-shell-extensions diff --git a/modules/shell/zsh.nix b/modules/shell/zsh.nix @@ -30,6 +30,7 @@ in { enableAutosuggestions = true; enableCompletion = true; enableVteIntegration = true; + syntaxHighlighting.enable = true; # Initialization initExtraBeforeCompInit = '' @@ -75,11 +76,6 @@ in { src = pkgs.zsh-autopair; file = "share/zsh/zsh-autopair/autopair.zsh"; } - { - name = "zsh-syntax-highlighting"; - src = pkgs.zsh-syntax-highlighting; - file = "share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"; - } ]; }; diff --git a/packages/README.md b/packages/README.md @@ -13,3 +13,7 @@ sha256 = lib.fakeSha256; ``` Then Nix will fail the build with an `error` message and give the correct hash + +### Patches + +The default package channel can be patched by simply dropping a valid `.patch` file into the `patches` directory diff --git a/packages/flake.nix b/packages/flake.nix @@ -4,7 +4,7 @@ ... }: let inherit (util) map; - inherit (builtins) attrValues; + inherit (builtins) any attrValues isPath; in { ## Package Configuration ## perSystem = { @@ -24,22 +24,34 @@ in { in rec { # Default Package Channel _module.args.pkgs = legacyPackages; - legacyPackages = with inputs; - import nixpkgs { - inherit system; - config = import ../modules/nix/config.nix; - overlays = - [nur.overlay] - ++ (attrValues self.overlays or {}) - ++ [ - (final: prev: { - custom = self.packages."${system}"; - wine = wine.packages."${system}"; - gaming = gaming.packages."${system}"; - generators = generators.packages."${system}".default; - }) - ]; - }; + legacyPackages = with inputs; let + src = nixpkgs; + patches = map.patches ./patches; + pkgs' = import src {inherit system;}; + in + if !(any isPath patches) + then import src + else + import (pkgs'.applyPatches { + inherit src patches; + name = "nixpkgs-patched-${src.shortRev}"; + }) { + inherit system; + config = import ../modules/nix/config.nix; + overlays = + [nur.overlay] + ++ (attrValues self.overlays or {}) + ++ [ + (final: prev: { + custom = self.packages."${system}"; + unstable = import unstable {inherit system;}; + + wine = wine.packages."${system}"; + gaming = gaming.packages."${system}"; + generators = generators.packages."${system}".default; + }) + ]; + }; # Custom Packages apps = diff --git a/packages/overlays/discord.nix b/packages/overlays/discord.nix @@ -1,5 +1,5 @@ final: prev: { - # Update Discord to Latest Version + # Update Discord to latest version discord = prev.discord.overrideAttrs (_: rec { version = "0.0.34"; diff --git a/packages/overlays/google-chrome.nix b/packages/overlays/google-chrome.nix @@ -1,5 +1,5 @@ final: prev: { - # Patch Google Chrome Dark Mode + # Patch Google Chrome dark mode google-chrome = prev.google-chrome.overrideAttrs (old: { installPhase = old.installPhase diff --git a/packages/patches/.keep b/packages/patches/.keep diff --git a/packages/patches/gscan2pdf.patch b/packages/patches/gscan2pdf.patch @@ -0,0 +1,183 @@ +From 9a579e14dd7536bf4cf554c065615810defd72d8 Mon Sep 17 00:00:00 2001 +From: Florian Brandes <florian.brandes@posteo.de> +Date: Tue, 21 Nov 2023 01:10:25 +0100 +Subject: [PATCH 1/4] gscan2pdf: fix build failures + +Due to the removal of tools like `tiff2pdf` from `libtiff` +many tests fail or cause a timeout. +This commit fixes the dependency to `libtiff_4_5`. + +fixes #268406 + +Signed-off-by: Florian Brandes <florian.brandes@posteo.de> +--- + pkgs/applications/graphics/gscan2pdf/default.nix | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/pkgs/applications/graphics/gscan2pdf/default.nix b/pkgs/applications/graphics/gscan2pdf/default.nix +index 78f25a0df3ade2..7726f9e3e36a13 100644 +--- a/pkgs/applications/graphics/gscan2pdf/default.nix ++++ b/pkgs/applications/graphics/gscan2pdf/default.nix +@@ -2,7 +2,7 @@ + # libs + librsvg, sane-backends, sane-frontends, + # runtime dependencies +- imagemagick, libtiff, djvulibre, poppler_utils, ghostscript, unpaper, pdftk, ++ imagemagick, libtiff_4_5, djvulibre, poppler_utils, ghostscript, unpaper, pdftk, + # test dependencies + xvfb-run, liberation_ttf, file, tesseract }: + +@@ -71,7 +71,7 @@ perlPackages.buildPerlPackage rec { + wrapProgram "$out/bin/gscan2pdf" \ + --prefix PATH : "${sane-backends}/bin" \ + --prefix PATH : "${imagemagick}/bin" \ +- --prefix PATH : "${libtiff}/bin" \ ++ --prefix PATH : "${libtiff_4_5}/bin" \ + --prefix PATH : "${djvulibre}/bin" \ + --prefix PATH : "${poppler_utils}/bin" \ + --prefix PATH : "${ghostscript}/bin" \ +@@ -87,7 +87,10 @@ perlPackages.buildPerlPackage rec { + + nativeCheckInputs = [ + imagemagick +- libtiff ++ # Needs older libtiff version, because it stopped packageing tools like ++ # tiff2pdf and others in version 4.6. These tools are necessary for gscan2pdf. ++ # See commit f57a4b0ac1b954eec0c8def2a99e2a464ac6ff7a for in-depth explanation. ++ libtiff_4_5 + djvulibre + poppler_utils + ghostscript + +From fe3094b0dcc167494891090d49f367c59ea4c6e9 Mon Sep 17 00:00:00 2001 +From: Florian Brandes <florian.brandes@posteo.de> +Date: Thu, 23 Nov 2023 12:00:28 +0100 +Subject: [PATCH 2/4] gscan2pdf: re-add previously removed test + +Signed-off-by: Florian Brandes <florian.brandes@posteo.de> +--- + pkgs/applications/graphics/gscan2pdf/default.nix | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/pkgs/applications/graphics/gscan2pdf/default.nix b/pkgs/applications/graphics/gscan2pdf/default.nix +index 7726f9e3e36a13..98713a4fa4d223 100644 +--- a/pkgs/applications/graphics/gscan2pdf/default.nix ++++ b/pkgs/applications/graphics/gscan2pdf/default.nix +@@ -133,12 +133,6 @@ perlPackages.buildPerlPackage rec { + # Non-zero wait status: 139 + rm t/0601_Dialog_Scan.t + +- # Disable a test which failed due to convert returning an exit value of 1 +- # convert: negative or zero image size `/build/KL5kTVnNCi/YfgegFM53e.pnm' @ error/resize.c/ResizeImage/3743. +- # *** unhandled exception in callback: +- # *** "convert" unexpectedly returned exit value 1 at t/357_unpaper_rtl.t line 63. +- rm t/357_unpaper_rtl.t +- + xvfb-run -s '-screen 0 800x600x24' \ + make test + ''; + +From 1e2704927aeb052ede5cedde4b6eb20d424af5d2 Mon Sep 17 00:00:00 2001 +From: Florian Brandes <florian.brandes@posteo.de> +Date: Wed, 22 Nov 2023 10:48:04 +0100 +Subject: [PATCH 3/4] gscan2pdf: add patch to remove warnings during test + +see https://sourceforge.net/p/gscan2pdf/bugs/421 + +Signed-off-by: Florian Brandes <florian.brandes@posteo.de> +--- + pkgs/applications/graphics/gscan2pdf/default.nix | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/pkgs/applications/graphics/gscan2pdf/default.nix b/pkgs/applications/graphics/gscan2pdf/default.nix +index 98713a4fa4d223..296d63cd6785af 100644 +--- a/pkgs/applications/graphics/gscan2pdf/default.nix ++++ b/pkgs/applications/graphics/gscan2pdf/default.nix +@@ -1,4 +1,4 @@ +-{ lib, fetchurl, perlPackages, wrapGAppsHook, ++{ lib, fetchurl, perlPackages, wrapGAppsHook, fetchpatch, + # libs + librsvg, sane-backends, sane-frontends, + # runtime dependencies +@@ -17,6 +17,15 @@ perlPackages.buildPerlPackage rec { + hash = "sha256-NGz6DUa7TdChpgwmD9pcGdvYr3R+Ft3jPPSJpybCW4Q="; + }; + ++ patches = [ ++ # fixes warnings during tests. See https://sourceforge.net/p/gscan2pdf/bugs/421 ++ (fetchpatch { ++ name = "0001-Remove-given-and-when-keywords-and-operator.patch"; ++ url = "https://sourceforge.net/p/gscan2pdf/bugs/_discuss/thread/602a7cedfd/1ea4/attachment/0001-Remove-given-and-when-keywords-and-operator.patch"; ++ hash = "sha256-JtrHUkfEKnDhWfEVdIdYVlr5b/xChTzsrrPmruLaJ5M="; ++ }) ++ ]; ++ + nativeBuildInputs = [ wrapGAppsHook ]; + + buildInputs = + +From d54a7a6019d30ecee3cbd363a99297b7f2bd00d7 Mon Sep 17 00:00:00 2001 +From: Florian Brandes <florian.brandes@posteo.de> +Date: Thu, 23 Nov 2023 11:54:10 +0100 +Subject: [PATCH 4/4] gscan2pdf: patch from upstream with utf8 filenames + +see: https://sourceforge.net/p/gscan2pdf/bugs/400 + +Signed-off-by: Florian Brandes <florian.brandes@posteo.de> +--- + .../graphics/gscan2pdf/default.nix | 2 ++ + .../graphics/gscan2pdf/image-utf8-fix.patch | 32 +++++++++++++++++++ + 2 files changed, 34 insertions(+) + create mode 100644 pkgs/applications/graphics/gscan2pdf/image-utf8-fix.patch + +diff --git a/pkgs/applications/graphics/gscan2pdf/default.nix b/pkgs/applications/graphics/gscan2pdf/default.nix +index 296d63cd6785af..0acc934a7fd9be 100644 +--- a/pkgs/applications/graphics/gscan2pdf/default.nix ++++ b/pkgs/applications/graphics/gscan2pdf/default.nix +@@ -24,6 +24,8 @@ perlPackages.buildPerlPackage rec { + url = "https://sourceforge.net/p/gscan2pdf/bugs/_discuss/thread/602a7cedfd/1ea4/attachment/0001-Remove-given-and-when-keywords-and-operator.patch"; + hash = "sha256-JtrHUkfEKnDhWfEVdIdYVlr5b/xChTzsrrPmruLaJ5M="; + }) ++ # fixes an error with utf8 file names. See https://sourceforge.net/p/gscan2pdf/bugs/400 ++ ./image-utf8-fix.patch + ]; + + nativeBuildInputs = [ wrapGAppsHook ]; +diff --git a/pkgs/applications/graphics/gscan2pdf/image-utf8-fix.patch b/pkgs/applications/graphics/gscan2pdf/image-utf8-fix.patch +new file mode 100644 +index 00000000000000..fa1d03e0309a81 +--- /dev/null ++++ b/pkgs/applications/graphics/gscan2pdf/image-utf8-fix.patch +@@ -0,0 +1,32 @@ ++diff --git a/bin/gscan2pdf b/bin/gscan2pdf ++index e075b0f2..ff124522 100755 ++--- a/bin/gscan2pdf +++++ b/bin/gscan2pdf ++@@ -3434,9 +3434,11 @@ sub save_image { ++ if ( @{$list_of_pages} > 1 ) { ++ my $w = length scalar @{$list_of_pages}; ++ for ( 1 .. @{$list_of_pages} ) { +++ _utf8_on($filename); ++ my $current_filename = ++ sprintf "${filename}_%0${w}d.$SETTING{'image type'}", ++ $_; +++ _utf8_off($filename); ++ if ( -f $current_filename ) { ++ my $text = sprintf __('This operation would overwrite %s'), ++ $current_filename; ++@@ -3450,11 +3452,15 @@ sub save_image { ++ return; ++ } ++ } +++ _utf8_on($filename); ++ $filename = "${filename}_%0${w}d.$SETTING{'image type'}"; +++ _utf8_off($filename); ++ } ++ else { ++ if ( $filename !~ /[.]$SETTING{'image type'}$/ixsm ) { +++ _utf8_on($filename); ++ $filename = "$filename.$SETTING{'image type'}"; +++ _utf8_off($filename); ++ return if ( file_exists( $file_chooser, $filename ) ); ++ } ++ return if ( file_writable( $file_chooser, $filename ) ); diff --git a/scripts/packages.sh b/scripts/packages.sh @@ -9,9 +9,8 @@ set -euo pipefail update() { if [[ "${1:-""}" != "" ]] then - t="$(mktemp)"; trap 'rm ${t}' EXIT; - m="$(mktemp)"; trap 'rm ${m}' EXIT; - l="$(mktemp)"; trap 'rm ${l}' EXIT; + t1="$(mktemp)"; trap 'rm ${t1}' EXIT; + t2="$(mktemp)"; trap 'rm ${t2}' EXIT; pkg="${1}" metadata="${pkg}/metadata.nix" pkgname="$(basename "${pkg}")" @@ -23,16 +22,16 @@ update() { # Extraction # Include ${pkg}/metadata.nix according to spec - nix eval -f "${metadata}" --json > "${t}" 2>/dev/null - rev="$(cat "${t}" | jq -r .rev)" - sha256="$(cat "${t}" | jq -r .sha256)" - repo="$(cat "${t}" | jq -r .repo)" - branch="$(cat "${t}" | jq -r .branch)" # Optional - release="$(cat "${t}" | jq -r .release)" # Optional - cargoSha256="$(cat "${t}" | jq -r .cargoSha256)" # Optional - vendorSha256="$(cat "${t}" | jq -r .vendorSha256)" # Optional - skip="$(cat "${t}" | jq -r .skip)" # Optional - upattr="$(cat "${t}" | jq -r .upattr)"; # Optional + nix eval -f "${metadata}" --json > "${t1}" 2>/dev/null + rev="$(cat "${t1}" | jq -r .rev)" + sha256="$(cat "${t1}" | jq -r .sha256)" + repo="$(cat "${t1}" | jq -r .repo)" + branch="$(cat "${t1}" | jq -r .branch)" # Optional + release="$(cat "${t1}" | jq -r .release)" # Optional + cargoSha256="$(cat "${t1}" | jq -r .cargoSha256)" # Optional + vendorSha256="$(cat "${t1}" | jq -r .vendorSha256)" # Optional + skip="$(cat "${t1}" | jq -r .skip)" # Optional + upattr="$(cat "${t1}" | jq -r .upattr)"; # Optional if [[ "${upattr}" == "null" ]] then upattr="${pkgname}" @@ -69,52 +68,52 @@ update() { echo "Updating '${pkgname}'..." echo "Bumping '${rev}' ---> '${newrev}'" - # Sha256 + # SHA fakeHash="0000000000000000000000000000000000000000000000000000000000000000" sed -i "s|${rev}|${newrev}|" "${metadata}" sed -i "s|${sha256}|${fakeHash}|" "${metadata}" - nix build --no-link "..#${upattr}" &> "${l}" || true - newsha256="$(cat "${l}" | grep 'got:' | cut -d':' -f2 | tr -d ' ' || true)" + nix build --no-link "..#${upattr}" &> "${t2}" || true + newsha256="$(cat "${t2}" | grep 'got:' | cut -d':' -f2 | tr -d ' ' || true)" if [[ "${newsha256}" == "sha256" ]] then - newsha256="$(cat "${l}" | grep 'got:' | cut -d':' -f3 | tr -d ' ' || true)" + newsha256="$(cat "${t2}" | grep 'got:' | cut -d':' -f3 | tr -d ' ' || true)" fi newsha256="$(nix hash to-sri --type sha256 "${newsha256}")" sed -i "s|${fakeHash}|${newsha256}|" "${metadata}" - # CargoSha256 + # Cargo SHA if [[ "${cargoSha256}" != "null" ]] then sed -i "s|${cargoSha256}|${fakeHash}|" "${metadata}" - nix build --no-link "..#${upattr}" &> "${l}" || true - newcargoSha256="$(cat "${l}" | grep 'got:' | cut -d':' -f2 | tr -d ' ' || true)" + nix build --no-link "..#${upattr}" &> "${t2}" || true + newcargoSha256="$(cat "${t2}" | grep 'got:' | cut -d':' -f2 | tr -d ' ' || true)" if [[ "${newcargoSha256}" == "sha256" ]] then - newcargoSha256="$(cat "${l}" | grep 'got:' | cut -d':' -f3 | tr -d ' ' || true)" + newcargoSha256="$(cat "${t2}" | grep 'got:' | cut -d':' -f3 | tr -d ' ' || true)" fi newcargoSha256="$(nix hash to-sri --type sha256 "${newcargoSha256}")" sed -i "s|${fakeHash}|${newcargoSha256}|" "${metadata}" fi - # VendorSha256 + # Vendor SHA if [[ "${vendorSha256}" != "null" ]] then sed -i "s|${vendorSha256}|${fakeHash}|" "${metadata}" - nix build --no-link "..#${upattr}" &> "${l}" || true - newvendorSha256="$(cat "${l}" | grep 'got:' | cut -d':' -f2 | tr -d ' ' || true)" + nix build --no-link "..#${upattr}" &> "${t2}" || true + newvendorSha256="$(cat "${t2}" | grep 'got:' | cut -d':' -f2 | tr -d ' ' || true)" if [[ "${newvendorSha256}" == "sha256" ]] then - newvendorSha256="$(cat "${l}" | grep 'got:' | cut -d':' -f3 | tr -d ' ' || true)" + newvendorSha256="$(cat "${t2}" | grep 'got:' | cut -d':' -f3 | tr -d ' ' || true)" fi newvendorSha256="$(nix hash to-sri --type sha256 "${newvendorSha256}")" sed -i "s|${fakeHash}|${newvendorSha256}|" "${metadata}" fi # Commit - prefix="chore(packages):" + prefix="chore(packages): Update" git diff-index --quiet HEAD "${pkg}" || \ - git commit -q -n "${pkg}" -m "${prefix} ${pkgname} (${rev} ---> ${newrev})" + git commit -q -n "${pkg}" -m "${prefix} \`${pkgname}\`" -m "${rev} ---> ${newrev}" echo -e "Finished Updating '${pkgname}' ('${rev}' ---> '${newrev}')\n" exit 0 fi