From 2ecf8f7259bd97a07f1a785649362a85487e392d Mon Sep 17 00:00:00 2001 From: Himadri Bhattacharjee <107522312+lavafroth@users.noreply.github.com> Date: Sun, 23 Mar 2025 19:49:34 +0530 Subject: [PATCH] feat: add uni python flake --- devShells/uniPython/flake.lock | 27 +++++++++++++++++++ devShells/uniPython/flake.nix | 48 ++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 devShells/uniPython/flake.lock create mode 100644 devShells/uniPython/flake.nix diff --git a/devShells/uniPython/flake.lock b/devShells/uniPython/flake.lock new file mode 100644 index 0000000..62e0614 --- /dev/null +++ b/devShells/uniPython/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1742422364, + "narHash": "sha256-mNqIplmEohk5jRkqYqG19GA8MbQ/D4gQSK0Mu4LvfRQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a84ebe20c6bc2ecbcfb000a50776219f48d134cc", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/devShells/uniPython/flake.nix b/devShells/uniPython/flake.nix new file mode 100644 index 0000000..9546d5a --- /dev/null +++ b/devShells/uniPython/flake.nix @@ -0,0 +1,48 @@ +{ + description = "matplotlib kitcat devshell"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + outputs = + { nixpkgs, ... }: + let + forAllSystems = + f: + nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed (system: f nixpkgs.legacyPackages.${system}); + in + { + devShells = forAllSystems (pkgs: { + default = pkgs.mkShell { + packages = [ + (pkgs.python311.withPackages ( + ps: with ps; [ + numpy + ipython + matplotlib + pandas + # kitkat backend to view plots + # directly in the kitty terminal + (ps.buildPythonPackage rec { + pname = "kitcat"; + version = "1.2.1"; + format = "pyproject"; + src = pkgs.fetchPypi { + inherit pname version; + hash = "sha256-biNvOgAtSUUxvDtBH78Z6MG/pq9rhles3DDvokbpLsg="; + }; + nativeBuildInputs = with ps; [ hatchling ]; + buildInputs = with ps; [ + matplotlib + setuptools + build + ]; + }) + ] + )) + ]; + + MPLBACKEND = "module://kitcat"; + }; + }); + }; +}