From 685fab808e3eb470af01f3ab25a80615f88bd106 Mon Sep 17 00:00:00 2001 From: Adrian G L Date: Fri, 2 Jan 2026 22:41:52 +0100 Subject: [PATCH] nixpkgs cleanup --- flake.nix | 6 +- home/aider.nix | 14 +-- home/gunalx.nix | 3 + home/neovim.nix | 2 + home/opencode.nix | 182 ++++++++++++++++---------------- home/zed.nix | 1 - hosts/elros/configuration.nix | 3 + hosts/galadriel/nvidia.nix | 54 +++++----- hosts/legolas/configuration.nix | 2 +- modules/acme.nix | 25 +++-- modules/basePackages.nix | 2 +- modules/develPackages.nix | 1 - modules/displaymanager.nix | 1 - modules/docling.nix | 4 +- modules/nix.nix | 6 +- modules/nixpkgs.nix | 19 ++++ modules/pangolin.nix | 9 +- modules/unstable.nix | 6 +- 18 files changed, 180 insertions(+), 160 deletions(-) create mode 100644 modules/nixpkgs.nix diff --git a/flake.nix b/flake.nix index efd4545..fe3a2e4 100644 --- a/flake.nix +++ b/flake.nix @@ -58,8 +58,7 @@ home-manager.nixosModules.home-manager { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; + home-manager.users.gunalx = import ./home/gunalx.nix; home-manager.backupFileExtension = "bac"; home-manager.extraSpecialArgs = { inherit nix-colors inputs; }; @@ -92,8 +91,7 @@ home-manager.nixosModules.home-manager { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; + home-manager.users.gunalx = import ./home/gunalx.nix; home-manager.backupFileExtension = "bac"; home-manager.extraSpecialArgs = { inherit nix-colors inputs; }; diff --git a/home/aider.nix b/home/aider.nix index 2e1f3c9..1f2bebd 100644 --- a/home/aider.nix +++ b/home/aider.nix @@ -12,7 +12,7 @@ programs.aider-chat = { enable = true; - package = pkgs.unstable.aider-chat-full; + package = pkgs.unstable.aider-chat-with-playwright; settings = { architect = true; auto-accept-architect = false; @@ -24,12 +24,12 @@ show-model-warnings = false; verify-ssl = false; - watch-files=true; - analytics-disable=true; - check-update=false; - multiline=true; - notifications=true; - show-diffs=true; + watch-files = true; + analytics-disable = true; + check-update = false; + multiline = true; + notifications = true; + show-diffs = true; }; }; diff --git a/home/gunalx.nix b/home/gunalx.nix index 581f0a9..77a905f 100644 --- a/home/gunalx.nix +++ b/home/gunalx.nix @@ -6,6 +6,9 @@ }: { imports = [ + ../modules/unstable.nix + ../modules/nixpkgs.nix + ./sshconfig.nix ./atuin.nix ./git.nix diff --git a/home/neovim.nix b/home/neovim.nix index 57f6957..9d37f0e 100644 --- a/home/neovim.nix +++ b/home/neovim.nix @@ -21,6 +21,8 @@ ]; plugins = with pkgs.vimPlugins; [ + vim-indent-guides + # --- UI / File Explorer (Replaces Chadtree) --- nvim-tree-lua nvim-web-devicons diff --git a/home/opencode.nix b/home/opencode.nix index ebd43d9..b60ec0d 100644 --- a/home/opencode.nix +++ b/home/opencode.nix @@ -13,129 +13,127 @@ programs.opencode = { enable = true; enableMcpIntegration = true; - + settings = { model = "github-copilot/gpt-5.2"; - small_model = "zai-coding-plan/glm-4.6"; + small_model = "zai-coding-plan/glm-4.7"; autoshare = false; autoupdate = false; }; - agents = { - code-reviewer = '' - # Code Reviewer Agent - - You are a senior software engineer specializing in code reviews. - Focus on code quality, security, and maintainability. - - ## Guidelines - - Review for potential bugs and edge cases - - Check for security vulnerabilities - - Ensure code follows best practices - - Suggest improvements for readability and performance - ''; + code-reviewer = '' + # Code Reviewer Agent - debugger = '' - # Debugger Agent - - You are a software engineer specializing in debugging and troubleshooting. - Focus on identifying issues, providing insights into existing bugs, and suggesting improvements to the debugging process. - - ## Guidelines - - Look for unhandled exceptions, crashes, or error states. - - Identify and remove redundant or unnecessary debug/print statements. - - Check for proper logging practices: ensure log levels (info, debug, error) are used correctly. - - Examine error messages for clarity and context—ensure they aid in troubleshooting. - - Look for missing or incorrect error handling and suggest improvements. - - Trace the flow of execution to catch logical or state-related bugs. - - Ensure relevant variable states are being monitored during runtime to spot anomalies. - - Suggest improvements to breakpoints, watchpoints, or other debugging tools for better visibility. - - Look for performance bottlenecks that could be causing issues and suggest optimizations. - - Check for edge cases and race conditions that might not be covered by current debugging. - - Ensure debugging steps or tools don’t affect production environments (i.e., avoid verbose logging in production). - - Document findings and proposed fixes clearly for future reference. - ''; + You are a senior software engineer specializing in code reviews. + Focus on code quality, security, and maintainability. - simplifier = '' - # Simplifier Agent - - You are a software engineer specializing in simplifying and refactoring complex code. - Focus on making the code more readable, maintainable, and easier to understand without altering its functionality. - - ## Guidelines - - Break down long or complex functions into smaller, well-named helper functions or methods. - - Identify and remove any redundant or duplicate logic, consolidating wherever possible. - - Use more descriptive variable and function names to improve clarity. - - Simplify nested loops or conditionals (e.g., consider early returns to reduce indentation). - - Replace complex data structures or algorithms with simpler, more efficient alternatives if appropriate. - - Refactor complex conditional logic (e.g., using polymorphism, strategy pattern, or lookup tables where applicable). - - Replace hardcoded values with constants or configuration variables to improve flexibility. - - Group related logic together to improve cohesion within classes or functions. - - Ensure the code follows the DRY (Don't Repeat Yourself) principle and refactor to remove duplication. - - Simplify error handling by centralizing common error paths or using more consistent exception handling. - - Remove unnecessary comments or redundant code that doesn’t add value to readability. - - Check for opportunities to use built-in language features or libraries to reduce custom code (e.g., use `map()` instead of for-loops in Python). - - Ensure code is modular and maintainable, facilitating easier testing and future updates. - - Use early exits or guard clauses to minimize nested logic and make the code more straightforward. - - ''; + ## Guidelines + - Review for potential bugs and edge cases + - Check for security vulnerabilities + - Ensure code follows best practices + - Suggest improvements for readability and performance + ''; + + debugger = '' + # Debugger Agent + + You are a software engineer specializing in debugging and troubleshooting. + Focus on identifying issues, providing insights into existing bugs, and suggesting improvements to the debugging process. + + ## Guidelines + - Look for unhandled exceptions, crashes, or error states. + - Identify and remove redundant or unnecessary debug/print statements. + - Check for proper logging practices: ensure log levels (info, debug, error) are used correctly. + - Examine error messages for clarity and context—ensure they aid in troubleshooting. + - Look for missing or incorrect error handling and suggest improvements. + - Trace the flow of execution to catch logical or state-related bugs. + - Ensure relevant variable states are being monitored during runtime to spot anomalies. + - Suggest improvements to breakpoints, watchpoints, or other debugging tools for better visibility. + - Look for performance bottlenecks that could be causing issues and suggest optimizations. + - Check for edge cases and race conditions that might not be covered by current debugging. + - Ensure debugging steps or tools don’t affect production environments (i.e., avoid verbose logging in production). + - Document findings and proposed fixes clearly for future reference. + ''; + + simplifier = '' + # Simplifier Agent + + You are a software engineer specializing in simplifying and refactoring complex code. + Focus on making the code more readable, maintainable, and easier to understand without altering its functionality. + + ## Guidelines + - Break down long or complex functions into smaller, well-named helper functions or methods. + - Identify and remove any redundant or duplicate logic, consolidating wherever possible. + - Use more descriptive variable and function names to improve clarity. + - Simplify nested loops or conditionals (e.g., consider early returns to reduce indentation). + - Replace complex data structures or algorithms with simpler, more efficient alternatives if appropriate. + - Refactor complex conditional logic (e.g., using polymorphism, strategy pattern, or lookup tables where applicable). + - Replace hardcoded values with constants or configuration variables to improve flexibility. + - Group related logic together to improve cohesion within classes or functions. + - Ensure the code follows the DRY (Don't Repeat Yourself) principle and refactor to remove duplication. + - Simplify error handling by centralizing common error paths or using more consistent exception handling. + - Remove unnecessary comments or redundant code that doesn’t add value to readability. + - Check for opportunities to use built-in language features or libraries to reduce custom code (e.g., use `map()` instead of for-loops in Python). + - Ensure code is modular and maintainable, facilitating easier testing and future updates. + - Use early exits or guard clauses to minimize nested logic and make the code more straightforward. + + ''; }; commands = { - commit = '' - # Commit Command + commit = '' + # Commit Command - Create a git commit with proper message formatting following conventional commits. - Usage: /commit [message] - ''; + Create a git commit with proper message formatting following conventional commits. + Usage: /commit [message] + ''; }; rules = '' -### **General Project Guidelines** -#### **Separation of Concerns** + ### **General Project Guidelines** + #### **Separation of Concerns** -* Keep your code **loosely coupled** components/modules should only know about what they need. -* Maintain clear **separation between domain logic and business logic** ensure your domain layer is independent of infrastructure or framework specific details. -* Ensure **separation of data concerns** never mix UI data, business data, and domain entities in a single layer. + * Keep your code **loosely coupled** components/modules should only know about what they need. + * Maintain clear **separation between domain logic and business logic** ensure your domain layer is independent of infrastructure or framework specific details. + * Ensure **separation of data concerns** never mix UI data, business data, and domain entities in a single layer. -#### **Typing and Type Safety** + #### **Typing and Type Safety** -* **Always define types** explicitly for variables, parameters, and return values. -* Avoid using `any` if you're unsure about a type, lean on **unknown** or **generics** until you can define it properly. -* **Interfaces and Types** should be descriptive and reusable prefer interfaces for object shapes, and types for unions/intersections or specific business rules. -* Avoid overcomplicating types focus on clarity and consistency. + * **Always define types** explicitly for variables, parameters, and return values. + * Avoid using `any` if you're unsure about a type, lean on **unknown** or **generics** until you can define it properly. + * **Interfaces and Types** should be descriptive and reusable prefer interfaces for object shapes, and types for unions/intersections or specific business rules. + * Avoid overcomplicating types focus on clarity and consistency. -#### **Code Simplicity** + #### **Code Simplicity** -* Write **simple, understandable code** don't over engineer solutions unless absolutely necessary. -* Keep methods and functions **small and focused** follow the Single Responsibility Principle. -* **Comment only when necessary** to explain complex or non obvious patterns **no comments for simple or self explanatory code**. + * Write **simple, understandable code** don't over engineer solutions unless absolutely necessary. + * Keep methods and functions **small and focused** follow the Single Responsibility Principle. + * **Comment only when necessary** to explain complex or non obvious patterns **no comments for simple or self explanatory code**. -#### **Production-Ready Code** + #### **Production-Ready Code** -* Always write **production-grade code** optimize for maintainability, readability, and scalability. -* Ensure **robust error handling** catch edge cases, validate inputs, and handle exceptions gracefully. + * Always write **production-grade code** optimize for maintainability, readability, and scalability. + * Ensure **robust error handling** catch edge cases, validate inputs, and handle exceptions gracefully. -#### **Framework and Library Usage** + #### **Framework and Library Usage** -* Use frameworks and libraries **where they make sense**, but avoid unnecessary dependencies, we usually want to keep dependencies down. -* Follow **framework best practices** for structure, state management, and lifecycle methods -* Keep **UI and business logic separate** don't directly tie your UI components to business logic; use hooks or services to handle interactions. + * Use frameworks and libraries **where they make sense**, but avoid unnecessary dependencies, we usually want to keep dependencies down. + * Follow **framework best practices** for structure, state management, and lifecycle methods + * Keep **UI and business logic separate** don't directly tie your UI components to business logic; use hooks or services to handle interactions. -#### **Documentation** + #### **Documentation** -* **Document key architecture decisions** especially if they are complex or non intuitive. -* Only document the **why** and **how** when it's not obvious avoid redundant or trivial comments. -* Keep your documentation to the developmentlog.md Make a new section, dont write to long, just briefely what needs to be documented. + * **Document key architecture decisions** especially if they are complex or non intuitive. + * Only document the **why** and **how** when it's not obvious avoid redundant or trivial comments. + * Keep your documentation to the developmentlog.md Make a new section, dont write to long, just briefely what needs to be documented. -#### **Performance Considerations** + #### **Performance Considerations** -* Optimize for **readability first**, then **performance** measure performance bottlenecks before optimizing. -* When optimizing, our first priority is finding arcitectural problems, then finding out ways to parralelize. + * Optimize for **readability first**, then **performance** measure performance bottlenecks before optimizing. + * When optimizing, our first priority is finding arcitectural problems, then finding out ways to parralelize. ''; }; - } diff --git a/home/zed.nix b/home/zed.nix index fa59c5a..23f9b4b 100644 --- a/home/zed.nix +++ b/home/zed.nix @@ -1,7 +1,6 @@ { pkgs, lib, - unstable, config, ... }: diff --git a/hosts/elros/configuration.nix b/hosts/elros/configuration.nix index fa28db4..03f366d 100644 --- a/hosts/elros/configuration.nix +++ b/hosts/elros/configuration.nix @@ -24,6 +24,9 @@ ../../modules/tailscale.nix ../../modules/basePackages.nix + ../../modules/acme.nix + ../../modules/pangolin.nix + ]; # Use the systemd-boot EFI boot loader. diff --git a/hosts/galadriel/nvidia.nix b/hosts/galadriel/nvidia.nix index da11fa9..3d06b23 100644 --- a/hosts/galadriel/nvidia.nix +++ b/hosts/galadriel/nvidia.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { # Enable OpenGL hardware.graphics = { @@ -6,9 +11,8 @@ enable32Bit = true; }; - # Load nvidia driver for Xorg and Wayland - services.xserver.videoDrivers = ["nvidia"]; + services.xserver.videoDrivers = [ "nvidia" ]; boot = { blacklistedKernelModules = [ "nouveau" ]; @@ -18,32 +22,30 @@ hardware.nvidia = { modesetting.enable = true; - # Nvidia power management. Experimental, and can cause sleep/suspend to fail. - #powerManagement.enable = true; - # Fine-grained power management. Turns off GPU when not in use. Experimental and only works on modern Nvidia GPUs (Turing or newer). - powerManagement.finegrained = false; + # Nvidia power management. Experimental, and can cause sleep/suspend to fail. + #powerManagement.enable = true; + # Fine-grained power management. Turns off GPU when not in use. Experimental and only works on modern Nvidia GPUs (Turing or newer). + powerManagement.finegrained = false; - # Use the NVidia open source kernel module (not to be confused with the independent third-party "nouveau" open source driver). - # Currently alpha-quality/buggy, so false is currently the recommended setting. - open = false; #need proprietary for cuda. + # Use the NVidia open source kernel module (not to be confused with the independent third-party "nouveau" open source driver). + # Currently alpha-quality/buggy, so false is currently the recommended setting. + open = false; # need proprietary for cuda. - # Enable the Nvidia settings menu, accessible via `nvidia-settings`. - #nvidiaSettings = true; + # Enable the Nvidia settings menu, accessible via `nvidia-settings`. + #nvidiaSettings = true; - # Optionally, you may need to select the appropriate driver version for your specific GPU. - package = config.boot.kernelPackages.nvidiaPackages.stable; - }; - - # Enable the CUDA toolkit - #install packages - environment.systemPackages = with pkgs; [ - cudaPackages.cudatoolkit - cudaPackages.cudnn - nvtopPackages.nvidia - cudaPackages.nccl - pkgs.cudaPackages.libcublas - ]; + # Optionally, you may need to select the appropriate driver version for your specific GPU. + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; + # Enable the CUDA toolkit + #install packages + environment.systemPackages = with pkgs; [ + cudaPackages.cudatoolkit + cudaPackages.cudnn + nvtopPackages.nvidia + cudaPackages.nccl + pkgs.cudaPackages.libcublas + ]; } - diff --git a/hosts/legolas/configuration.nix b/hosts/legolas/configuration.nix index a242f45..96d838b 100644 --- a/hosts/legolas/configuration.nix +++ b/hosts/legolas/configuration.nix @@ -34,7 +34,7 @@ ../../modules/jupyterhub.nix ../../modules/blog.nix ../../modules/ollama.nix - ../../modules/docling.nix # temp for dev + #../../modules/docling.nix # temp for dev ... Waiting for non broken docling-serve ../../modules/kdeconnect.nix ../../modules/desktopApplications.nix diff --git a/modules/acme.nix b/modules/acme.nix index 40b82b4..2508912 100644 --- a/modules/acme.nix +++ b/modules/acme.nix @@ -1,7 +1,12 @@ -{ config, pkgs, lib, ... }: -{ - sops.secrets."acme/certs" = { }; - networking.enableIPv6 = false; #For some reason acme only works without ipv6, probably because of missing AAAA records. +{ + config, + pkgs, + lib, + ... +}: +{ + sops.secrets."acme/certs" = { }; + networking.enableIPv6 = false; # For some reason acme only works without ipv6, probably because of missing AAAA records. networking.domain = "lauterer.it"; #acme and certs helpful blog https://carjorvaz.com/posts/ security.acme = { @@ -9,7 +14,7 @@ defaults.email = "adrian+acme@lauterer.it"; certs."${config.networking.domain}" = { domain = "${config.networking.domain}"; - extraDomainNames = [ + extraDomainNames = [ "*.${config.networking.domain}" "lb0fj.eu" "*.lb0fj.eu" @@ -19,16 +24,16 @@ "addictedmaker.eu" ]; ## for testing. - #server = "https://acme-staging-v02.api.letsencrypt.org/directory"; + #server = "https://acme-staging-v02.api.letsencrypt.org/directory"; #enableDebugLogs = true; - #legos registrar specific stuff. + #legos registrar specific stuff. dnsResolver = "ns1.hyp.net:53"; - dnsProvider = "domeneshop"; + dnsProvider = "domeneshop"; dnsPropagationCheck = true; - + #need to manually create this file according to dnsprovider secrets, and format of key according to lego in privider and add to secrets.yaml - credentialsFile = config.sops.secrets."acme/certs".path; + credentialsFile = config.sops.secrets."acme/certs".path; }; }; diff --git a/modules/basePackages.nix b/modules/basePackages.nix index f5c03b2..c5c9d08 100644 --- a/modules/basePackages.nix +++ b/modules/basePackages.nix @@ -20,7 +20,7 @@ ripgrep eza fastfetch - + ]; } diff --git a/modules/develPackages.nix b/modules/develPackages.nix index 81a9311..e4cdab7 100644 --- a/modules/develPackages.nix +++ b/modules/develPackages.nix @@ -13,7 +13,6 @@ curl wget - openssl gdb libgcc diff --git a/modules/displaymanager.nix b/modules/displaymanager.nix index 23a9572..26ce97b 100644 --- a/modules/displaymanager.nix +++ b/modules/displaymanager.nix @@ -7,7 +7,6 @@ { - environment.systemPackages = [ (pkgs.catppuccin-sddm.override { flavor = "mocha"; diff --git a/modules/docling.nix b/modules/docling.nix index 6996450..ac2de04 100644 --- a/modules/docling.nix +++ b/modules/docling.nix @@ -6,8 +6,8 @@ }: { services.docling-serve = { - enable = false; #this is broken for now. - package = pkgs.python312Packages.docling-serve; + enable = true; # this is broken for now. + package = pkgs.unstable.python313Packages.docling-serve; port = 5001; host = "127.0.0.1"; openFirewall = true; diff --git a/modules/nix.nix b/modules/nix.nix index 4b09720..d09c7a9 100644 --- a/modules/nix.nix +++ b/modules/nix.nix @@ -6,14 +6,10 @@ }: { - imports = [ ]; + imports = [ ./nixpkgs.nix ]; # migrate this afterwards. system.rebuild.enableNg = true; - nixpkgs.config.allowUnfree = true; - nixpkgs.config.permittedInsecurePackages = [ - # example "python3.11-youtube-dl-2021.12.17" - ]; sops.secrets."github/api" = { mode = "0444"; group = "root"; diff --git a/modules/nixpkgs.nix b/modules/nixpkgs.nix new file mode 100644 index 0000000..ef02c83 --- /dev/null +++ b/modules/nixpkgs.nix @@ -0,0 +1,19 @@ +{ + config, + pkgs, + lib, + ... +}: + +{ + imports = [ ]; + + nixpkgs = { + config = { + allowUnfree = true; + permittedInsecurePackages = [ + # example "python3.11-youtube-dl-2021.12.17" + ]; + }; + }; +} diff --git a/modules/pangolin.nix b/modules/pangolin.nix index 897c439..81e2179 100644 --- a/modules/pangolin.nix +++ b/modules/pangolin.nix @@ -6,16 +6,15 @@ }: { - - services.pangolin = { + services.pangolin = { enable = true; openFirewall = true; - + baseDomain = "lauterer.it"; dashboardDomain = "auth.lauterer.it"; dnsProvider = "domeneshop"; - - #settings + + #settings #environmentFile #dataDir }; diff --git a/modules/unstable.nix b/modules/unstable.nix index e213ca6..8f10528 100644 --- a/modules/unstable.nix +++ b/modules/unstable.nix @@ -1,16 +1,14 @@ { config, - pkgs, inputs, - system, ... }: let unstableOverlay = final: prev: { unstable = import inputs.unstable { - inherit system; - config = prev.config; + inherit (final.stdenv.hostPlatform) system; + inherit (config.nixpkgs) config; }; }; in