Skip to content

Deduplicate systems #36

@alecandido

Description

@alecandido

Even if there is little code in there, it is already duplicated. Cf. mkNixos and mkDarwin

mkNixos = name: (let
config = import "${path}/home";
user = config.user;
path = ./. + ("/" + name);
homeMods = lib.homeMods {
inherit inputs;
homeRoot = "${self}/home";
config = config // {home = "/home/${user}";};
};
in
nixpkgs.lib.nixosSystem {
modules = [
{
networking.hostName = name;
nix.settings.trusted-users = [user];
}
"${self}/etc/nixos"
path
home-manager.nixosModules.home-manager
homeMods
lib.commonMods
inputs.agenix.nixosModules.default
];
# Give `inputs` access to all nix-darwin modules
specialArgs = {inherit inputs;};
system = "x86_64-linux";
});

mkDarwin = name: (let
config = import "${path}/home";
user = config.user;
path = ./. + ("/" + name);
homeMods = lib.homeMods {
inherit inputs;
homeRoot = "${self}/home";
config = config // {home = "/Users/${user}";};
};
in
darwin.lib.darwinSystem {
modules = [
{
networking.hostName = name;
nix.settings.trusted-users = [user];
}
"${self}/etc/darwin"
path
home-manager.darwinModules.home-manager
homeMods
inputs.agenix.darwinModules.default
lib.commonMods
{nixpkgs.overlays = [inputs.nixpkgs-firefox-darwin.overlay];}
];
# Give `inputs` access to all nix-darwin modules
specialArgs = {inherit inputs;};
system = "aarch64-darwin";
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactorImprove the configuration code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions