From a0dd718b4eebef3353f166f0552685366fc62b95 Mon Sep 17 00:00:00 2001 From: Ahmad Ansori Palembani Date: Tue, 16 Jul 2024 16:29:32 +0700 Subject: [PATCH] chore(nix): Migrate inkscape from homebrew to nix Also add overlay to ignore pytest for some python packages, because python is pain --- .config/nix/darwin/configuration.nix | 19 +++++++++++++------ .config/nix/darwin/default.nix | 17 +++++++++++++++++ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/.config/nix/darwin/configuration.nix b/.config/nix/darwin/configuration.nix index e36e8f1..3384c82 100644 --- a/.config/nix/darwin/configuration.nix +++ b/.config/nix/darwin/configuration.nix @@ -7,7 +7,17 @@ # NOTE: List packages installed in system profile. To search by name, run: # `nix-env -qaP | grep wget` - environment.systemPackages = [ + environment.systemPackages = + let + dontCheckPython = drv: drv.overridePythonAttrs (old: { + }); + python = (pkgs.python312Full.withPackages (py: [ + py.pip + py.tkinter + py.dnspython + ])); + in + [ pkgs.zsh pkgs.git pkgs.vim @@ -16,11 +26,8 @@ pkgs.passExtensions.pass-otp pkgs.gnupg pkgs.htop-vim - (pkgs.python312Full.withPackages (py: [ - py.pip - py.tkinter - ])) - # FIXME: Build failed, dnspython pytest keep returning FAILED caused by timeout. Maybe find a way to bypass check for them + python + (pkgs.inkscape.override { python3 = python; }) # (pkgs.poetry.override { python3 = python; }) pkgs.fastfetch pkgs.eza diff --git a/.config/nix/darwin/default.nix b/.config/nix/darwin/default.nix index b3a1110..39bf514 100644 --- a/.config/nix/darwin/default.nix +++ b/.config/nix/darwin/default.nix @@ -1,10 +1,27 @@ { inputs, nixpkgs, nix-darwin, home-manager, vars, ... }: let + disablePyChecks = pkg: pkg.overridePythonAttrs (old: { + doCheck = false; + doInstallCheck = false; + dontCheck = true; + }); systemConfig = system: { system = system; pkgs = import nixpkgs { inherit system; + overlays = [(final: prev: { + pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [(pyfinal: pyprev: { + dnspython = (disablePyChecks pyprev.dnspython).overridePythonAttrs (old: { + disabledTests = [ + # This test is unreliable when my internet is throttled by Indonesian ISP, timeout everywhere... lovely... + "test_resolver" + ] ++ old.disabledTests; + }); + pillow = disablePyChecks pyprev.pillow; + cherrypy = disablePyChecks pyprev.cherrypy; + })]; + })]; config.allowUnfree = true; }; };