mirror of
https://github.com/vale981/fibre_walk_project_code
synced 2025-03-04 17:31:39 -05:00
switch to a flake
This commit is contained in:
parent
5cda9758f4
commit
00500adeea
4 changed files with 295 additions and 1857 deletions
175
flake.lock
generated
Normal file
175
flake.lock
generated
Normal file
|
@ -0,0 +1,175 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"inputs": {
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-github-actions": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"poetry2nix",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1703863825,
|
||||
"narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nix-github-actions",
|
||||
"rev": "5163432afc817cf8bd1f031418d1869e4c9d5547",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nix-github-actions",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1715435713,
|
||||
"narHash": "sha256-lb2HqDQGfTdnCCpc1pgF6fkdgIOuBQ0nP8jjVSfLFqg=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "52b40f6c4be12742b1504ca2eb4527e597bf2526",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable-small",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"poetry2nix": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nix-github-actions": "nix-github-actions",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": "systems_3",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1715251496,
|
||||
"narHash": "sha256-vRBfJCKvJtu5sYev56XStirA3lAOPv0EkoEV2Nfc+tc=",
|
||||
"owner": "nix-community",
|
||||
"repo": "poetry2nix",
|
||||
"rev": "291a863e866972f356967d0a270b259f46bf987f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "poetry2nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"poetry2nix": "poetry2nix"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_2": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_3": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "systems",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"poetry2nix",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1714058656,
|
||||
"narHash": "sha256-Qv4RBm4LKuO4fNOfx9wl40W2rBbv5u5m+whxRYUMiaA=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "c6aaf729f34a36c445618580a9f95a48f5e4e03f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
127
flake.nix
127
flake.nix
|
@ -1,34 +1,103 @@
|
|||
{
|
||||
description = "Analysis code for the realization of the NHQW in fibre loops.";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
};
|
||||
|
||||
outputs = {nixpkgs, ...}: let
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in {
|
||||
devShells.${system}.default = pkgs.mkShell {
|
||||
packages = [
|
||||
pkgs.python3
|
||||
pkgs.poetry
|
||||
];
|
||||
|
||||
env = {
|
||||
# Workaround in linux: python downloads ELF's that can't find glibc
|
||||
# You would see errors like: error while loading shared libraries: name.so: cannot open shared object file: No such file or directory
|
||||
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
|
||||
pkgs.stdenv.cc.cc
|
||||
# Add any missing library needed
|
||||
# You can use the nix-index package to locate them, e.g. nix-locate -w --top-level --at-root /lib/libudev.so.1
|
||||
];
|
||||
|
||||
# Put the venv on the repo, so direnv can access it
|
||||
POETRY_VIRTUALENVS_IN_PROJECT = "true";
|
||||
POETRY_VIRTUALENVS_PATH = "{project-dir}/.venv";
|
||||
|
||||
# Use python from path, so you can use a different version to the one bundled with poetry
|
||||
POETRY_VIRTUALENVS_PREFER_ACTIVE_PYTHON = "true";
|
||||
};
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
|
||||
poetry2nix = {
|
||||
url = "github:nix-community/poetry2nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = inputs @ { self, nixpkgs, flake-utils, ... }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
poetry2nix = inputs.poetry2nix.lib.mkPoetry2Nix { inherit pkgs;};
|
||||
in
|
||||
{
|
||||
packages = {
|
||||
fibreMagic = poetry2nix.mkPoetryApplication {
|
||||
projectDir = self;
|
||||
preferWheels = true;
|
||||
|
||||
|
||||
overrides = poetry2nix.overrides.withDefaults (final: prev: {
|
||||
matplotlib = with pkgs; prev.matplotlib.overridePythonAttrs (
|
||||
old:
|
||||
let
|
||||
interactive = true;
|
||||
|
||||
passthru = {
|
||||
config = {
|
||||
directories = { basedirlist = "."; };
|
||||
libs = {
|
||||
system_freetype = true;
|
||||
system_qhull = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
inherit (pkgs) tk tcl wayland qhull;
|
||||
inherit (pkgs.xorg) libX11;
|
||||
in
|
||||
{
|
||||
XDG_RUNTIME_DIR = "/tmp";
|
||||
|
||||
buildInputs = old.buildInputs or [ ] ++ [
|
||||
pkgs.which
|
||||
];
|
||||
|
||||
propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [
|
||||
final.certifi
|
||||
pkgs.libpng
|
||||
pkgs.freetype
|
||||
qhull
|
||||
]
|
||||
++ [ pkgs.cairo pkgs.librsvg final.pycairo pkgs.gtk3 pkgs.gtk4 pkgs.gobject-introspection final.pygobject3 ] ;
|
||||
|
||||
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [
|
||||
pkg-config
|
||||
] ++ [
|
||||
final.setuptools-scm
|
||||
];
|
||||
|
||||
# Clang doesn't understand -fno-strict-overflow, and matplotlib builds with -Werror
|
||||
hardeningDisable = if stdenv.isDarwin then [ "strictoverflow" ] else [ ];
|
||||
|
||||
passthru = old.passthru or { } // passthru;
|
||||
|
||||
MPLSETUPCFG = pkgs.writeText "mplsetup.cfg" (lib.generators.toINI { } passthru.config);
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
});
|
||||
};
|
||||
default = self.packages.${system}.fibreMagic;
|
||||
};
|
||||
|
||||
# Shell for app dependencies.
|
||||
#
|
||||
# nix develop
|
||||
#
|
||||
# Use this shell for developing your app.
|
||||
devShells.default = pkgs.mkShell {
|
||||
inputsFrom = [ self.packages.${system}.fibreMagic ];
|
||||
package = with pkgs; [
|
||||
ruff pyright
|
||||
];
|
||||
};
|
||||
|
||||
# Shell for poetry.
|
||||
#
|
||||
# nix develop .#poetry
|
||||
#
|
||||
# Use this shell for changes to pyproject.toml and poetry.lock.
|
||||
devShells.poetry = pkgs.mkShell {
|
||||
packages = [ pkgs.poetry ];
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
1848
poetry.lock
generated
1848
poetry.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -13,8 +13,8 @@ matplotlib = "^3.8.4"
|
|||
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
ptpython = "^3.0.26"
|
||||
ipython = "^8.24.0"
|
||||
jupyter = "^1.0.0"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core"]
|
||||
|
|
Loading…
Add table
Reference in a new issue