blob: 9cc504b2a8f46b58444405bc1079894922763684 (
plain) (
tree)
|
|
# This function creates a NixOS system based on our VM setup for a
# particular architecture.
{
nixpkgs,
inputs,
overlays,
}:
name:
{
system,
user,
darwin ? false,
}:
let
# The config files for this system.
machineConfig = ../machines/${name};
userOSConfig = ../users/${user}/${if darwin then "darwin" else "nixos"}.nix;
userHMConfig = ../users/${user}/home-manager.nix;
# NixOS vs nix-darwin functionst
systemFunc = if darwin then inputs.darwin.lib.darwinSystem else nixpkgs.lib.nixosSystem;
home-manager =
if darwin then inputs.home-manager.darwinModules else inputs.home-manager.nixosModules;
in
systemFunc rec {
inherit system;
modules = [
# Allow unfree packages.
{ nixpkgs.config.allowUnfree = true; }
# Add overlays
{ nixpkgs.overlays = overlays; }
machineConfig
userOSConfig
home-manager.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.${user} = import userHMConfig {
inputs = inputs;
darwin = darwin;
systemName = name;
};
}
# We expose some extra arguments so that our modules can parameterize
# better based on these values.
{
config._module.args = {
currentSystem = system;
currentSystemName = name;
currentSystemUser = user;
inputs = inputs;
};
}
];
}
|