Files
ad-nix/configuration.nix
John Lancaster 1702cb3828 added time zone
2024-11-27 10:20:11 -06:00

82 lines
2.1 KiB
Nix

{ pkgs, lib, modulesPath, ... }:
let
stateVersion = "24.05";
unstable = import <nixos-unstable> {};
adHome = "/srv/appdaemon";
adNixPath = "${adHome}/ad-nix";
adPath = "/usr/src/app";
adRepo = "https://github.com/jsl12/appdaemon";
adBranch = "hass";
in
{
imports = [
(modulesPath + "/virtualisation/proxmox-lxc.nix")
(import "${builtins.fetchTarball https://github.com/nix-community/home-manager/archive/release-24.05.tar.gz}/nixos")
(fetchTarball "https://github.com/nix-community/nixos-vscode-server/tarball/master")
./telegraf.nix
];
environment.systemPackages = with pkgs; [
(pkgs.writeShellScriptBin "nrbs" "sudo nixos-rebuild switch")
(pkgs.writeShellScriptBin "nrbsu" "sudo nix-channel --update && sudo nixos-rebuild switch")
(pkgs.writeShellScriptBin "ad-clone" ''
if [ ! -d ${adPath} ]; then
sudo git clone -b ${adBranch} ${adRepo} ${adPath}
sudo chown -R appdaemon:users $(dirname ${adPath})
else
echo "${adPath} already exists"
fi
'')
bash
git
eza
gh
# appdaemon
];
time.timeZone = "America/Chicago";
virtualisation.docker.enable = true;
services.vscode-server.enable = true;
services.openssh.enable = true;
services.tailscale.enable = true;
system.activationScripts.ensureDirectory = ''
if [ ! -d /conf ]; then
mkdir /conf
chmod 0755 /conf
chown 1000:100 /conf
fi
'';
security.sudo-rs = {
enable = true;
execWheelOnly = false;
wheelNeedsPassword = false;
};
users.users.appdaemon = {
isNormalUser = true;
home = "${adHome}";
extraGroups = [ "wheel" "docker"];
openssh.authorizedKeys.keyFiles = [ "/root/.ssh/authorized_keys" ];
};
home-manager = {
useGlobalPkgs = true;
users.appdaemon = { pkgs, ... }: {
home.stateVersion = stateVersion;
imports = [ ./git.nix ];
programs = {
ssh.enable = true;
git.extraConfig.safe.directory = "${adNixPath}";
bash = {
enable = true;
profileExtra = "cd ${adNixPath}";
};
};
};
};
system.stateVersion = stateVersion;
}