Skip to content

Commit

Permalink
nix configuration (??)
Browse files Browse the repository at this point in the history
i know that's not perfect. the best i can come up with right now.
  • Loading branch information
adamperkowski committed Oct 5, 2024
1 parent c9e1cc6 commit 1dea0c2
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
11 changes: 9 additions & 2 deletions core/tabs/applications-setup/docker-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

# Function to prompt the user for installation choice
choose_installation() {
clear
printf "%b\n" "${YELLOW}Choose what to install:${RC}"
printf "%b\n" "1. ${YELLOW}Docker${RC}"
printf "%b\n" "2. ${YELLOW}Docker Compose${RC}"
Expand Down Expand Up @@ -36,6 +35,11 @@ install_docker() {
"$ESCALATION_TOOL" systemctl enable docker
"$ESCALATION_TOOL" systemctl start docker
;;
nix-env)
"$PACKAGER" -iA nixpkgs.docker
"$ESCALATION_TOOL" sed -i '/^virtualisation\.docker\.enable/!b; s/^virtualisation\.docker\.enable.*/virtualisation.docker.enable = true;/' "$NIXOS_CONFIG" || echo 'virtualisation.docker.enable = true;' | "$ESCALATION_TOOL" tee -a "$NIXOS_CONFIG"
"$ESCALATION_TOOL" nixos-rebuild switch
;;
*)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
exit 1
Expand All @@ -55,6 +59,9 @@ install_docker_compose() {
pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm docker-compose
;;
nix-env)
"$PACKAGER" -iA nixpkgs.docker-compose
;;
*)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
exit 1
Expand Down Expand Up @@ -84,4 +91,4 @@ install_components() {

checkEnv
checkEscalationTool
install_components
install_components
2 changes: 2 additions & 0 deletions core/tabs/applications-setup/dwmtitus-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ setupDWM() {
"$ESCALATION_TOOL" "$PACKAGER" groupinstall -y "Development Tools"
"$ESCALATION_TOOL" "$PACKAGER" install -y libX11-devel libXinerama-devel libXft-devel imlib2-devel libxcb-devel unzip flameshot lxappearance feh mate-polkit # no need to include git here as it should be already installed via "Development Tools"
;;
nix-env)
;;
*)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
exit 1
Expand Down
2 changes: 2 additions & 0 deletions core/tabs/applications-setup/setup-flatpak.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ setup_flatpak() {
;;
nix-env)
"$PACKAGER" -iA nixpkgs.flatpak
"$ESCALATION_TOOL" sed -i '/^services\.flatpak\.enable/!b; s/^services\.flatpak\.enable.*/services.flatpak.enable = true;/' "$NIXOS_CONFIG" || echo 'services.flatpak.enable = true;' | "$ESCALATION_TOOL" tee -a "$NIXOS_CONFIG"
"$ESCALATION_TOOL" nixos-rebuild switch
;;
*)
"$ESCALATION_TOOL" "$PACKAGER" install -y flatpak
Expand Down
10 changes: 10 additions & 0 deletions core/tabs/common-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@ checkPackageManager() {
if command_exists "${pgm}"; then
PACKAGER=${pgm}
printf "%b\n" "${CYAN}Using ${pgm} as package manager${RC}"

if [ $PACKAGER = 'nix-env' ] && [ -z "$NIXOS_CONFIG" ]; then
NIXOS_CONFIG="/etc/nixos/configuration.nix"
while [ ! -f "$NIXOS_CONFIG" ]; do
printf "%b\n" "${RED}configuration.nix not found.${RC}"
printf "%b" "${YELLOW}Enter the path manually: ${RC}"
read -r NIXOS_CONFIG
done
fi

break
fi
done
Expand Down

0 comments on commit 1dea0c2

Please sign in to comment.