diff --git a/devFlake/private.narHash b/devFlake/private.narHash new file mode 100644 index 000000000..502717bdb --- /dev/null +++ b/devFlake/private.narHash @@ -0,0 +1 @@ +sha256-pFUj3KhQ4FkzZT19t+FHBru8u8Lspax0rS2cv7nXIgM= diff --git a/devFlake/private/flake.lock b/devFlake/private/flake.lock new file mode 100644 index 000000000..faad3bcf3 --- /dev/null +++ b/devFlake/private/flake.lock @@ -0,0 +1,165 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": [ + "systems" + ] + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "ixx": { + "inputs": { + "flake-utils": [ + "nuschtos", + "flake-utils" + ], + "nixpkgs": [ + "nuschtos", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1748294338, + "narHash": "sha256-FVO01jdmUNArzBS7NmaktLdGA5qA3lUMJ4B7a05Iynw=", + "owner": "NuschtOS", + "repo": "ixx", + "rev": "cc5f390f7caf265461d4aab37e98d2292ebbdb85", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "ref": "v0.0.8", + "repo": "ixx", + "type": "github" + } + }, + "nixpkgs-dev": { + "locked": { + "lastModified": 1751867001, + "narHash": "sha256-3I49W0s3WVEDBO5S1RxYr74E2LLG7X8Wuvj9AmU0RDk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "73feb5e20ec7259e280ca6f424ba165059b3bb6b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable-small", + "repo": "nixpkgs", + "type": "github" + } + }, + "nuschtos": { + "inputs": { + "flake-utils": "flake-utils_2", + "ixx": "ixx", + "nixpkgs": [ + "nixpkgs-dev" + ] + }, + "locked": { + "lastModified": 1749730855, + "narHash": "sha256-L3x2nSlFkXkM6tQPLJP3oCBMIsRifhIDPMQQdHO5xWo=", + "owner": "NuschtOS", + "repo": "search", + "rev": "8dfe5879dd009ff4742b668d9c699bc4b9761742", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "repo": "search", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs-dev": "nixpkgs-dev", + "nuschtos": "nuschtos", + "systems": "systems_2", + "treefmt-nix": "treefmt-nix" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "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": [] + }, + "locked": { + "lastModified": 1750931469, + "narHash": "sha256-0IEdQB1nS+uViQw4k3VGUXntjkDp7aAlqcxdewb/hAc=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "ac8e6f32e11e9c7f153823abc3ab007f2a65d3e1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/devFlake/private/flake.nix b/devFlake/private/flake.nix new file mode 100644 index 000000000..44ffa70a7 --- /dev/null +++ b/devFlake/private/flake.nix @@ -0,0 +1,19 @@ +{ + description = "private dev inputs"; + + # Dev dependencies + inputs.nixpkgs-dev.url = "github:NixOS/nixpkgs/nixos-unstable-small"; + + inputs.flake-utils.url = "github:numtide/flake-utils"; + inputs.flake-utils.inputs.systems.follows = "systems"; + + inputs.nuschtos.url = "github:NuschtOS/search"; + inputs.nuschtos.inputs.nixpkgs.follows = "nixpkgs-dev"; + + inputs.treefmt-nix.url = "github:numtide/treefmt-nix"; + inputs.treefmt-nix.inputs.nixpkgs.follows = ""; + + inputs.systems.url = "github:nix-systems/default"; + + outputs = _: { }; +} diff --git a/devFlake/update-private-narhash b/devFlake/update-private-narhash new file mode 100755 index 000000000..900e573e1 --- /dev/null +++ b/devFlake/update-private-narhash @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# Used to update the private dev flake hash reference. +set -euo pipefail + +cd "$(dirname "$0")" + +echo "Updating $PWD/private.narHash" >&2 + +nix --extra-experimental-features 'flakes nix-command' flake lock ./private +nix --extra-experimental-features 'flakes nix-command' hash path ./private >./private.narHash + +echo OK \ No newline at end of file diff --git a/docs/nix/options/flake-module.nix b/docs/nix/options/flake-module.nix index 216445778..32fcf8eae 100644 --- a/docs/nix/options/flake-module.nix +++ b/docs/nix/options/flake-module.nix @@ -1,9 +1,15 @@ -{ self, config, ... }: +{ + self, + config, + inputs, + privateInputs ? { }, + ... +}: { perSystem = { - inputs', lib, + pkgs, ... }: let @@ -157,11 +163,16 @@ }; in { - packages.docs-options = inputs'.nuschtos.packages.mkMultiSearch { - inherit baseHref; - title = "Clan Options"; - # scopes = mapAttrsToList mkScope serviceModules; - scopes = [ (mkScope "Clan Inventory" serviceModules) ]; + packages = lib.optionalAttrs ((privateInputs ? nuschtos) || (inputs ? nuschtos)) { + docs-options = + (privateInputs.nuschtos or inputs.nuschtos) + .packages.${pkgs.stdenv.hostPlatform.system}.mkMultiSearch + { + inherit baseHref; + title = "Clan Options"; + # scopes = mapAttrsToList mkScope serviceModules; + scopes = [ (mkScope "Clan Inventory" serviceModules) ]; + }; }; }; } diff --git a/flake.lock b/flake.lock index e60bb3566..febf7452e 100644 --- a/flake.lock +++ b/flake.lock @@ -67,52 +67,6 @@ "type": "github" } }, - "flake-utils": { - "inputs": { - "systems": [ - "systems" - ] - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "ixx": { - "inputs": { - "flake-utils": [ - "nuschtos", - "flake-utils" - ], - "nixpkgs": [ - "nuschtos", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1748294338, - "narHash": "sha256-FVO01jdmUNArzBS7NmaktLdGA5qA3lUMJ4B7a05Iynw=", - "owner": "NuschtOS", - "repo": "ixx", - "rev": "cc5f390f7caf265461d4aab37e98d2292ebbdb85", - "type": "github" - }, - "original": { - "owner": "NuschtOS", - "ref": "v0.0.8", - "repo": "ixx", - "type": "github" - } - }, "nix-darwin": { "inputs": { "nixpkgs": [ @@ -174,41 +128,15 @@ "url": "https://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz" } }, - "nuschtos": { - "inputs": { - "flake-utils": [ - "flake-utils" - ], - "ixx": "ixx", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1749730855, - "narHash": "sha256-L3x2nSlFkXkM6tQPLJP3oCBMIsRifhIDPMQQdHO5xWo=", - "owner": "NuschtOS", - "repo": "search", - "rev": "8dfe5879dd009ff4742b668d9c699bc4b9761742", - "type": "github" - }, - "original": { - "owner": "NuschtOS", - "repo": "search", - "type": "github" - } - }, "root": { "inputs": { "data-mesher": "data-mesher", "disko": "disko", "flake-parts": "flake-parts", - "flake-utils": "flake-utils", "nix-darwin": "nix-darwin", "nix-select": "nix-select", "nixos-facter-modules": "nixos-facter-modules", "nixpkgs": "nixpkgs", - "nuschtos": "nuschtos", "sops-nix": "sops-nix", "systems": "systems", "treefmt-nix": "treefmt-nix" diff --git a/flake.nix b/flake.nix index ad5edac73..d26762fdc 100644 --- a/flake.nix +++ b/flake.nix @@ -35,19 +35,13 @@ }; }; - # dependencies needed for nuschtos - flake-utils.url = "github:numtide/flake-utils"; - flake-utils.inputs.systems.follows = "systems"; - nuschtos.url = "github:NuschtOS/search"; - nuschtos.inputs.nixpkgs.follows = "nixpkgs"; - nuschtos.inputs.flake-utils.follows = "flake-utils"; }; outputs = inputs@{ - flake-parts, nixpkgs, systems, + flake-parts, ... }: let @@ -56,10 +50,29 @@ optional pathExists ; + + loadDevFlake = + path: + let + flakeHash = nixpkgs.lib.fileContents "${toString path}.narHash"; + flakePath = "path:${toString path}?narHash=${flakeHash}"; + in + builtins.getFlake (builtins.unsafeDiscardStringContext flakePath); + + devFlake = + if pathExists ./devFlake/private && builtins ? getFlake then + loadDevFlake ./devFlake/private + else + null; + + privateInputs = if devFlake != null then devFlake.inputs else { }; in flake-parts.lib.mkFlake { inherit inputs; } ( { ... }: { + _module.args = { + inherit privateInputs; + }; clan = { meta.name = "clan-core"; inventory = {