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

View File

@ -210,6 +210,24 @@
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_3": {
"inputs": {
"systems": [
"stylix",
@ -589,7 +607,7 @@
},
"nuschtosSearch": {
"inputs": {
"flake-utils": "flake-utils",
"flake-utils": "flake-utils_2",
"ixx": "ixx",
"nixpkgs": [
"nixvim",
@ -612,6 +630,7 @@
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"home-manager": "home-manager",
"nix-matlab": "nix-matlab",
"nixpkgs": "nixpkgs",
@ -628,12 +647,12 @@
"base16-vim": "base16-vim",
"firefox-gnome-theme": "firefox-gnome-theme",
"flake-compat": "flake-compat_3",
"flake-utils": "flake-utils_2",
"flake-utils": "flake-utils_3",
"git-hooks": "git-hooks_2",
"gnome-shell": "gnome-shell",
"home-manager": "home-manager_3",
"nixpkgs": "nixpkgs_3",
"systems": "systems_2",
"systems": "systems_3",
"tinted-foot": "tinted-foot",
"tinted-kitty": "tinted-kitty",
"tinted-tmux": "tinted-tmux",
@ -683,6 +702,21 @@
"type": "github"
}
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"tinted-foot": {
"flake": false,
"locked": {

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;
}
));
}

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
];
};
}

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";
};
};
}

View File

@ -0,0 +1,17 @@
{
pkgs,
lib,
config,
...
}:
with lib;
{
options.cuda = {
enable = mkEnableOption "CUDA";
};
config = mkIf config.cuda.enable {
};
}

View File

@ -4,6 +4,8 @@
imports = [
./ide/mathematica.nix
./ide/matlab.nix
# TODO: Move languages to make clear it is just IDE configuration
# Languages should be installed with devShells, however the IDE must be configured globally
./language/cpp.nix
./language/haskell.nix
./language/js.nix

View File

@ -8,7 +8,6 @@
with lib;
let
cfg = config.modules.python;
package = pkgs.python3.withPackages cfg.extraPythonPackages;
in
{
options.modules.python = {
@ -26,9 +25,7 @@ in
config = mkIf cfg.enable {
# Development packages
home.packages = [
package
];
home.packages = [ ];
# Allow unfree
modules.unfree.allowedPackages = [

View File

@ -109,16 +109,6 @@
tex.enable = true;
jupyter.enable = true;
# python.extraPythonPackages = p: [
# p.numpy
# p.scikit-learn
# p.scipy
# p.pandas
# p.matplotlib
# p.torch
# p.torchvision
# ];
# Enable unfree
unfree.enable = true;
};