Skip to content

cmacrae/flakelight-darwin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flakelight-darwin

A nix-darwin module for flakelight.

About

Provides integration for darwinConfigurations & darwinModules into your flakelight config, like so:

{
  inputs = {
    flakelight.url = "github:nix-community/flakelight";
    flakelight-darwin.url = "github:cmacrae/flakelight-darwin";
  };
  outputs = { flakelight, flakelight-darwin, ... }: flakelight ./. {
    imports = [ flakelight-darwin.flakelightModules.default ];
    darwinConfigurations.example = {
      system = "aarch64-darwin";
      modules = [{ system.stateVersion = 4; }];
    };
  };
}

This mimics the expression of nixosConfigurations & nixosModules found in flakelight. Thus it benefits from the same directory and module(s) conventions, such that:

  • you can track your darwinConfigurations & darwinModules in directories, named darwin & darwinModules
  • singular modules expressed directly (darwinModule = { ... }) yield the default attribute
  • module declarations can point to paths

For further guidance, consult flakelight's excellent API guide and note the documentation on nixosConfigurations & nixosModules, wherein you can substitute darwinConfigurations & darwinModules

Getting Started

There are two example templates provided

Provides a minimal example Darwin system declaration, directly in flake.nix.

Instantiate your own with:

nix flake init -t github:cmacrae/flakelight-darwin

Provides an example configuration comprised of multiple Darwin system declarations, importing an example module, represented in a directory structure:

.
├── flake.nix
└── nix
    ├── darwin
    │   ├── host1
    │   │   ├── configuration.nix
    │   │   └── default.nix
    │   └── host2
    │       ├── configuration.nix
    │       └── default.nix
    └── darwinModules
        └── example.nix

Instantiate your own with:

nix flake init -t github:cmacrae/flakelight-darwin#autoload