SeaCogs/flake.nix

73 lines
2 KiB
Nix
Raw Permalink Normal View History

{
description = "SeaCogs Nix Flake";
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";
outputs =
{ self, nixpkgs }:
let
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forEachSupportedSystem =
f:
nixpkgs.lib.genAttrs supportedSystems (
system:
f {
pkgs = import nixpkgs { inherit system; };
2025-02-06 17:20:39 -06:00
lib = nixpkgs.lib;
}
);
in
{
devShells = forEachSupportedSystem (
2025-02-06 17:20:39 -06:00
{ pkgs, lib }:
let
myPython = pkgs.python311;
lib-path =
with pkgs;
lib.makeLibraryPath [
stdenv.cc.cc
# Red-DiscordBot dependencies
libffi
libsodium
# PyLav dependency
libaio
# Material for MkDocs dependency
cairo
];
in
{
default = pkgs.mkShell {
2025-02-06 17:20:39 -06:00
lib-path = lib-path;
packages = with pkgs; [
2025-02-06 17:20:39 -06:00
myPython
uv
2025-02-06 17:20:39 -06:00
ruff # the ruff pip package installs a dynamically linked binary that cannot run on NixOS
forgejo-runner
# Red-DiscordBot dependencies
git
jdk17
# Material for MkDocs dependencies
pngquant
# SeaCogs dependencies
dig
];
shellHook = # bash
''
2025-02-06 17:20:39 -06:00
export "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${lib-path}"
export "UV_PYTHON_PREFERENCE=only-system"
export "UV_PYTHON_DOWNLOADS=never"
uv sync --all-groups
source ./.venv/bin/activate
2025-02-06 17:20:39 -06:00
export "PYTHONPATH=`pwd`/.venv/${myPython.sitePackages}/:$PYTHONPATH"
export "PATH=${pkgs.ruff}/bin:$PATH"
'';
};
}
);
};
}