Skip to content

Instantly share code, notes, and snippets.

@daemonfire300
Last active August 13, 2026 08:50
Show Gist options
  • Select an option

  • Save daemonfire300/50994f844c04ee3289ccf777da4355ff to your computer and use it in GitHub Desktop.

Select an option

Save daemonfire300/50994f844c04ee3289ccf777da4355ff to your computer and use it in GitHub Desktop.
example.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: devcontainer
labels:
app: devcontainer
spec:
serviceName: devcontainer
replicas: 1
selector:
matchLabels:
app: devcontainer
template:
metadata:
labels:
app: devcontainer
spec:
securityContext:
runAsNonRoot: true
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
fsGroupChangePolicy: OnRootMismatch
seccompProfile:
type: RuntimeDefault
containers:
- name: devcontainer
image: devcontainer:dev
imagePullPolicy: IfNotPresent
env:
# Base URLs of three separate Nexus proxy repositories. Configure
# these in an overlay, ConfigMap, or deployment pipeline.
- name: NIX_CHANNEL_PROXY_URL
value: ""
- name: NIX_BINARY_CACHE_PROXY_URL
value: ""
- name: NIX_BINARY_CACHE_PUBLIC_KEYS
value: ""
- name: GITHUB_PROXY_URL
value: ""
securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
volumeMounts:
- name: home
mountPath: /home/me
- name: tmp
mountPath: /tmp
- name: nix
mountPath: /nix
resources:
requests:
cpu: 500m
memory: 1Gi
volumes:
- name: tmp
emptyDir: {}
initContainers:
- name: bootstrap-nix-store
image: devcontainer:dev
imagePullPolicy: IfNotPresent
command:
- /opt/devcontainer/bin/bootstrap-nix-store
env:
- name: HOME
value: /tmp
- name: XDG_CACHE_HOME
value: /tmp/.cache
- name: NIX_CONF_DIR
value: /tmp/nix-conf
securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
volumeMounts:
- name: nix
mountPath: /nix-bootstrap/nix
- name: tmp
mountPath: /tmp
volumeClaimTemplates:
- metadata:
name: home
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
- metadata:
name: nix
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment