nix-configuration/flake.nix
2025-08-21 12:33:25 +02:00

134 lines
3.6 KiB
Nix

{
description = "nix system flake";
inputs = {
# Not manager by home manager, to update: nix flake lock --update-input <input>
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nix-darwin.url = "github:LnL7/nix-darwin";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
mac-app-util.url = "github:hraban/mac-app-util";
mac-app-util.inputs.nixpkgs.follows = "nixpkgs";
nixgl.url = "github:nix-community/nixGL";
nixgl.inputs.nixpkgs.follows = "nixpkgs";
plasma-manager.url = "github:nix-community/plasma-manager";
plasma-manager.inputs.nixpkgs.follows = "nixpkgs";
plasma-manager.inputs.home-manager.follows = "home-manager";
};
outputs =
inputs@{
self,
home-manager,
mac-app-util,
nix-darwin,
nixgl,
nixpkgs,
plasma-manager,
}:
let
systems = nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];
# Add overlay for custom packages
overlay = final: prev: {
hammerspoon = final.callPackage ./modules/hammerspoon.nix { };
};
in
{
lib = {
forAllSystems =
function:
systems (
system:
function (
import nixpkgs {
inherit system;
config.allowUnfreePredicate = (pkg: builtins.elem (nixpkgs.lib.getName pkg) [ "nvidia" ]);
}
)
);
};
formatter = self.lib.forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
homeConfigurations =
let
pkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [
nixgl.overlay
];
config = {
allowUnfree = true;
};
};
in
{
# init with
# nix run home-manager/master -- switch --flake ~/.config/nix
# update with
# home-manager switch --flake ~/.config/nix
"becky@dingleberry" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
inputs.plasma-manager.homeManagerModules.plasma-manager
./home-manager/common.nix
./home-manager/becky-dingleberry.nix
];
};
};
darwinConfigurations = {
# init with
# nix run nix-darwin -- switch --flake ~/.config/nix
# update with
# darwin-rebuild switch --flake ~/.config/nix
lcech-mac = nix-darwin.lib.darwinSystem {
system = "aarch64-darwin";
specialArgs = {
self = self;
inputs = inputs // {
darwin = inputs.nix-darwin;
};
};
modules = [
# Add our overlay to the system configuration
(
{ ... }:
{
nixpkgs.overlays = [ overlay ];
}
)
mac-app-util.darwinModules.default
./darwin/common.nix
./darwin/lcech-mac-veracode.nix
home-manager.darwinModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.lcech.imports = [
mac-app-util.homeManagerModules.default
./home-manager/common.nix
./home-manager/lcech-mac-veracode.nix
];
};
users.users.lcech.home = "/Users/lcech";
}
];
};
};
};
}