Modularized + enabled darwin things

This commit is contained in:
Ariel Sosnovsky committed 2024-05-16 13:50:53 -04:00
1 parent b040991a96
commit 274e6d475b
4 files changed
+93 -45

No files matched your search

+46
View File
@@ -0,0 +1,46 @@
{
description = "Main Flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, home-manager, nix-darwin, nixpkgs }: {
lib = {
makeImports = { ... }@attrs: [ (import ./main.nix attrs) ];
makeNixOsModule = { system, configuration ? null, ... }@attrs:
nixpkgs.lib.nixosSystem {
system = system;
modules = (self.lib.makeImports attrs)
++ (if attrs.home-manager.enable then
[ home-manager.nixosModules.default ]
else
[ ])
++ (if (isNull configuration) then [ configuration ] else [ ]);
};
makeDarwinModule =
{ system ? "x86_64-darwin", user, configuration ? null, ... }@attrs:
nix-darwin.lib.darwinSystem {
modules = (self.lib.makeImports attrs)
++ (if attrs.home-manager.enable then [
home-manager.darwinModules.home-manager
(import ./macos-home-manager.nix { user = user; })
] else
[ ])
++ (if (isNull configuration) then [ configuration ] else [ ]) ++ [
(import ./macos.nix {
user = user;
system = system;
})
];
darwinPackages = self.darwinConfigurations."default".pkgs;
};
};
};
}
+10
View File
@@ -0,0 +1,10 @@
{ user }:
{ ... }: {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.${user.name} = {
home = {
sessionVariables = { "DOCKER_DEFAULT_PLATFORM" = "linux/amd64"; };
};
};
}
+7
View File
@@ -0,0 +1,7 @@
{ user, system }:
{ pkgs, ... }: {
services.nix-daemon.enable = true;
security.pam.enableSudoTouchIdAuth = true;
users.users.${user.name}.home = user.homepath;
nixpkgs.hostPlatform = system;
}