Working on modularizing stuff, again

This commit is contained in:
Chris Kruining 2024-07-21 14:03:57 +02:00
parent b698ce3485
commit 9ba5f8fdf0
32 changed files with 1481 additions and 88 deletions

View file

@ -0,0 +1,16 @@
{ config, options, lib, pkgs, ... }:
let
inherit (lib.modules) mkIf;
in
{
options.modules.develop = let
inherit (lib.options) mkEnableOption;
in
{
xdg.enable = mkEnableOption "XDG-related conf" // { default = true; };
};
config = mkIf conf.modules.develop.xdg.enable {
};
}

36
modules/develop/rust.nix Normal file
View file

@ -0,0 +1,36 @@
{ config, options, lib, pkgs, ... }:
let
inherit (lib.attrsets) attrValues;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.meta) getExe;
in
{
options.modules.develop.rust = let
inherit (lib.options) mkEnableOption;
in {
enable = mkEnableOption "Rust developmnt";
};
config = mkMerge [
(mkIf config.modules.develop.rust.enable (
nixpkgs.overlays = [ inputs.rust.overlays.default ];
user.packages = attrValues {
rust-package = pkgs.rust-bin.nightly.latest.default;
inherit (pkgs) rust-analyser rust-script;
};
environment.shellAlliases = {
rs = "rustc";
ca = "cargo";
};
))
(mkIf config.modules.develop.cdg.enable {
env = {
CARGO_HOME = "$XDG_DATA_HOME/cargo";
PATH = [ "$CARGO_HOME/bin" ];
};
})
];
}