Added devenv and moved config files
This commit is contained in:
@@ -18,7 +18,6 @@
|
|||||||
(setq doom-unicode-font (font-spec :family "Iosevka Nerd Font" :size 15))
|
(setq doom-unicode-font (font-spec :family "Iosevka Nerd Font" :size 15))
|
||||||
|
|
||||||
;; Themeing
|
;; Themeing
|
||||||
;; (load! "themes/base16-samfelag.el")
|
|
||||||
(use-package base16-theme
|
(use-package base16-theme
|
||||||
:init (add-to-list 'custom-theme-load-path "~/.config/doom/themes")
|
:init (add-to-list 'custom-theme-load-path "~/.config/doom/themes")
|
||||||
:ensure t
|
:ensure t
|
||||||
|
|||||||
@@ -153,7 +153,9 @@
|
|||||||
php ; perl's insecure younger brother
|
php ; perl's insecure younger brother
|
||||||
;;plantuml ; diagrams for confusing people more
|
;;plantuml ; diagrams for confusing people more
|
||||||
;;purescript ; javascript, but functional
|
;;purescript ; javascript, but functional
|
||||||
python ; beautiful is better than ugly
|
(python
|
||||||
|
+lsp
|
||||||
|
+pyright) ; beautiful is better than ugly
|
||||||
;;qt ; the 'cutest' gui framework ever
|
;;qt ; the 'cutest' gui framework ever
|
||||||
;;racket ; a DSL for DSLs
|
;;racket ; a DSL for DSLs
|
||||||
;;raku ; the artist formerly known as perl6
|
;;raku ; the artist formerly known as perl6
|
||||||
|
|||||||
@@ -50,7 +50,6 @@
|
|||||||
;(unpin! t)
|
;(unpin! t)
|
||||||
|
|
||||||
(package! base16-theme)
|
(package! base16-theme)
|
||||||
|
|
||||||
(package! parinfer)
|
(package! parinfer)
|
||||||
|
|
||||||
;; Editor
|
;; Editor
|
||||||
|
|||||||
88
data/devenv/devenv.sh
Normal file
88
data/devenv/devenv.sh
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
SANDBOXES_DIR=$HOME/sandbox
|
||||||
|
TEMPLATES_DIR=$XDG_DATA_HOME/devenv/templates
|
||||||
|
|
||||||
|
list_templates() {
|
||||||
|
echo "The available templates are:"
|
||||||
|
ls $TEMPLATES_DIR
|
||||||
|
}
|
||||||
|
|
||||||
|
check_template () {
|
||||||
|
TEMPLATE=$1
|
||||||
|
if [ -z "$TEMPLATE" ]; then
|
||||||
|
echo "No template given"
|
||||||
|
list_templates
|
||||||
|
exit 1
|
||||||
|
elif [ ! -e "$TEMPLATES_DIR/$TEMPLATE" ]; then
|
||||||
|
echo "The given template '$TEMPLATE' doesn't exist!"
|
||||||
|
list_templates
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
devenv_install() {
|
||||||
|
install -m 644 $TEMPLATES_DIR/$TEMPLATE/* ./
|
||||||
|
echo "use flake . --impure" > .envrc
|
||||||
|
direnv allow
|
||||||
|
}
|
||||||
|
|
||||||
|
devenv_init() {
|
||||||
|
TEMPLATE=$1
|
||||||
|
check_template $TEMPLATE
|
||||||
|
devenv_install
|
||||||
|
}
|
||||||
|
|
||||||
|
devenv_sandbox() {
|
||||||
|
DIRECTORY=$1
|
||||||
|
if [ -z "$DIRECTORY" ]; then
|
||||||
|
show_help_sandbox
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
SANDBOX_DIR="$SANDBOXES_DIR/$DIRECTORY"
|
||||||
|
TEMPLATE=$2
|
||||||
|
if [ -z "$TEMPLATE" ]; then
|
||||||
|
TEMPLATE=$DIRECTORY
|
||||||
|
fi
|
||||||
|
check_template $TEMPLATE
|
||||||
|
if [ ! -e $SANDBOX_DIR ]; then
|
||||||
|
echo "Creating sandbox at $SANDBOX_DIR with template $TEMPLATE"
|
||||||
|
mkdir -p $SANDBOX_DIR
|
||||||
|
cd $SANDBOX_DIR
|
||||||
|
devenv_init $TEMPLATE
|
||||||
|
else
|
||||||
|
cd $SANDBOX_DIR
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
show_help_sandbox() {
|
||||||
|
echo "Usage: devenv sandbox <directory> [<template>]"
|
||||||
|
echo ""
|
||||||
|
echo " directory: The sandbox directory to go to."
|
||||||
|
echo " template: If the directory doesn't exist, the template to use for that sandbox"
|
||||||
|
echo " Defaults to directory if not given."
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
show_help() {
|
||||||
|
echo "Usage: devenv <action>"
|
||||||
|
echo "Available actions:"
|
||||||
|
echo ""
|
||||||
|
echo " init: Initialize a dev env in the current directory"
|
||||||
|
echo " sandbox: Go to a sandbox directory using a template"
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
init)
|
||||||
|
shift
|
||||||
|
devenv_init $@
|
||||||
|
;;
|
||||||
|
sandbox)
|
||||||
|
shift
|
||||||
|
devenv_sandbox $@
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
show_help
|
||||||
|
;;
|
||||||
|
esac
|
||||||
27
data/devenv/templates/python/flake.nix
Normal file
27
data/devenv/templates/python/flake.nix
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
description = "Development flake for this python project";
|
||||||
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, flake-utils }:
|
||||||
|
flake-utils.lib.eachDefaultSystem (system: let
|
||||||
|
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
|
||||||
|
projectDependencies = with pkgs; [
|
||||||
|
];
|
||||||
|
|
||||||
|
in {
|
||||||
|
devShells.default = pkgs.mkShell {
|
||||||
|
nativeBuildInputs = [ pkgs.bashInteractive ];
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
# Core python dependencies
|
||||||
|
python39
|
||||||
|
python39Packages.pip
|
||||||
|
python39Packages.virtualenv
|
||||||
|
# Development tools
|
||||||
|
python39Packages.ipython
|
||||||
|
] ++ projectDependencies;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
32
data/devenv/templates/rust/flake.nix
Normal file
32
data/devenv/templates/rust/flake.nix
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
description = "Development flake for this rust project";
|
||||||
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, flake-utils }:
|
||||||
|
flake-utils.lib.eachDefaultSystem (system: let
|
||||||
|
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
|
||||||
|
projectDependencies = with pkgs; [
|
||||||
|
];
|
||||||
|
|
||||||
|
in {
|
||||||
|
devShells.default = pkgs.mkShell {
|
||||||
|
nativeBuildInputs = [ pkgs.bashInteractive ];
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
# Core rust dependencies
|
||||||
|
rustc
|
||||||
|
cargo
|
||||||
|
# Development tools
|
||||||
|
rustfmt
|
||||||
|
rust-analyzer
|
||||||
|
clippy
|
||||||
|
] ++ projectDependencies;
|
||||||
|
|
||||||
|
LD_LIBRARY_PATH = nixpkgs.lib.makeLibraryPath projectDependencies;
|
||||||
|
|
||||||
|
RUST_BACKTRACE = 1;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -54,7 +54,7 @@ in
|
|||||||
|
|
||||||
dev.git.userName = "marc";
|
dev.git.userName = "marc";
|
||||||
dev.git.userEmail = "marc@sastre.cat";
|
dev.git.userEmail = "marc@sastre.cat";
|
||||||
dev.direnv.enable = true;
|
dev.devenv.enable = true;
|
||||||
|
|
||||||
# - Other apps -------------------------------
|
# - Other apps -------------------------------
|
||||||
app.spotify.enable = true;
|
app.spotify.enable = true;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ in
|
|||||||
(nerdfonts.override { fonts = [ "Iosevka" ]; })
|
(nerdfonts.override { fonts = [ "Iosevka" ]; })
|
||||||
];
|
];
|
||||||
|
|
||||||
hm.xdg.configFile."alacritty/alacritty.yml".source = ../../config/.config/alacritty/alacritty.yml;
|
hm.xdg.configFile."alacritty/alacritty.yml".source = ../../config/alacritty/alacritty.yml;
|
||||||
|
|
||||||
# - Themeing ---------------------------------
|
# - Themeing ---------------------------------
|
||||||
hm.xdg.configFile."alacritty/theme.yml".text = ''
|
hm.xdg.configFile."alacritty/theme.yml".text = ''
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ let
|
|||||||
'';
|
'';
|
||||||
# Paths
|
# Paths
|
||||||
paths = {
|
paths = {
|
||||||
config = ../../config/.config/polybar/config.ini;
|
config = ../../config/polybar/config.ini;
|
||||||
bars = ../../config/.config/polybar/bars;
|
bars = ../../config/polybar/bars;
|
||||||
scripts = ../../config/.config/polybar/scripts;
|
scripts = ../../config/polybar/scripts;
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ in
|
|||||||
rofi
|
rofi
|
||||||
];
|
];
|
||||||
|
|
||||||
hm.xdg.configFile."rofi/menus".source = ../../config/.config/rofi/menus;
|
hm.xdg.configFile."rofi/menus".source = ../../config/rofi/menus;
|
||||||
hm.xdg.configFile."rofi/nix.png".source = nix-colors-lib.nixWallpaperFromScheme {
|
hm.xdg.configFile."rofi/nix.png".source = nix-colors-lib.nixWallpaperFromScheme {
|
||||||
scheme = config.colorScheme;
|
scheme = config.colorScheme;
|
||||||
width = 600;
|
width = 600;
|
||||||
|
|||||||
26
modules/dev/devenv.nix
Normal file
26
modules/dev/devenv.nix
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# Custom package to quickly set up development environments for different
|
||||||
|
# programing languages
|
||||||
|
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.samfelag.modules.dev.devenv;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.samfelag.modules.dev.devenv = {
|
||||||
|
enable = lib.mkEnableOption "devenv";
|
||||||
|
};
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
|
||||||
|
hm.xdg.dataFile."devenv/devenv.sh".source = ../../data/devenv/devenv.sh;
|
||||||
|
hm.xdg.dataFile."devenv/templates".source = ../../data/devenv/templates;
|
||||||
|
|
||||||
|
hm.programs.zsh.shellAliases = {
|
||||||
|
devenv = "source $HOME/.local/share/devenv/devenv.sh";
|
||||||
|
};
|
||||||
|
|
||||||
|
# - Requirements -----------------------------
|
||||||
|
samfelag.modules.dev.direnv.enable = true;
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -17,6 +17,6 @@ in
|
|||||||
ripgrep
|
ripgrep
|
||||||
tldr
|
tldr
|
||||||
];
|
];
|
||||||
hm.xdg.configFile."shell".source = ../../config/.config/shell;
|
hm.xdg.configFile."shell".source = ../../config/shell;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ in
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
hm.xdg.configFile."zsh/.p10k.zsh".source = ../../config/.config/zsh/.p10k.zsh;
|
hm.xdg.configFile."zsh/.p10k.zsh".source = ../../config/zsh/.p10k.zsh;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user