Skip to content

Commit

Permalink
remove flake-parts
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasmohrin committed Oct 12, 2024
1 parent 50facce commit 7c66ecd
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 69 deletions.
37 changes: 3 additions & 34 deletions flake.lock

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

80 changes: 45 additions & 35 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,23 @@
inputs.nixpkgs.follows = "nixpkgs";
};

flake-parts.url = "github:hercules-ci/flake-parts";
process-compose-flake.url = "github:Platonic-Systems/process-compose-flake";
services-flake.url = "github:juspay/services-flake";
};

outputs = { self, flake-parts, ... }@inputs:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.process-compose-flake.flakeModule
];
outputs = { self, nixpkgs, ... }@inputs:
let
lib = nixpkgs.lib;
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ];
perSystem = { self', inputs', pkgs, lib, system, ... }: {
devShells = rec {
forAllSystems = lib.genAttrs systems;
pkgsFor = lib.genAttrs systems (system: import nixpkgs { inherit system; });
in
{
devShells = forAllSystems (system:
let
pkgs = pkgsFor.${system};
in
rec {
evap = pkgs.callPackage ./nix/shell.nix {
python3 = pkgs.python310;
poetry2nix = inputs.poetry2nix.lib.mkPoetry2Nix { inherit pkgs; };
Expand All @@ -29,35 +33,41 @@
};
evap-dev = evap.override { poetry-groups = [ "dev" ]; };
default = evap-dev;
};
});

# Start with `nix run .#services`
process-compose =
let
make = only-databases: import ./nix/services.nix {
inherit pkgs only-databases;
inherit (inputs) services-flake;
inherit (self'.devShells.evap.passthru) poetry-env;
};
in
{
services = make true;
services-full = make false;
packages = forAllSystems (system:
let
pkgs = pkgsFor.${system};
make-process-compose = only-databases: (import inputs.process-compose-flake.lib { inherit pkgs; }).makeProcessCompose {
modules = [
inputs.services-flake.processComposeModules.default
(import
./nix/services.nix
{
inherit pkgs only-databases;
inherit (inputs) services-flake;
inherit (self.devShells.${system}.evap.passthru) poetry-env;
})
];
};
in
{
services = make-process-compose true;
services-full = make-process-compose false;

packages.wait-for-pc =
let
pc = lib.getExe self'.packages.services;
in
pkgs.writeShellApplication {
name = "wait-for-pc";
runtimeInputs = [ pkgs.jq ];
text = ''
while [ "$(${pc} process list -o json 2>/dev/null | jq '.[] |= .is_ready == "Ready" or .status == "Completed" or .status == "Disabled" | all')" != "true" ]; do
sleep 1
done
'';
};
};
wait-for-pc =
let
pc = lib.getExe self.packages.${system}.services;
in
pkgs.writeShellApplication {
name = "wait-for-pc";
runtimeInputs = [ pkgs.jq ];
text = ''
while [ "$(${pc} process list -o json 2>/dev/null | jq '.[] |= .is_ready == "Ready" or .status == "Completed" or .status == "Disabled" | all')" != "true" ]; do
sleep 1
done
'';
};
});
};
}

0 comments on commit 7c66ecd

Please sign in to comment.