basic coding config
This commit is contained in:
@ -1,10 +1,13 @@
|
||||
{
|
||||
lib,
|
||||
outputs,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
}:
|
||||
{
|
||||
nixpkgs = {
|
||||
overlays = [
|
||||
outputs.overlays.stable-packages
|
||||
];
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
@ -15,7 +18,10 @@
|
||||
nix = {
|
||||
package = lib.mkDefault pkgs.nix;
|
||||
settings = {
|
||||
experimental-features = ["nix-command" "flakes"];
|
||||
experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
warn-dirty = false;
|
||||
};
|
||||
};
|
||||
|
93
modules/coding/default.nix
Normal file
93
modules/coding/default.nix
Normal file
@ -0,0 +1,93 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
goCfg = config.features.coding.go;
|
||||
nixCfg = config.features.coding.nix;
|
||||
pythonCfg = config.features.coding.python;
|
||||
in
|
||||
{
|
||||
options.features.coding = {
|
||||
go = {
|
||||
enable = mkEnableOption "enable Go development environment";
|
||||
packageSet = mkOption {
|
||||
type = types.str;
|
||||
default = "default";
|
||||
description = "Which nixpkgs variant to use for Golang";
|
||||
};
|
||||
additionalPackages = mkOption {
|
||||
type = types.listOf types.str;
|
||||
example = [
|
||||
delve
|
||||
go-outline
|
||||
];
|
||||
};
|
||||
|
||||
};
|
||||
python = {
|
||||
enable = mkEnableOption "enable Python development environment";
|
||||
additionalPackages = mkOption {
|
||||
type = types.listOf types.str;
|
||||
example = [
|
||||
"requests"
|
||||
"pandas"
|
||||
];
|
||||
};
|
||||
};
|
||||
nix = {
|
||||
enable = mkEnableOption "enable Nix development environment";
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
selectPkgs = packageSet: if packageSet == "default" then pkgs else pkgs.${packageSet};
|
||||
in
|
||||
mkMerge [
|
||||
(mkIf goCfg.enable (
|
||||
let
|
||||
goPkgs = selectPkgs goCfg.packageSet;
|
||||
in
|
||||
{
|
||||
home.packages =
|
||||
with goPkgs;
|
||||
[
|
||||
go
|
||||
gopls
|
||||
]
|
||||
++ (map (name: goPkgs.${name}) goCfg.additionalPackages);
|
||||
}
|
||||
))
|
||||
(mkIf pythonCfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
(python3.withPackages (
|
||||
ps:
|
||||
with ps;
|
||||
[
|
||||
uv
|
||||
pip
|
||||
pipx
|
||||
virtualenv
|
||||
]
|
||||
++ (map (name: ps.${name}) pythonCfg.additionalPackages)
|
||||
))
|
||||
pyrefly
|
||||
black
|
||||
];
|
||||
})
|
||||
(mkIf nixCfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
alejandra
|
||||
nil
|
||||
nixd
|
||||
statix
|
||||
deadnix
|
||||
nix-tree
|
||||
];
|
||||
})
|
||||
];
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
{...}: {
|
||||
imports = [
|
||||
./cli
|
||||
./coding
|
||||
./base.nix
|
||||
];
|
||||
}
|
||||
|
Reference in New Issue
Block a user