ATproto Nix User Repo

refactor: remove cfg-if-fix overlay

-35
modules/blacksky/community.nix
··· 1 - # This module configures the Blacksky Community web client service. 2 - 3 - { config, lib, pkgs, ... }: 4 - 5 - with lib; 6 - 7 - { 8 - options.blacksky.community = { 9 - enable = mkEnableOption "Blacksky Community web client service."; 10 - port = mkOption { 11 - type = types.port; 12 - default = 80; 13 - description = "Port for the Blacksky Community web client."; 14 - }; 15 - hostName = mkOption { 16 - type = types.str; 17 - default = "localhost"; 18 - description = "Host name for the Blacksky Community web client."; 19 - }; 20 - }; 21 - 22 - config = mkIf config.blacksky.community.enable { 23 - services.nginx = { 24 - enable = true; 25 - virtualHosts.${config.blacksky.community.hostName} = { 26 - enable = true; 27 - root = "${pkgs.blacksky.community}/share/nginx/html"; 28 - listen = [{ 29 - addr = "127.00.1"; 30 - port = config.blacksky.community.port; 31 - }]; 32 - }; 33 - }; 34 - }; 35 - }
-31
modules/blacksky/default.nix
··· 1 - # This module aggregates all Blacksky AT Protocol services. 2 - 3 - { config, lib, pkgs, ... }: 4 - 5 - with lib; 6 - 7 - { 8 - imports = [ 9 - ./rsky/pds.nix 10 - ./rsky/relay.nix 11 - ./rsky/feedgen.nix 12 - ./rsky/satnav.nix 13 - ./rsky/firehose.nix 14 - ./rsky/jetstream-subscriber.nix 15 - ./rsky/labeler.nix 16 - # Individual service modules will be imported here 17 - ]; 18 - 19 - options.blacksky = { 20 - enable = mkEnableOption "Blacksky AT Protocol services"; 21 - }; 22 - 23 - config = mkIf config.blacksky.enable { 24 - blacksky.pds.enable = false; 25 - blacksky.feedgen.enable = false; 26 - blacksky.satnav.enable = false; 27 - blacksky.firehose.enable = false; 28 - blacksky.jetstream-subscriber.enable = false; 29 - blacksky.labeler.enable = false; 30 - }; 31 - }
-32
modules/blacksky/rsky/feedgen.nix
··· 1 - # This module configures the Blacksky Feed Generator service. 2 - 3 - { config, lib, pkgs, ... }: 4 - 5 - with lib; 6 - 7 - { 8 - options.blacksky.feedgen = { 9 - enable = mkEnableOption "Blacksky Feed Generator service."; 10 - port = mkOption { 11 - type = types.port; 12 - default = 8001; 13 - description = "Port for the Blacksky Feed Generator service."; 14 - }; 15 - # Add other options specific to the feedgen service 16 - }; 17 - 18 - config = mkIf config.blacksky.feedgen.enable { 19 - systemd.services.blacksky-feedgen = { 20 - description = "Blacksky Feed Generator service"; 21 - after = [ "network.target" ]; 22 - wantedBy = [ "multi-user.target" ]; 23 - serviceConfig = { 24 - ExecStart = "${pkgs.blacksky.feedgen}/bin/rsky-feedgen"; 25 - Restart = "always"; 26 - DynamicUser = true; 27 - StateDirectory = "blacksky-feedgen"; 28 - # Add other environment variables or arguments as needed by rsky-feedgen 29 - }; 30 - }; 31 - }; 32 - }
-32
modules/blacksky/rsky/firehose.nix
··· 1 - # This module configures the Blacksky Firehose service. 2 - 3 - { config, lib, pkgs, ... }: 4 - 5 - with lib; 6 - 7 - { 8 - options.blacksky.firehose = { 9 - enable = mkEnableOption "Blacksky Firehose service."; 10 - port = mkOption { 11 - type = types.port; 12 - default = 8003; 13 - description = "Port for the Blacksky Firehose service."; 14 - }; 15 - # Add other options specific to the firehose service 16 - }; 17 - 18 - config = mkIf config.blacksky.firehose.enable { 19 - systemd.services.blacksky-firehose = { 20 - description = "Blacksky Firehose service"; 21 - after = [ "network.target" ]; 22 - wantedBy = [ "multi-user.target" ]; 23 - serviceConfig = { 24 - ExecStart = "${pkgs.blacksky.firehose}/bin/rsky-firehose"; 25 - Restart = "always"; 26 - DynamicUser = true; 27 - StateDirectory = "blacksky-firehose"; 28 - # Add other environment variables or arguments as needed by rsky-firehose 29 - }; 30 - }; 31 - }; 32 - }
-32
modules/blacksky/rsky/jetstream-subscriber.nix
··· 1 - # This module configures the Blacksky Jetstream Subscriber service. 2 - 3 - { config, lib, pkgs, ... }: 4 - 5 - with lib; 6 - 7 - { 8 - options.blacksky.jetstreamSubscriber = { 9 - enable = mkEnableOption "Blacksky Jetstream Subscriber service."; 10 - port = mkOption { 11 - type = types.port; 12 - default = 8004; 13 - description = "Port for the Blacksky Jetstream Subscriber service."; 14 - }; 15 - # Add other options specific to the jetstream subscriber service 16 - }; 17 - 18 - config = mkIf config.blacksky.jetstreamSubscriber.enable { 19 - systemd.services.blacksky-jetstream-subscriber = { 20 - description = "Blacksky Jetstream Subscriber service"; 21 - after = [ "network.target" ]; 22 - wantedBy = [ "multi-user.target" ]; 23 - serviceConfig = { 24 - ExecStart = "${pkgs.blacksky.jetstreamSubscriber}/bin/rsky-jetstream-subscriber"; 25 - Restart = "always"; 26 - DynamicUser = true; 27 - StateDirectory = "blacksky-jetstream-subscriber"; 28 - # Add other environment variables or arguments as needed by rsky-jetstream-subscriber 29 - }; 30 - }; 31 - }; 32 - }
-32
modules/blacksky/rsky/labeler.nix
··· 1 - # This module configures the Blacksky Labeler service. 2 - 3 - { config, lib, pkgs, ... }: 4 - 5 - with lib; 6 - 7 - { 8 - options.blacksky.labeler = { 9 - enable = mkEnableOption "Blacksky Labeler service."; 10 - port = mkOption { 11 - type = types.port; 12 - default = 8005; 13 - description = "Port for the Blacksky Labeler service."; 14 - }; 15 - # Add other options specific to the labeler service 16 - }; 17 - 18 - config = mkIf config.blacksky.labeler.enable { 19 - systemd.services.blacksky-labeler = { 20 - description = "Blacksky Labeler service"; 21 - after = [ "network.target" ]; 22 - wantedBy = [ "multi-user.target" ]; 23 - serviceConfig = { 24 - ExecStart = "${pkgs.blacksky.labeler}/bin/rsky-labeler"; 25 - Restart = "always"; 26 - DynamicUser = true; 27 - StateDirectory = "blacksky-labeler"; 28 - # Add other environment variables or arguments as needed by rsky-labeler 29 - }; 30 - }; 31 - }; 32 - }
-38
modules/blacksky/rsky/pds.nix
··· 1 - # This module configures the Blacksky PDS service. 2 - 3 - { config, lib, pkgs, ... }: 4 - 5 - with lib; 6 - 7 - { 8 - options.blacksky.pds = { 9 - enable = mkEnableOption "Blacksky PDS service."; 10 - port = mkOption { 11 - type = types.port; 12 - default = 3000; 13 - description = "Port for the Blacksky PDS service."; 14 - }; 15 - dataDir = mkOption { 16 - type = types.str; 17 - default = "/var/lib/blacksky-pds"; 18 - description = "Data directory for the Blacksky PDS service."; 19 - }; 20 - }; 21 - 22 - config = mkIf config.blacksky.pds.enable { 23 - systemd.services.blacksky-pds = { 24 - description = "Blacksky PDS service"; 25 - after = [ "network.target" ]; 26 - wantedBy = [ "multi-user.target" ]; 27 - serviceConfig = { 28 - ExecStart = "${pkgs.blacksky.pds}/bin/rsky-pds"; 29 - Restart = "always"; 30 - DynamicUser = true; 31 - # Ensure data directory exists and has correct permissions 32 - preStart = '' 33 - mkdir -p ${config.blacksky.pds.dataDir} 34 - chown -R blacksky-pds:blacksky-pds ${config.blacksky.pds.dataDir} 35 - ''; 36 - }; 37 - }; 38 - }
-32
modules/blacksky/rsky/relay.nix
··· 1 - # This module configures the Blacksky Relay service. 2 - 3 - { config, lib, pkgs, ... }: 4 - 5 - with lib; 6 - 7 - { 8 - options.blacksky.relay = { 9 - enable = mkEnableOption "Blacksky Relay service."; 10 - port = mkOption { 11 - type = types.port; 12 - default = 8000; 13 - description = "Port for the Blacksky Relay service."; 14 - }; 15 - # Add other options specific to the relay service, e.g., certs, private_key 16 - }; 17 - 18 - config = mkIf config.blacksky.relay.enable { 19 - systemd.services.blacksky-relay = { 20 - description = "Blacksky Relay service"; 21 - after = [ "network.target" ]; 22 - wantedBy = [ "multi-user.target" ]; 23 - serviceConfig = { 24 - ExecStart = "${pkgs.blacksky.relay}/bin/rsky-relay"; 25 - Restart = "always"; 26 - DynamicUser = true; 27 - StateDirectory = "blacksky-relay"; 28 - # Add other environment variables or arguments as needed by rsky-relay 29 - }; 30 - }; 31 - }; 32 - }
-33
modules/blacksky/rsky/satnav.nix
··· 1 - # This module configures the Blacksky Satnav service. 2 - 3 - { config, lib, pkgs, ... }: 4 - 5 - with lib; 6 - 7 - { 8 - options.blacksky.satnav = { 9 - enable = mkEnableOption "Blacksky Satnav service."; 10 - port = mkOption { 11 - type = types.port; 12 - default = 8002; 13 - description = "Port for the Blacksky Satnav service."; 14 - }; 15 - # Satnav is a web UI, so it might need a web server configuration 16 - # For simplicity, we'll just run the binary directly for now. 17 - }; 18 - 19 - config = mkIf config.blacksky.satnav.enable { 20 - systemd.services.blacksky-satnav = { 21 - description = "Blacksky Satnav service"; 22 - after = [ "network.target" ]; 23 - wantedBy = [ "multi-user.target" ]; 24 - serviceConfig = { 25 - ExecStart = "${pkgs.blacksky.satnav}/bin/rsky-satnav"; 26 - Restart = "always"; 27 - DynamicUser = true; 28 - StateDirectory = "blacksky-satnav"; 29 - # Add other environment variables or arguments as needed by rsky-satnav 30 - }; 31 - }; 32 - }; 33 - }
+1 -3
modules/default.nix
··· 1 1 { 2 2 imports = [ 3 - ./blacksky 4 - ./microcosm 5 3 ]; 6 - } 4 + }
-55
modules/microcosm/constellation.nix
··· 1 - # This module configures the Microcosm Constellation service. 2 - 3 - { config, lib, pkgs, ... }: 4 - 5 - with lib; 6 - 7 - let 8 - cfg = config.services.microcosm-constellation; 9 - microcosmPkgs = pkgs.microcosm; # Access the packages we built 10 - in 11 - { 12 - options.services.microcosm-constellation = { 13 - enable = mkEnableOption "Microcosm Constellation service."; 14 - package = mkOption { 15 - type = types.package; 16 - default = microcosmPkgs.constellation; 17 - description = "The Microcosm Constellation package to use."; 18 - }; 19 - port = mkOption { 20 - type = types.port; 21 - default = 8080; # Example default port 22 - description = "The port on which the Constellation service listens."; 23 - }; 24 - jetstream = mkOption { 25 - type = types.str; 26 - description = "Jetstream server to connect to."; 27 - }; 28 - data = mkOption { 29 - type = types.str; 30 - default = "/var/lib/microcosm-constellation"; 31 - description = "Where to store data on disk."; 32 - }; 33 - backend = mkOption { 34 - type = types.str; 35 - default = "memory"; 36 - description = "Storage backend to use."; 37 - }; 38 - # Add other service-specific options here (e.g., databaseUrl, logLevel) 39 - }; 40 - 41 - config = mkIf cfg.enable { 42 - systemd.services.microcosm-constellation = { 43 - description = "Microcosm Constellation Service"; 44 - after = [ "network.target" ]; 45 - wantedBy = [ "multi-user.target" ]; 46 - serviceConfig = { 47 - ExecStart = "${cfg.package}/bin/main --jetstream ${cfg.jetstream} --data ${cfg.data} --backend ${cfg.backend}"; 48 - Restart = "always"; 49 - DynamicUser = true; 50 - StateDirectory = "microcosm-constellation"; 51 - # Add other systemd options as needed (e.g., working directory, environment variables) 52 - }; 53 - }; 54 - }; 55 - }
-17
modules/microcosm/default.nix
··· 1 - # This module aggregates all Microcosm services. 2 - 3 - { pkgs, ... }: 4 - 5 - { 6 - imports = [ 7 - ./constellation.nix 8 - ./spacedust.nix 9 - ./slingshot.nix 10 - ./ufos.nix 11 - ./jetstream.nix 12 - ./who-am-i.nix 13 - ./quasar.nix 14 - ./pocket.nix 15 - ./reflector.nix 16 - ]; 17 - }
-42
modules/microcosm/jetstream.nix
··· 1 - # This module configures the Microcosm Jetstream service. 2 - 3 - { config, lib, pkgs, ... }: 4 - 5 - with lib; 6 - 7 - let 8 - cfg = config.services.microcosm-jetstream; 9 - microcosmPkgs = pkgs.microcosm; 10 - in 11 - { 12 - options.services.microcosm-jetstream = { 13 - enable = mkEnableOption "Microcosm Jetstream service."; 14 - package = mkOption { 15 - type = types.package; 16 - default = microcosmPkgs.jetstream; 17 - description = "The Microcosm Jetstream package to use."; 18 - }; 19 - # Add other service-specific options here 20 - }; 21 - 22 - config = mkIf cfg.enable { 23 - systemd.services.microcosm-jetstream = { 24 - description = "Microcosm Jetstream Service"; 25 - after = [ "network.target" ]; 26 - wantedBy = [ "multi-user.target" ]; 27 - serviceConfig = { 28 - ExecStart = "${cfg.package}/bin/jetstream"; # This command likely needs adjustment 29 - Restart = "always"; 30 - User = "microcosm-jetstream"; 31 - Group = "microcosm-jetstream"; 32 - }; 33 - users.users.microcosm-jetstream = { 34 - isSystem = true; 35 - group = "microcosm-jetstream"; 36 - }; 37 - users.groups.microcosm-jetstream = { 38 - isSystem = true; 39 - }; 40 - }; 41 - }; 42 - }
-43
modules/microcosm/pocket.nix
··· 1 - # This module configures the Microcosm Pocket service. 2 - 3 - { config, lib, pkgs, ... }: 4 - 5 - with lib; 6 - 7 - let 8 - cfg = config.services.microcosm-pocket; 9 - microcosmPkgs = pkgs.microcosm; 10 - in 11 - { 12 - options.services.microcosm-pocket = { 13 - enable = mkEnableOption "Microcosm Pocket service."; 14 - package = mkOption { 15 - type = types.package; 16 - default = microcosmPkgs.pocket; 17 - description = "The Microcosm Pocket package to use."; 18 - }; 19 - db = mkOption { 20 - type = types.str; 21 - description = "path to the sqlite db file"; 22 - }; 23 - domain = mkOption { 24 - type = types.str; 25 - description = "the domain for serving a did doc"; 26 - }; 27 - # Add other service-specific options here 28 - }; 29 - 30 - config = mkIf cfg.enable { 31 - systemd.services.microcosm-pocket = { 32 - description = "Microcosm Pocket Service"; 33 - after = [ "network.target" ]; 34 - wantedBy = [ "multi-user.target" ]; 35 - serviceConfig = { 36 - ExecStart = "${cfg.package}/bin/pocket --db ${cfg.db} --domain ${cfg.domain}"; 37 - Restart = "always"; 38 - DynamicUser = true; 39 - StateDirectory = "microcosm-pocket"; 40 - }; 41 - }; 42 - }; 43 - }
-35
modules/microcosm/quasar.nix
··· 1 - # This module configures the Microcosm Quasar service. 2 - 3 - { config, lib, pkgs, ... }: 4 - 5 - with lib; 6 - 7 - let 8 - cfg = config.services.microcosm-quasar; 9 - microcosmPkgs = pkgs.microcosm; 10 - in 11 - { 12 - options.services.microcosm-quasar = { 13 - enable = mkEnableOption "Microcosm Quasar service."; 14 - package = mkOption { 15 - type = types.package; 16 - default = microcosmPkgs.quasar; 17 - description = "The Microcosm Quasar package to use."; 18 - }; 19 - # Add other service-specific options here 20 - }; 21 - 22 - config = mkIf cfg.enable { 23 - systemd.services.microcosm-quasar = { 24 - description = "Microcosm Quasar Service"; 25 - after = [ "network.target" ]; 26 - wantedBy = [ "multi-user.target" ]; 27 - serviceConfig = { 28 - ExecStart = "${cfg.package}/bin/quasar"; 29 - Restart = "always"; 30 - DynamicUser = true; 31 - StateDirectory = "microcosm-quasar"; 32 - }; 33 - }; 34 - }; 35 - }
-51
modules/microcosm/reflector.nix
··· 1 - # This module configures the Microcosm Reflector service. 2 - 3 - { config, lib, pkgs, ... }: 4 - 5 - with lib; 6 - 7 - let 8 - cfg = config.services.microcosm-reflector; 9 - microcosmPkgs = pkgs.microcosm; 10 - in 11 - { 12 - options.services.microcosm-reflector = { 13 - enable = mkEnableOption "Microcosm Reflector service."; 14 - package = mkOption { 15 - type = types.package; 16 - default = microcosmPkgs.reflector; 17 - description = "The Microcosm Reflector package to use."; 18 - }; 19 - id = mkOption { 20 - type = types.str; 21 - description = "The DID document service ID to serve"; 22 - }; 23 - type = mkOption { 24 - type = types.str; 25 - description = "Service type"; 26 - }; 27 - serviceEndpoint = mkOption { 28 - type = types.str; 29 - description = "The HTTPS endpoint for the service"; 30 - }; 31 - domain = mkOption { 32 - type = types.str; 33 - description = "The parent domain"; 34 - }; 35 - # Add other service-specific options here 36 - }; 37 - 38 - config = mkIf cfg.enable { 39 - systemd.services.microcosm-reflector = { 40 - description = "Microcosm Reflector Service"; 41 - after = [ "network.target" ]; 42 - wantedBy = [ "multi-user.target" ]; 43 - serviceConfig = { 44 - ExecStart = "${cfg.package}/bin/reflector --id ${cfg.id} --type ${cfg.type} --service-endpoint ${cfg.serviceEndpoint} --domain ${cfg.domain}"; 45 - Restart = "always"; 46 - DynamicUser = true; 47 - StateDirectory = "microcosm-reflector"; 48 - }; 49 - }; 50 - }; 51 - }
-55
modules/microcosm/slingshot.nix
··· 1 - # This module configures the Microcosm Slingshot service. 2 - 3 - { config, lib, pkgs, ... }: 4 - 5 - with lib; 6 - 7 - let 8 - cfg = config.services.microcosm-slingshot; 9 - microcosmPkgs = pkgs.microcosm; 10 - in 11 - { 12 - options.services.microcosm-slingshot = { 13 - enable = mkEnableOption "Microcosm Slingshot service."; 14 - package = mkOption { 15 - type = types.package; 16 - default = microcosmPkgs.slingshot; 17 - description = "The Microcosm Slingshot package to use."; 18 - }; 19 - jetstream = mkOption { 20 - type = types.str; 21 - description = "Jetstream server to connect to."; 22 - }; 23 - cacheDir = mkOption { 24 - type = types.str; 25 - description = "where to keep disk caches"; 26 - }; 27 - domain = mkOption { 28 - type = types.str; 29 - description = "the domain pointing to this server"; 30 - }; 31 - acmeContact = mkOption { 32 - type = types.str; 33 - description = "email address for letsencrypt contact"; 34 - }; 35 - certs = mkOption { 36 - type = types.str; 37 - description = "a location to cache acme https certs"; 38 - }; 39 - # Add other service-specific options here 40 - }; 41 - 42 - config = mkIf cfg.enable { 43 - systemd.services.microcosm-slingshot = { 44 - description = "Microcosm Slingshot Service"; 45 - after = [ "network.target" ]; 46 - wantedBy = [ "multi-user.target" ]; 47 - serviceConfig = { 48 - ExecStart = "${cfg.package}/bin/slingshot --jetstream ${cfg.jetstream} --cache-dir ${cfg.cacheDir} --domain ${cfg.domain} --acme-contact ${cfg.acmeContact} --certs ${cfg.certs}"; 49 - Restart = "always"; 50 - DynamicUser = true; 51 - StateDirectory = "microcosm-slingshot"; 52 - }; 53 - }; 54 - }; 55 - }
-44
modules/microcosm/spacedust.nix
··· 1 - # This module configures the Microcosm Spacedust service. 2 - 3 - { config, lib, pkgs, ... }: 4 - 5 - with lib; 6 - 7 - let 8 - cfg = config.services.microcosm-spacedust; 9 - microcosmPkgs = pkgs.microcosm; 10 - in 11 - { 12 - options.services.microcosm-spacedust = { 13 - enable = mkEnableOption "Microcosm Spacedust service."; 14 - package = mkOption { 15 - type = types.package; 16 - default = microcosmPkgs.spacedust; 17 - description = "The Microcosm Spacedust package to use."; 18 - }; 19 - jetstream = mkOption { 20 - type = types.str; 21 - description = "Jetstream server to connect to."; 22 - }; 23 - jetstreamNoZstd = mkOption { 24 - type = types.bool; 25 - default = false; 26 - description = "don't request zstd-compressed jetstream events"; 27 - }; 28 - # Add other service-specific options here 29 - }; 30 - 31 - config = mkIf cfg.enable { 32 - systemd.services.microcosm-spacedust = { 33 - description = "Microcosm Spacedust Service"; 34 - after = [ "network.target" ]; 35 - wantedBy = [ "multi-user.target" ]; 36 - serviceConfig = { 37 - ExecStart = "${cfg.package}/bin/spacedust --jetstream ${cfg.jetstream} ${lib.optionalString cfg.jetstreamNoZstd "--jetstream-no-zstd"}"; 38 - Restart = "always"; 39 - DynamicUser = true; 40 - StateDirectory = "microcosm-spacedust"; 41 - }; 42 - }; 43 - }; 44 - }
-78
modules/microcosm/ufos.nix
··· 1 - # This module configures the Microcosm UFOs service. 2 - 3 - { config, lib, pkgs, ... }: 4 - 5 - with lib; 6 - 7 - let 8 - cfg = config.services.microcosm-ufos; 9 - microcosmPkgs = pkgs.microcosm; 10 - in 11 - { 12 - options.services.microcosm-ufos = { 13 - enable = mkEnableOption "Microcosm UFOs service."; 14 - package = mkOption { 15 - type = types.package; 16 - default = microcosmPkgs.ufos; 17 - description = "The Microcosm UFOs package to use."; 18 - }; 19 - jetstream = mkOption { 20 - type = types.str; 21 - description = "Jetstream server to connect to."; 22 - }; 23 - data = mkOption { 24 - type = types.str; 25 - description = "Location to store persist data to disk"; 26 - }; 27 - jetstreamForce = mkOption { 28 - type = types.bool; 29 - default = false; 30 - description = "allow changing jetstream endpoints"; 31 - }; 32 - jetstreamNoZstd = mkOption { 33 - type = types.bool; 34 - default = false; 35 - description = "don't request zstd-compressed jetstream events"; 36 - }; 37 - pauseWriter = mkOption { 38 - type = types.bool; 39 - default = false; 40 - description = "DEBUG: don't start the jetstream consumer or its write loop"; 41 - }; 42 - backfill = mkOption { 43 - type = types.bool; 44 - default = false; 45 - description = "Adjust runtime settings like background task intervals for efficient backfill"; 46 - }; 47 - pauseRw = mkOption { 48 - type = types.bool; 49 - default = false; 50 - description = "DEBUG: force the rw loop to fall behind by pausing it todo: restore this"; 51 - }; 52 - reroll = mkOption { 53 - type = types.bool; 54 - default = false; 55 - description = "reset the rollup cursor, scrape through missed things in the past (backfill)"; 56 - }; 57 - jetstreamFixture = mkOption { 58 - type = types.bool; 59 - default = false; 60 - description = "DEBUG: interpret jetstream as a file fixture"; 61 - }; 62 - # Add other service-specific options here 63 - }; 64 - 65 - config = mkIf cfg.enable { 66 - systemd.services.microcosm-ufos = { 67 - description = "Microcosm UFOs Service"; 68 - after = [ "network.target" ]; 69 - wantedBy = [ "multi-user.target" ]; 70 - serviceConfig = { 71 - ExecStart = "${cfg.package}/bin/ufos --jetstream ${cfg.jetstream} --data ${cfg.data} ${lib.optionalString cfg.jetstreamForce "--jetstream-force"} ${lib.optionalString cfg.jetstreamNoZstd "--jetstream-no-zstd"} ${lib.optionalString cfg.pauseWriter "--pause-writer"} ${lib.optionalString cfg.backfill "--backfill"} ${lib.optionalString cfg.pauseRw "--pause-rw"} ${lib.optionalString cfg.reroll "--reroll"} ${lib.optionalString cfg.jetstreamFixture "--jetstream-fixture"}"; 72 - Restart = "always"; 73 - DynamicUser = true; 74 - StateDirectory = "microcosm-ufos"; 75 - }; 76 - }; 77 - }; 78 - }
-66
modules/microcosm/who-am-i.nix
··· 1 - # This module configures the Microcosm Who-Am-I service. 2 - 3 - { config, lib, pkgs, ... }: 4 - 5 - with lib; 6 - 7 - let 8 - cfg = config.services.microcosm-who-am-i; 9 - microcosmPkgs = pkgs.microcosm; 10 - in 11 - { 12 - options.services.microcosm-who-am-i = { 13 - enable = mkEnableOption "Microcosm Who-Am-I service."; 14 - package = mkOption { 15 - type = types.package; 16 - default = microcosmPkgs."who-am-i"; 17 - description = "The Microcosm Who-Am-I package to use."; 18 - }; 19 - appSecret = mkOption { 20 - type = types.str; 21 - description = "secret key from which the cookie-signing key is derived"; 22 - }; 23 - oauthPrivateKey = mkOption { 24 - type = types.str; 25 - description = "path to at-oauth private key (PEM pk8 format)"; 26 - }; 27 - jwtPrivateKey = mkOption { 28 - type = types.str; 29 - description = "path to jwt private key (PEM pk8 format)"; 30 - }; 31 - baseUrl = mkOption { 32 - type = types.str; 33 - description = "this server's client-reachable base url, for oauth redirect + jwt check"; 34 - }; 35 - bind = mkOption { 36 - type = types.str; 37 - default = "127.0.0.1:9997"; 38 - description = "host:port to bind to on startup"; 39 - }; 40 - dev = mkOption { 41 - type = types.bool; 42 - default = false; 43 - description = "Enable dev mode"; 44 - }; 45 - allowedHosts = mkOption { 46 - type = types.listOf types.str; 47 - default = []; 48 - description = "Hosts who are allowed to one-click auth"; 49 - }; 50 - # Add other service-specific options here 51 - }; 52 - 53 - config = mkIf cfg.enable { 54 - systemd.services.microcosm-who-am-i = { 55 - description = "Microcosm Who-Am-I Service"; 56 - after = [ "network.target" ]; 57 - wantedBy = [ "multi-user.target" ]; 58 - serviceConfig = { 59 - ExecStart = "${cfg.package}/bin/who-am-i --app-secret ${cfg.appSecret} --oauth-private-key ${cfg.oauthPrivateKey} --jwt-private-key ${cfg.jwtPrivateKey} --base-url ${cfg.baseUrl} --bind ${cfg.bind} ${lib.optionalString cfg.dev "--dev"} ${lib.concatMapStringsSep " " (host: "--allow_host " + host) cfg.allowedHosts}"; 60 - Restart = "always"; 61 - DynamicUser = true; 62 - StateDirectory = "microcosm-who-am-i"; 63 - }; 64 - }; 65 - }; 66 - }
-19
overlays/cfg-if-fix.nix
··· 1 - final: prev: { 2 - vendorCargoDeps = args: 3 - let 4 - previousOverride = args.overrideVendorCargoPackage or (_pkg: drv: drv); 5 - newOverride = pkg: drv: 6 - let 7 - drv' = if pkg.name == "cfg-if" then 8 - drv.overrideAttrs (old: { 9 - unpackPhase = '' 10 - tar -x -z -f $src 11 - ''; 12 - }) 13 - else 14 - drv; 15 - in 16 - previousOverride pkg drv'; 17 - in 18 - prev.vendorCargoDeps (args // { overrideVendorCargoPackage = newOverride; }); 19 - }
-1
overlays/default.nix
··· 1 1 { 2 - cfg-if-fix = import ./cfg-if-fix.nix; 3 2 }
-3
pkgs/blacksky/default.nix
··· 1 - { pkgs, craneLib, buildYarnPackage, ... }: 2 - 3 - import ./rsky { inherit pkgs craneLib buildYarnPackage; }
-203
pkgs/blacksky/rsky/default.nix
··· 1 - { pkgs, craneLib, buildYarnPackage }: 2 - 3 - { 4 - pds = craneLib.buildPackage rec { 5 - pname = "rsky-pds"; 6 - version = "0.1.0"; # Placeholder version, should be updated from rsky's Cargo.toml 7 - src = pkgs.fetchFromGitHub { 8 - owner = "blacksky-algorithms"; 9 - repo = "rsky"; 10 - rev = "main"; # Placeholder, should be updated to a specific commit or tag 11 - hash = "sha256-nqBe20MCeNrSVxLVxiYc7iCFaBdf5Vf1p/i0D/aS8oY="; 12 - }; 13 - cargoHash = "sha256-0000000000000000000000000000000000000000000000000000000000000000="; 14 - 15 - # Build only the rsky-pds binary 16 - 17 - cargoBuildFlags = [ "--package rsky-pds --bin rsky-pds" ]; 18 - cargoInstallFlags = [ "--package rsky-pds --bin rsky-pds" ]; 19 - tarFlags = "--no-same-owner"; 20 - 21 - meta = with pkgs.lib; { 22 - description = "AT Protocol Personal Data Server (PDS) from rsky"; 23 - homepage = "https://github.com/atproto-nix/nur"; # Placeholder 24 - license = licenses.mit; # Placeholder 25 - maintainers = with maintainers; [ ]; # Placeholder 26 - }; 27 - }; 28 - 29 - relay = craneLib.buildPackage rec { 30 - pname = "rsky-relay"; 31 - version = "0.1.0"; # Placeholder version 32 - src = pkgs.fetchFromGitHub { 33 - owner = "blacksky-algorithms"; 34 - repo = "rsky"; 35 - rev = "main"; # Placeholder 36 - hash = "sha256-nqBe20MCeNrSVxLVxiYc7iCFaBdf5Vf1p/i0D/aS8oY="; 37 - }; 38 - cargoHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; # Placeholder 39 - 40 - cargoBuildFlags = [ "--package rsky-relay --bin rsky-relay" ]; 41 - cargoInstallFlags = [ "--package rsky-relay --bin rsky-relay" ]; 42 - tarFlags = "--no-same-owner"; 43 - 44 - meta = with pkgs.lib; { 45 - description = "AT Protocol Relay from rsky"; 46 - homepage = "https://github.com/atproto-nix/nur"; 47 - license = licenses.mit; 48 - maintainers = with maintainers; [ ]; 49 - }; 50 - }; 51 - 52 - feedgen = craneLib.buildPackage rec { 53 - pname = "rsky-feedgen"; 54 - version = "0.1.0"; # Placeholder version 55 - src = pkgs.fetchFromGitHub { 56 - owner = "blacksky-algorithms"; 57 - repo = "rsky"; 58 - rev = "main"; # Placeholder 59 - hash = "sha256-nqBe20MCeNrSVxLVxiYc7iCFaBdf5Vf1p/i0D/aS8oY="; 60 - }; 61 - cargoHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; # Placeholder 62 - 63 - cargoBuildFlags = [ "--package rsky-feedgen --bin rsky-feedgen" ]; 64 - cargoInstallFlags = [ "--package rsky-feedgen --bin rsky-feedgen" ]; 65 - tarFlags = "--no-same-owner"; 66 - 67 - meta = with pkgs.lib; { 68 - description = "AT Protocol Feed Generator from rsky"; 69 - homepage = "https://github.com/atproto-nix/nur"; 70 - license = licenses.mit; 71 - maintainers = with maintainers; [ ]; 72 - }; 73 - }; 74 - 75 - satnav = craneLib.buildPackage rec { 76 - pname = "rsky-satnav"; 77 - version = "0.1.0"; # Placeholder version 78 - src = pkgs.fetchFromGitHub { 79 - owner = "blacksky-algorithms"; 80 - repo = "rsky"; 81 - rev = "main"; # Placeholder 82 - hash = "sha256-nqBe20MCeNrSVxLVxiYc7iCFaBdf5Vf1p/i0D/aS8oY="; 83 - }; 84 - cargoHash = "sha256-0000000000000000000000000000000000000000000000000000000000000000="; # Placeholder, will be updated by Nix 85 - 86 - cargoBuildFlags = [ "--package rsky-satnav --bin rsky-satnav" ]; 87 - cargoInstallFlags = [ "--package rsky-satnav --bin rsky-satnav" ]; 88 - tarFlags = "--no-same-owner"; 89 - 90 - meta = with pkgs.lib; { 91 - description = "AT Protocol Satnav from rsky"; 92 - homepage = "https://github.com/atproto-nix/nur"; 93 - license = licenses.mit; 94 - maintainers = with maintainers; [ ]; 95 - }; 96 - }; 97 - 98 - firehose = craneLib.buildPackage rec { 99 - pname = "rsky-firehose"; 100 - version = "0.2.1"; # Version from Cargo.toml 101 - src = pkgs.fetchFromGitHub { 102 - owner = "blacksky-algorithms"; 103 - repo = "rsky"; 104 - rev = "main"; # Placeholder 105 - hash = "sha256-nqBe20MCeNrSVxLVxiYc7iCFaBdf5Vf1p/i0D/aS8oY="; 106 - }; 107 - cargoHash = "sha256-0000000000000000000000000000000000000000000000000000000000000000="; # Placeholder 108 - 109 - cargoBuildFlags = [ "--package rsky-firehose --bin rsky-firehose" ]; 110 - cargoInstallFlags = [ "--package rsky-firehose --bin rsky-firehose" ]; 111 - tarFlags = "--no-same-owner"; 112 - 113 - meta = with pkgs.lib; { 114 - description = "AT Protocol Firehose subscriber from rsky"; 115 - homepage = "https://github.com/atproto-nix/nur"; 116 - license = licenses.mit; 117 - maintainers = with maintainers; [ ]; 118 - }; 119 - }; 120 - 121 - jetstreamSubscriber = craneLib.buildPackage rec { 122 - pname = "rsky-jetstream-subscriber"; 123 - version = "0.1.0"; # Version from Cargo.toml 124 - src = pkgs.fetchFromGitHub { 125 - owner = "blacksky-algorithms"; 126 - repo = "rsky"; 127 - rev = "main"; # Placeholder 128 - hash = "sha256-nqBe20MCeNrSVxLVxiYc7iCFaBdf5Vf1p/i0D/aS8oY="; 129 - }; 130 - cargoHash = "sha256-0000000000000000000000000000000000000000000000000000000000000000="; # Placeholder 131 - 132 - cargoBuildFlags = [ "--package rsky-jetstream-subscriber --bin rsky-jetstream-subscriber" ]; 133 - cargoInstallFlags = [ "--package rsky-jetstream-subscriber --bin rsky-jetstream-subscriber" ]; 134 - tarFlags = "--no-same-owner"; 135 - 136 - meta = with pkgs.lib; { 137 - description = "AT Protocol Jetstream Subscriber from rsky"; 138 - homepage = "https://github.com/atproto-nix/nur"; 139 - license = licenses.mit; 140 - maintainers = with maintainers; [ ]; 141 - }; 142 - }; 143 - 144 - labeler = craneLib.buildPackage rec { 145 - pname = "rsky-labeler"; 146 - version = "0.1.3"; # Version from Cargo.toml 147 - src = pkgs.fetchFromGitHub { 148 - owner = "blacksky-algorithms"; 149 - repo = "rsky"; 150 - rev = "main"; # Placeholder 151 - hash = "sha256-nqBe20MCeNrSVxLVxiYc7iCFaBdf5Vf1p/i0D/aS8oY="; 152 - }; 153 - cargoHash = "sha256-0000000000000000000000000000000000000000000000000000000000000000="; # Placeholder 154 - 155 - cargoBuildFlags = [ "--package rsky-labeler --bin rsky-labeler" ]; 156 - cargoInstallFlags = [ "--package rsky-labeler --bin rsky-labeler" ]; 157 - tarFlags = "--no-same-owner"; 158 - 159 - meta = with pkgs.lib; { 160 - description = "AT Protocol Labeler from rsky"; 161 - homepage = "https://github.com/atproto-nix/nur"; 162 - license = licenses.mit; 163 - maintainers = with maintainers; [ ]; 164 - }; 165 - }; 166 - 167 - community = pkgs.buildYarnPackage rec { 168 - pname = "blacksky.community"; 169 - version = "1.109.0"; # Version from package.json 170 - 171 - src = pkgs.fetchFromGitHub { 172 - owner = "blacksky-algorithms"; 173 - repo = "blacksky.community"; 174 - # TODO: Update 'rev' to a specific commit hash or release tag for reproducible builds. 175 - rev = "main"; 176 - # TODO: Update 'hash' to the correct SHA256 hash of the fetched source. 177 - # You can obtain the correct hash by setting it to an empty string, running nix-build, 178 - # and then copying the hash from the error message. 179 - hash = "sha256-W0mXqED9geNKJSPGJhUdJZ2voMOMDCXX1T4zn3GZKlY="; 180 - }; 181 - 182 - yarnLock = "yarn.lock"; # Specify the yarn.lock file 183 - 184 - buildPhase = '' 185 - yarn build-web 186 - ''; 187 - 188 - installPhase = '' 189 - mkdir -p $out/share/nginx/html 190 - cp -r web-build/* $out/share/nginx/html 191 - ''; 192 - 193 - meta = with pkgs.lib; { 194 - description = "Blacksky Community Web Client"; 195 - # Placeholder, update with actual homepage if available. 196 - homepage = "https://github.com/blacksky-algorithms/blacksky.community"; 197 - # Placeholder, update with actual license if available. Assuming MIT for now. 198 - license = licenses.mit; 199 - # Placeholder, add actual maintainers. 200 - maintainers = with maintainers; [ ]; 201 - }; 202 - }; 203 - }
-80
pkgs/microcosm/default.nix
··· 1 - { pkgs, craneLib }: 2 - let 3 - src = pkgs.fetchFromGitHub { 4 - owner = "at-microcosm"; 5 - repo = "microcosm-rs"; 6 - rev = "b0a66a102261d0b4e8a90d34cec3421073a7b728"; 7 - sha256 = "sha256-swdAcsjRWnj9abmnrce5LzeKRK+LHm8RubCEIuk+53c="; 8 - }; 9 - 10 - commonEnv = { 11 - LIBCLANG_PATH = pkgs.lib.makeLibraryPath [ pkgs.llvmPackages.libclang.lib ]; 12 - OPENSSL_NO_VENDOR = "1"; 13 - OPENSSL_LIB_DIR = "${pkgs.lib.getLib pkgs.openssl}/lib"; 14 - OPENSSL_INCLUDE_DIR = "${pkgs.lib.getDev pkgs.openssl}/include"; 15 - BINDGEN_EXTRA_CLANG_ARGS = pkgs.lib.concatStringsSep " " (["-I${pkgs.llvmPackages.libclang.lib}/lib/clang/${pkgs.lib.versions.major pkgs.llvmPackages.libclang.version}/include"] ++ pkgs.lib.optional pkgs.stdenv.isLinux "-I${pkgs.glibc.dev}"); 16 - ZSTD_SYS_USE_PKG_CONFIG = "1"; 17 - CC = "${pkgs.llvmPackages.clang}/bin/clang"; 18 - CXX = "${pkgs.llvmPackages.clang}/bin/clang++"; 19 - PKG_CONFIG_PATH = "${pkgs.zstd.dev}/lib/pkgconfig:${pkgs.lz4.dev}/lib/pkgconfig"; 20 - }; 21 - 22 - nativeInputs = with pkgs; [ 23 - pkg-config 24 - perl 25 - ]; 26 - 27 - buildInputs = with pkgs; [ 28 - zstd 29 - lz4 30 - rocksdb 31 - openssl 32 - ]; 33 - 34 - cargoArtifacts = craneLib.buildDepsOnly { 35 - inherit src; 36 - pname = "microcosm-rs-deps"; 37 - nativeBuildInputs = nativeInputs; 38 - buildInputs = buildInputs; 39 - env = commonEnv; 40 - }; 41 - 42 - members = [ 43 - "links" 44 - "constellation" 45 - "jetstream" 46 - "ufos" 47 - "ufos/fuzz" 48 - "spacedust" 49 - "who-am-i" 50 - "slingshot" 51 - "quasar" 52 - "pocket" 53 - "reflector" 54 - ]; 55 - 56 - buildPackage = member: 57 - let 58 - packageName = if member == "ufos/fuzz" then "ufos-fuzz" else member; 59 - in 60 - craneLib.buildPackage { 61 - inherit src cargoArtifacts; 62 - pname = packageName; 63 - version = "0.1.0"; 64 - cargoExtraArgs = "--package ${packageName}"; 65 - nativeBuildInputs = nativeInputs; 66 - buildInputs = buildInputs ++ (pkgs.lib.optional (member == "pocket") pkgs.sqlite); 67 - env = commonEnv; 68 - }; 69 - 70 - packages = pkgs.lib.genAttrs members (member: buildPackage member); 71 - 72 - in 73 - packages // { 74 - default = pkgs.linkFarm "microcosm-rs" (pkgs.lib.mapAttrsToList (name: value: 75 - let 76 - linkName = if name == "ufos/fuzz" then "ufos-fuzz" else name; 77 - in 78 - { name = linkName; path = value; } 79 - ) packages); 80 - }