https://github.com/snowfallorg/dotbox
Integrate DotBox with Nix
https://github.com/snowfallorg/dotbox
Last synced: 11 months ago
JSON representation
Integrate DotBox with Nix
- Host: GitHub
- URL: https://github.com/snowfallorg/dotbox
- Owner: snowfallorg
- License: other
- Created: 2022-10-03T10:42:43.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-05-25T22:17:54.000Z (about 2 years ago)
- Last Synced: 2025-03-29T12:11:10.388Z (over 1 year ago)
- Language: Nix
- Size: 29.3 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DotBox ❤ Nix
This Nix Flake provides the [DotBox](https://dotbox.dev) command line package
as well as a development shell and Nix library which allows you to import DotBox
files into Nix.
## Try Without Installing
You can try DotBox out without committing to installing it on your system by running
the following command.
```bash
nix run github:snowfallorg/dotbox
```
## Install `dotbox`
### Nix Profile
You can install this package imperatively with the following command.
```bash
nix profile install github:snowfallorg/dotbox
```
### Nix Configuration
You can install this package by adding it as an input to your Nix flake.
```nix
{
description = "My system flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05";
# Snowfall Lib is not required, but will make configuration easier for you.
snowfall-lib = {
url = "github:snowfallorg/lib";
inputs.nixpkgs.follows = "nixpkgs";
};
dotbox = {
url = "github:snowfallorg/dotbox";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs:
inputs.snowfall-lib.mkFlake {
inherit inputs;
src = ./.;
overlays = with inputs; [
# Use the overlay provided by this flake.
dotbox.overlay
# There is also a named overlay, though the output is the same.
dotbox.overlays."nixpkgs/snowfallorg"
];
};
}
```
If you've added the overlay from this flake, then in your system configuration
you can add the `snowfallorg.dotbox` package.
```nix
{ pkgs }:
{
environment.systemPackages = with pkgs; [
snowfallorg.dotbox
];
}
```
## Dev Shell
If you want access to DotBox temporarily, you can enter a development shell
available with this flake.
```bash
nix develop github:snowfallorg/dotbox
```
## Library
This flake provides a helper library for integrating DotBox with Nix. See the
following example for information on using this flake's library.
```nix
{
description = "My flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05";
dotbox = {
url = "github:snowfallorg/dotbox";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, dotbox }:
let
# We require a NixPkgs instance in order to build DotBox files.
pkgs = nixpkgs.legacyPackages.x86_64-linux;
# Access helpers like `mkImporter` from `dotbox.lib`.
importer = dotbox.lib.mkImporter pkgs;
# Integrate your DotBox files with Nix!
my-config = importer.import ./my.box;
some-value = my-config.user.name.first;
in
{};
}
```
### `dotbox.lib.mkImporter`
Construct a DotBox importer.
Type: `Attrs -> Attrs`
Usage:
```nix
mkImporter pkgs
```
Result:
```nix
{ import = file: { /* ... */ }; }
```