This commit is contained in:
Jan-Bulthuis committed 2025-02-09 01:11:07 +01:00
1 parent f1f4255d7d
commit e2abde8b28
8 files changed
+129 -26

No files matched your search

+20 -8
View File
@@ -1,8 +1,14 @@
{ nixpkgs, flake-utils, ... }:
{
nixpkgs,
flake-utils,
...
}:
let
imports = [
./shell.nix
./languages/python.nix
./utilities/cuda.nix
];
in
{
@@ -16,15 +22,21 @@ in
inherit system;
config.allowUnfree = true;
};
modules = [
attrs
] ++ imports;
evaluated = nixpkgs.lib.evalModules { inherit modules; };
evaluated =
(nixpkgs.lib.evalModules {
modules = [ attrs ] ++ imports;
specialArgs = {
pkgs = pkgs;
};
}).config;
recUpdate = nixpkgs.lib.recursiveUpdate;
shell = recUpdate {
env = evaluated.env;
packages = evaluated.packages ++ (evaluated.extraPackages pkgs);
} evaluated.override;
in
{
devShells.default = pkgs.mkShell {
TEST_ENV = builtins.trace evaluated.config "HELLO";
};
devShells.default = pkgs.mkShell shell;
}
));
}
+35
View File
@@ -0,0 +1,35 @@
{
pkgs,
lib,
config,
...
}:
with lib;
{
options.python = {
enable = mkEnableOption "Python";
packages = mkOption {
type = types.functionTo (types.listOf types.package) // {
merge =
loc: defs: p:
lib.concatMap (def: (def.value p)) defs;
};
default = p: [ ];
description = "Python packages to install";
};
# TODO: Add option to directly read from requirements.txt, maybe with mach-nix
};
config = mkIf config.python.enable {
packages =
with pkgs;
let
packages = config.python.packages;
pythonPackage = python3.withPackages packages;
in
[
pythonPackage
];
};
}
+17 -1
View File
@@ -5,7 +5,7 @@ with lib;
options = {
env = mkOption {
type = types.attrsOf types.str;
default = [ ];
default = { };
};
packages = mkOption {
@@ -13,5 +13,21 @@ with lib;
default = [ ];
description = "Packages to install";
};
extraPackages = mkOption {
type = types.functionTo (types.listOf types.package) // {
merge =
loc: defs: p:
lib.concatMap (def: (def.value p)) defs;
};
default = p: [ ];
description = "Extra packages to install";
};
override = mkOption {
type = types.attrs;
default = { };
description = "Settings in the mkShell call to override";
};
};
}
+17
View File
@@ -0,0 +1,17 @@
{
pkgs,
lib,
config,
...
}:
with lib;
{
options.cuda = {
enable = mkEnableOption "CUDA";
};
config = mkIf config.cuda.enable {
};
}