diff options
| author | seth <[email protected]> | 2024-01-26 05:43:47 -0500 |
|---|---|---|
| committer | seth <[email protected]> | 2024-01-26 05:43:47 -0500 |
| commit | 90c83b4694150bdcfe4fcac1c55fcfdef17c3612 (patch) | |
| tree | 74f3a8d9cac0b972fc7e50fdcf2403f60e39795e /README.md | |
initial commit
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..8d1fc45 --- /dev/null +++ b/README.md @@ -0,0 +1,102 @@ +# procfile-nix + +A library + [flake-parts](https://flake.parts/) module that helps you manage procfiles and background jobs with [overmind](https://github.com/DarthSim/overmind)! + +## Usage + +Regardless of if you use the library or flakeModule, you will be putting a package into your development shells. +Following this, the name you gave the Procfile will be avalible as a command while will setup all of your processes. + +Example: + +```shell +$ nix develop +$ myprocfile +``` + +You can also send the command to run in the background like so: `myprocfile &` + +## Usage (library) + +First, put this in your `flake.nix`: + +```nix +{ + inputs = { + nixpkgs.url = "nixpkgs/nixpkgs-unstable"; + procfile-nix = { + url = "github:getchoo/procfile-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { nixpkgs, procfile-nix, ... }: let + systems = [ "x86_64-linux" "aarch64-linux" ]; + + forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system}); + in { + devShells = forAllSystems ({ + lib, + pkgs, + system, + ... + }: let + procfile = procfile-nix.lib.${system}.mkProcfileRunner { + name = "daemons"; + procGroup = { + redis = lib.getExe' pkgs.redis "redis-server"; + }; + }; + in { + default = pkgs.mkShell { + packages = [ procfile ]; + }; + }); + }; +} +``` + +Then run `nix develop`, `daemons &`, and you're good to go! + +## Usage (flakeModule) + +```nix +{ + + inputs = { + nixpkgs.url = "nixpkgs/nixpkgs-unstable"; + flake-parts = { + url = "github:hercules-ci/flake-parts"; + inputs.nixpkgs-lib.follows = "nixpkgs"; + }; + procfile-nix = { + url = "github:getchoo/procfile-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = inputs: + inputs.flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ "x86_64-linux" "aarch64-linux" ]; + + imports = [ inputs.procfile-nix.flakeModule ]; + + perSystem = { + config, + lib, + pkgs, + ... + }: { + procfiles.daemons.processes = { + redis = lib.getExe' pkgs.redis "redis-server"; + }; + + devShells.default = pkgs.mkShell { + packages = [ config.procfiles.daemons.package ]; + }; + }; + }; +} +``` + +Similar to the last example, `nix develop` and `daemons &` may be run to start your Procfile |
