nix/lib/default.nix
2023-09-19 09:57:43 +09:00

70 lines
No EOL
2 KiB
Nix

{ inputs, outputs, stateVersion, hmStateVersion, ... }: {
# Helper function for generating home-manager configs
mkHome = {
hostname,
username ? "albert",
desktop ? null,
platform ? "x86_64-linux",
theme ? "default"
}: inputs.home-manager.lib.homeManagerConfiguration {
pkgs = inputs.nixpkgs.legacyPackages.${platform};
extraSpecialArgs = { inherit inputs outputs desktop hostname platform username hmStateVersion theme; };
modules = [
../home-manager
inputs.doom-emacs.hmModule
];
};
# Helper function for generating host configs
mkHost = {
hostname,
username ? "albert",
desktop ? null,
gpu ? null,
platform ? "x86_64-linux",
theme ? "default"
}: inputs.nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs desktop hostname username stateVersion gpu platform theme; };
modules = [
../nixos
inputs.sops-nix.nixosModules.sops
inputs.lanzaboote.nixosModules.lanzaboote
];
};
# Combines mkHost and mkHome for image building
mkImage = {
hostname ,
username ? "albert",
desktop ? null,
platform ? "x86_64-linux",
installer ,
gpu ? null,
theme ? "default"
}: inputs.nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs desktop hostname username stateVersion gpu platform theme; };
system = "$platform";
modules = [
../nixos
installer
inputs.sops-nix.nixosModules.sops
inputs.lanzaboote.nixosModules.lanzaboote
inputs.home-manager.nixosModules.home-manager {
extraSpecialArgs = { inherit inputs outputs desktop hostname platform username hmStateVersion theme; };
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
users.users."$username" = import ../home-manager;
imports = [
inputs.doom-emacs.hmModule
];
}
];
};
forAllSystems = inputs.nixpkgs.lib.genAttrs [
"aarch64-linux"
"x86_64-linux"
];
}