Created
September 12, 2024 14:01
-
-
Save svor/83c8dd9a40254bd093d0a7baa9022c0e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
schemaVersion: 2.3.0 | |
metadata: | |
name: univesal-workspace-nix | |
components: | |
- name: nix | |
attributes: | |
controller.devfile.io/merge-contribution: true | |
container: | |
image: nixos/nix:2.24.5@sha256:4ad79a0ab633944869a37921f096d35a3f2c7a0275d98b7bfa0cd3cba5a6b96e | |
memoryLimit: 8Gi | |
cpuLimit: '4' | |
command: ["/bin/sh", "-c", "cp /configs/vscode/settings.json /checode/remote/data/Machine && tail -f /dev/null"] | |
env: | |
- name: HOME | |
value: /home/nix | |
- name: VSCODE_NODEJS_RUNTIME_DIR | |
value: /home/nix/.nix-profile/bin | |
- name: PATH | |
value: /root/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:/home/nix/.nix-profile/bin | |
volumeMounts: | |
- name: nix-volume | |
path: /nix/ | |
- name: home | |
path: /home/ | |
- name: nix-copy | |
container: | |
image: nixos/nix:2.24.5@sha256:4ad79a0ab633944869a37921f096d35a3f2c7a0275d98b7bfa0cd3cba5a6b96e | |
memoryLimit: 4Gi | |
cpuLimit: '1' | |
command: ["/bin/sh", "-c"] | |
args: | |
- | | |
if [ ! -f /nix-tmp/copy-finished ]; then | |
rm -rf /nix-tmp/* | |
cp -nav /nix/* /nix-tmp/ | |
touch /nix-tmp/copy-finished | |
else | |
echo "Nix volume already copied." | |
fi | |
volumeMounts: | |
- name: nix-volume | |
path: /nix-tmp/ | |
- name: nix-config | |
container: | |
image: nixos/nix:2.24.5@sha256:4ad79a0ab633944869a37921f096d35a3f2c7a0275d98b7bfa0cd3cba5a6b96e | |
memoryLimit: 4Gi | |
cpuLimit: '1' | |
command: ["/bin/sh", "-c"] | |
args: | |
- | | |
set +x | |
mkdir -p /home/nix/.config/home-manager | |
mkdir -p /home/nix/.config/nix | |
if [ -f /configs/nix/nix.conf ]; then | |
cp /configs/nix/nix.conf /home/nix/.config/nix/nix.conf | |
else | |
echo "Warning: /configs/nix/nix.conf not found, skipping copy." | |
fi | |
if [ -f /configs/nix/home.nix ]; then | |
cp /configs/nix/home.nix /home/nix/.config/home-manager/home.nix | |
else | |
echo "Warning: /configs/nix/home.nix not found, skipping copy." | |
fi | |
if [ -f /configs/nix/flake.nix ]; then | |
cp /configs/nix/flake.nix /home/nix/.config/home-manager/flake.nix | |
else | |
echo "Warning: /configs/nix/flake.nix not found, skipping copy." | |
fi | |
# VSCode configuration | |
if [ -f "/configs/vscode/settings.json" ]; then | |
cp /configs/vscode/settings.json /checode/remote/data/Machine/settings.json | |
else | |
echo "Warning: VSCode settings file or destination directory not found." | |
fi | |
# VSCode Continue.dev configuration | |
if [ -f "/configs/vscode/extensions/continue/config.json" ]; then | |
mkdir -p $HOME/.continue | |
cp /configs/vscode/extensions/continue/config.json $HOME/.continue | |
else | |
echo "Warning: Continue.dev config file not found." | |
fi | |
# NodeJS necessary for Eclipse Che VSCode | |
nix profile install nixpkgs#nodejs_22 | |
# Install Nix Home manager | |
nix run home-manager/8a1671642826633586d12ac3158e463c7a50a112 -- init --switch | |
# Fix permissions for zsh | |
nix path-info github:NixOS/nixpkgs/ed0fe13cc637546cad8c3ee903a23459b59f5080#zsh | xargs chmod -R 755 | |
nix path-info github:NixOS/nixpkgs/ed0fe13cc637546cad8c3ee903a23459b59f5080#oh-my-zsh | xargs chmod -R 755 | |
env: | |
- name: HOME | |
value: /home/nix | |
- name: PATH | |
value: /root/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:/home/nix/.nix-profile/bin | |
volumeMounts: | |
- name: nix-volume | |
path: /nix/ | |
- name: checode | |
path: /checode/ | |
- name: home | |
path: /home/ | |
- name: nix-volume | |
volume: | |
size: 20Gi | |
- name: home | |
volume: | |
size: 20Gi | |
commands: | |
- id: nix-copy | |
apply: | |
component: nix-copy | |
- id: nix-config | |
apply: | |
component: nix-config | |
events: | |
preStart: | |
- nix-copy | |
- nix-config |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment