gooberOS/make-system.nix
2024-10-21 23:09:12 +03:00

66 lines
1.4 KiB
Nix

{ nixpkgs }:
{
modules,
system ? builtins.currentSystem,
platform ? null,
crossSystem ? null,
}:
let
pkgs = import nixpkgs {
inherit system;
platform = platform;
config = { };
};
pkgsModule =
{ config, ... }:
{
_file = ./default.nix;
key = ./default.nix;
config = {
nixpkgs.pkgs = (
import nixpkgs {
inherit system crossSystem;
config = config.nixpkgs.config;
overlays = config.nixpkgs.overlays;
}
);
nixpkgs.localSystem =
{
inherit system;
}
// pkgs.lib.optionalAttrs (crossSystem != null) {
inherit crossSystem;
};
};
};
baseModules = [
./base.nix
./system-path.nix
./stage-1.nix
./stage-2.nix
./runit.nix
(nixpkgs + "/nixos/modules/system/etc/etc.nix")
(nixpkgs + "/nixos/modules/system/activation/activation-script.nix")
(nixpkgs + "/nixos/modules/misc/nixpkgs.nix")
(nixpkgs + "/nixos/modules/system/boot/kernel.nix")
(nixpkgs + "/nixos/modules/misc/assertions.nix")
(nixpkgs + "/nixos/modules/misc/lib.nix")
(nixpkgs + "/nixos/modules/config/sysctl.nix")
pkgsModule
];
other = {
_module.check = true;
_module.args = { };
};
in
pkgs.lib.evalModules {
prefix = [ ];
modules =
modules
++ baseModules
++ [
pkgsModule
other
];
}