add python dependencies and update flake

py: add requirements.txt
flake: add pip hook & update to 23.11
flake: add flake lock
This commit is contained in:
morgan 2023-12-05 10:41:58 +08:00
parent 4975093f41
commit d92214bd4e
3 changed files with 92 additions and 11 deletions

61
flake.lock Normal file
View File

@ -0,0 +1,61 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1701539137,
"narHash": "sha256-nVO/5QYpf1GwjvtpXhyxx5M3U/WN0MwBro4Lsk+9mL0=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "933d7dc155096e7575d207be6fb7792bc9f34f6d",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-23.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View File

@ -1,7 +1,6 @@
{ {
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
nixpkgs_stable.url = "github:NixOS/nixpkgs/nixpkgs-23.05-darwin";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
}; };
outputs = { nixpkgs, flake-utils, ... }: flake-utils.lib.eachDefaultSystem (system: outputs = { nixpkgs, flake-utils, ... }: flake-utils.lib.eachDefaultSystem (system:
@ -10,19 +9,29 @@
inherit system; inherit system;
}; };
pypkgs = ps: [
ps.pip
ps.scipy
ps.numpy
ps.matplotlib
];
in rec { in rec {
devShell = pkgs.mkShell { devShell = pkgs.mkShell {
name = "WRPLL-sim"; name = "WRPLL-sim";
buildInputs = with pkgs; [ venvDir = "./.venv";
(python3.withPackages pypkgs) buildInputs = with pkgs.python3Packages; [
python
numba
numpy
notebook # use jupyter notebook without missing libstdc++.so.6
venvShellHook
]; ];
# Only run once when venv is created
postVenvCreation = ''
unset SOURCE_DATE_EPOCH
pip install -r requirements.txt
'';
postShellHook = ''
# allow pip to install wheels
unset SOURCE_DATE_EPOCH
'';
}; };
} }
); );

11
requirements.txt Normal file
View File

@ -0,0 +1,11 @@
scipy
numpy
ipykernel
ipywidgets
jupyter
jupyterlab
notebook
numba
pandas
plotly
plotly-resampler