Snowfall lib - initial work
Switch to treefmt
This commit is contained in:
parent
2fbee2adb5
commit
bca554318e
10
.vscode/settings.json
vendored
10
.vscode/settings.json
vendored
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"direnv.path.executable": "/run/current-system/sw/bin/direnv",
|
"direnv.path.executable": "/run/current-system/sw/bin/direnv",
|
||||||
"direnv.restart.automatic": true,
|
"direnv.restart.automatic": true,
|
||||||
"nix.enableLanguageServer": true,
|
"nix.enableLanguageServer": true,
|
||||||
"nix.serverPath": "/run/current-system/sw/bin/nil",
|
"nix.serverPath": "/run/current-system/sw/bin/nil",
|
||||||
"nix.formatterPath": "/run/current-system/sw/bin/nix fmt",
|
"nix.formatterPath": "/run/current-system/sw/bin/nix fmt"
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,10 +130,11 @@ nixos-rebuild build-vm --flake .
|
||||||
### Layout
|
### Layout
|
||||||
|
|
||||||
This config uses a custom templating system built off of the [Auxolotl system templates](https://git.auxolotl.org/auxolotl/templates).
|
This config uses a custom templating system built off of the [Auxolotl system templates](https://git.auxolotl.org/auxolotl/templates).
|
||||||
|
|
||||||
- Flakes are the entrypoint, via `flake.nix`. This is where Flake inputs and Flake-specific options get defined.
|
- Flakes are the entrypoint, via `flake.nix`. This is where Flake inputs and Flake-specific options get defined.
|
||||||
- Hosts are defined in the `hosts` folder.
|
- Hosts are defined in the `hosts` folder.
|
||||||
- Modules are defined in `modules`. All of these files are automatically imported (except home-manager modules). You simply enable the ones you want to use, and disable the ones you don't. For example, to install Flatpak support, set `aux.system.ui.flatpak.enable = true;`.
|
- Modules are defined in `modules`. All of these files are automatically imported (except home-manager modules). You simply enable the ones you want to use, and disable the ones you don't. For example, to install Flatpak support, set `aux.system.ui.flatpak.enable = true;`.
|
||||||
- After adding a new module, make sure to `git add` it before running `nixos-rebuild`.
|
- After adding a new module, make sure to `git add` it before running `nixos-rebuild`.
|
||||||
- Home-manager configs live in the `users/` folders.
|
- Home-manager configs live in the `users/` folders.
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
|
@ -8,16 +8,16 @@ outDir="./out"
|
||||||
metadataFile="$inDir/metadata.yml"
|
metadataFile="$inDir/metadata.yml"
|
||||||
|
|
||||||
function usage() {
|
function usage() {
|
||||||
echo "Compile a directory of Markdown (.md) files into DOCX, ePub, and PDF files."
|
echo "Compile a directory of Markdown (.md) files into DOCX, ePub, and PDF files."
|
||||||
echo ""
|
echo ""
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " --help Show this help screen."
|
echo " --help Show this help screen."
|
||||||
echo " -n, --name [name] The name of this draft."
|
echo " -n, --name [name] The name of this draft."
|
||||||
echo " -i, --input [path] Directory containing the files to convert. Defaults to this directory."
|
echo " -i, --input [path] Directory containing the files to convert. Defaults to this directory."
|
||||||
echo " -o, --output [path] Directory to store the converted files in. Defaults to ./out."
|
echo " -o, --output [path] Directory to store the converted files in. Defaults to ./out."
|
||||||
echo " -m, --metadata [path] Path to the YAML file containing metadata for pandoc."
|
echo " -m, --metadata [path] Path to the YAML file containing metadata for pandoc."
|
||||||
echo ""
|
echo ""
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# Argument processing logic shamelessly stolen from https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash
|
# Argument processing logic shamelessly stolen from https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash
|
||||||
|
@ -25,47 +25,47 @@ POSITIONAL_ARGS=()
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--draft-name|--name|-n)
|
--draft-name|--name|-n)
|
||||||
draftName="$2"
|
draftName="$2"
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--input|--indir|-i)
|
--input|--indir|-i)
|
||||||
inDir="$2"
|
inDir="$2"
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--output|--outdir|-o)
|
--output|--outdir|-o)
|
||||||
outDir="$2"
|
outDir="$2"
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--metadata|--metadataFile|-m)
|
--metadata|--metadataFile|-m)
|
||||||
metadataFile="$2"
|
metadataFile="$2"
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--help)
|
--help)
|
||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
POSITIONAL_ARGS+=("$1") # save positional arg
|
POSITIONAL_ARGS+=("$1") # save positional arg
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
remainingArgs=${POSITIONAL_ARGS[@]}
|
remainingArgs=${POSITIONAL_ARGS[@]}
|
||||||
set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters
|
set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters
|
||||||
|
|
||||||
# If this is a git repo and no name has been provided, name the draft after the current branch
|
# If this is a git repo and no name has been provided, name the draft after the current branch
|
||||||
if [ -d ".git" ] && [ "$draftName" = "draft" ]; then
|
if [ -d ".git" ] && [ "$draftName" = "draft" ]; then
|
||||||
draftName=$(git rev-parse --abbrev-ref HEAD)
|
draftName=$(git rev-parse --abbrev-ref HEAD)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if this directory already exists
|
# Check if this directory already exists
|
||||||
outDir="$outDir/${draftName}"
|
outDir="$outDir/${draftName}"
|
||||||
if [ -d $outDir ]; then
|
if [ -d $outDir ]; then
|
||||||
echo "The folder $outDir already exists."
|
echo "The folder $outDir already exists."
|
||||||
read -p "Enter YES to overwrite, or Ctrl-C to cancel: " confirm && [ $confirm = "YES" ] || exit 1
|
read -p "Enter YES to overwrite, or Ctrl-C to cancel: " confirm && [ $confirm = "YES" ] || exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
draftFile="$outDir/${draftName}"
|
draftFile="$outDir/${draftName}"
|
||||||
|
@ -82,11 +82,11 @@ echo > $draftFile.md
|
||||||
# Obsidian specifically creates "folder notes," which are named for the directory, so we make sure to exclude it.
|
# Obsidian specifically creates "folder notes," which are named for the directory, so we make sure to exclude it.
|
||||||
find "$inDir" -type f -wholename "* *.md" ! -name content.md -print0 | sort -z | while read -d $'\0' file
|
find "$inDir" -type f -wholename "* *.md" ! -name content.md -print0 | sort -z | while read -d $'\0' file
|
||||||
do
|
do
|
||||||
# Add newline to Markdown doc
|
# Add newline to Markdown doc
|
||||||
echo >> $draftFile.md
|
echo >> $draftFile.md
|
||||||
# Clean up incoming Markdown and append it to final doc
|
# Clean up incoming Markdown and append it to final doc
|
||||||
sed "s|(../|($inDir/../|g" "$file" >> $draftFile.md
|
sed "s|(../|($inDir/../|g" "$file" >> $draftFile.md
|
||||||
echo "\\newpage" >> $draftFile.md
|
echo "\\newpage" >> $draftFile.md
|
||||||
done
|
done
|
||||||
|
|
||||||
# Generate the output files:
|
# Generate the output files:
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ "$(id -u)" != "0" ]; then
|
if [ "$(id -u)" != "0" ]; then
|
||||||
echo "This script must be run as root" 1>&2
|
echo "This script must be run as root" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Configuration parameters
|
# Configuration parameters
|
||||||
|
@ -17,42 +17,42 @@ luks_partition="" # The drive partition to create the LUKS container on
|
||||||
root_partition="/dev/mapper/nixos-crypt" # The partition to install NixOS to
|
root_partition="/dev/mapper/nixos-crypt" # The partition to install NixOS to
|
||||||
|
|
||||||
function usage() {
|
function usage() {
|
||||||
echo "Usage: format-drives.sh [--boot boot-partition-path] [--luks luks-partition-path] [--ask-root-password]"
|
echo "Usage: format-drives.sh [--boot boot-partition-path] [--luks luks-partition-path] [--ask-root-password]"
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " -h | --help Show this help screen."
|
echo " -h | --help Show this help screen."
|
||||||
echo " -b | --boot <path> The path to the boot drive (e.g. /dev/nvme0n1p1)."
|
echo " -b | --boot <path> The path to the boot drive (e.g. /dev/nvme0n1p1)."
|
||||||
echo " -l | --luks <path> The path to the partition to create the LUKS container on (e.g. /dev/nvme0n1p2)."
|
echo " -l | --luks <path> The path to the partition to create the LUKS container on (e.g. /dev/nvme0n1p2)."
|
||||||
echo " -a | --ask-root-password Sets a password for the root user account."
|
echo " -a | --ask-root-password Sets a password for the root user account."
|
||||||
exit 2
|
exit 2
|
||||||
}
|
}
|
||||||
|
|
||||||
# Argument processing logic shamelessly stolen from https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash
|
# Argument processing logic shamelessly stolen from https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash
|
||||||
POSITIONAL_ARGS=()
|
POSITIONAL_ARGS=()
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--ask-root-password|-a)
|
--ask-root-password|-a)
|
||||||
ask_root_password=true
|
ask_root_password=true
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--boot|-b)
|
--boot|-b)
|
||||||
boot_partition="$2"
|
boot_partition="$2"
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--luks|-l)
|
--luks|-l)
|
||||||
luks_partition="$2"
|
luks_partition="$2"
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--help|-h)
|
--help|-h)
|
||||||
usage
|
usage
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
POSITIONAL_ARGS+=("$1") # save positional arg
|
POSITIONAL_ARGS+=("$1") # save positional arg
|
||||||
shift # past argument
|
shift # past argument
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters
|
set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters
|
||||||
|
|
|
@ -12,73 +12,73 @@ buildHost="" # Which host to use to generate
|
||||||
remainingArgs="" # All remaining arguments that haven't yet been processed (will be passed to nixos-rebuild)
|
remainingArgs="" # All remaining arguments that haven't yet been processed (will be passed to nixos-rebuild)
|
||||||
|
|
||||||
function usage() {
|
function usage() {
|
||||||
echo "The NixOS Operations Script (NOS) is a nixos-rebuild wrapper for system maintenance."
|
echo "The NixOS Operations Script (NOS) is a nixos-rebuild wrapper for system maintenance."
|
||||||
echo ""
|
echo ""
|
||||||
echo "Running the script with no parameters performs the following operations:"
|
echo "Running the script with no parameters performs the following operations:"
|
||||||
echo " 1. Pull the latest version of your Nix config repository"
|
echo " 1. Pull the latest version of your Nix config repository"
|
||||||
echo " 2. Run 'nixos-rebuild switch'."
|
echo " 2. Run 'nixos-rebuild switch'."
|
||||||
echo ""
|
echo ""
|
||||||
echo "Advanced usage: nixos-operations-script.sh [-h | --hostname hostname-to-build] [-o | --operation operation] [-f | --flake path-to-flake] [extra nixos-rebuild parameters]"
|
echo "Advanced usage: nixos-operations-script.sh [-h | --hostname hostname-to-build] [-o | --operation operation] [-f | --flake path-to-flake] [extra nixos-rebuild parameters]"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " --help Show this help screen."
|
echo " --help Show this help screen."
|
||||||
echo " -f, --flake [path] The path to your flake.nix file (defualts to the FLAKE_DIR environment variable)."
|
echo " -f, --flake [path] The path to your flake.nix file (defualts to the FLAKE_DIR environment variable)."
|
||||||
echo " -h, --hostname [hostname] The name of the host to build (defaults to the current system's hostname)."
|
echo " -h, --hostname [hostname] The name of the host to build (defaults to the current system's hostname)."
|
||||||
echo " -o, --operation [operation] The nixos-rebuild operation to perform (defaults to 'switch')."
|
echo " -o, --operation [operation] The nixos-rebuild operation to perform (defaults to 'switch')."
|
||||||
echo " -U, --update Update and commit the flake.lock file."
|
echo " -U, --update Update and commit the flake.lock file."
|
||||||
echo " -u, --user [username] Which user account to run git commands under (defaults to the user running this script)."
|
echo " -u, --user [username] Which user account to run git commands under (defaults to the user running this script)."
|
||||||
echo ""
|
echo ""
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# Argument processing logic shamelessly stolen from https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash
|
# Argument processing logic shamelessly stolen from https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash
|
||||||
POSITIONAL_ARGS=()
|
POSITIONAL_ARGS=()
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--build-host)
|
--build-host)
|
||||||
buildHost="$2"
|
buildHost="$2"
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--flake|-f)
|
--flake|-f)
|
||||||
flakeDir="$2"
|
flakeDir="$2"
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--hostname|-h)
|
--hostname|-h)
|
||||||
hostname="$2"
|
hostname="$2"
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--update|--upgrade|-U)
|
--update|--upgrade|-U)
|
||||||
update=true
|
update=true
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--operation|-o)
|
--operation|-o)
|
||||||
operation="$2"
|
operation="$2"
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--user|-u)
|
--user|-u)
|
||||||
user="$2"
|
user="$2"
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--help)
|
--help)
|
||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
POSITIONAL_ARGS+=("$1") # save positional arg
|
POSITIONAL_ARGS+=("$1") # save positional arg
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
remainingArgs=${POSITIONAL_ARGS[@]}
|
remainingArgs=${POSITIONAL_ARGS[@]}
|
||||||
set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters
|
set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters
|
||||||
|
|
||||||
if [ -z "${flakeDir}" ]; then
|
if [ -z "${flakeDir}" ]; then
|
||||||
echo "Flake directory not specified. Use '--flake <path>' or set \$FLAKE_DIR."
|
echo "Flake directory not specified. Use '--flake <path>' or set \$FLAKE_DIR."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $flakeDir
|
cd $flakeDir
|
||||||
|
@ -87,19 +87,19 @@ echo "Pulling the latest version of the repository..."
|
||||||
/run/wrappers/bin/sudo -u $user /run/current-system/sw/bin/git pull
|
/run/wrappers/bin/sudo -u $user /run/current-system/sw/bin/git pull
|
||||||
|
|
||||||
if [ $update = true ]; then
|
if [ $update = true ]; then
|
||||||
echo "Updating flake.lock..."
|
echo "Updating flake.lock..."
|
||||||
/run/wrappers/bin/sudo -u $user /run/current-system/sw/bin/nix flake update --commit-lock-file
|
/run/wrappers/bin/sudo -u $user /run/current-system/sw/bin/nix flake update --commit-lock-file
|
||||||
/run/wrappers/bin/sudo -u $user git push
|
/run/wrappers/bin/sudo -u $user git push
|
||||||
else
|
else
|
||||||
echo "Skipping 'nix flake update'..."
|
echo "Skipping 'nix flake update'..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
options="--flake ${flakeDir}#${hostname} ${remainingArgs} --use-remote-sudo --log-format multiline-with-logs"
|
options="--flake ${flakeDir}#${hostname} ${remainingArgs} --use-remote-sudo --log-format multiline-with-logs"
|
||||||
|
|
||||||
if [[ -n "${buildHost}" && $operation != "build" && $operation != *"dry"* ]]; then
|
if [[ -n "${buildHost}" && $operation != "build" && $operation != *"dry"* ]]; then
|
||||||
echo "Remote build detected, running this operation first: nixos-rebuild build ${options} --build-host $buildHost"
|
echo "Remote build detected, running this operation first: nixos-rebuild build ${options} --build-host $buildHost"
|
||||||
/run/current-system/sw/bin/nixos-rebuild build $options --build-host $buildHost
|
/run/current-system/sw/bin/nixos-rebuild build $options --build-host $buildHost
|
||||||
echo "Remote build complete!"
|
echo "Remote build complete!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Running this operation: nixos-rebuild ${operation} ${options}"
|
echo "Running this operation: nixos-rebuild ${operation} ${options}"
|
||||||
|
|
130
flake.lock
130
flake.lock
|
@ -58,6 +58,22 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"flake-compat_2": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1650374568,
|
||||||
|
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"flake-parts": {
|
"flake-parts": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs-lib": [
|
"nixpkgs-lib": [
|
||||||
|
@ -97,6 +113,25 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"flake-utils-plus": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils_3"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1715533576,
|
||||||
|
"narHash": "sha256-fT4ppWeCJ0uR300EH3i7kmgRZnAVxrH+XtK09jQWihk=",
|
||||||
|
"owner": "gytis-ivaskevicius",
|
||||||
|
"repo": "flake-utils-plus",
|
||||||
|
"rev": "3542fe9126dc492e53ddd252bb0260fe035f2c0f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "gytis-ivaskevicius",
|
||||||
|
"repo": "flake-utils-plus",
|
||||||
|
"rev": "3542fe9126dc492e53ddd252bb0260fe035f2c0f",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"flake-utils_2": {
|
"flake-utils_2": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"systems": "systems_2"
|
"systems": "systems_2"
|
||||||
|
@ -115,6 +150,24 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"flake-utils_3": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems_3"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1694529238,
|
||||||
|
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"flakey-profile": {
|
"flakey-profile": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1712898590,
|
"lastModified": 1712898590,
|
||||||
|
@ -198,21 +251,6 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lib": {
|
|
||||||
"locked": {
|
|
||||||
"dir": "lib",
|
|
||||||
"lastModified": 1728413071,
|
|
||||||
"narHash": "sha256-5WHctvz0R9N9oBGda1ROuJ/V/m/tZsEXloGWDrd9G7Y=",
|
|
||||||
"rev": "866b8902c975a1aaec547445976dd39d60def4ab",
|
|
||||||
"type": "tarball",
|
|
||||||
"url": "https://git.auxolotl.org/api/v1/repos/auxolotl/labs/archive/866b8902c975a1aaec547445976dd39d60def4ab.tar.gz?rev=866b8902c975a1aaec547445976dd39d60def4ab"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"dir": "lib",
|
|
||||||
"type": "tarball",
|
|
||||||
"url": "https://git.auxolotl.org/auxolotl/labs/archive/main.tar.gz"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"lix": {
|
"lix": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -379,12 +417,13 @@
|
||||||
"auto-cpufreq": "auto-cpufreq",
|
"auto-cpufreq": "auto-cpufreq",
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
"lanzaboote": "lanzaboote",
|
"lanzaboote": "lanzaboote",
|
||||||
"lib": "lib",
|
|
||||||
"lix-module": "lix-module",
|
"lix-module": "lix-module",
|
||||||
"nix-flatpak": "nix-flatpak",
|
"nix-flatpak": "nix-flatpak",
|
||||||
"nixos-hardware": "nixos-hardware",
|
"nixos-hardware": "nixos-hardware",
|
||||||
"nixpkgs": "nixpkgs_2",
|
"nixpkgs": "nixpkgs_2",
|
||||||
"nixpkgs-unstable": "nixpkgs-unstable"
|
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||||
|
"snowfall-lib": "snowfall-lib",
|
||||||
|
"treefmt-nix": "treefmt-nix"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rust-overlay": {
|
"rust-overlay": {
|
||||||
|
@ -412,6 +451,28 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"snowfall-lib": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat_2",
|
||||||
|
"flake-utils-plus": "flake-utils-plus",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1732544274,
|
||||||
|
"narHash": "sha256-qvzLIxuqukl0nxpXHEh5+iw1BLeLxYOwRC0+7cFUbPo=",
|
||||||
|
"owner": "snowfallorg",
|
||||||
|
"repo": "lib",
|
||||||
|
"rev": "cfeacd055545ab5de0ecfd41e09324dcd8fb2bbb",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "snowfallorg",
|
||||||
|
"repo": "lib",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"systems": {
|
"systems": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1681028828,
|
"lastModified": 1681028828,
|
||||||
|
@ -441,6 +502,41 @@
|
||||||
"repo": "default",
|
"repo": "default",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"systems_3": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"treefmt-nix": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1733222881,
|
||||||
|
"narHash": "sha256-JIPcz1PrpXUCbaccEnrcUS8jjEb/1vJbZz5KkobyFdM=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "treefmt-nix",
|
||||||
|
"rev": "49717b5af6f80172275d47a418c9719a31a78b53",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "treefmt-nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
|
138
flake.nix
138
flake.nix
|
@ -25,9 +25,6 @@
|
||||||
# SecureBoot support
|
# SecureBoot support
|
||||||
lanzaboote.url = "github:nix-community/lanzaboote/v0.4.1";
|
lanzaboote.url = "github:nix-community/lanzaboote/v0.4.1";
|
||||||
|
|
||||||
# Aux lib
|
|
||||||
lib.url = "https://git.auxolotl.org/auxolotl/labs/archive/main.tar.gz?dir=lib";
|
|
||||||
|
|
||||||
# Use Lix in place of Nix.
|
# Use Lix in place of Nix.
|
||||||
# If you'd rather use regular Nix, remove `lix-module.nixosModules.default` from the `modules` section below.
|
# If you'd rather use regular Nix, remove `lix-module.nixosModules.default` from the `modules` section below.
|
||||||
# To learn more about Lix, see https://lix.systems/
|
# To learn more about Lix, see https://lix.systems/
|
||||||
|
@ -41,97 +38,110 @@
|
||||||
|
|
||||||
# NixOS hardware quirks
|
# NixOS hardware quirks
|
||||||
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
|
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
|
||||||
|
|
||||||
|
# Snowfall - a unified configuration manager for NixOS
|
||||||
|
# Quickstart guide: https://snowfall.org/guides/lib/quickstart/
|
||||||
|
# Jake's reference config: https://github.com/jakehamilton/config
|
||||||
|
snowfall-lib = {
|
||||||
|
url = "github:snowfallorg/lib";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
|
treefmt-nix = {
|
||||||
|
url = "github:numtide/treefmt-nix";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
inputs@{
|
inputs:
|
||||||
auto-cpufreq,
|
|
||||||
home-manager,
|
|
||||||
lanzaboote,
|
|
||||||
lix-module,
|
|
||||||
nix-flatpak,
|
|
||||||
nixos-hardware,
|
|
||||||
nixpkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
let
|
let
|
||||||
forAllSystems =
|
lib = inputs.snowfall-lib.mkLib {
|
||||||
function:
|
inherit inputs;
|
||||||
nixpkgs.lib.genAttrs [
|
|
||||||
"x86_64-linux"
|
|
||||||
"aarch64-linux"
|
|
||||||
] (system: function nixpkgs.legacyPackages.${system});
|
|
||||||
|
|
||||||
# Define shared modules and imports
|
# Root dir for flake.nix
|
||||||
defaultModules = [
|
src = ./.;
|
||||||
./modules/autoimport.nix
|
|
||||||
auto-cpufreq.nixosModules.default
|
# Configure Snowfall
|
||||||
lix-module.nixosModules.default
|
snowfall = {
|
||||||
lanzaboote.nixosModules.lanzaboote
|
# Choose a namespace to use for your flake's packages, library, and overlays.
|
||||||
nix-flatpak.nixosModules.nix-flatpak
|
namespace = "Sapana";
|
||||||
home-manager.nixosModules.home-manager
|
|
||||||
{
|
# Add flake metadata that can be processed by tools like Snowfall Frost.
|
||||||
_module.args = {
|
meta = {
|
||||||
inherit inputs;
|
# A slug to use in documentation when displaying things like file paths.
|
||||||
|
name = "aires-flake";
|
||||||
|
|
||||||
|
# A title to show for your flake, typically the name.
|
||||||
|
title = "Aires' Flake";
|
||||||
};
|
};
|
||||||
home-manager = {
|
};
|
||||||
/*
|
};
|
||||||
When running, Home Manager will use the global package cache.
|
|
||||||
It will also back up any files that it would otherwise overwrite.
|
|
||||||
The originals will have the extension shown below.
|
|
||||||
*/
|
|
||||||
useGlobalPkgs = true;
|
|
||||||
useUserPackages = true;
|
|
||||||
backupFileExtension = "home-manager-backup";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
in
|
in
|
||||||
{
|
lib.mkFlake {
|
||||||
formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
|
# Configure Nix channels
|
||||||
|
channels-config.allowUnfree = true;
|
||||||
|
|
||||||
nixosConfigurations = {
|
# Define systems
|
||||||
|
systems = {
|
||||||
|
# Modules to import for all systems
|
||||||
|
modules.nixos = with inputs; [
|
||||||
|
./modules/autoimport.nix
|
||||||
|
auto-cpufreq.nixosModules.default
|
||||||
|
lix-module.nixosModules.default
|
||||||
|
lanzaboote.nixosModules.lanzaboote
|
||||||
|
nix-flatpak.nixosModules.nix-flatpak
|
||||||
|
home-manager.nixosModules.home-manager
|
||||||
|
{
|
||||||
|
_module.args = {
|
||||||
|
inherit inputs;
|
||||||
|
};
|
||||||
|
home-manager = {
|
||||||
|
/*
|
||||||
|
When running, Home Manager will use the global package cache.
|
||||||
|
It will also back up any files that it would otherwise overwrite.
|
||||||
|
The originals will have the extension shown below.
|
||||||
|
*/
|
||||||
|
useGlobalPkgs = true;
|
||||||
|
useUserPackages = true;
|
||||||
|
backupFileExtension = "home-manager-backup";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
Dimaga = nixpkgs.lib.nixosSystem {
|
# Individual host configurations
|
||||||
system = "x86_64-linux";
|
hosts = {
|
||||||
modules = defaultModules ++ [
|
Dimaga.modules = with inputs; [
|
||||||
nixos-hardware.nixosModules.common-cpu-intel
|
nixos-hardware.nixosModules.common-cpu-intel
|
||||||
./hosts/Dimaga
|
./hosts/Dimaga
|
||||||
];
|
];
|
||||||
};
|
|
||||||
|
|
||||||
Hevana = nixpkgs.lib.nixosSystem {
|
Hevana.modules = with inputs; [
|
||||||
system = "x86_64-linux";
|
|
||||||
modules = defaultModules ++ [
|
|
||||||
nixos-hardware.nixosModules.common-cpu-amd-pstate
|
nixos-hardware.nixosModules.common-cpu-amd-pstate
|
||||||
nixos-hardware.nixosModules.common-gpu-amd
|
nixos-hardware.nixosModules.common-gpu-amd
|
||||||
./hosts/Hevana
|
./hosts/Hevana
|
||||||
];
|
];
|
||||||
};
|
|
||||||
|
|
||||||
Khanda = nixpkgs.lib.nixosSystem {
|
Khanda.modules = with inputs; [
|
||||||
system = "x86_64-linux";
|
|
||||||
modules = defaultModules ++ [
|
|
||||||
nixos-hardware.nixosModules.microsoft-surface-pro-9
|
nixos-hardware.nixosModules.microsoft-surface-pro-9
|
||||||
./hosts/Khanda
|
./hosts/Khanda
|
||||||
];
|
];
|
||||||
};
|
|
||||||
|
|
||||||
Pihole = nixpkgs.lib.nixosSystem {
|
Pihole.modules = with inputs; [
|
||||||
system = "aarch64-linux";
|
|
||||||
modules = defaultModules ++ [
|
|
||||||
nixos-hardware.nixosModules.raspberry-pi-4
|
nixos-hardware.nixosModules.raspberry-pi-4
|
||||||
./hosts/Pihole
|
./hosts/Pihole
|
||||||
];
|
];
|
||||||
};
|
|
||||||
|
|
||||||
Shura = nixpkgs.lib.nixosSystem {
|
Shura.modules = with inputs; [
|
||||||
system = "x86_64-linux";
|
|
||||||
modules = defaultModules ++ [
|
|
||||||
nixos-hardware.nixosModules.lenovo-legion-16arha7
|
nixos-hardware.nixosModules.lenovo-legion-16arha7
|
||||||
./hosts/Shura
|
./hosts/Shura
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Use treefmt to format project repo
|
||||||
|
outputs-builder = channels: {
|
||||||
|
formatter = (inputs.treefmt-nix.lib.evalModule channels.nixpkgs ./treefmt.nix).config.build.wrapper;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,16 +6,18 @@
|
||||||
}:
|
}:
|
||||||
|
|
||||||
{
|
{
|
||||||
# Install base packages
|
aux.system = {
|
||||||
aux.system.packages = with pkgs; [
|
# Install base packages
|
||||||
fastfetch # Show a neat system statistics screen when opening a terminal
|
packages = with pkgs; [
|
||||||
htop # System monitor
|
fastfetch # Show a neat system statistics screen when opening a terminal
|
||||||
lm_sensors # System temperature monitoring
|
htop # System monitor
|
||||||
zellij # Terminal multiplexer
|
lm_sensors # System temperature monitoring
|
||||||
];
|
zellij # Terminal multiplexer
|
||||||
|
];
|
||||||
|
|
||||||
# Install the nos helper script
|
# Install the nos helper script
|
||||||
aux.system.nixos-operations-script.enable = true;
|
nixos-operations-script.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
# Allow packages from the unstable repo by using 'pkgs.unstable'
|
# Allow packages from the unstable repo by using 'pkgs.unstable'
|
||||||
nixpkgs.overlays = [
|
nixpkgs.overlays = [
|
||||||
|
|
15
treefmt.nix
Normal file
15
treefmt.nix
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
# Configure formatter for .nix and other repo files
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
projectRootFile = "flake.nix";
|
||||||
|
|
||||||
|
programs = {
|
||||||
|
beautysh.enable = true;
|
||||||
|
nixfmt = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.nixfmt-rfc-style;
|
||||||
|
};
|
||||||
|
prettier.enable = true;
|
||||||
|
yamlfmt.enable = true;
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue