Allow consuming jail.nix without flakes

This commit is contained in:
Alex David 2025-08-15 07:51:01 -07:00
commit c37ae887fd
3 changed files with 24 additions and 2 deletions

1
default.nix Normal file
View file

@ -0,0 +1 @@
_: import ./lib

View file

@ -7,6 +7,11 @@ in {
(jail "hello" pkgs.hello [])
"Hello, world!";
"can be imported using callPackage" = let
jail-nix-without-flake = pkgs.callPackage ../. {};
jail-without-flake = jail-nix-without-flake.init pkgs;
in assertStdout (jail-without-flake "hello" pkgs.hello []) "Hello, world!";
"it allows overriding base permissions shared across all jails" = let
jail' = jail-nix.lib.extend {
inherit pkgs;

View file

@ -2,8 +2,9 @@
## Installation
It is currently recommended to install jail.nix as a flake input to your
configuration:
### Flakes
To install jail.nix using flakes, add jail.nix to your flake inputs:
```nix
# flake.nix
@ -16,6 +17,21 @@ configuration:
}
```
### callPackage
To install jail.nix using a different dependency manager like
[niv](https://github.com/nmattia/niv), you can use `pkgs.callPackage`:
```nix
let
sources = import ./nix/sources.nix;
pkgs = import sources.nixpkgs {};
jail-nix = pkgs.callPackage sources."jail.nix" {};
jail = jail-nix.init pkgs;
in
# ...
```
---
## Initializing