mirror of
https://github.com/smg1024/nix-darwin.git
synced 2026-05-22 20:32:59 +09:00
Initial commit
This commit is contained in:
commit
6c503c465b
9 changed files with 493 additions and 0 deletions
56
flake.nix
Normal file
56
flake.nix
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
description = "Nix for macOS configuration";
|
||||
|
||||
##################################################################################################################
|
||||
#
|
||||
# Want to know Nix in details? Looking for a beginner-friendly tutorial?
|
||||
# Check out https://github.com/ryan4yin/nixos-and-flakes-book !
|
||||
#
|
||||
##################################################################################################################
|
||||
|
||||
# This is the standard format for flake.nix. `inputs` are the dependencies of the flake,
|
||||
# Each item in `inputs` will be passed as a parameter to the `outputs` function after being pulled and built.
|
||||
inputs = {
|
||||
nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
# nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-24.05-darwin";
|
||||
darwin = {
|
||||
url = "github:lnl7/nix-darwin";
|
||||
inputs.nixpkgs.follows = "nixpkgs-darwin";
|
||||
};
|
||||
};
|
||||
|
||||
# The `outputs` function will return all the build results of the flake.
|
||||
# A flake can have many use cases and different types of outputs,
|
||||
# parameters in `outputs` are defined in `inputs` and can be referenced by their names.
|
||||
# However, `self` is an exception, this special parameter points to the `outputs` itself (self-reference)
|
||||
# The `@` syntax here is used to alias the attribute set of the inputs's parameter, making it convenient to use inside the function.
|
||||
outputs = inputs @ {
|
||||
self,
|
||||
nixpkgs,
|
||||
darwin,
|
||||
...
|
||||
}: let
|
||||
# TODO replace with your own username, system and hostname
|
||||
username = "poby";
|
||||
system = "aarch64-darwin";
|
||||
hostname = "pobys-macbook-pro";
|
||||
|
||||
specialArgs =
|
||||
inputs
|
||||
// {
|
||||
inherit username hostname;
|
||||
};
|
||||
in {
|
||||
darwinConfigurations."${hostname}" = darwin.lib.darwinSystem {
|
||||
inherit system specialArgs;
|
||||
modules = [
|
||||
./modules/nix-core.nix
|
||||
./modules/system.nix
|
||||
./modules/apps.nix
|
||||
./modules/host-users.nix
|
||||
];
|
||||
};
|
||||
# nix code formatter
|
||||
formatter.${system} = nixpkgs.legacyPackages.${system}.alejandra;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue