Skip to content

Commit

Permalink
refactor: Clean up flake.nix and reorganize Nix-related files
Browse files Browse the repository at this point in the history
- Update project description to "topos-cli"
- Reorganize overlays and services into a dedicated 'nix' directory
- Simplify service configurations:
  - Remove commented-out Kafka settings
  - Standardize service naming (e.g., "ollama" instead of "ollama1")
- Update TOPOS_CONFIG_PATH to use ~/.topos instead of ~/.config/topos
- Remove unused tkinter overlay
- Adjust data directory paths for consistency
- Clean up comments and whitespace

These changes improve the maintainability of our Nix configuration and
provide a cleaner structure for future development.
  • Loading branch information
G-structure committed Oct 16, 2024
1 parent 63d14e5 commit c77d7a0
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 61 deletions.
35 changes: 10 additions & 25 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
description = "topos";
description = "topos-cli";

inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
Expand All @@ -26,7 +26,7 @@
toposPoetryEnv = final.callPackage toposPoetryEnv { };
pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [
(python-final: python-prev: {
pystray = python-final.callPackage ./overlays/pystray/default.nix { };
pystray = python-final.callPackage ./nix/overlays/pystray/default.nix { };
})
];
})
Expand Down Expand Up @@ -78,7 +78,7 @@
# if one is not already set in the user's .config directory.
toposSetupHook = ''
export $(cat ${envFile} | xargs)
export TOPOS_CONFIG_PATH="$HOME/.config/topos/config.yaml"
export TOPOS_CONFIG_PATH="$HOME/.topos/config.yaml"
mkdir -p "$(dirname "$TOPOS_CONFIG_PATH")"
if [ ! -f "$TOPOS_CONFIG_PATH" ]; then
echo "Creating new config file at $TOPOS_CONFIG_PATH"
Expand All @@ -98,18 +98,19 @@
process-compose."services-flake-topos" = { config, ... }: {
imports = [
inputs.services-flake.processComposeModules.default
(import ./topos-service.nix { inherit pkgs lib config; topos = self'.packages.topos; })
(import ./nix/services/topos-service.nix { inherit pkgs lib config; topos = self'.packages.topos; })
];
services = let dataDirBase = "$HOME/.services-flake/llm"; in {
services = let dataDirBase = "$HOME/.topos"; in {
# Backend service to perform inference on LLM models
ollama."ollama1" = {
ollama."ollama" = {
enable = true;

# The models are usually huge, downloading them in every project
# directory can lead to a lot of duplication. Change here to a
# directory where the Ollama models can be stored and shared across
# projects.
dataDir = "${dataDirBase}/ollama1";

# dataDir = "${dataDirBase}/ollama";

# Define the models to download when our app starts
#
Expand All @@ -125,7 +126,7 @@
package = pkgs.postgresql_16.withPackages (p: [ p.pgvector ]);
port = 5432;
listen_addresses = "127.0.0.1";

# dataDir = "${dataDirBase}/pg";
initialDatabases = [
{ name = "${envVars.POSTGRES_DB}"; }
];
Expand Down Expand Up @@ -172,27 +173,11 @@
apache-kafka."kafka" = {
enable = true;
port = 9092;
# dataDir = "${dataDirBase}/kafka";
settings = {
"offsets.topic.replication.factor" = 1;
"zookeeper.connect" = [ "localhost:2181" ];
};
# settings = {
# "broker.id" = 1;
# "log.dirs" = [ "/tmp/kraft-combined-logs/server-1" ];
# "listeners" = [ "PLAINTEXT://localhost:9092" "CONTROLLER://localhost:9091" ];
# "listener.security.protocol.map" = "CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT";
# "advertised.listeners" = "PLAINTEXT://localhost:9092";
# "controller.quorum.voters" = "1@localhost:9091";
# "controller.listener.names" = "CONTROLLER";
# "process.roles" = "broker,controller";
# "node.id" = 1;
# "offsets.topic.replication.factor" = 1;
# "transaction.state.log.replication.factor" = 1;
# "transaction.state.log.min.isr" = 1;
# "auto.create.topics.enable" = true;
# "num.partitions" = 1;
# };
# clusterId = "$(${pkgs.apacheKafka}/bin/kafka-storage.sh random-uuid)";
formatLogDirs = true;
formatLogDirsIgnoreFormatted = true;
jvmOptions = [
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
36 changes: 0 additions & 36 deletions overlays/tkinter/default.nix

This file was deleted.

0 comments on commit c77d7a0

Please sign in to comment.