nix toolkit

This commit is contained in:
raf 2023-10-07 23:53:53 +03:00
parent a532eae13b
commit 721ff3eb3c
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29
4 changed files with 89 additions and 1 deletions

38
default.nix Normal file
View file

@ -0,0 +1,38 @@
{
lib,
python3Packages,
doCheck ? true,
...
}:
python3Packages.buildPythonApplication {
pname = "projectile-simulation";
version = "0.0.1";
src = ./.;
propagatedBuildInputs = with python3Packages; [
numpy
matplotlib
pytest
];
nativeCheckInputs = [
python3Packages.pytest
];
checkPhase = lib.optionals doCheck ''
runHook preCheck
pytest
runHook postCheck
'';
meta = {
description = "Simulate the motion of a projectile with air resistance";
longDescription = ''
This is a Python package that simulates the motion of a projectile with air resistance.
It is based on the Euler method.
'';
license = lib.licenses.eupl12;
maintainers = with lib.maintainers; [NotAShelf];
};
}

27
flake.lock Normal file
View file

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1696661029,
"narHash": "sha256-GIB5VTkvsDIqfMpdtuetOzpm64P8wm8nBSv5Eo8XM3Y=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2de1be5b51c3d6fa833f1c1f222dc867dd054b31",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

23
flake.nix Normal file
View file

@ -0,0 +1,23 @@
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
outputs = {
self,
nixpkgs,
}: let
systems = ["x86_64-linux" "aarch64-linux"];
forEachSystem = nixpkgs.lib.genAttrs systems;
pkgsForEach = nixpkgs.legacyPackages;
in {
packages = forEachSystem (system: {
default = pkgsForEach.${system}.callPackage ./default.nix {};
});
devShells = forEachSystem (system: {
devShells = {
default = pkgsForEach.${system}.callPackage ./shell.nix {};
};
});
};
}

View file

@ -1,4 +1,4 @@
{pkgs ? import <nixpkgs> {}}: let
{pkgs, ...}: let
my-python-packages = ps:
with ps; [
matplotlib