2024-08-07 14:47:32 -04:00
|
|
|
inputs: rec {
|
|
|
|
# Import pkgs from a nixpkgs instance
|
2024-09-04 23:41:56 -04:00
|
|
|
mkPkgs = {
|
|
|
|
system,
|
|
|
|
nixpkgs,
|
|
|
|
cudaSupport ? false,
|
|
|
|
}:
|
2024-08-07 14:47:32 -04:00
|
|
|
import nixpkgs {
|
2024-05-20 22:41:45 -04:00
|
|
|
inherit system;
|
2024-09-04 23:41:56 -04:00
|
|
|
config = {
|
|
|
|
allowUnfree = true;
|
|
|
|
inherit cudaSupport;
|
|
|
|
};
|
2024-05-20 22:41:45 -04:00
|
|
|
};
|
|
|
|
|
2024-09-22 23:16:10 -04:00
|
|
|
allowModularOverrides = {
|
|
|
|
cudaSupport,
|
2024-09-04 23:41:56 -04:00
|
|
|
system,
|
2024-09-22 23:16:10 -04:00
|
|
|
}: ({config, ...}: let
|
|
|
|
pkgs = mkPkgs {
|
|
|
|
inherit system cudaSupport;
|
|
|
|
inherit (inputs) nixpkgs;
|
2024-05-20 22:41:45 -04:00
|
|
|
};
|
2024-09-22 23:16:10 -04:00
|
|
|
inherit (pkgs.lib) composeManyExtensions mkForce;
|
|
|
|
in {
|
|
|
|
_module.args.pkgs = mkForce (pkgs.extend (composeManyExtensions config.nixpkgs.overlays));
|
|
|
|
});
|
2024-05-20 22:41:45 -04:00
|
|
|
|
|
|
|
# Default system
|
2024-09-04 23:41:56 -04:00
|
|
|
mkNixOS = {
|
|
|
|
extraModules ? [],
|
|
|
|
cudaSupport ? false,
|
|
|
|
}:
|
2024-06-24 11:38:30 -04:00
|
|
|
inputs.nixpkgs.lib.nixosSystem rec {
|
2024-05-20 22:41:45 -04:00
|
|
|
system = "x86_64-linux";
|
2024-09-22 23:16:10 -04:00
|
|
|
specialArgs = inputs;
|
2024-05-20 22:41:45 -04:00
|
|
|
modules =
|
|
|
|
[
|
2024-09-22 23:16:10 -04:00
|
|
|
(allowModularOverrides {inherit system cudaSupport;})
|
2024-05-20 22:41:45 -04:00
|
|
|
{home-manager.extraSpecialArgs = specialArgs;}
|
2024-08-07 14:47:32 -04:00
|
|
|
../common
|
2024-05-20 22:41:45 -04:00
|
|
|
]
|
2024-09-04 23:41:56 -04:00
|
|
|
++ extraModules;
|
2024-05-20 22:41:45 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
mkNixOnDroid = mods:
|
2024-06-24 11:38:30 -04:00
|
|
|
inputs.nix-on-droid.lib.nixOnDroidConfiguration rec {
|
2024-09-22 23:16:10 -04:00
|
|
|
extraSpecialArgs = inputs;
|
2024-06-24 11:38:30 -04:00
|
|
|
home-manager-path = inputs.home-manager.outPath;
|
2024-09-22 23:16:10 -04:00
|
|
|
inherit (extraSpecialArgs) pkgs;
|
2024-05-20 22:41:45 -04:00
|
|
|
|
2024-09-22 23:16:10 -04:00
|
|
|
modules =
|
2024-05-20 22:41:45 -04:00
|
|
|
[
|
2024-09-22 23:16:10 -04:00
|
|
|
(allowModularOverrides {system = "aarch64-linux";})
|
|
|
|
|
|
|
|
({
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
inherit (lib) mkOption types;
|
|
|
|
in {
|
|
|
|
# Adapt NixOnDroid to NixOS options
|
|
|
|
options.environment.variables = {
|
|
|
|
FLAKE = mkOption {
|
2024-05-20 22:41:45 -04:00
|
|
|
type = with types; nullOr str;
|
|
|
|
};
|
2024-09-22 23:16:10 -04:00
|
|
|
systemPackages = mkOption {
|
2024-08-20 20:06:20 -04:00
|
|
|
type = with types; listOf package;
|
|
|
|
default = [];
|
|
|
|
};
|
2024-05-20 22:41:45 -04:00
|
|
|
};
|
2024-09-22 23:16:10 -04:00
|
|
|
|
2024-08-20 20:06:20 -04:00
|
|
|
config.environment.packages = config.environment.systemPackages;
|
|
|
|
})
|
2024-09-22 23:16:10 -04:00
|
|
|
|
2024-05-20 22:41:45 -04:00
|
|
|
{home-manager = {inherit extraSpecialArgs;};}
|
2024-09-22 23:16:10 -04:00
|
|
|
|
2024-08-07 14:47:32 -04:00
|
|
|
../common/nix-on-droid.nix
|
2024-05-20 22:41:45 -04:00
|
|
|
]
|
|
|
|
++ mods;
|
|
|
|
};
|
|
|
|
}
|