mirror of
https://gitlab.com/TECHNOFAB/coder-templates.git
synced 2025-12-13 18:50:06 +01:00
feat: add dotfile loading via home-manager
This commit is contained in:
parent
eb737c39b2
commit
ba17b0ee0c
4 changed files with 41 additions and 8 deletions
|
|
@ -17,8 +17,9 @@ pkgs.dockerTools.buildLayeredImage {
|
||||||
pkgs.openssh
|
pkgs.openssh
|
||||||
pkgs.git
|
pkgs.git
|
||||||
pkgs.curl
|
pkgs.curl
|
||||||
pkgs.home-manager
|
(pkgs.writeShellScriptBin "reload-dotfiles" ''
|
||||||
pkgs.direnv
|
${pkgs.home-manager}/bin/home-manager switch --flake ''${DOTFILES_REPO:-$1}
|
||||||
|
'')
|
||||||
(pkgs.writeTextDir "etc/nix/nix.conf" "experimental-features = nix-command flakes")
|
(pkgs.writeTextDir "etc/nix/nix.conf" "experimental-features = nix-command flakes")
|
||||||
(pkgs.writeTextDir "etc/passwd" "coder:x:1000:1000::/home/coder:/bin/bash")
|
(pkgs.writeTextDir "etc/passwd" "coder:x:1000:1000::/home/coder:/bin/bash")
|
||||||
(pkgs.writeTextDir "etc/shadow" "coder:!:::::::")
|
(pkgs.writeTextDir "etc/shadow" "coder:!:::::::")
|
||||||
|
|
|
||||||
|
|
@ -39,5 +39,20 @@
|
||||||
run_on_start = true;
|
run_on_start = true;
|
||||||
start_blocks_login = true;
|
start_blocks_login = true;
|
||||||
};
|
};
|
||||||
|
coder_script."home-manager" = {
|
||||||
|
agent_id = "\${coder_agent.coder.id}";
|
||||||
|
display_name = "Home Manager";
|
||||||
|
icon = "/emojis/1f3e0.png";
|
||||||
|
script = ''
|
||||||
|
if [ ! -z "$DOTFILES_REPO" ] then
|
||||||
|
echo "Dotfiles present, reloading home-manager profile"
|
||||||
|
reload-dotfiles
|
||||||
|
else
|
||||||
|
echo "No dotfiles repo specified, skipping..."
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
run_on_start = true;
|
||||||
|
start_blocks_login = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,10 @@
|
||||||
name = "CODER_AGENT_TOKEN";
|
name = "CODER_AGENT_TOKEN";
|
||||||
value = "\${resource.coder_agent.coder.token}";
|
value = "\${resource.coder_agent.coder.token}";
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
name = "DOTFILES_REPO";
|
||||||
|
value = "\${data.coder_parameter.dotfiles_repo.value}";
|
||||||
|
}
|
||||||
];
|
];
|
||||||
resources = {
|
resources = {
|
||||||
requests = {
|
requests = {
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,25 @@
|
||||||
{...}: {
|
{...}: {
|
||||||
data.coder_parameter = {
|
data.coder_parameter = {
|
||||||
|
dotfiles_repo = {
|
||||||
|
name = "Dotfiles Repository (passed to home-manager)";
|
||||||
|
description = ''
|
||||||
|
Nix flake URI to your dotfiles repository, eg.
|
||||||
|
github:example/dotfiles#coder
|
||||||
|
|
||||||
|
Your flake.nix has to expose a homeManagerConfiguration.coder in this case.
|
||||||
|
'';
|
||||||
|
default = "";
|
||||||
|
order = 1;
|
||||||
|
type = "string";
|
||||||
|
mutable = true;
|
||||||
|
};
|
||||||
git_repo = {
|
git_repo = {
|
||||||
name = "Git Repository";
|
name = "Git Repository";
|
||||||
description = ''
|
description = ''
|
||||||
URI for a git repository which should automatically be cloned to ~/repos/<name>
|
URI for a git repository which should automatically be cloned to ~/repos/<name>
|
||||||
'';
|
'';
|
||||||
default = "";
|
default = "";
|
||||||
order = 1;
|
order = 2;
|
||||||
type = "string";
|
type = "string";
|
||||||
mutable = true;
|
mutable = true;
|
||||||
};
|
};
|
||||||
|
|
@ -16,7 +29,7 @@
|
||||||
Which container image tag should be used.
|
Which container image tag should be used.
|
||||||
'';
|
'';
|
||||||
default = "latest";
|
default = "latest";
|
||||||
order = 2;
|
order = 3;
|
||||||
type = "string";
|
type = "string";
|
||||||
mutable = true;
|
mutable = true;
|
||||||
};
|
};
|
||||||
|
|
@ -26,7 +39,7 @@
|
||||||
CPU Limit for Kubernetes Pod. Kubernetes Notation (eg. 500m)
|
CPU Limit for Kubernetes Pod. Kubernetes Notation (eg. 500m)
|
||||||
'';
|
'';
|
||||||
default = "500m";
|
default = "500m";
|
||||||
order = 3;
|
order = 4;
|
||||||
type = "string";
|
type = "string";
|
||||||
mutable = true;
|
mutable = true;
|
||||||
};
|
};
|
||||||
|
|
@ -36,7 +49,7 @@
|
||||||
Memory Limit for Kubernetes Pod. Kubernetes Notation (eg. 1Gi)
|
Memory Limit for Kubernetes Pod. Kubernetes Notation (eg. 1Gi)
|
||||||
'';
|
'';
|
||||||
default = "1Gi";
|
default = "1Gi";
|
||||||
order = 4;
|
order = 5;
|
||||||
type = "string";
|
type = "string";
|
||||||
mutable = true;
|
mutable = true;
|
||||||
};
|
};
|
||||||
|
|
@ -46,7 +59,7 @@
|
||||||
Size for the /home PV in GB
|
Size for the /home PV in GB
|
||||||
'';
|
'';
|
||||||
default = 5;
|
default = 5;
|
||||||
order = 5;
|
order = 6;
|
||||||
type = "number";
|
type = "number";
|
||||||
mutable = true;
|
mutable = true;
|
||||||
validation = [
|
validation = [
|
||||||
|
|
@ -63,7 +76,7 @@
|
||||||
Size for the /nix PV in GB. This might grow pretty big.
|
Size for the /nix PV in GB. This might grow pretty big.
|
||||||
'';
|
'';
|
||||||
default = 5;
|
default = 5;
|
||||||
order = 6;
|
order = 7;
|
||||||
type = "number";
|
type = "number";
|
||||||
mutable = true;
|
mutable = true;
|
||||||
validation = [
|
validation = [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue