Skip to content

Commit

Permalink
devcontainers
Browse files Browse the repository at this point in the history
  • Loading branch information
florentinl committed May 18, 2024
1 parent b42d1ca commit 7f6a390
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 14 deletions.
11 changes: 11 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/alpine
{
"name": "Debian",
"image": "alpine",
"features": {
"./": {
"flake": "github:florentinl/home-manager#root"
}
}
}
2 changes: 2 additions & 0 deletions .github/workflows/realease.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ jobs:
with:
publish-features: "true"
base-path-to-features: "./devcontainers"
disable-repo-tagging: "true"
features-namespace: "features"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions commons/shell/starship.nix
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
disabled = false;
format = "[$symbol](fg:fg bg:bg)";
symbols = {
Alpine = " ";
Ubuntu = "󰕈 ";
Debian = " ";
Macos = " ";
Expand Down
30 changes: 30 additions & 0 deletions devcontainers/home-manager/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"id": "home-manager",
"version": "0.1.0",
"name": "Install a Home Manager configuration from a flake",
"documentationURL": "https://nix-community.github.io/home-manager/",
"description": "Install an Home Manager configuration from a flake",
"options": {
"flake": {
"type": "string",
"description": "The flake to install Home Manager from",
"proposals": [
"github:florentinl/home-manager"
],
"default": "github:florentinl/home-manager"
},
"shell_program": {
"type": "string",
"description": "The shell to use for the installation",
"enum": [
"bash",
"zsh",
"fish"
],
"default": "zsh"
}
},
"dependsOn": {
"ghcr.io/florentinl/home-manager/nix:latest": {}
}
}
4 changes: 4 additions & 0 deletions devcontainers/home-manager/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /usr/bin/env nix
#! nix shell nixpkgs#home-manager --command sh
USER=$_REMOTE_USER home-manager switch --impure --flake $FLAKE
chsh -s $(which $SHELL_PROGRAM) $_REMOTE_USER
13 changes: 3 additions & 10 deletions devcontainers/nix/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
{
"id": "nix",
"version": "0.0.3",
"version": "0.1.0",
"name": "Nix Package Manager using Determinate Systems Installer",
"documentationURL": "https://github.com/DeterminateSystems/nix-installer?tab=readme-ov-file#in-a-container",
"description": "Install the Nix package manager with flake support",
"description": "Install the Nix package manager with flake support powered by Determinate Systems Installer",
"options": {},
"containerEnv": {
"PATH": "${PATH}:/nix/var/nix/profiles/default/bin"
},
"mounts": [
{
"source": "/nix/store",
"target": "/nix/store",
"type": "bind"
}
]
}
}
6 changes: 2 additions & 4 deletions devcontainers/nix/install.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#!/usr/bin/sh
# Install curl through apt if on debian based systems
if command -v apt-get &> /dev/null; then
sudo apt-get update
sudo apt-get install -y curl
apt-get update
apt-get install -y curl
fi
# Install curl through apk if on alpine based systems
if command -v apk &> /dev/null; then
apk add --update curl
fi
Expand Down

0 comments on commit 7f6a390

Please sign in to comment.