{ inputs = { # my apps skygqts.url = "git+ssh://gitea@gitea.app.internal:22/ari/skygqts.git"; skygqts.inputs.nixpkgs.follows = "nixpkgs"; hermenix.url = "git+ssh://gitea@gitea.app.internal:22/ari/hermenix.git"; nbot = { url = "git+ssh://git@github.com/SkyG-Org/nBot.git"; inputs.nixpkgs.follows = "nixpkgs-unstable"; }; looprail = { url = "git+ssh://git@github.com/SkyG-Org/LoopRail.git"; inputs.nixpkgs.follows = "nixpkgs-unstable"; }; # Read-only host monitor (systemd, journal, Docker) over REST + MCP. skyg-linux-tracker = { url = "git+https://gitea.skyg.ca/ari/skyg-linux-tracker.git"; inputs.nixpkgs.follows = "nixpkgs"; }; # Headless Hyprland session streamed over a Unix socket. hhstream = { url = "git+ssh://gitea@gitea.app.internal:22/Hermenix/hyprland-headless-stream-plugin.git"; inputs.nixpkgs.follows = "nixpkgs"; }; # Hardware nixos-hardware.url = "github:NixOS/nixos-hardware/master"; systems.url = "github:nix-systems/default"; # Pre-commit hooks git-hooks = { url = "github:cachix/git-hooks.nix"; inputs.nixpkgs.follows = "nixpkgs"; }; # Nixpkgs determinate.url = "https://flakehub.com/f/DeterminateSystems/determinate/*"; determinate.inputs.nixpkgs.follows = "nixpkgs"; nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0"; # Slack 4.53.287, NixOS/nixpkgs#557737. nixpkgs-slack.url = "github:NixOS/nixpkgs/713bc1926b25ad17376e552e339faeea73cf86dc"; nixpkgs-unstable.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1"; # my fork of nixpkgs my-nixpkgs.url = "github:asosnovsky/nixpkgs/ds4-init"; flox.url = "github:flox/flox/latest"; # nix-index database (for nix-index and comma) nix-index-database = { url = "github:nix-community/nix-index-database"; inputs.nixpkgs.follows = "nixpkgs"; }; # DankShell dms = { url = "github:AvengeMedia/DankMaterialShell/stable"; inputs.nixpkgs.follows = "nixpkgs-unstable"; }; # DankShell greeter (moved out of the dms repo) dank-greeter = { url = "github:AvengeMedia/dank-greeter"; inputs.nixpkgs.follows = "nixpkgs-unstable"; }; # Noctalia noctalia = { url = "github:noctalia-dev/noctalia-shell"; inputs.nixpkgs.follows = "nixpkgs"; }; # Nixarchy — Omarchy vendored for NixOS. Used only on fwbook, for the # Omarchy shell package (no nixarchy modules; see hosts/fwbook/packages.nix). nixarchy = { url = "github:olafkfreund/nixarchy/v4.0.4-1"; inputs.nixpkgs.follows = "nixpkgs"; # nixarchy's own home-manager checkouts are unused here; follow ours so # they don't sit in the lock. inputs.home-manager.follows = "home-manager"; inputs.home-manager-stable.follows = "home-manager"; }; # Hermes hermes-agent.url = "github:NousResearch/hermes-agent"; # Flatpak nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=main"; # Home manager home-manager = { url = "github:nix-community/home-manager/release-26.05"; inputs.nixpkgs.follows = "nixpkgs"; }; # Themes stylix = { url = "github:nix-community/stylix/release-26.05"; inputs.nixpkgs.follows = "nixpkgs"; }; # Macos nix-darwin = { url = "github:LnL7/nix-darwin"; inputs.nixpkgs.follows = "nixpkgs"; }; # Hyprland hyprlauncher.url = "github:hyprwm/hyprlauncher"; # Hyprland compositor via flake — pinned to the latest stable release tag # (was floating on main, 50 commits past v0.57.0, which caused a # compositor render-spin episode on fwbook: ~4-core spin, 100°C, no # suspend requested). Re-lock with: nix flake lock --update-input hyprland hyprland.url = "github:hyprwm/Hyprland/v0.57.0"; # Secrets management agenix.url = "github:ryantm/agenix"; herdr.url = "github:herdrdev/herdr"; # Declarative disk partitioning (for nixos-anywhere installs) disko = { url = "github:nix-community/disko"; inputs.nixpkgs.follows = "nixpkgs"; }; # CI (buildbot-nix) buildbot-nix = { url = "github:nix-community/buildbot-nix"; inputs.nixpkgs.follows = "nixpkgs-unstable"; }; }; outputs = { self , skygqts , hermenix , skyg-linux-tracker , nbot , looprail , hhstream , nixpkgs-unstable , nixpkgs-slack , flox , determinate , nixos-hardware , nixpkgs , systems , home-manager , nix-darwin , nix-flatpak , stylix , hyprlauncher , hyprland , my-nixpkgs , dms , dank-greeter , noctalia , nixarchy , git-hooks , nix-index-database , agenix , hermes-agent , herdr , disko , buildbot-nix }: let # Libs lib = import modules/lib.nix { user = { name = "ari"; fullName = "Ari Sosnovsky"; email = "ariel@sosnovsky.ca"; }; rootDir = ./.; configsDir = ./configs; inherit nixpkgs nixpkgs-unstable home-manager determinate nix-darwin systems nix-flatpak stylix agenix ; specialArgs = { skyg-secrets = { buzz-env = ./secrets/buzz-env.age; cloudflare-dns = ./secrets/cloudflare-dns.age; cloudflare-ddclient = ./secrets/cloudflare-ddclient.age; portainer-agent-minipc1 = ./secrets/portainer-agent-minipc1.age; portainer-agent-bigbox1 = ./secrets/portainer-agent-bigbox1.age; portainer-tls-key = ./secrets/portainer-tls-key.age; stack1 = ./secrets/stack1.age; stack2 = ./secrets/stack2.age; portainer-agent-minipc3 = ./secrets/portainer-agent-minipc3.age; portainer-cert = ./configs/pki/portainer.app.internal.crt; buildbot-worker-password-minipc3 = ./secrets/buildbot-worker-password-minipc3.age; buildbot-worker-password-fwdesk = ./secrets/buildbot-worker-password-fwdesk.age; buildbot-gitea-token = ./secrets/buildbot-gitea-token.age; buildbot-gitea-webhook-secret = ./secrets/buildbot-gitea-webhook-secret.age; buildbot-gitea-oauth-secret = ./secrets/buildbot-gitea-oauth-secret.age; immich-shared = ./secrets/immich-shared.age; grafana-secret-key = ./secrets/grafana-secret-key.age; umami-app-secret = ./secrets/umami-app-secret.age; linux-tracker-peer-minipc1 = ./secrets/linux-tracker-peer-minipc1.age; linux-tracker-peer-minipc2 = ./secrets/linux-tracker-peer-minipc2.age; linux-tracker-peer-minipc3 = ./secrets/linux-tracker-peer-minipc3.age; linux-tracker-peer-bigbox1 = ./secrets/linux-tracker-peer-bigbox1.age; linux-tracker-peer-bigbox2 = ./secrets/linux-tracker-peer-bigbox2.age; linux-tracker-peer-terra1 = ./secrets/linux-tracker-peer-terra1.age; scrypted-envs = ./secrets/scrypted-envs.age; nbot-slack = ./secrets/nbot-slack.age; nbot-goose = ./secrets/nbot-goose.age; nbot-cluster = ./secrets/nbot-cluster.age; nbot-cluster-hl-fws1 = ./secrets/nbot-cluster-hl-fws1.age; github-runner-token-fws1 = ./secrets/github-runner-token-fws1.age; }; inherit hyprlauncher hyprland nixpkgs-unstable nixpkgs-slack my-nixpkgs dms dank-greeter noctalia nixarchy nix-index-database hermes-agent skygqts hermenix skyg-linux-tracker nbot looprail hhstream flox determinate herdr ; }; } ; internalNetworking = import ./modules/internal-networking.nix { inherit (nixpkgs) lib; }; # The internal app map is global (identical on every host), so read it # from any one config. internalNetworkingMap = (nixpkgs.lib.head (nixpkgs.lib.attrValues self.nixosConfigurations)).config.skyg.internalNetworkingMap; in { # Dev Setups # ------------- devShells = lib.eachSystem ( system: let pkgs = nixpkgs.legacyPackages.${system}; qtDocs = pkgs.qt6.qtdoc; # Hook: run skyg pkgs update --all at most once a week; fail if it bumped # anything under pkgs/ so bumps get reviewed and staged, never auto-committed. pkgs-update-script = pkgs.writeShellScriptBin "skyg-pkgs-update" '' set -euo pipefail export PATH=${pkgs.bash}/bin:${pkgs.coreutils}/bin:${pkgs.curl}/bin:${pkgs.jq}/bin:${pkgs.git}/bin:${pkgs.gnused}/bin:${pkgs.gawk}/bin:$PATH root=$(${pkgs.git}/bin/git rev-parse --show-toplevel) cd "$root" stamp=$(${pkgs.git}/bin/git rev-parse --git-path pkgs-update-last-success) now=$(date +%s) last_run=$(date -r "$stamp" +%s 2>/dev/null || echo 0) if (( now - last_run < 604800 )); then exit 0 fi ${pkgs.nushell}/bin/nu --commands 'use ./bin/lib/cmds.nu *; skyg pkgs update --all' touch "$stamp" if ! ${pkgs.git}/bin/git diff --quiet -- pkgs/; then echo "" echo "pkgs-update: version bumps applied under pkgs/ — review 'git diff pkgs/'," echo "stage them ('git add pkgs/') and commit again." exit 1 fi ''; pre-commit-check = git-hooks.lib.${system}.run { src = ./.; hooks = { nixpkgs-fmt.enable = true; stylua.enable = true; pkgs-update = { enable = true; entry = "${pkgs-update-script}/bin/skyg-pkgs-update"; language = "system"; pass_filenames = false; always_run = true; }; }; }; in { default = pkgs.mkShell { name = "nixos-setup"; QMLLS_DOC_DIR = "${qtDocs}/share/doc/qt6"; QML_IMPORT_PATH = "${pkgs.qt6.qtdeclarative}/lib/qt-6/qml:${pkgs.quickshell}/lib/qt-6/qml"; QT_PLUGIN_PATH = "${pkgs.qt6.qtdeclarative}/lib/qt-6/plugins"; packages = with pkgs; [ qtDocs qt6.qtdeclarative nixpkgs-fmt stylua nixd nh agenix.packages.${system}.default age yq nak home-manager.packages.${system}.home-manager rustc cargo rust-analyzer nushell # Python tooling for niri-touchscreen-gestures script python3 python3Packages.evdev python3Packages.tomli python3Packages.pydantic python3Packages.pydantic-settings python3Packages.pytest libinput wlrctl ydotool ]; shellHook = '' export PATH=$PATH:$(pwd)/bin export SKYG_LIB="$(pwd)/bin/lib/cmds.nu" export CLAUDE_CONFIG_DIR="$(pwd)/.claude-nixos-setup" ${pre-commit-check.shellHook} if [ -z "$NU_VERSION" ] && [ -t 0 ] && command -v nu >/dev/null; then cat <<'BANNER' ____ _ ____ ____ _ _ _ / ___|| | ___ _/ ___| / ___|| |__ ___| | | \___ \| |/ / | | | | _ \___ \| '_ \ / _ \ | | ___) | <| |_| | |_| | ___) | | | | __/ | | |____/|_|\_\\__, |\____| |____/|_| |_|\___|_|_| |___/ BANNER exec nu --execute "use \"$SKYG_LIB\" *" fi ''; }; } ); lib = lib; # Flat view of every internal DNS record declared by any host: # nix eval .#dnsRecords --json | jq dnsRecords = internalNetworking.records internalNetworkingMap.apps; formatter = lib.eachSystem (system: nixpkgs.legacyPackages.${system}.nixpkgs-fmt); packages = lib.eachSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; openwrt = import ./modules/openwrt { inherit pkgs; inherit (nixpkgs) lib; }; dnsRecordsFile = pkgs.writeText "skyg-dns-records.json" (builtins.toJSON (internalNetworking.json internalNetworkingMap.apps)); glmain = (import ./openwrt-routers/glmain.nix) // { dnsRecords = dnsRecordsFile; }; in { openwrt-glmain = (openwrt glmain).deployScript; openwrt-glmain-dry-run = (openwrt glmain).dryRunScript; skyg-dns-records = dnsRecordsFile; ds4 = my-nixpkgs.legacyPackages.${system}.ds4; buzz-desktop = lib.pkgs.${system}.buzz-desktop; delta-editor = lib.pkgs.${system}.delta-editor; colibri = lib.pkgs.${system}.colibri; llama-cpp-halo = lib.pkgs.${system}.llama-cpp-halo; herdr = herdr.packages.${system}.default; } ); # Non-NixOS Linux Setups (standalone home-manager) # ------------- homeConfigurations = { "ari" = lib.makeHomeManagerUsers { }; }; # NixOS Linux Setups # ------------- nixosConfigurations = { fwbook = lib.makeNixOs { hostName = "fwbook"; systemStateVersion = "23.11"; configuration = [ ./hosts/fwbook nixos-hardware.nixosModules.framework-13-7040-amd ]; }; hl-fws1 = lib.makeNixOs { hostName = "hl-fws1"; configuration = [ ./hosts/hl-fws1 ./hosts/hl-fws1.disko.nix nixos-hardware.nixosModules.framework-11th-gen-intel disko.nixosModules.disko nbot.nixosModules.host ]; }; hl-fwdesk = lib.makeNixOs { hostName = "hl-fwdesk"; systemStateVersion = "25.05"; configuration = [ ./hosts/hl-fwdesk nixos-hardware.nixosModules.framework-desktop-amd-ai-max-300-series hermenix.nixosModules.default buildbot-nix.nixosModules.buildbot-worker nbot.nixosModules.host ]; }; hl-bigbox1 = lib.makeNixOs { hostName = "hl-bigbox1"; configuration = [ ./hosts/hl-bigbox1 ]; }; hl-bigbox2 = lib.makeNixOs { hostName = "hl-bigbox2"; systemStateVersion = "25.05"; configuration = [ ./hosts/hl-bigbox2 ]; }; hl-minipc1 = lib.makeNixOs { hostName = "hl-minipc1"; configuration = [ ./hosts/hl-minipc1 ]; }; hl-minipc2 = lib.makeNixOs { hostName = "hl-minipc2"; configuration = [ ./hosts/hl-minipc2 ]; }; hl-minipc3 = lib.makeNixOs { hostName = "hl-minipc3"; configuration = [ ./hosts/hl-minipc3 buildbot-nix.nixosModules.buildbot-master buildbot-nix.nixosModules.buildbot-worker ]; }; hl-pi1 = lib.makeSdImage { system = "aarch64-linux"; hostName = "hl-pi1"; configuration = [ ./hosts/hl-pi1 ]; }; hl-pi2 = lib.makeSdImage { system = "aarch64-linux"; hostName = "hl-pi2"; configuration = [ ./hosts/hl-pi2 ]; }; hl-terra1 = lib.makeNixOs { hostName = "hl-terra1"; configuration = [ ./hosts/hl-terra1 ]; }; iso = lib.makeIso { hostName = "skygnix"; configuration = [ ./hosts/iso ]; }; }; }; }