nix-configuration/flake.nix
2025-01-07 15:00:43 +01:00

110 lines
2.9 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";
};
outputs =
inputs@{
self,
home-manager,
mac-app-util,
nix-darwin,
nixgl,
nixpkgs,
}:
let
systems = nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];
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 = [
./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;
};
modules = [
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";
}
];
};
};
};
}