python: refactor and cleanup

This commit is contained in:
Ilan Joselevich 2022-07-21 02:45:22 +03:00
parent 2f86534428
commit cd093ed16b
6 changed files with 21 additions and 60 deletions

View file

@ -1 +0,0 @@
use flake

View file

@ -1,13 +0,0 @@
name: "Build legacy Nix package on Ubuntu"
on:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v12
- name: Building package
run: nix-build . -A defaultPackage.x86_64-linux

6
python/.gitignore vendored
View file

@ -1,6 +0,0 @@
__pycache__
secrets.py
runs
.ipynb_*
*.csv
.direnv

View file

@ -1,7 +0,0 @@
(import (
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz";
sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; }
) {
src = ./.;
}).defaultNix

View file

@ -1,29 +1,24 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
outputs = { self, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system});
in
{
packages = forAllSystems (system: {
default = pkgs.${system}.poetry2nix.mkPoetryApplication { projectDir = self; };
});
devShells = forAllSystems (system: {
default = pkgs.${system}.mkShellNoCC {
packages = with pkgs.${system}; [
(poetry2nix.mkPoetryEnv { projectDir = self; })
poetry
];
};
});
};
outputs = {self, nixpkgs, utils}:
let out = system:
let pkgs = nixpkgs.legacyPackages."${system}";
in {
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
python3Packages.poetry
];
};
defaultPackage = with pkgs.poetry2nix; mkPoetryApplication {
projectDir = ./.;
preferWheels = true;
};
defaultApp = utils.lib.mkApp {
drv = self.defaultPackage."${system}";
};
}; in with utils.lib; eachSystem defaultSystems out;
}

View file

@ -1,7 +0,0 @@
(import (
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz";
sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; }
) {
src = ./.;
}).shellNix