49 lines
1.2 KiB
Nim
49 lines
1.2 KiB
Nim
# SPDX-License-Identifier: LSL-1.0
|
|
# Copyright (c) 2026 Markus Maiwald
|
|
# Stewardship: Self Sovereign Society Foundation
|
|
#
|
|
# This file is part of the Nexus Sovereign Core.
|
|
# See legal/LICENSE_SOVEREIGN.md for license terms.
|
|
|
|
import strutils, os
|
|
|
|
type
|
|
Source* = object
|
|
url*: string
|
|
blake3*: string
|
|
Fragment* = object
|
|
name*: string
|
|
version*: string
|
|
source*: Source
|
|
dependencies*: seq[string]
|
|
NexusRecipe* = Fragment
|
|
|
|
proc translateNixFlake(flakeUrl: string): NexusRecipe =
|
|
echo "Translating Nix Flake: ", flakeUrl
|
|
result = NexusRecipe(
|
|
name: "example",
|
|
version: "1.0.0",
|
|
source: Source(url: flakeUrl, blake3: ""),
|
|
dependencies: @[]
|
|
)
|
|
|
|
proc translateAUR(pkgbuildUrl: string): NexusRecipe =
|
|
echo "Translating AUR PKGBUILD: ", pkgbuildUrl
|
|
result = NexusRecipe(
|
|
name: "example",
|
|
version: "1.0.0",
|
|
source: Source(url: pkgbuildUrl, blake3: ""),
|
|
dependencies: @[]
|
|
)
|
|
|
|
proc getRecipe(source, url: string, iKnowWhatIDo: bool): NexusRecipe =
|
|
if not iKnowWhatIDo:
|
|
quit("Error: --i-know-what-i-do flag required for external sources")
|
|
case source
|
|
of "nixpkgs":
|
|
result = translateNixFlake(url)
|
|
of "aur":
|
|
result = translateAUR(url)
|
|
else:
|
|
quit("Unknown source: " & source)
|