Skip to content

Commit

Permalink
yes working
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasmohrin committed Nov 25, 2024
1 parent 1046a97 commit db8105c
Show file tree
Hide file tree
Showing 6 changed files with 975 additions and 202 deletions.
164 changes: 61 additions & 103 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 29 additions & 26 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,20 @@

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
poetry2nix = {
url = "github:nix-community/poetry2nix";

pyproject-nix = {
url = "github:nix-community/pyproject.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
uv2nix = {
url = "github:adisbladis/uv2nix";
inputs.pyproject-nix.follows = "pyproject-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
pyproject-build-systems = {
url = "github:pyproject-nix/build-system-pkgs";
inputs.pyproject-nix.follows = "pyproject-nix";
inputs.uv2nix.follows = "uv2nix";
inputs.nixpkgs.follows = "nixpkgs";
};

Expand All @@ -23,18 +35,25 @@
devShells = forAllSystems (system:
let
pkgs = pkgsFor.${system};
extras = if pkgs.stdenv.isDarwin then [ "psycopg-c" ] else [ "psycopg-binary" ];
in
rec {
evap = pkgs.callPackage ./nix/shell.nix {
inherit (self.packages.${system}) python3;
poetry2nix = inputs.poetry2nix.lib.mkPoetry2Nix { inherit pkgs; };
pyproject = ./pyproject.toml;
poetrylock = ./poetry.lock;
inherit extras;
inherit (inputs) pyproject-nix uv2nix uv2nix_hammer_overrides pyproject-build-systems;
workspaceRoot = ./.;
};
evap-dev = evap.override { poetry-groups = [ "dev" ]; };
evap-dev = evap.override { dependency-groups = [ "dev" ]; };
default = evap-dev;

impure = pkgs.mkShell {
packages = [
pkgs.python310
pkgs.uv
];
shellHook = ''
unset PYTHONPATH
'';
};
});

packages = forAllSystems (system:
Expand All @@ -48,29 +67,13 @@
{
inherit pkgs only-databases;
inherit (inputs) services-flake;
inherit (self.devShells.${system}.evap.passthru) poetry-env;
inherit (self.devShells.${system}.evap.passthru) venv;
})
];
};
in
rec {
python3 = pkgs.python310.override {
self = python3;
packageOverrides = lib.composeManyExtensions [
(_finalPackages: prevPackages: lib.mapAttrs
(_name: package:
if lib.isDerivation package && lib.hasAttr "overridePythonAttrs" package
then package.overridePythonAttrs (_: { doCheck = false; })
else package)
prevPackages)
(finalPackages: prevPackages: {
jeepney = prevPackages.jeepney.overridePythonAttrs (prev: {
buildInputs = prev.buildInputs or [ ] ++ [ finalPackages.outcome finalPackages.trio ];
});
})
];
};
poetry = (pkgs.poetry.override { inherit python3; }).overridePythonAttrs { doCheck = false; };
python3 = pkgs.python310;

services = make-process-compose true;
services-full = make-process-compose false;
Expand Down
13 changes: 7 additions & 6 deletions nix/services.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{ pkgs, lib ? pkgs.lib, services-flake, only-databases, poetry-env }: {
{ pkgs, lib ? pkgs.lib, services-flake, only-databases, venv }: {
imports = [
services-flake.processComposeModules.default
];

httpServer = {
enable = true;
uds = "process-compose.socket";
};
cli.options.unix-socket = "process-compose.socket";
# httpServer = {
# enable = true;
# uds = "process-compose.socket";
# };

services = {
redis."r1" = {
Expand Down Expand Up @@ -58,7 +59,7 @@
settings.processes."init-django" = {
command = pkgs.writeShellApplication {
name = "init-django";
runtimeInputs = with pkgs; [ poetry-env git gnused gettext coreutils ];
runtimeInputs = with pkgs; [ venv git gnused gettext coreutils ];
text = ''
set -e
if [[ -f evap/localsettings.py ]]; then
Expand Down
Loading

0 comments on commit db8105c

Please sign in to comment.