From 068cdbf5d464c3882473ea0218b954b9ddab8261 Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Wed, 26 Jun 2024 16:24:35 -0400 Subject: [PATCH] try building mole for eblume relates to #68 --- hosts/lookingglass/default.nix | 1 + modules/common/applications/default.nix | 1 + modules/common/applications/mole.nix | 110 ++++++++++++++++++++++++ 3 files changed, 112 insertions(+) create mode 100644 modules/common/applications/mole.nix diff --git a/hosts/lookingglass/default.nix b/hosts/lookingglass/default.nix index 59c6781..1db1c83 100644 --- a/hosts/lookingglass/default.nix +++ b/hosts/lookingglass/default.nix @@ -34,6 +34,7 @@ inputs.darwin.lib.darwinSystem { dark = true; }; mail.user = globals.user; + mole.enable = true; atuin.enable = true; charm.enable = true; neovim.enable = true; diff --git a/modules/common/applications/default.nix b/modules/common/applications/default.nix index 8f94e4d..7a8206a 100644 --- a/modules/common/applications/default.nix +++ b/modules/common/applications/default.nix @@ -8,6 +8,7 @@ ./firefox.nix ./kitty.nix ./media.nix + ./mole.nix ./obsidian.nix ./qbittorrent.nix ./slack.nix diff --git a/modules/common/applications/mole.nix b/modules/common/applications/mole.nix new file mode 100644 index 0000000..d994212 --- /dev/null +++ b/modules/common/applications/mole.nix @@ -0,0 +1,110 @@ +{ + config, + pkgs, + lib, + ... +}: + +let + + # Build kdl-py + kdl-py = pkgs.python311.pkgs.buildPythonPackage rec { + pname = "kdl-py"; + version = "1.2.0"; + pyproject = true; + src = pkgs.fetchPypi { + inherit pname version; + hash = "sha256-Y/P0bGJ33trc5E3PyUZyv25r8zMLkBIuATTCKFfimXM="; + }; + build-system = [ pkgs.python311.pkgs.setuptools ]; + # has no tests + doCheck = false; + }; + + mole = pkgs.python311.pkgs.buildPythonPackage rec { + pname = "mole"; + version = "0.7.1"; + pyproject = true; + + src = pkgs.fetchFromGitHub { + owner = "eblume"; + repo = pname; + rev = "30bb052a97050b1fa89c287855d834f7952b195a"; + sha256 = "sha256-DUWsfyICCfFQ2ZQBYSQVoA3eLdKC8djUylKgGdHIyJo="; + }; + + patches = [ + (builtins.toString ( + pkgs.writeText "pyproject.toml.patch" '' + diff --git a/pyproject.toml b/pyproject.toml + index 12ce0f5..787e978 100644 + --- a/pyproject.toml + +++ b/pyproject.toml + @@ -12,11 +12,11 @@ packages = [ + [tool.poetry.dependencies] + python = "^3.11" + # Now back to the regular dependencies + -typer = {extras = ["all"], version = "^0.9"} + +typer = {extras = ["all"], version = "^0.12"} + todoist-api-python = "^2.1.3" + openai = "^1.2.4" + rich = "^13.4.2" + -watchdog = "^3.0.0" + +watchdog = "^4.0.0" + pydub = "^0.25.1" + requests = "^2.31.0" + pyyaml = "^6.0.1" + '' + )) + ]; + + # Used during build time + nativeBuildInputs = [ pkgs.python311Packages.poetry-core ]; + + # Used during run time + buildInputs = [ + pkgs._1password + pkgs.nb-cli + ]; + + # Both build and run time + propagatedBuildInputs = [ + pkgs.python311Packages.typer + pkgs.python311Packages.todoist-api-python + pkgs.python311Packages.openai + pkgs.python311Packages.rich + pkgs.python311Packages.watchdog + pkgs.python311Packages.pydub + pkgs.python311Packages.requests + pkgs.python311Packages.pyyaml + pkgs.python311Packages.pydantic + pkgs.python311Packages.pendulum + kdl-py + pkgs.ffmpeg + ]; + + build-system = [ pkgs.python311.pkgs.setuptools ]; + + # has no tests + doCheck = false; + + }; + +in +{ + + options = { + mole = { + enable = lib.mkEnableOption { + description = "Enable Mole."; + default = false; + }; + }; + }; + + config = lib.mkIf config.mole.enable { + home-manager.users.${config.user} = { + home.packages = [ mole ]; + }; + }; +}