diff --git a/flake.nix b/flake.nix index af47ae2..1fbefeb 100644 --- a/flake.nix +++ b/flake.nix @@ -17,6 +17,7 @@ flake = { homeManagerModules = import ./modules/home-manager; overlays = import ./overlays { inherit inputs self; }; + templates = import ./templates; }; perSystem = { pkgs, ... }: diff --git a/home/programs/shell/starship.nix b/home/programs/shell/starship.nix index fc0f423..569d4ea 100644 --- a/home/programs/shell/starship.nix +++ b/home/programs/shell/starship.nix @@ -25,7 +25,6 @@ $scala\ $conda\ $python\ - $custom\ $container\ $nix_shell\ $time\n\ @@ -180,14 +179,6 @@ disabled = false symbol = ' ' - [custom.flake] - command = "cat flake.nix | grep description | cut -d\" -f2" - style = "bg:overlay fg:pine" - format = " [](fg:overlay)[ $symbol$output ]($style)[](fg:overlay)" - disabled = false - symbol = "󱄅 " - detect_files = ["flake.nix"] - [nix_shell] format = 'via [$symbol$state( \($name\))]($style) ' symbol = "󱄅 " diff --git a/templates/default.nix b/templates/default.nix new file mode 100644 index 0000000..353f7df --- /dev/null +++ b/templates/default.nix @@ -0,0 +1,6 @@ +{ + python-analyze = { + path = ./python-analyze; + description = "Python with modules for analyzing data"; + }; +} diff --git a/templates/python-analyze/flake.lock b/templates/python-analyze/flake.lock new file mode 100644 index 0000000..4e8a4e4 --- /dev/null +++ b/templates/python-analyze/flake.lock @@ -0,0 +1,96 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1741352980, + "narHash": "sha256-+u2UunDA4Cl5Fci3m7S643HzKmIDAe+fiXrLqYsR2fs=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f4330d22f1c5d2ba72d3d22df5597d123fdb60a9", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1739451785, + "narHash": "sha256-3ebRdThRic9bHMuNi2IAA/ek9b32bsy8F5R4SvGTIog=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1128e89fd5e11bb25aedbfc287733c6502202ea9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1740877520, + "narHash": "sha256-oiwv/ZK/2FhGxrCkQkB83i7GnWXPPLzoqFHpDD3uYpk=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "147dee35aab2193b174e4c0868bd80ead5ce755c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1735554305, + "narHash": "sha256-zExSA1i/b+1NMRhGGLtNfFGXgLtgo+dcuzHzaWA6w3Q=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "0e82ab234249d8eee3e8c91437802b32c74bb3fd", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs", + "treefmt-nix": "treefmt-nix" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1742370146, + "narHash": "sha256-XRE8hL4vKIQyVMDXykFh4ceo3KSpuJF3ts8GKwh5bIU=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "adc195eef5da3606891cedf80c0d9ce2d3190808", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/templates/python-analyze/flake.nix b/templates/python-analyze/flake.nix new file mode 100644 index 0000000..01cadcd --- /dev/null +++ b/templates/python-analyze/flake.nix @@ -0,0 +1,51 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; + treefmt-nix.url = "github:numtide/treefmt-nix"; + }; + + outputs = + { ... }@inputs: + inputs.flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ "x86_64-linux" ]; + imports = [ + inputs.treefmt-nix.flakeModule + ]; + perSystem = + { pkgs, ... }: + { + devShells = { + default = + let + packageOverrides = pkgs.callPackage ./python-packages.nix { }; + python = pkgs.python312.override { inherit packageOverrides; }; + in + pkgs.mkShellNoCC { + buildInputs = [ + (python.withPackages ( + ps: with ps; [ + numpy + pandas + scipy + requests + matplotlib + scikit-learn + seaborn + pingouin + ] + )) + ]; + shellHook = '' + fish + ''; + }; + }; + treefmt = { + projectRootFile = "flake.nix"; + programs.nixfmt.enable = true; + programs.ruff-format.enable = true; + }; + }; + }; +} diff --git a/templates/python-analyze/python-packages.nix b/templates/python-analyze/python-packages.nix new file mode 100644 index 0000000..8230d14 --- /dev/null +++ b/templates/python-analyze/python-packages.nix @@ -0,0 +1,51 @@ +# Generated by pip2nix 0.8.0.dev1 +# See https://github.com/nix-community/pip2nix + +{ + pkgs, + fetchurl, +}: + +self: super: { + "pandas-flavor" = super.buildPythonPackage { + pname = "pandas-flavor"; + version = "0.6.0"; + src = fetchurl { + url = "https://files.pythonhosted.org/packages/67/1a/bfb5574b215f530c7ac5be684f33d60b299abbebd763c203aa31755f2fb2/pandas_flavor-0.6.0-py3-none-any.whl"; + sha256 = "14wqi64h4srgabznb75w2dvq14gfih3x0ayg429mf0m71lp9wb53"; + }; + format = "wheel"; + doCheck = false; + buildInputs = [ ]; + checkInputs = [ ]; + nativeBuildInputs = [ ]; + propagatedBuildInputs = with pkgs.python312Packages; [ + pandas + xarray + ]; + }; + "pingouin" = super.buildPythonPackage { + pname = "pingouin"; + version = "0.5.5"; + src = fetchurl { + url = "https://files.pythonhosted.org/packages/eb/56/6d3607f3a78aee1de8e5466f5171722c8e344266a12dc44ccb73d024b3b3/pingouin-0.5.5-py3-none-any.whl"; + sha256 = "1w8fwbad92j3v3paib0mnrbhg4rpb68fwj0840qi2m759vjaymii"; + }; + format = "wheel"; + doCheck = false; + buildInputs = [ ]; + checkInputs = [ ]; + nativeBuildInputs = [ ]; + propagatedBuildInputs = with pkgs.python312Packages; [ + matplotlib + numpy + pandas + self."pandas-flavor" + scikit-learn + scipy + seaborn + statsmodels + tabulate + ]; + }; +}