First attempts on using distrobox
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
profile = import ./profile.nix;
|
||||
in
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
openmodelica.combined
|
||||
];
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
profile = import ./profile.nix;
|
||||
in
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
speed_dreams
|
||||
];
|
||||
}
|
||||
@@ -4,30 +4,28 @@
|
||||
|
||||
{ config, pkgs, ... }:
|
||||
let
|
||||
profile = import ./profile.nix;
|
||||
profile = import ./profile.nix;
|
||||
in
|
||||
{
|
||||
imports =
|
||||
[ # Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
./cron-schedule.nix
|
||||
./home-manager.nix
|
||||
];
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
./cron-schedule.nix
|
||||
./home-manager.nix
|
||||
];
|
||||
|
||||
# Bootloader.
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
boot.extraModulePackages = with config.boot.kernelPackages; [
|
||||
v4l2loopback
|
||||
];
|
||||
|
||||
boot.kernelModules = [ "v4l2loopback" ];
|
||||
boot.extraModprobeConfig = ''
|
||||
options v4l2loopback video_nr=10 card_label=snapcam exclusive_caps=1
|
||||
'';
|
||||
|
||||
boot.extraModulePackages = with config.boot.kernelPackages; [
|
||||
v4l2loopback
|
||||
];
|
||||
|
||||
boot.kernelModules = [ "v4l2loopback" ];
|
||||
boot.extraModprobeConfig = ''
|
||||
options v4l2loopback video_nr=10 card_label=snapcam exclusive_caps=1
|
||||
'';
|
||||
|
||||
networking.hostName = profile.hostname; # Define your hostname.
|
||||
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
|
||||
@@ -36,9 +34,9 @@ boot.extraModprobeConfig = ''
|
||||
networking.networkmanager = {
|
||||
enable = true;
|
||||
plugins = with pkgs; [
|
||||
networkmanager-ssh
|
||||
networkmanager-openvpn
|
||||
networkmanager-strongswan
|
||||
networkmanager-ssh
|
||||
networkmanager-openvpn
|
||||
networkmanager-strongswan
|
||||
];
|
||||
|
||||
};
|
||||
@@ -85,33 +83,32 @@ boot.extraModprobeConfig = ''
|
||||
console.keyMap = "de-latin1";
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
wget
|
||||
strongswan
|
||||
epiphany
|
||||
nodejs_24
|
||||
dive
|
||||
podman-tui
|
||||
podman-compose
|
||||
gmp
|
||||
gmp.dev
|
||||
pkg-config
|
||||
wget
|
||||
strongswan
|
||||
nodejs_24
|
||||
dive
|
||||
podman-tui
|
||||
podman-compose
|
||||
gmp
|
||||
gmp.dev
|
||||
pkg-config
|
||||
];
|
||||
|
||||
programs.nix-ld = {
|
||||
enable = true;
|
||||
libraries = with pkgs; [
|
||||
stdenv.cc.cc
|
||||
zlib
|
||||
gmp
|
||||
openssl
|
||||
curl
|
||||
glib
|
||||
gtk3
|
||||
libGL
|
||||
xorg.libX11
|
||||
appimage-run
|
||||
libgcrypt
|
||||
libxcrypt
|
||||
stdenv.cc.cc
|
||||
zlib
|
||||
gmp
|
||||
openssl
|
||||
curl
|
||||
glib
|
||||
gtk3
|
||||
libGL
|
||||
xorg.libX11
|
||||
appimage-run
|
||||
libgcrypt
|
||||
libxcrypt
|
||||
];
|
||||
};
|
||||
|
||||
@@ -140,7 +137,10 @@ boot.extraModprobeConfig = ''
|
||||
|
||||
# Enable the OpenSSH daemon.
|
||||
services.openssh.enable = true;
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
nix.settings.experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
# This value determines the NixOS release from which the default
|
||||
# settings for stateful data, like file locations and database versions
|
||||
|
||||
@@ -8,7 +8,7 @@ in
|
||||
./browser.nix
|
||||
./planner.nix
|
||||
./window-manager.nix
|
||||
../applications/matrix-element.nix
|
||||
../applications/matrix.nix
|
||||
];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
|
||||
@@ -19,12 +19,17 @@ in
|
||||
extraGroups = ["disks" "storage" "networkmanager" "wheel" "docker" "scanner" "lp" "uucp" "dialout"];
|
||||
packages = with pkgs; [];
|
||||
shell = pkgs.zsh;
|
||||
hashedPassword = profile.hashed-password;
|
||||
hashedPassword = profile.hashed-password;
|
||||
};
|
||||
|
||||
home-manager.backupFileExtension = "bck.lck";
|
||||
|
||||
home-manager.users.${profile.username} = { pkgs, ... }: {
|
||||
|
||||
imports = [
|
||||
./terminal-environment/genv
|
||||
];
|
||||
|
||||
home.stateVersion = "25.11";
|
||||
programs.git = {
|
||||
enable = true;
|
||||
|
||||
@@ -13,6 +13,7 @@ in
|
||||
astyle
|
||||
hyfetch
|
||||
fzf-zsh
|
||||
distrobox
|
||||
];
|
||||
|
||||
programs.tmux = {
|
||||
|
||||
67
terminal-environment/genv/default.nix
Normal file
67
terminal-environment/genv/default.nix
Normal file
@@ -0,0 +1,67 @@
|
||||
{ pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
genv = pkgs.writeShellScriptBin "genv" ''
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
DISTRO="$1"
|
||||
PRESET="$2"
|
||||
|
||||
if [ -z "$DISTRO" ] || [ -z "$PRESET" ]; then
|
||||
echo "Usage: genv <distro> <preset>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PROJECT=$(basename "$PWD")
|
||||
BOX="genv-$PROJECT"
|
||||
|
||||
# distro mapping
|
||||
case "$DISTRO" in
|
||||
ubuntu) IMAGE="docker.io/library/ubuntu:24.04" ;;
|
||||
arch) IMAGE="docker.io/library/archlinux:latest" ;;
|
||||
alpine) IMAGE="docker.io/library/alpine:latest" ;;
|
||||
*) IMAGE="$DISTRO" ;;
|
||||
esac
|
||||
|
||||
echo "[genv] image: $IMAGE"
|
||||
|
||||
# container nur erstellen wenn nötig
|
||||
if ! distrobox list | grep -q "$BOX"; then
|
||||
distrobox create --name "$BOX" --image "$IMAGE"
|
||||
fi
|
||||
|
||||
mkdir -p .genv
|
||||
|
||||
# preset kopieren
|
||||
cp ${./presets}/$PRESET.sh .genv/setup.sh
|
||||
chmod +x .genv/setup.sh
|
||||
|
||||
# envrc generieren
|
||||
cat > .envrc <<EOF
|
||||
export GENV_BOX="$BOX"
|
||||
|
||||
# container starten
|
||||
distrobox start "$GENV_BOX" >/dev/null 2>&1 || true
|
||||
|
||||
# setup einmalig
|
||||
if [ ! -f .genv/.init ]; then
|
||||
echo "[genv] setup läuft"
|
||||
distrobox enter "$GENV_BOX" -- bash .genv/setup.sh
|
||||
touch .genv/.init
|
||||
fi
|
||||
|
||||
# tmux workflow
|
||||
if [ -z "$TMUX" ]; then
|
||||
tmux new-session -A -s "$GENV_BOX" \
|
||||
\; new-window -n editor "nvim" \
|
||||
\; new-window -n dev "distrobox enter $GENV_BOX"
|
||||
fi
|
||||
EOF
|
||||
|
||||
echo "[genv] fertig → direnv allow"
|
||||
'';
|
||||
in
|
||||
{
|
||||
home.packages = [ genv ];
|
||||
}
|
||||
11
terminal-environment/genv/presets/c.sh
Normal file
11
terminal-environment/genv/presets/c.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
if command -v apt >/dev/null; then
|
||||
sudo apt update
|
||||
sudo apt install -y build-essential cmake
|
||||
elif command -v pacman >/dev/null; then
|
||||
sudo pacman -Sy --noconfirm base-devel cmake
|
||||
elif command -v apk >/dev/null; then
|
||||
sudo apk add build-base cmake
|
||||
fi
|
||||
11
terminal-environment/genv/presets/data-science.sh
Normal file
11
terminal-environment/genv/presets/data-science.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
if command -v apt >/dev/null; then
|
||||
sudo apt update
|
||||
sudo apt install -y python3
|
||||
elif command -v pacman >/dev/null; then
|
||||
sudo pacman -Sy --noconfirm base-devel python3
|
||||
elif command -v apk >/dev/null; then
|
||||
sudo apk add build-base python3
|
||||
fi
|
||||
Reference in New Issue
Block a user