Code Monkey home page Code Monkey logo

dotbox's Introduction

DotBox ❤ Nix

Nix Flakes Ready Built With Snowfall Powered By DotBox

  

This Nix Flake provides the DotBox 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.

nix run github:snowfallorg/dotbox

Install dotbox

Nix Profile

You can install this package imperatively with the following command.

nix profile install github:snowfallorg/dotbox

Nix Configuration

You can install this package by adding it as an input to your Nix flake.

{
	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.

{ 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.

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.

{
	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:

mkImporter pkgs

Result:

{ import = file: { /* ... */ }; }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.