# flake-parts will export this wholesale as the flakes' `outputs`, with no per-system transposition. See `perSystem` below for this.
flake={
# Configurations for Linux (NixOS) machines
nixosConfigurations={};
# Configurations for macOS machines
darwinConfigurations={
# Personal M1 Max MBP
Bandersnatch=self.nixos-flake.lib.mkMacosSystem{
nixpkgs.hostPlatform="aarch64-darwin";
imports=[
self.nixosModules.common# See below for "nixosModules"!
self.nixosModules.darwin
# Your machine's configuration.nix goes here
({pkgs,...}:{
# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
system.stateVersion=4;
})
# Your home-manager configuration
self.darwinModules_.home-manager
{
home-manager.users.${myUsername}={
imports=[
self.homeModules.common# See below for "homeModules"!
self.homeModules.darwin
];
home.stateVersion="24.05";
};
}
];
};
};
# All nixos/nix-darwin configurations are kept here.
nixosModules={
# Common nixos/nix-darwin configuration shared between Linux and macOS.
common={pkgs,system,...}:
let
nvim=mkNvimsystem;
in
{
home-manager.backupFileExtension="bak-hm";
home-manager.useUserPackages=true;
# home-manager.verbose = true;
nixpkgs.config.allowUnfree=true;
environment.variables={
# EDITOR = "${nvim}/bin/nvim";
# VISUAL = "${nvim}/bin/nvim";
};
environment.systemPackages=withpkgs;[
git
bat
];
};
# NixOS specific configuration
linux={pkgs,...}:{
users.users.${myUsername}.isNormalUser=true;
};
# nix-darwin specific configuration
darwin={pkgs,...}:{
nix={
useDaemon=true;
## Control the version of Nix that nix-darwin uses. At time of writing, it defaults to 2.18.x, but latest is 2.23.3.
## Commented out because versions after 2.18.x are apparently pretty buggy
# package = pkgs.nixVersions.latest;
# Use Lix (a Nix-compatible lang -- https://lix.systems)
package=pkgs.lix;
settings={
trusted-users=["root"myUsername];
allowed-users=["root"myUsername"@nixbld"];
};
extraOptions=''
extra-nix-path="nixpkgs=flake:nixpkgs"
experimental-features=nix-commandflakes
'';
};
homebrew.enable=true;
# This needs to be here in addition to the home-manager configuration below in order to write /etc/zshenv to correctly configure ZSH. This is confusing, but...