1
0
Fork 0
forked from auxolotl/templates
auxolotl-templates/darwin/flake.nix
Samuel Shuert 3f3ac4306b
Initial work on creating sensible templates
Available templates include the following:
- system: flake based system similar to the default when starting
  nix.
- darwin: flake based darwin system with ajusted nixpkgs and modules to better suit it.
- home-manager: flake and home manager for non darwin systems.

Co-Authored-by: isabelroses <isabel@isabelroses.com>
Co-Authored-by: Skyler Grey <minion@clicks.codes>
Co-Authored-by: Sigmanificient <edhyjox@gmail.com>
Co-Authored-by: AxelSilverdew <7677954+AxelSilverdew@users.noreply.github.com>
2024-05-01 16:55:17 -04:00

80 lines
2.9 KiB
Nix

{
description = "A simple darwin flake using Aux and home-manager";
inputs = {
# nixpkgs is the input that we use for this flake the end section `nixpkgs-unstable` refers to the branch
# of nixpkgs that we want to use. This can be changed to any branch or commit hash.
nixpkgs.url = "github:auxolotl/nixpkgs/nixpkgs-unstable";
home-manager = {
url = "github:nix-community/home-manager";
# The `follows` keyword in inputs is used for inheritance.
# we do this in order to prevent duplication of the nixpkgs input, and potential
# issues with diffrent versions of given packages.
# However, it should be noted that this can lead to having to rebuild packages from source.
inputs.nixpkgs.follows = "nixpkgs";
};
darwin = {
url = "github:lnl7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
inputs@{
self,
nixpkgs,
darwin,
home-manager,
...
}:
# we can use the `let` and `in` syntax to define variables
# and use them in the rest of the expression
let
# this can be either aarch64-darwin or x86_64-darwin
# if your using a M1 or later your going to need to use aarch64-darwin
# otherwise you can use x86_64-darwin
system = builtins.abort "You need to fill in your system";
# here we define our username and hostname to reuse them later
username = builtins.abort "You need to fill in your username"; # Set this variable equal to your username
hostname = builtins.abort "You need to fill in your hostname"; # Set this variable equal to your hostname
# the specialArgs are used to pass the inputs to the system configuration and home-manager configuration
specialArgs = {
inherit inputs username hostname;
};
in
{
# here the hostname is being set to "reservoir" but you can change that to your needs
# it is important that you use darwin.lib.darwinSystem as this is the builder that allow
# for the configuration of the darwin system
darwinConfigurations.${hostname} = darwin.lib.darwinSystem {
# The specialArgs are used to pass the inputs to the system configuration
inherit specialArgs;
modules = [
./homebrew.nix
./users.nix
# The home-manager module is used to configure home-manager
# to read more about this please see ../home-manager
home-manager.darwinModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
# extraSpecialArgs is used to pass the inputs to the home-manager configuration
home-manager.extraSpecialArgs = specialArgs;
# Here we have assume that the use is called "axel" but you can change that to your needs
home-manager.users.${username} = import ./home.nix;
}
];
};
};
}