nixos/lib/mk_raspi.nix

53 lines
1.5 KiB
Nix
Raw Normal View History

2022-11-04 19:35:57 +01:00
{ custom, hostname, system ? "aarch64-linux", home-module ? "headless" }:
2022-09-07 11:50:25 +02:00
let
2022-09-07 17:42:36 +02:00
overlay-unstable = final: prev: {
2022-11-04 19:35:57 +01:00
unstable = import custom.inputs.nixpkgs-unstable {
2022-09-07 17:42:36 +02:00
inherit system;
config.allowUnfree = true;
};
};
2022-11-04 19:35:57 +01:00
pkgs = import custom.inputs.nixpkgs {
2022-09-07 11:50:25 +02:00
inherit system;
config = {
allowUnfree = true;
};
2022-09-07 17:42:36 +02:00
overlays = [
overlay-unstable
2022-11-05 19:08:12 +01:00
# The following is requried for building images {
# https://github.com/NixOS/nixpkgs/issues/126755#issuecomment-869149243
(final: super: {
makeModulesClosure = x:
super.makeModulesClosure (x // { allowMissing = true; });
})
# }
2022-09-07 17:42:36 +02:00
];
2022-09-07 11:50:25 +02:00
};
in
2022-11-04 19:35:57 +01:00
custom.inputs.nixpkgs.lib.nixosSystem {
2022-11-04 13:52:30 +01:00
inherit pkgs system;
2022-11-04 19:35:57 +01:00
specialArgs = { inherit custom; };
modules = (
[
# System configuration for this host
2022-11-04 19:35:57 +01:00
(import "${custom.inputs.self}/systems/${hostname}"
{ inherit custom hostname; })
# Common configuration
2022-11-04 19:35:57 +01:00
(import "${custom.inputs.self}/modules/common" { inherit custom; })
2022-11-04 19:35:57 +01:00
custom.inputs.agenix.nixosModules.age
{ environment.systemPackages = [ custom.inputs.agenix.defaultPackage.${system} ]; }
2022-11-04 19:35:57 +01:00
custom.inputs.home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.${custom.username}.imports = [
2022-11-04 19:35:57 +01:00
(import "${custom.inputs.self}/home-manager/${home-module}.nix" { inherit custom; })
];
}
]);
}