initial commit
This commit is contained in:
97
flake.nix
Normal file
97
flake.nix
Normal file
@@ -0,0 +1,97 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager/release-25.11";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
nix-darwin = {
|
||||
url = "github:lnl7/nix-darwin/nix-darwin-25.11";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*";
|
||||
};
|
||||
|
||||
outputs = inputs @ {
|
||||
self,
|
||||
nixpkgs,
|
||||
home-manager,
|
||||
nix-darwin,
|
||||
flake-schemas,
|
||||
}: let
|
||||
# set username, hostname, email, and time zone (TZ identifier) here as variables
|
||||
userName = "username";
|
||||
userEmail = "user@user.me";
|
||||
hostName = "hostname";
|
||||
timeZone = "America/Detroit";
|
||||
|
||||
# needed if you are going to utilize home-manager
|
||||
extraSpecialArgs = {
|
||||
inherit userName hostName userEmail timeZone;
|
||||
};
|
||||
|
||||
# for any overlay packages that you need/build
|
||||
userOverlays = { ... }: {
|
||||
nixpkgs.overlays = [
|
||||
self.common.overlays # this is user defined but it's empty
|
||||
];
|
||||
};
|
||||
|
||||
# utilizes flake-schemas, allows modularization between platforms/systems
|
||||
# currently, you are not using the full potential of flake-schemas but i included it
|
||||
# in case you build upon this flake - add platforms to the list below (e.g. "x86_64-linux")
|
||||
supportedSystems = [ "aarch64-darwin" ];
|
||||
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
});
|
||||
in {
|
||||
schemas = flake-schemas.schemas;
|
||||
common = {
|
||||
overlays = import ./common/overlays;
|
||||
};
|
||||
|
||||
# a development shell where you can tailor each package to your liking
|
||||
devShell = forEachSupportedSystem ({ pkgs }: {
|
||||
default = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
deadnix
|
||||
nixd
|
||||
];
|
||||
};
|
||||
});
|
||||
|
||||
# system configuration utilizing home-manager
|
||||
darwinConfigurations.${hostName} =
|
||||
nix-darwin.lib.darwinSystem {
|
||||
system = "aarch64-darwin";
|
||||
specialArgs = {
|
||||
inherit userName hostName userEmail;
|
||||
hostname = hostName;
|
||||
};
|
||||
modules = [
|
||||
userOverlays
|
||||
./machine
|
||||
|
||||
home-manager.darwinModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.extraSpecialArgs = extraSpecialArgs;
|
||||
home-manager.backupFileExtension = "bak";
|
||||
home-manager.users.${userName} = import ./home;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# utilizing _just_ home-manager
|
||||
homeConfigurations.${hostName} =
|
||||
home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = forEachSupportedSystem;
|
||||
extraSpecialArgs = extraSpecialArgs;
|
||||
modules = [
|
||||
userOverlays
|
||||
./home
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user