Skip to content

Commit

Permalink
Initial commit with changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis committed May 17, 2024
1 parent e65c528 commit 1b9a63d
Show file tree
Hide file tree
Showing 26 changed files with 940 additions and 0 deletions.
30 changes: 30 additions & 0 deletions apps/aarch64-darwin/apply
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/usr/bin/env bash

<<<<<<< HEAD
=======
VERSION=1.0

# Color codes
>>>>>>> b3202fa (Initial commit with changes)
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
Expand Down Expand Up @@ -32,6 +38,7 @@ _prompt() {
read -r $variable
}

<<<<<<< HEAD
insert_secrets_output() {
local pattern="outputs = { self, darwin, nix-homebrew, homebrew-bundle, homebrew-core, homebrew-cask, home-manager, nixpkgs, disko, agenix } @inputs:"
local insert_text="secrets "
Expand Down Expand Up @@ -95,6 +102,8 @@ EOF
rm "${FILE_PATH}.bak"
}

=======
>>>>>>> b3202fa (Initial commit with changes)
ask_for_star() {
_print "${YELLOW}Would you mind quickly starring my Github repo? yes/no [yes]: ${NC}"
local response
Expand Down Expand Up @@ -138,12 +147,15 @@ if [[ -z "$GIT_NAME" ]]; then
_prompt "${YELLOW}Please enter your name: ${NC}" GIT_NAME
fi

<<<<<<< HEAD
_prompt "${YELLOW}Please enter your Github username: ${NC}" GITHUB_USER
_prompt "${YELLOW}Please enter your Github secrets repository name: ${NC}" GITHUB_SECRETS_REPO

export GITHUB_USER
export GITHUB_SECRETS_REPO

=======
>>>>>>> b3202fa (Initial commit with changes)
select_boot_disk() {
local disks
local _boot_disk
Expand Down Expand Up @@ -174,7 +186,10 @@ if [[ "$OS" != "Darwin" ]]; then
select_boot_disk
fi

<<<<<<< HEAD
# Confirmation step
=======
>>>>>>> b3202fa (Initial commit with changes)
confirm_details() {
_print "${GREEN}Username: $USERNAME"
_print "Email: $GIT_EMAIL"
Expand All @@ -186,8 +201,11 @@ confirm_details() {
_print "Hostname: $HOST_NAME${NC}"
fi

<<<<<<< HEAD
_print "${GREEN}Secrets repository: $GITHUB_USER/$GITHUB_SECRETS_REPO${NC}"

=======
>>>>>>> b3202fa (Initial commit with changes)
_prompt "${YELLOW}Is this correct? yes/no: ${NC}" choice

case "$choice" in
Expand All @@ -197,7 +215,10 @@ confirm_details() {
esac
}

<<<<<<< HEAD
# Call the confirmation function
=======
>>>>>>> b3202fa (Initial commit with changes)
confirm_details

# Function to replace tokens in each file
Expand All @@ -209,8 +230,11 @@ replace_tokens() {
LC_ALL=C LANG=C sed -i '' -e "s/%USER%/$USERNAME/g" "$file"
LC_ALL=C LANG=C sed -i '' -e "s/%EMAIL%/$GIT_EMAIL/g" "$file"
LC_ALL=C LANG=C sed -i '' -e "s/%NAME%/$GIT_NAME/g" "$file"
<<<<<<< HEAD
LC_ALL=C LANG=C sed -i '' -e "s/%GITHUB_USER%/$GITHUB_USER/g" "$file"
LC_ALL=C LANG=C sed -i '' -e "s/%GITHUB_SECRETS_REPO%/$GITHUB_SECRETS_REPO/g" "$file"
=======
>>>>>>> b3202fa (Initial commit with changes)
else
# Linux or other
sed -i -e "s/%USER%/$USERNAME/g" "$file"
Expand All @@ -219,16 +243,22 @@ replace_tokens() {
sed -i -e "s/%INTERFACE%/$PRIMARY_IFACE/g" "$file"
sed -i -e "s/%DISK%/$BOOT_DISK/g" "$file"
sed -i -e "s/%HOST%/$HOST_NAME/g" "$file"
<<<<<<< HEAD
sed -i -e "s/%GITHUB_USER%/$GITHUB_USER/g" "$file"
sed -i -e "s/%GITHUB_SECRETS_REPO%/$GITHUB_SECRETS_REPO/g" "$file"
=======
>>>>>>> b3202fa (Initial commit with changes)
fi
fi
}

<<<<<<< HEAD
# Insert secrets repo into flake
insert_secrets_input
insert_secrets_output

=======
>>>>>>> b3202fa (Initial commit with changes)
# Traverse directories and call replace_tokens on each Nix file
export -f replace_tokens
find . -type f -exec bash -c 'replace_tokens "$0"' {} \;
Expand Down
4 changes: 4 additions & 0 deletions apps/aarch64-darwin/rollback
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ YELLOW='\033[1;33m'
RED='\033[1;31m'
NC='\033[0m'

<<<<<<< HEAD
FLAKE="dlorents-MBP"
=======
FLAKE="macos"
>>>>>>> b3202fa (Initial commit with changes)

echo "${YELLOW}Available generations:${NC}"
/run/current-system/sw/bin/darwin-rebuild --list-generations
Expand Down
30 changes: 30 additions & 0 deletions apps/x86_64-darwin/apply
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/usr/bin/env bash

<<<<<<< HEAD
=======
VERSION=1.0

# Color codes
>>>>>>> b3202fa (Initial commit with changes)
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
Expand Down Expand Up @@ -32,6 +38,7 @@ _prompt() {
read -r $variable
}

<<<<<<< HEAD
insert_secrets_output() {
local pattern="outputs = { self, darwin, nix-homebrew, homebrew-bundle, homebrew-core, homebrew-cask, home-manager, nixpkgs, disko, agenix } @inputs:"
local insert_text="secrets "
Expand Down Expand Up @@ -95,6 +102,8 @@ EOF
rm "${FILE_PATH}.bak"
}

=======
>>>>>>> b3202fa (Initial commit with changes)
ask_for_star() {
_print "${YELLOW}Would you mind quickly starring my Github repo? yes/no [yes]: ${NC}"
local response
Expand Down Expand Up @@ -138,12 +147,15 @@ if [[ -z "$GIT_NAME" ]]; then
_prompt "${YELLOW}Please enter your name: ${NC}" GIT_NAME
fi

<<<<<<< HEAD
_prompt "${YELLOW}Please enter your Github username: ${NC}" GITHUB_USER
_prompt "${YELLOW}Please enter your Github secrets repository name: ${NC}" GITHUB_SECRETS_REPO

export GITHUB_USER
export GITHUB_SECRETS_REPO

=======
>>>>>>> b3202fa (Initial commit with changes)
select_boot_disk() {
local disks
local _boot_disk
Expand Down Expand Up @@ -174,7 +186,10 @@ if [[ "$OS" != "Darwin" ]]; then
select_boot_disk
fi

<<<<<<< HEAD
# Confirmation step
=======
>>>>>>> b3202fa (Initial commit with changes)
confirm_details() {
_print "${GREEN}Username: $USERNAME"
_print "Email: $GIT_EMAIL"
Expand All @@ -186,8 +201,11 @@ confirm_details() {
_print "Hostname: $HOST_NAME${NC}"
fi

<<<<<<< HEAD
_print "${GREEN}Secrets repository: $GITHUB_USER/$GITHUB_SECRETS_REPO${NC}"

=======
>>>>>>> b3202fa (Initial commit with changes)
_prompt "${YELLOW}Is this correct? yes/no: ${NC}" choice

case "$choice" in
Expand All @@ -197,7 +215,10 @@ confirm_details() {
esac
}

<<<<<<< HEAD
# Call the confirmation function
=======
>>>>>>> b3202fa (Initial commit with changes)
confirm_details

# Function to replace tokens in each file
Expand All @@ -209,8 +230,11 @@ replace_tokens() {
LC_ALL=C LANG=C sed -i '' -e "s/%USER%/$USERNAME/g" "$file"
LC_ALL=C LANG=C sed -i '' -e "s/%EMAIL%/$GIT_EMAIL/g" "$file"
LC_ALL=C LANG=C sed -i '' -e "s/%NAME%/$GIT_NAME/g" "$file"
<<<<<<< HEAD
LC_ALL=C LANG=C sed -i '' -e "s/%GITHUB_USER%/$GITHUB_USER/g" "$file"
LC_ALL=C LANG=C sed -i '' -e "s/%GITHUB_SECRETS_REPO%/$GITHUB_SECRETS_REPO/g" "$file"
=======
>>>>>>> b3202fa (Initial commit with changes)
else
# Linux or other
sed -i -e "s/%USER%/$USERNAME/g" "$file"
Expand All @@ -219,16 +243,22 @@ replace_tokens() {
sed -i -e "s/%INTERFACE%/$PRIMARY_IFACE/g" "$file"
sed -i -e "s/%DISK%/$BOOT_DISK/g" "$file"
sed -i -e "s/%HOST%/$HOST_NAME/g" "$file"
<<<<<<< HEAD
sed -i -e "s/%GITHUB_USER%/$GITHUB_USER/g" "$file"
sed -i -e "s/%GITHUB_SECRETS_REPO%/$GITHUB_SECRETS_REPO/g" "$file"
=======
>>>>>>> b3202fa (Initial commit with changes)
fi
fi
}

<<<<<<< HEAD
# Insert secrets repo into flake
insert_secrets_input
insert_secrets_output

=======
>>>>>>> b3202fa (Initial commit with changes)
# Traverse directories and call replace_tokens on each Nix file
export -f replace_tokens
find . -type f -exec bash -c 'replace_tokens "$0"' {} \;
Expand Down
6 changes: 6 additions & 0 deletions apps/x86_64-linux/apply
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/usr/bin/env bash

<<<<<<< HEAD
=======
VERSION=1.0

# Color codes
>>>>>>> b3202fa (Initial commit with changes)
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
Expand Down
7 changes: 7 additions & 0 deletions apps/x86_64-linux/build-switch
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
#!/bin/sh -e

<<<<<<< HEAD
RED='\033[1;31m'
GREEN='\033[1;32m'
=======
VERSION=1.0

GREEN='\033[1;32m'
RED='\033[1;31m'
>>>>>>> b3202fa (Initial commit with changes)
YELLOW='\033[1;33m'
NC='\033[0m'

Expand Down
Loading

0 comments on commit 1b9a63d

Please sign in to comment.