starting poking at dev environments

This commit is contained in:
2025-09-03 10:40:07 -06:00
parent 523609ea95
commit 498f863066
3 changed files with 131 additions and 1 deletions

115
system/extras/pydev.nix Normal file
View File

@@ -0,0 +1,115 @@
{
description = "Python UV dev environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
pyproject-nix = {
url = "github:pyproject-nix/pyproject.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
uv2nix = {
url = "github:pyproject-nix/uv2nix";
inputs.pyproject-nix.folows = "pyproject-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
pyproject-build-systems = {
url = "github:pyproject-nix/build-system-pkgs";
inputs.pyproject-nex.follows = "pyproject-nix";
inputs.uv2nix.follow = "uv2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
uv2nix,
pyproject-nix,
pyproject-build-systems,
...
}:
let
inherit (nixpkgs) lib;
workspace = uv2nix.lib.workspace.loadWorkspace {workspaceRoot = ./.;};
overlay = workspace.mkPyProjectOverlay{
sorcePreference = "wheel";
};
pyprojectOverrides = _final: _prev: {};
pkgs = nixpkgs.legacyPackages.x86-64-linux;
python = pkgs.python314;
pythonSet =
(pkgs.callPackage pyproject-nix.build.packages{
inherit python;
}).overrideScope
(
lib.composeManyExtensions [
pyproject-build-systems.overlays.default
overlay
pyprojectOverrides
]
);
in
{
packages.x86_64-linux.default = pythonSet.mkVirtualEnv "autumnism" workspace.deps.default;
apps.x86_64-linux = {
default = {
type ="app";
program = "${self.packages.x86_64-linux.default}/bin/hello";
};
};
devShells.x86_64-linux = {
uv2nix =
let
editableOverlay = workspace.mkEditablePyprojectOverlay {
root = "$REPO_ROOT";
}
editablePythonSet = pythonSet.overrideScope (
lib.composeManyExtensions [
editableOverlay
(final: prev: {
autumnism = prev.autumnism.overrideAttrs (old: {
src = lib.fileset.toSource {
root = old.src;
fileset = lib.fileset.unions [
(old.src + "pyproject.toml")
(old.src + "/README.md")
(old.src + "/src/autumnism")
];
};
nativeBuildInputs =
old.nativeBuildInputs
++ final.resolveBuildSystem {
editables = [ ];
};
});
})
]
);
virtualenv = editablePythonSet.mkVirtualEnv "autumnism-dev-env" workspace.deps.all;
in
pkgs.mkShell {
packages = [
virtualenv
pkgs.uv
];
env = {
UV_NO_SYNC = "1";
UV_PYTHON = python.interpreter;
UV_PYTHON_DOWNLOADS = "never";
};
shellHook = ''
unset PYTHONPATH
export REPO_ROOT=$(git rev-parse --show-toplevel)
'';
};
};
};
}

View File

@@ -71,7 +71,21 @@
vim
pavucontrol
nh
docker
docker-compose
podman
skopeo
buildkit
];
virtualisation.containers.policy = {
default = [{type = "insecureAcceptAnything";}];
transports = {
docker-daemon = {
"" = [{type = "insecureAcceptAnything";}];
};
};
};
nix.settings.experimental-features = ["nix-command" "flakes"];
nix.settings.download-buffer-size = 5242880000;
@@ -93,5 +107,6 @@
system.autoUpgrade.enable = true;
system.autoUpgrade.allowReboot = true;
system.autoUpgrade.flake = "../../flake.nix";
qt.platformTheme = "kde6";
}