Kapack #
Kapack contains Nix package definitions of the software we work on at the DataMove team: OAR, Batsim ecosystem, Melissa, etc.
Interactive usage #
You can enter shells that contain some of our packages with nix run.
nix shell github:stepbrobd/kapack#{batexpe,batsched,batsim,pybatsim}
Usage from Nix expressions #
You can write Nix expression to define environments that use our packages.
{
inputs.kapack.url = "github:stepbrobd/kapack";
outputs = inputs:
let
inherit (inputs.kapack.inputs) nixpkgs;
inherit (nixpkgs) lib;
in
{
devShells = lib.genAttrs lib.systems.flakeExposed (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
default = pkgs.mkShell {
packages = [
batexpe
batsched
batsim
pybatsim
];
};
}
);
};
}
If you want to pin the Kapack version you use, you can do one of the following:
- Pin to a specific commit:
inputs.kapack.url = "github:stepbrobd/kapack/019d3bebf1e090c8d9ad1bd0cc3ad03ee8b4335d"; - Pint to a named branch:
inputs.kapack.url = "github:stepbrobd/kapack/25.05";
Adding new packages and modules #
Kapack uses flake-parts to split Nix Flake definitions into more manageable flake modules, and are automatically loaded after checking into VCS.
The general evaluation order for everything inside Kapack:
autopilotkicks in and instantiates its own helper functions- Load helper functions in
lib - Load flake modules under
modules/flake - Definitions in
modules/flake- Loads
pkgsbased on directory structure and expose them to flake outputpackages.${system}.<name> - Loads
modules/nixosbased on directory structure and expose them to flake outputnixosModules.<name>
- Loads
For example:
- modules/nixos
- batsky.nix
- oar/default.nix
- pkgs
- batsim/default.nix
- batsim-master.nix
Would expose
- nixosModules.batsky
- nixosModules.oar
- pkgs.batsim
- pkgs.batsim-master
Packages defined in pkgs are automatically added to the callPackage
argument, thus internal dependencies would work right out of the box.
New packages can be added by
- creating a directory under
pkgswith a file nameddefault.nixwhere its content would be evaluated as a derivation, or an attribute set for sub-namespaces - creating a file (discouraged) under
pkgsAnd check the files into VCS.
The same principle also applies to NixOS modules.