feat(nix): move Nix configuration to root level

This commit is contained in:
Stefan Imhoff
2024-07-31 12:46:55 +02:00
parent ec67a98313
commit c5be8e73b6
224 changed files with 62 additions and 67 deletions

59
flake.nix Normal file
View File

@@ -0,0 +1,59 @@
{
description = "My Darwin and home-manager dotfiles";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
nix-darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
mac-app-util.url = "github:hraban/mac-app-util";
};
outputs = { self, nix-darwin, home-manager, nixpkgs, mac-app-util }:
let
mkDarwinConfig = { system, hostname, username }:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
in
nix-darwin.lib.darwinSystem {
inherit system;
specialArgs = { inherit pkgs; };
modules = [
./hosts/${hostname}/configuration.nix
mac-app-util.darwinModules.default
home-manager.darwinModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.verbose = true;
home-manager.users.${username} = {
imports = [
./hosts/${hostname}/home.nix
mac-app-util.homeManagerModules.default
];
};
home-manager.extraSpecialArgs = { inherit pkgs; };
}
];
};
in
{
# Build darwin flake using:
# $ darwin-rebuild switch --flake ~/.dotfiles/.#mac-mini
darwinConfigurations = {
"mac-mini" = mkDarwinConfig {
system = "aarch64-darwin";
hostname = "mac-mini";
username = "kogakure";
};
};
};
}