From 0ae7419c918abc0093e6744ddde5ae9cf2218afe Mon Sep 17 00:00:00 2001 From: Daniel Rolls Date: Sun, 12 Jan 2025 15:22:48 +0000 Subject: [PATCH 1/4] Prioritise less global repos & avoid local urls --- shellify.cabal | 2 + src/TemplateGeneration.hs | 71 +++++++++++++------ test/Spec.hs | 45 ++++++++++++ test/TestHelpers.hs | 55 ++++++++++++++ .../cowsay-from-global-nixpkgs-flake.nix | 20 ++++++ .../cowsay-from-global-nixpkgs-shell.nix | 9 +++ .../cowsay-from-local-nixpkgs-flake.nix | 20 ++++++ .../cowsay-from-local-nixpkgs-shell.nix | 9 +++ .../cowsay-from-system-custompkgs-flake.nix | 22 ++++++ .../cowsay-from-system-custompkgs-shell.nix | 9 +++ .../cowsay-from-system-nixpkgs-flake.nix | 20 ++++++ .../cowsay-from-system-nixpkgs-shell.nix | 9 +++ .../cowsay-from-user-nixpkgs-flake.nix | 20 ++++++ .../cowsay-from-user-nixpkgs-shell.nix | 9 +++ .../inputs-from-unknown-source-flake.nix | 22 ++++++ .../inputs-from-unknown-source-shell.nix | 9 +++ 16 files changed, 330 insertions(+), 21 deletions(-) create mode 100644 test/outputs/cowsay-from-global-nixpkgs-flake.nix create mode 100644 test/outputs/cowsay-from-global-nixpkgs-shell.nix create mode 100644 test/outputs/cowsay-from-local-nixpkgs-flake.nix create mode 100644 test/outputs/cowsay-from-local-nixpkgs-shell.nix create mode 100644 test/outputs/cowsay-from-system-custompkgs-flake.nix create mode 100644 test/outputs/cowsay-from-system-custompkgs-shell.nix create mode 100644 test/outputs/cowsay-from-system-nixpkgs-flake.nix create mode 100644 test/outputs/cowsay-from-system-nixpkgs-shell.nix create mode 100644 test/outputs/cowsay-from-user-nixpkgs-flake.nix create mode 100644 test/outputs/cowsay-from-user-nixpkgs-shell.nix create mode 100644 test/outputs/inputs-from-unknown-source-flake.nix create mode 100644 test/outputs/inputs-from-unknown-source-shell.nix diff --git a/shellify.cabal b/shellify.cabal index dfb1fcd..53815a8 100644 --- a/shellify.cabal +++ b/shellify.cabal @@ -56,7 +56,9 @@ library directory >=1.3.6.2 && <1.4, extra >=1.7.13 && <1.9, HStringTemplate >=0.8.8 && <0.9, + MissingH >=1.6.0.1 && <1.7, mtl >=2.2.2 && <2.4, + parsec >=3.1.17.0 && <3.2, shake >=0.19.7 && <0.20, unordered-containers >=0.2.19.1 && <0.3 diff --git a/src/TemplateGeneration.hs b/src/TemplateGeneration.hs index 486527a..394a9e3 100644 --- a/src/TemplateGeneration.hs +++ b/src/TemplateGeneration.hs @@ -1,20 +1,20 @@ module TemplateGeneration (generateShellDotNixText, generateFlakeText, getRegistryDB) where -import Prelude hiding (lines) - import Constants import FlakeTemplate import Options import ShellifyTemplate +import Data.Bifunctor (bimap) import Data.Bool (bool) -import Data.List (find, sort) -import Data.List.Extra ((!?)) -import Data.Maybe (catMaybes, fromMaybe) +import Data.List (find, sort, sortBy) +import Data.Maybe (fromMaybe) import Data.Set (fromList, toList) -import Data.Text (isInfixOf, isPrefixOf, lines, pack, splitOn, Text()) +import Data.String.Utils (strip) +import Data.Text (Text(), isInfixOf, isPrefixOf, pack, splitOn, unpack) import Development.Shake.Command (cmd, Exit(Exit), Stderr(Stderr), Stdout(Stdout)) import System.Exit (ExitCode (ExitSuccess)) +import Text.ParserCombinators.Parsec (Parser, char, endBy, eof, many1, noneOf, parse, sepBy, string, (<|>)) import Text.StringTemplate (newSTMP, render, setAttribute) generateFlakeText :: Text -> Options -> Maybe Text @@ -28,13 +28,13 @@ generateFlakeText db Options{packages=packages, generateFlake=shouldGenerateFlak $ setAttribute "shell_args" shellArgs $ newSTMP flakeTemplate) shouldGenerateFlake - where repos = uniq $ getPackageRepo <$> sort packages + where repos = getPackageRepoWrapper packages repoVars = getPackageRepoVarName <$> repos repoInputs = repoInput <$> repos repoInputLine repoName url = repoName <> ".url = \"" <> url <> "\";" repoInput repoName = repoInputLine repoName . either - (error "Unexpected output from nix registry call: " <>) + (error . ("Unexpected output from nix registry call: " <>)) (fromMaybe "PLEASE ENTER input here") . findFlakeRepoUrl db $ repoName pkgsVar = (<> "Pkgs") @@ -52,9 +52,12 @@ generateShellDotNixText Options{packages=packages, command=command} = command $ newSTMP shellifyTemplate where pkgs = generateBuildInput <$> sort packages - parameters = uniq $ generateParameters <$> sort packages + parameters = generateParametersWrapper packages generateBuildInput input = (toImportVar . getPackageRepo) input <> "." <> getPackageName input +getPackageRepoWrapper :: [Package] -> [Text] +getPackageRepoWrapper = uniq . ("nixpkgs" :) . fmap getPackageRepo . sort + getPackageRepo input | "#" `isInfixOf` input = head $ splitOn "#" input | otherwise @@ -73,6 +76,9 @@ toImportVar var | var == "nixpkgs" getPackageRepoVarName "nixpkgs" = "pkgs" getPackageRepoVarName a = a +generateParametersWrapper :: [Package] -> [Text] +generateParametersWrapper = uniq . ("pkgs ? import {}" :) . fmap generateParameters . sort + generateParameters :: Package -> Text generateParameters package | "#" `isInfixOf` package && not ("nixpkgs#" `isPrefixOf` package) @@ -90,23 +96,46 @@ getRegistryDB = (Right $ pack out) (ex == ExitSuccess) -findFlakeRepoUrl :: Text -> Text -> Either Text (Maybe Text) +findFlakeRepoUrl :: Text -> Text -> Either String (Maybe Text) findFlakeRepoUrl haystack needle = - fmap repoUrl . find ((needle ==) . repoName) . catMaybes <$> mapM getFlakeRepo (lines haystack) + bimap ((<>) "Error processing nix registry list output: " . show) + (fmap repoUrl . find ((needle ==) . repoName) + . sortBy compareRepoEntries) + $ parse parseRepos "" . strip . unpack $ haystack + +compareRepoEntries repoA repoB + | repoHasLocalPinning repoA && not (repoHasLocalPinning repoB) = GT + | repoHasLocalPinning repoB && not (repoHasLocalPinning repoA) = LT + | otherwise = repoType repoA `compare` repoType repoB + where repoHasLocalPinning = isPrefixOf "path:" . repoUrl + +data RepoType = User | System | Global + deriving (Eq, Ord) data FlakeRepo = FlakeRepo { repoName :: Text , repoUrl :: Text + , repoType :: RepoType } -getFlakeRepo :: Text -> Either Text (Maybe FlakeRepo) -getFlakeRepo line = let expectedField = maybe (Left "unexepected nix registry command format") - Right - . (!?) (splitOn " " line) - urlField = expectedField 2 - splitRepoField = splitOn ":" <$> expectedField 1 - potentialFlakeName ["flake", b] = Just b - potentialFlakeName _ = Nothing - f x y = (`FlakeRepo` y) <$> potentialFlakeName x - in f <$> splitRepoField <*> urlField +parseRepos :: Parser [FlakeRepo] +parseRepos = do res <- parseLines + eof + return res +--parseRepos = endBy parseLines eof + +parseLines :: Parser [FlakeRepo] +parseLines = sepBy parseLine (char '\n') + +parseLine :: Parser FlakeRepo +parseLine = do repoType <- parseRepoType + char ' ' + flakeName <- string "flake:" >> parseParam + char ' ' + repoUrl <- parseParam + return $ FlakeRepo (pack flakeName) (pack repoUrl) repoType + where parseParam = many1 (noneOf " \n") + parseRepoType = (string "global" >> return Global) + <|> (string "system" >> return System) + <|> (string "user" >> return User) diff --git a/test/Spec.hs b/test/Spec.hs index 306d7d5..1bc49bd 100644 --- a/test/Spec.hs +++ b/test/Spec.hs @@ -6,6 +6,46 @@ import TestHelpers main = hspec $ do + describe "where system is local and global is available fall through to global" $ + whereALocalSystemAndFlakeGlobalNixpkgsExistsShellifyWithArgs "shell nixpkgs#cowsay" + `shouldReturnShellAndFlakeTextDefinedBy` + "cowsay-from-global-nixpkgs" + + describe "where system is local and no user or global is available, use local" $ + whereALocalSystemNixpkgsExistsShellifyWithArgs "shell nixpkgs#cowsay" + `shouldReturnShellAndFlakeTextDefinedBy` + "cowsay-from-local-nixpkgs" + + describe "When the nixpkgs in the registry is configured such that it defines a user registry" $ + whereOnlyAUserNixpkgsExistsShellifyWithArgs "shell nixpkgs#cowsay" + `shouldReturnShellAndFlakeTextDefinedBy` + "cowsay-from-user-nixpkgs" + + describe "When the custompkgs in the registry is configured such that it defines a global and system registry" $ + whereASystemAndGlobalCustomPkgsExistsShellifyWithArgs "shell custompkgs#cowsay" + `shouldReturnShellAndFlakeTextDefinedBy` + "cowsay-from-system-custompkgs" + + describe "When the custompkgs in the registry is configured such that it defines a system and global registry" $ + whereAGlobalAndSystemCustomPkgsExistsShellifyWithArgs "shell custompkgs#cowsay" + `shouldReturnShellAndFlakeTextDefinedBy` + "cowsay-from-system-custompkgs" + + describe "When the nixpkgs in the registry is configured such that it defines a system registry" $ + whereASystemAndGlobalNixpkgsExistsShellifyWithArgs "shell nixpkgs#cowsay" + `shouldReturnShellAndFlakeTextDefinedBy` + "cowsay-from-system-nixpkgs" + + describe "When the nixpkgs in the registry is configured such that it defines a system registry with the global registry listed first" $ + whereAGlobalAndSystemNixpkgsExistsShellifyWithArgs "shell nixpkgs#cowsay" + `shouldReturnShellAndFlakeTextDefinedBy` + "cowsay-from-system-nixpkgs" + + describe "When the nixpkgs in the registry is configured such that it defines only a global registry" $ + whereOnlyAGlobalNixpkgsExistsShellifyWithArgs "shell nixpkgs#cowsay" + `shouldReturnShellAndFlakeTextDefinedBy` + "cowsay-from-global-nixpkgs" + describe "When passing option combinations" $ do it "should print a message saying no package is specified when no argument is supplied" $ shellifyWithArgs "" @@ -90,6 +130,11 @@ main = hspec $ do `shouldBe` Right def{packages=[ "nixpkgs#python", "nixpkgs#cowsay" ], generateFlake=True} + describe "when one buildInputs is required from an unknown source" $ + shellifyWithArgs "--with-flake shell foo#cowsay" + `shouldReturnShellAndFlakeTextDefinedBy` + "inputs-from-unknown-source" + describe "when two buildInputs are required from two sources" $ shellifyWithArgs "--with-flake shell foo#cowsay nixpkgs#python" `shouldReturnShellAndFlakeTextDefinedBy` diff --git a/test/TestHelpers.hs b/test/TestHelpers.hs index 0a98379..6546601 100644 --- a/test/TestHelpers.hs +++ b/test/TestHelpers.hs @@ -19,6 +19,39 @@ shouldReturnSubstring shellifyOutput expectedSubstring = shellifyWithArgs :: Text -> Either Text [(Text, Text)] shellifyWithArgs = parseOptionsAndCalculateExpectedFiles db "nix-shellify" . words +shellifyWithArgsWithDb :: Text -> Text -> Either Text [(Text, Text)] +shellifyWithArgsWithDb customDb = parseOptionsAndCalculateExpectedFiles customDb "nix-shellify" . words + +whereOnlyAUserNixpkgsExistsShellifyWithArgs :: Text -> Either Text [(Text, Text)] +whereOnlyAUserNixpkgsExistsShellifyWithArgs = shellifyWithArgsWithDb dbWithGlobalToUserNixpkgs + +whereASystemAndGlobalCustomPkgsExistsShellifyWithArgs :: Text -> Either Text [(Text, Text)] +whereASystemAndGlobalCustomPkgsExistsShellifyWithArgs = shellifyWithArgsWithDb dbWithGlobalToSystemCustomPkgs + +whereAGlobalAndSystemCustomPkgsExistsShellifyWithArgs :: Text -> Either Text [(Text, Text)] +whereAGlobalAndSystemCustomPkgsExistsShellifyWithArgs = shellifyWithArgsWithDb dbWithSystemToGlobalCustomPkgs + +whereASystemAndGlobalNixpkgsExistsShellifyWithArgs :: Text -> Either Text [(Text, Text)] +whereASystemAndGlobalNixpkgsExistsShellifyWithArgs = shellifyWithArgsWithDb dbWithSystemAndGlobalNixpkgs + +whereAGlobalAndSystemNixpkgsExistsShellifyWithArgs :: Text -> Either Text [(Text, Text)] +whereAGlobalAndSystemNixpkgsExistsShellifyWithArgs = shellifyWithArgsWithDb dbWithGlobalToSystemNixpkgs + +whereOnlyASystemAndGlobalNixpkgsExistsShellifyWithArgs :: Text -> Either Text [(Text, Text)] +whereOnlyASystemAndGlobalNixpkgsExistsShellifyWithArgs = error "TODO" + +whereAUserSystemAndGlobalNixpkgsExistsShellifyWithArgs :: Text -> Either Text [(Text, Text)] +whereAUserSystemAndGlobalNixpkgsExistsShellifyWithArgs = error "TODO" + +whereOnlyAGlobalNixpkgsExistsShellifyWithArgs :: Text -> Either Text [(Text, Text)] +whereOnlyAGlobalNixpkgsExistsShellifyWithArgs = shellifyWithArgsWithDb dbWithOnlyGlobalNixpkgs + +whereALocalSystemAndFlakeGlobalNixpkgsExistsShellifyWithArgs :: Text -> Either Text [(Text, Text)] +whereALocalSystemAndFlakeGlobalNixpkgsExistsShellifyWithArgs = shellifyWithArgsWithDb dbWithLocalSystemToGlobalNixpkgs + +whereALocalSystemNixpkgsExistsShellifyWithArgs :: Text -> Either Text [(Text, Text)] +whereALocalSystemNixpkgsExistsShellifyWithArgs = shellifyWithArgsWithDb dbWithLocalSystemNixpkgs + shouldReturnShellAndFlakeTextDefinedBy result expectedOutput = it "should produce the expected shell.nix and flake.nix" $ do expShell <- readNixTemplate (shellFile expectedOutput) @@ -57,3 +90,25 @@ flakeFile = (<> "-flake.nix") shellFile = (<> "-shell.nix") db = "global flake:agda github:agda/agda\nglobal flake:arion github:hercules-ci/arion\nglobal flake:blender-bin github:edolstra/nix-warez?dir=blender\nglobal flake:composable github:ComposableFi/composable\nglobal flake:dreampkgs github:nix-community/dreampkgs\nglobal flake:dwarffs github:edolstra/dwarffs\nglobal flake:emacs-overlay github:nix-community/emacs-overlay\nglobal flake:fenix github:nix-community/fenix\nglobal flake:flake-parts github:hercules-ci/flake-parts\nglobal flake:flake-utils github:numtide/flake-utils\nglobal flake:gemini github:nix-community/flake-gemini\nglobal flake:hercules-ci-effects github:hercules-ci/hercules-ci-effects\nglobal flake:hercules-ci-agent github:hercules-ci/hercules-ci-agent\nglobal flake:home-manager github:nix-community/home-manager\nglobal flake:hydra github:NixOS/hydra\nglobal flake:mach-nix github:DavHau/mach-nix\nglobal flake:nimble github:nix-community/flake-nimble\nglobal flake:nix github:NixOS/nix\nglobal flake:nix-darwin github:LnL7/nix-darwin\nglobal flake:nixops github:NixOS/nixops\nglobal flake:nixos-hardware github:NixOS/nixos-hardware\nglobal flake:nixos-homepage github:NixOS/nixos-homepage\nglobal flake:nixos-search github:NixOS/nixos-search\nglobal flake:nur github:nix-community/NUR\nglobal flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-unstable\nglobal flake:templates github:NixOS/templates\nglobal flake:patchelf github:NixOS/patchelf\nglobal flake:poetry2nix github:nix-community/poetry2nix\nglobal flake:nix-serve github:edolstra/nix-serve\nglobal flake:nickel github:tweag/nickel\nglobal flake:bundlers github:NixOS/bundlers\nglobal flake:pridefetch github:SpyHoodle/pridefetch\nglobal flake:systems github:nix-systems/default\nglobal flake:helix github:helix-editor/helix\nglobal flake:sops-nix github:Mic92/sops-nix\n" :: Text + +dbWithUserNixpkgs = "global flake:agda github:agda/agda\nglobal flake:arion github:hercules-ci/arion\nglobal flake:blender-bin github:edolstra/nix-warez?dir=blender\nglobal flake:composable github:ComposableFi/composable\nglobal flake:dreampkgs github:nix-community/dreampkgs\nglobal flake:dwarffs github:edolstra/dwarffs\nglobal flake:emacs-overlay github:nix-community/emacs-overlay\nglobal flake:fenix github:nix-community/fenix\nglobal flake:flake-parts github:hercules-ci/flake-parts\nglobal flake:flake-utils github:numtide/flake-utils\nglobal flake:gemini github:nix-community/flake-gemini\nglobal flake:hercules-ci-effects github:hercules-ci/hercules-ci-effects\nglobal flake:hercules-ci-agent github:hercules-ci/hercules-ci-agent\nglobal flake:home-manager github:nix-community/home-manager\nglobal flake:hydra github:NixOS/hydra\nglobal flake:mach-nix github:DavHau/mach-nix\nglobal flake:nimble github:nix-community/flake-nimble\nglobal flake:nix github:NixOS/nix\nglobal flake:nix-darwin github:LnL7/nix-darwin\nglobal flake:nixops github:NixOS/nixops\nglobal flake:nixos-hardware github:NixOS/nixos-hardware\nglobal flake:nixos-homepage github:NixOS/nixos-homepage\nglobal flake:nixos-search github:NixOS/nixos-search\nglobal flake:nur github:nix-community/NUR\nglobal flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-global-registry\nuser flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-user-registry\nglobal flake:templates github:NixOS/templates\nglobal flake:patchelf github:NixOS/patchelf\nglobal flake:poetry2nix github:nix-community/poetry2nix\nglobal flake:nix-serve github:edolstra/nix-serve\nglobal flake:nickel github:tweag/nickel\nglobal flake:bundlers github:NixOS/bundlers\nglobal flake:pridefetch github:SpyHoodle/pridefetch\nglobal flake:systems github:nix-systems/default\nglobal flake:helix github:helix-editor/helix\nglobal flake:sops-nix github:Mic92/sops-nix\n" :: Text + +dbWithSystemNixpkgs = "global flake:agda github:agda/agda\nglobal flake:arion github:hercules-ci/arion\nglobal flake:blender-bin github:edolstra/nix-warez?dir=blender\nglobal flake:composable github:ComposableFi/composable\nglobal flake:dreampkgs github:nix-community/dreampkgs\nglobal flake:dwarffs github:edolstra/dwarffs\nglobal flake:emacs-overlay github:nix-community/emacs-overlay\nglobal flake:fenix github:nix-community/fenix\nglobal flake:flake-parts github:hercules-ci/flake-parts\nglobal flake:flake-utils github:numtide/flake-utils\nglobal flake:gemini github:nix-community/flake-gemini\nglobal flake:hercules-ci-effects github:hercules-ci/hercules-ci-effects\nglobal flake:hercules-ci-agent github:hercules-ci/hercules-ci-agent\nglobal flake:home-manager github:nix-community/home-manager\nglobal flake:hydra github:NixOS/hydra\nglobal flake:mach-nix github:DavHau/mach-nix\nglobal flake:nimble github:nix-community/flake-nimble\nglobal flake:nix github:NixOS/nix\nglobal flake:nix-darwin github:LnL7/nix-darwin\nglobal flake:nixops github:NixOS/nixops\nglobal flake:nixos-hardware github:NixOS/nixos-hardware\nglobal flake:nixos-homepage github:NixOS/nixos-homepage\nglobal flake:nixos-search github:NixOS/nixos-search\nglobal flake:nur github:nix-community/NUR\nglobal flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-global-registry\nsystem flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-system-registry\nglobal flake:templates github:NixOS/templates\nglobal flake:patchelf github:NixOS/patchelf\nglobal flake:poetry2nix github:nix-community/poetry2nix\nglobal flake:nix-serve github:edolstra/nix-serve\nglobal flake:nickel github:tweag/nickel\nglobal flake:bundlers github:NixOS/bundlers\nglobal flake:pridefetch github:SpyHoodle/pridefetch\nglobal flake:systems github:nix-systems/default\nglobal flake:helix github:helix-editor/helix\nglobal flake:sops-nix github:Mic92/sops-nix\n" :: Text + +dbWithUserToGlobalNixpkgs = "global flake:agda github:agda/agda\nglobal flake:arion github:hercules-ci/arion\nglobal flake:blender-bin github:edolstra/nix-warez?dir=blender\nglobal flake:composable github:ComposableFi/composable\nglobal flake:dreampkgs github:nix-community/dreampkgs\nglobal flake:dwarffs github:edolstra/dwarffs\nglobal flake:emacs-overlay github:nix-community/emacs-overlay\nglobal flake:fenix github:nix-community/fenix\nglobal flake:flake-parts github:hercules-ci/flake-parts\nglobal flake:flake-utils github:numtide/flake-utils\nglobal flake:gemini github:nix-community/flake-gemini\nglobal flake:hercules-ci-effects github:hercules-ci/hercules-ci-effects\nglobal flake:hercules-ci-agent github:hercules-ci/hercules-ci-agent\nglobal flake:home-manager github:nix-community/home-manager\nglobal flake:hydra github:NixOS/hydra\nglobal flake:mach-nix github:DavHau/mach-nix\nglobal flake:nimble github:nix-community/flake-nimble\nglobal flake:nix github:NixOS/nix\nglobal flake:nix-darwin github:LnL7/nix-darwin\nglobal flake:nixops github:NixOS/nixops\nglobal flake:nixos-hardware github:NixOS/nixos-hardware\nglobal flake:nixos-homepage github:NixOS/nixos-homepage\nglobal flake:nixos-search github:NixOS/nixos-search\nglobal flake:nur github:nix-community/NUR\nuser flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-user-registry\nsystem flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-system-registry\nglobal flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-global-registry\nglobal flake:templates github:NixOS/templates\nglobal flake:patchelf github:NixOS/patchelf\nglobal flake:poetry2nix github:nix-community/poetry2nix\nglobal flake:nix-serve github:edolstra/nix-serve\nglobal flake:nickel github:tweag/nickel\nglobal flake:bundlers github:NixOS/bundlers\nglobal flake:pridefetch github:SpyHoodle/pridefetch\nglobal flake:systems github:nix-systems/default\nglobal flake:helix github:helix-editor/helix\nglobal flake:sops-nix github:Mic92/sops-nix\n" :: Text + +dbWithLocalSystemToGlobalNixpkgs = "global flake:agda github:agda/agda\nglobal flake:arion github:hercules-ci/arion\nglobal flake:blender-bin github:edolstra/nix-warez?dir=blender\nglobal flake:composable github:ComposableFi/composable\nglobal flake:dreampkgs github:nix-community/dreampkgs\nglobal flake:dwarffs github:edolstra/dwarffs\nglobal flake:emacs-overlay github:nix-community/emacs-overlay\nglobal flake:fenix github:nix-community/fenix\nglobal flake:flake-parts github:hercules-ci/flake-parts\nglobal flake:flake-utils github:numtide/flake-utils\nglobal flake:gemini github:nix-community/flake-gemini\nglobal flake:hercules-ci-effects github:hercules-ci/hercules-ci-effects\nglobal flake:hercules-ci-agent github:hercules-ci/hercules-ci-agent\nglobal flake:home-manager github:nix-community/home-manager\nglobal flake:hydra github:NixOS/hydra\nglobal flake:mach-nix github:DavHau/mach-nix\nglobal flake:nimble github:nix-community/flake-nimble\nglobal flake:nix github:NixOS/nix\nglobal flake:nix-darwin github:LnL7/nix-darwin\nglobal flake:nixops github:NixOS/nixops\nglobal flake:nixos-hardware github:NixOS/nixos-hardware\nglobal flake:nixos-homepage github:NixOS/nixos-homepage\nglobal flake:nixos-search github:NixOS/nixos-search\nglobal flake:nur github:nix-community/NUR\nsystem flake:nixpkgs path:/local/nixpkgs/path\nglobal flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-global-registry\nglobal flake:templates github:NixOS/templates\nglobal flake:patchelf github:NixOS/patchelf\nglobal flake:poetry2nix github:nix-community/poetry2nix\nglobal flake:nix-serve github:edolstra/nix-serve\nglobal flake:nickel github:tweag/nickel\nglobal flake:bundlers github:NixOS/bundlers\nglobal flake:pridefetch github:SpyHoodle/pridefetch\nglobal flake:systems github:nix-systems/default\nglobal flake:helix github:helix-editor/helix\nglobal flake:sops-nix github:Mic92/sops-nix\n" :: Text + +dbWithLocalSystemNixpkgs = "global flake:agda github:agda/agda\nglobal flake:arion github:hercules-ci/arion\nglobal flake:blender-bin github:edolstra/nix-warez?dir=blender\nglobal flake:composable github:ComposableFi/composable\nglobal flake:dreampkgs github:nix-community/dreampkgs\nglobal flake:dwarffs github:edolstra/dwarffs\nglobal flake:emacs-overlay github:nix-community/emacs-overlay\nglobal flake:fenix github:nix-community/fenix\nglobal flake:flake-parts github:hercules-ci/flake-parts\nglobal flake:flake-utils github:numtide/flake-utils\nglobal flake:gemini github:nix-community/flake-gemini\nglobal flake:hercules-ci-effects github:hercules-ci/hercules-ci-effects\nglobal flake:hercules-ci-agent github:hercules-ci/hercules-ci-agent\nglobal flake:home-manager github:nix-community/home-manager\nglobal flake:hydra github:NixOS/hydra\nglobal flake:mach-nix github:DavHau/mach-nix\nglobal flake:nimble github:nix-community/flake-nimble\nglobal flake:nix github:NixOS/nix\nglobal flake:nix-darwin github:LnL7/nix-darwin\nglobal flake:nixops github:NixOS/nixops\nglobal flake:nixos-hardware github:NixOS/nixos-hardware\nglobal flake:nixos-homepage github:NixOS/nixos-homepage\nglobal flake:nixos-search github:NixOS/nixos-search\nglobal flake:nur github:nix-community/NUR\nsystem flake:nixpkgs path:/local/nixpkgs/path\nglobal flake:templates github:NixOS/templates\nglobal flake:patchelf github:NixOS/patchelf\nglobal flake:poetry2nix github:nix-community/poetry2nix\nglobal flake:nix-serve github:edolstra/nix-serve\nglobal flake:nickel github:tweag/nickel\nglobal flake:bundlers github:NixOS/bundlers\nglobal flake:pridefetch github:SpyHoodle/pridefetch\nglobal flake:systems github:nix-systems/default\nglobal flake:helix github:helix-editor/helix\nglobal flake:sops-nix github:Mic92/sops-nix\n" :: Text + +dbWithGlobalToUserNixpkgs = "global flake:agda github:agda/agda\nglobal flake:arion github:hercules-ci/arion\nglobal flake:blender-bin github:edolstra/nix-warez?dir=blender\nglobal flake:composable github:ComposableFi/composable\nglobal flake:dreampkgs github:nix-community/dreampkgs\nglobal flake:dwarffs github:edolstra/dwarffs\nglobal flake:emacs-overlay github:nix-community/emacs-overlay\nglobal flake:fenix github:nix-community/fenix\nglobal flake:flake-parts github:hercules-ci/flake-parts\nglobal flake:flake-utils github:numtide/flake-utils\nglobal flake:gemini github:nix-community/flake-gemini\nglobal flake:hercules-ci-effects github:hercules-ci/hercules-ci-effects\nglobal flake:hercules-ci-agent github:hercules-ci/hercules-ci-agent\nglobal flake:home-manager github:nix-community/home-manager\nglobal flake:hydra github:NixOS/hydra\nglobal flake:mach-nix github:DavHau/mach-nix\nglobal flake:nimble github:nix-community/flake-nimble\nglobal flake:nix github:NixOS/nix\nglobal flake:nix-darwin github:LnL7/nix-darwin\nglobal flake:nixops github:NixOS/nixops\nglobal flake:nixos-hardware github:NixOS/nixos-hardware\nglobal flake:nixos-homepage github:NixOS/nixos-homepage\nglobal flake:nixos-search github:NixOS/nixos-search\nglobal flake:nur github:nix-community/NUR\nglobal flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-global-registry\nsystem flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-system-registry\nuser flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-user-registry\nglobal flake:templates github:NixOS/templates\nglobal flake:patchelf github:NixOS/patchelf\nglobal flake:poetry2nix github:nix-community/poetry2nix\nglobal flake:nix-serve github:edolstra/nix-serve\nglobal flake:nickel github:tweag/nickel\nglobal flake:bundlers github:NixOS/bundlers\nglobal flake:pridefetch github:SpyHoodle/pridefetch\nglobal flake:systems github:nix-systems/default\nglobal flake:helix github:helix-editor/helix\nglobal flake:sops-nix github:Mic92/sops-nix\n" :: Text + +dbWithSystemAndGlobalNixpkgs = "global flake:agda github:agda/agda\nglobal flake:arion github:hercules-ci/arion\nglobal flake:blender-bin github:edolstra/nix-warez?dir=blender\nglobal flake:composable github:ComposableFi/composable\nglobal flake:dreampkgs github:nix-community/dreampkgs\nglobal flake:dwarffs github:edolstra/dwarffs\nglobal flake:emacs-overlay github:nix-community/emacs-overlay\nglobal flake:fenix github:nix-community/fenix\nglobal flake:flake-parts github:hercules-ci/flake-parts\nglobal flake:flake-utils github:numtide/flake-utils\nglobal flake:gemini github:nix-community/flake-gemini\nglobal flake:hercules-ci-effects github:hercules-ci/hercules-ci-effects\nglobal flake:hercules-ci-agent github:hercules-ci/hercules-ci-agent\nglobal flake:home-manager github:nix-community/home-manager\nglobal flake:hydra github:NixOS/hydra\nglobal flake:mach-nix github:DavHau/mach-nix\nglobal flake:nimble github:nix-community/flake-nimble\nglobal flake:nix github:NixOS/nix\nglobal flake:nix-darwin github:LnL7/nix-darwin\nglobal flake:nixops github:NixOS/nixops\nglobal flake:nixos-hardware github:NixOS/nixos-hardware\nglobal flake:nixos-homepage github:NixOS/nixos-homepage\nglobal flake:nixos-search github:NixOS/nixos-search\nglobal flake:nur github:nix-community/NUR\nsystem flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-system-registry\nglobal flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-global-registry\nglobal flake:templates github:NixOS/templates\nglobal flake:patchelf github:NixOS/patchelf\nglobal flake:poetry2nix github:nix-community/poetry2nix\nglobal flake:nix-serve github:edolstra/nix-serve\nglobal flake:nickel github:tweag/nickel\nglobal flake:bundlers github:NixOS/bundlers\nglobal flake:pridefetch github:SpyHoodle/pridefetch\nglobal flake:systems github:nix-systems/default\nglobal flake:helix github:helix-editor/helix\nglobal flake:sops-nix github:Mic92/sops-nix\n" :: Text + +dbWithOnlyGlobalNixpkgs = "global flake:agda github:agda/agda\nglobal flake:arion github:hercules-ci/arion\nglobal flake:blender-bin github:edolstra/nix-warez?dir=blender\nglobal flake:composable github:ComposableFi/composable\nglobal flake:dreampkgs github:nix-community/dreampkgs\nglobal flake:dwarffs github:edolstra/dwarffs\nglobal flake:emacs-overlay github:nix-community/emacs-overlay\nglobal flake:fenix github:nix-community/fenix\nglobal flake:flake-parts github:hercules-ci/flake-parts\nglobal flake:flake-utils github:numtide/flake-utils\nglobal flake:gemini github:nix-community/flake-gemini\nglobal flake:hercules-ci-effects github:hercules-ci/hercules-ci-effects\nglobal flake:hercules-ci-agent github:hercules-ci/hercules-ci-agent\nglobal flake:home-manager github:nix-community/home-manager\nglobal flake:hydra github:NixOS/hydra\nglobal flake:mach-nix github:DavHau/mach-nix\nglobal flake:nimble github:nix-community/flake-nimble\nglobal flake:nix github:NixOS/nix\nglobal flake:nix-darwin github:LnL7/nix-darwin\nglobal flake:nixops github:NixOS/nixops\nglobal flake:nixos-hardware github:NixOS/nixos-hardware\nglobal flake:nixos-homepage github:NixOS/nixos-homepage\nglobal flake:nixos-search github:NixOS/nixos-search\nglobal flake:nur github:nix-community/NUR\nglobal flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-global-registry\nglobal flake:templates github:NixOS/templates\nglobal flake:patchelf github:NixOS/patchelf\nglobal flake:poetry2nix github:nix-community/poetry2nix\nglobal flake:nix-serve github:edolstra/nix-serve\nglobal flake:nickel github:tweag/nickel\nglobal flake:bundlers github:NixOS/bundlers\nglobal flake:pridefetch github:SpyHoodle/pridefetch\nglobal flake:systems github:nix-systems/default\nglobal flake:helix github:helix-editor/helix\nglobal flake:sops-nix github:Mic92/sops-nix\n" :: Text + +dbWithGlobalToSystemNixpkgs = "global flake:agda github:agda/agda\nglobal flake:arion github:hercules-ci/arion\nglobal flake:blender-bin github:edolstra/nix-warez?dir=blender\nglobal flake:composable github:ComposableFi/composable\nglobal flake:dreampkgs github:nix-community/dreampkgs\nglobal flake:dwarffs github:edolstra/dwarffs\nglobal flake:emacs-overlay github:nix-community/emacs-overlay\nglobal flake:fenix github:nix-community/fenix\nglobal flake:flake-parts github:hercules-ci/flake-parts\nglobal flake:flake-utils github:numtide/flake-utils\nglobal flake:gemini github:nix-community/flake-gemini\nglobal flake:hercules-ci-effects github:hercules-ci/hercules-ci-effects\nglobal flake:hercules-ci-agent github:hercules-ci/hercules-ci-agent\nglobal flake:home-manager github:nix-community/home-manager\nglobal flake:hydra github:NixOS/hydra\nglobal flake:mach-nix github:DavHau/mach-nix\nglobal flake:nimble github:nix-community/flake-nimble\nglobal flake:nix github:NixOS/nix\nglobal flake:nix-darwin github:LnL7/nix-darwin\nglobal flake:nixops github:NixOS/nixops\nglobal flake:nixos-hardware github:NixOS/nixos-hardware\nglobal flake:nixos-homepage github:NixOS/nixos-homepage\nglobal flake:nixos-search github:NixOS/nixos-search\nglobal flake:nur github:nix-community/NUR\nglobal flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-global-registry\nsystem flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-system-registry\nglobal flake:templates github:NixOS/templates\nglobal flake:patchelf github:NixOS/patchelf\nglobal flake:poetry2nix github:nix-community/poetry2nix\nglobal flake:nix-serve github:edolstra/nix-serve\nglobal flake:nickel github:tweag/nickel\nglobal flake:bundlers github:NixOS/bundlers\nglobal flake:pridefetch github:SpyHoodle/pridefetch\nglobal flake:systems github:nix-systems/default\nglobal flake:helix github:helix-editor/helix\nglobal flake:sops-nix github:Mic92/sops-nix\n" :: Text + +dbWithGlobalToSystemCustomPkgs = "global flake:arion github:hercules-ci/arion\nglobal flake:blender-bin github:edolstra/nix-warez?dir=blender\nglobal flake:composable github:ComposableFi/composable\nglobal flake:dreampkgs github:nix-community/dreampkgs\nglobal flake:dwarffs github:edolstra/dwarffs\nglobal flake:emacs-overlay github:nix-community/emacs-overlay\nglobal flake:fenix github:nix-community/fenix\nglobal flake:flake-parts github:hercules-ci/flake-parts\nglobal flake:flake-utils github:numtide/flake-utils\nglobal flake:gemini github:nix-community/flake-gemini\nglobal flake:hercules-ci-effects github:hercules-ci/hercules-ci-effects\nglobal flake:hercules-ci-agent github:hercules-ci/hercules-ci-agent\nglobal flake:home-manager github:nix-community/home-manager\nglobal flake:hydra github:NixOS/hydra\nglobal flake:mach-nix github:DavHau/mach-nix\nglobal flake:nimble github:nix-community/flake-nimble\nglobal flake:nix github:NixOS/nix\nglobal flake:nix-darwin github:LnL7/nix-darwin\nglobal flake:nixops github:NixOS/nixops\nglobal flake:nixos-hardware github:NixOS/nixos-hardware\nglobal flake:nixos-homepage github:NixOS/nixos-homepage\nglobal flake:nixos-search github:NixOS/nixos-search\nglobal flake:nur github:nix-community/NUR\nglobal flake:custompkgs github:NixOS/custompkgs/custompkgs-global-registry\nsystem flake:custompkgs github:NixOS/custompkgs/custompkgs-system-registry\nglobal flake:templates github:NixOS/templates\nglobal flake:patchelf github:NixOS/patchelf\nglobal flake:poetry2nix github:nix-community/poetry2nix\nglobal flake:nix-serve github:edolstra/nix-serve\nglobal flake:nickel github:tweag/nickel\nglobal flake:bundlers github:NixOS/bundlers\nglobal flake:pridefetch github:SpyHoodle/pridefetch\nglobal flake:systems github:nix-systems/default\nglobal flake:helix github:helix-editor/helix\nglobal flake:sops-nix github:Mic92/sops-nix\nglobal flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-unstable\n" :: Text + +dbWithSystemToGlobalCustomPkgs = "global flake:flake-utils github:numtide/flake-utils\nsystem flake:custompkgs github:NixOS/custompkgs/custompkgs-system-registry\nglobal flake:custompkgs github:NixOS/custompkgs/custompkgs-global-registry\nglobal flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-unstable\n" :: Text diff --git a/test/outputs/cowsay-from-global-nixpkgs-flake.nix b/test/outputs/cowsay-from-global-nixpkgs-flake.nix new file mode 100644 index 0000000..5f85367 --- /dev/null +++ b/test/outputs/cowsay-from-global-nixpkgs-flake.nix @@ -0,0 +1,20 @@ +{ + description = "my project description"; + + inputs = { + + flake-utils.url = "github:numtide/flake-utils"; + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-global-registry"; + + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem + (system: + let nixpkgsPkgs = if builtins.hasAttr "packages" nixpkgs then nixpkgs.packages.${system} else ( if builtins.hasAttr "legacyPackages" nixpkgs then nixpkgs.legacyPackages.${system} else nixpkgs); + in + { + devShells.default = import ./shell.nix { pkgs=nixpkgsPkgs; }; + } + ); +} diff --git a/test/outputs/cowsay-from-global-nixpkgs-shell.nix b/test/outputs/cowsay-from-global-nixpkgs-shell.nix new file mode 100644 index 0000000..6cde827 --- /dev/null +++ b/test/outputs/cowsay-from-global-nixpkgs-shell.nix @@ -0,0 +1,9 @@ +{ pkgs ? import {} }: + +pkgs.mkShell { + + buildInputs = [ + pkgs.cowsay + ]; + +} diff --git a/test/outputs/cowsay-from-local-nixpkgs-flake.nix b/test/outputs/cowsay-from-local-nixpkgs-flake.nix new file mode 100644 index 0000000..efe8d8e --- /dev/null +++ b/test/outputs/cowsay-from-local-nixpkgs-flake.nix @@ -0,0 +1,20 @@ +{ + description = "my project description"; + + inputs = { + + flake-utils.url = "github:numtide/flake-utils"; + nixpkgs.url = "path:/local/nixpkgs/path"; + + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem + (system: + let nixpkgsPkgs = if builtins.hasAttr "packages" nixpkgs then nixpkgs.packages.${system} else ( if builtins.hasAttr "legacyPackages" nixpkgs then nixpkgs.legacyPackages.${system} else nixpkgs); + in + { + devShells.default = import ./shell.nix { pkgs=nixpkgsPkgs; }; + } + ); +} diff --git a/test/outputs/cowsay-from-local-nixpkgs-shell.nix b/test/outputs/cowsay-from-local-nixpkgs-shell.nix new file mode 100644 index 0000000..6cde827 --- /dev/null +++ b/test/outputs/cowsay-from-local-nixpkgs-shell.nix @@ -0,0 +1,9 @@ +{ pkgs ? import {} }: + +pkgs.mkShell { + + buildInputs = [ + pkgs.cowsay + ]; + +} diff --git a/test/outputs/cowsay-from-system-custompkgs-flake.nix b/test/outputs/cowsay-from-system-custompkgs-flake.nix new file mode 100644 index 0000000..2177748 --- /dev/null +++ b/test/outputs/cowsay-from-system-custompkgs-flake.nix @@ -0,0 +1,22 @@ +{ + description = "my project description"; + + inputs = { + + flake-utils.url = "github:numtide/flake-utils"; + custompkgs.url = "github:NixOS/custompkgs/custompkgs-system-registry"; + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + + }; + + outputs = { self, custompkgs, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem + (system: + let custompkgsPkgs = if builtins.hasAttr "packages" custompkgs then custompkgs.packages.${system} else ( if builtins.hasAttr "legacyPackages" custompkgs then custompkgs.legacyPackages.${system} else custompkgs); + nixpkgsPkgs = if builtins.hasAttr "packages" nixpkgs then nixpkgs.packages.${system} else ( if builtins.hasAttr "legacyPackages" nixpkgs then nixpkgs.legacyPackages.${system} else nixpkgs); + in + { + devShells.default = import ./shell.nix { custompkgs=custompkgsPkgs; pkgs=nixpkgsPkgs; }; + } + ); +} diff --git a/test/outputs/cowsay-from-system-custompkgs-shell.nix b/test/outputs/cowsay-from-system-custompkgs-shell.nix new file mode 100644 index 0000000..395b883 --- /dev/null +++ b/test/outputs/cowsay-from-system-custompkgs-shell.nix @@ -0,0 +1,9 @@ +{ custompkgs, pkgs ? import {} }: + +pkgs.mkShell { + + buildInputs = [ + custompkgs.cowsay + ]; + +} diff --git a/test/outputs/cowsay-from-system-nixpkgs-flake.nix b/test/outputs/cowsay-from-system-nixpkgs-flake.nix new file mode 100644 index 0000000..863d049 --- /dev/null +++ b/test/outputs/cowsay-from-system-nixpkgs-flake.nix @@ -0,0 +1,20 @@ +{ + description = "my project description"; + + inputs = { + + flake-utils.url = "github:numtide/flake-utils"; + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-system-registry"; + + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem + (system: + let nixpkgsPkgs = if builtins.hasAttr "packages" nixpkgs then nixpkgs.packages.${system} else ( if builtins.hasAttr "legacyPackages" nixpkgs then nixpkgs.legacyPackages.${system} else nixpkgs); + in + { + devShells.default = import ./shell.nix { pkgs=nixpkgsPkgs; }; + } + ); +} diff --git a/test/outputs/cowsay-from-system-nixpkgs-shell.nix b/test/outputs/cowsay-from-system-nixpkgs-shell.nix new file mode 100644 index 0000000..6cde827 --- /dev/null +++ b/test/outputs/cowsay-from-system-nixpkgs-shell.nix @@ -0,0 +1,9 @@ +{ pkgs ? import {} }: + +pkgs.mkShell { + + buildInputs = [ + pkgs.cowsay + ]; + +} diff --git a/test/outputs/cowsay-from-user-nixpkgs-flake.nix b/test/outputs/cowsay-from-user-nixpkgs-flake.nix new file mode 100644 index 0000000..354acd1 --- /dev/null +++ b/test/outputs/cowsay-from-user-nixpkgs-flake.nix @@ -0,0 +1,20 @@ +{ + description = "my project description"; + + inputs = { + + flake-utils.url = "github:numtide/flake-utils"; + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-user-registry"; + + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem + (system: + let nixpkgsPkgs = if builtins.hasAttr "packages" nixpkgs then nixpkgs.packages.${system} else ( if builtins.hasAttr "legacyPackages" nixpkgs then nixpkgs.legacyPackages.${system} else nixpkgs); + in + { + devShells.default = import ./shell.nix { pkgs=nixpkgsPkgs; }; + } + ); +} diff --git a/test/outputs/cowsay-from-user-nixpkgs-shell.nix b/test/outputs/cowsay-from-user-nixpkgs-shell.nix new file mode 100644 index 0000000..6cde827 --- /dev/null +++ b/test/outputs/cowsay-from-user-nixpkgs-shell.nix @@ -0,0 +1,9 @@ +{ pkgs ? import {} }: + +pkgs.mkShell { + + buildInputs = [ + pkgs.cowsay + ]; + +} diff --git a/test/outputs/inputs-from-unknown-source-flake.nix b/test/outputs/inputs-from-unknown-source-flake.nix new file mode 100644 index 0000000..aadbb38 --- /dev/null +++ b/test/outputs/inputs-from-unknown-source-flake.nix @@ -0,0 +1,22 @@ +{ + description = "my project description"; + + inputs = { + + flake-utils.url = "github:numtide/flake-utils"; + foo.url = "PLEASE ENTER input here"; + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + + }; + + outputs = { self, foo, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem + (system: + let fooPkgs = if builtins.hasAttr "packages" foo then foo.packages.${system} else ( if builtins.hasAttr "legacyPackages" foo then foo.legacyPackages.${system} else foo); + nixpkgsPkgs = if builtins.hasAttr "packages" nixpkgs then nixpkgs.packages.${system} else ( if builtins.hasAttr "legacyPackages" nixpkgs then nixpkgs.legacyPackages.${system} else nixpkgs); + in + { + devShells.default = import ./shell.nix { foo=fooPkgs; pkgs=nixpkgsPkgs; }; + } + ); +} diff --git a/test/outputs/inputs-from-unknown-source-shell.nix b/test/outputs/inputs-from-unknown-source-shell.nix new file mode 100644 index 0000000..ebdf5ea --- /dev/null +++ b/test/outputs/inputs-from-unknown-source-shell.nix @@ -0,0 +1,9 @@ +{ foo, pkgs ? import {} }: + +pkgs.mkShell { + + buildInputs = [ + foo.cowsay + ]; + +} From b35ce7ad3191a8cdf2f13933c0cf62a80f6fbc3f Mon Sep 17 00:00:00 2001 From: Daniel Rolls Date: Sun, 12 Jan 2025 18:07:42 +0000 Subject: [PATCH 2/4] Explicitly enable tests... ...to ensure builds are test-suite compaible --- .github/workflows/cabaltest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cabaltest.yml b/.github/workflows/cabaltest.yml index 0413528..4b04532 100644 --- a/.github/workflows/cabaltest.yml +++ b/.github/workflows/cabaltest.yml @@ -12,4 +12,4 @@ jobs: nix_path: nixpkgs=channel:nixos-unstable - run: nix develop - run: cabal v2-update - - run: cabal v2-test + - run: cabal v2-test --enable-tests From 6eb78625841a538a86615c4cd6fba26a8fd2dea9 Mon Sep 17 00:00:00 2001 From: Daniel Rolls Date: Sun, 12 Jan 2025 19:39:35 +0000 Subject: [PATCH 3/4] Trigger cabal through development shells on Github --- .github/workflows/cabaltest.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cabaltest.yml b/.github/workflows/cabaltest.yml index 4b04532..3715d05 100644 --- a/.github/workflows/cabaltest.yml +++ b/.github/workflows/cabaltest.yml @@ -11,5 +11,5 @@ jobs: with: nix_path: nixpkgs=channel:nixos-unstable - run: nix develop - - run: cabal v2-update - - run: cabal v2-test --enable-tests + - run: nix develop --command cabal v2-update + - run: nix develop --command cabal v2-test --enable-tests From 4b904ee963938dd0f67d836b8a075e15168f7187 Mon Sep 17 00:00:00 2001 From: Daniel Rolls Date: Sat, 18 Jan 2025 08:45:11 +0000 Subject: [PATCH 4/4] --allow-local-pinned-registries-to-be-prioritized --- shellify.cabal | 1 - src/Constants.hs | 6 ++ src/Options.hs | 5 +- src/TemplateGeneration.hs | 39 +++---- test/Spec.hs | 211 ++++++++++++++++++++------------------ test/TestHelpers.hs | 141 +++++++++++++++---------- 6 files changed, 225 insertions(+), 178 deletions(-) diff --git a/shellify.cabal b/shellify.cabal index 53815a8..55645ac 100644 --- a/shellify.cabal +++ b/shellify.cabal @@ -56,7 +56,6 @@ library directory >=1.3.6.2 && <1.4, extra >=1.7.13 && <1.9, HStringTemplate >=0.8.8 && <0.9, - MissingH >=1.6.0.1 && <1.7, mtl >=2.2.2 && <2.4, parsec >=3.1.17.0 && <3.2, shake >=0.19.7 && <0.20, diff --git a/src/Constants.hs b/src/Constants.hs index 71babad..f15ee4f 100644 --- a/src/Constants.hs +++ b/src/Constants.hs @@ -26,6 +26,12 @@ Options the versions of dependencies are kept for reproducibility and so that shells are cached to load faster. + --allow-local-pinned-registries-to-be-prioritized + Pinned local repoisitory URLs are usually taken last when looking for URLs for + generated flake.nix files. This is usually desired. If you do however want + to see these pinned entries in the flake file as specified in your registry, + then set this flag. + --version Show the version number |] diff --git a/src/Options.hs b/src/Options.hs index 1cf64e8..da7f031 100644 --- a/src/Options.hs +++ b/src/Options.hs @@ -29,6 +29,7 @@ data Options = Options { packages :: Packages , command :: Maybe Text , generateFlake :: Bool + , prioritiseLocalPinnedSystem :: Bool } data OptionsParser = OptionsParser [Text] -- remainingOptions @@ -59,6 +60,7 @@ options progName args = oldStyleOption opt = baseOption opt newStyleOption "-p" = returnError "-p not supported with new style commands" newStyleOption "--packages" = returnError "--packages not supported with new style commands" + newStyleOption "--allow-local-pinned-registries-to-be-prioritized" = transformOptionsWith setPrioritiseLocalPinnedSystem newStyleOption arg | isSwitch arg = baseOption arg | otherwise = transformOptionsWith $ appendPackages [arg] baseOption :: Text -> [Text] -> OptionsParser @@ -82,6 +84,7 @@ options progName args = appendPackages ps opts = opts{packages=ps ++ packages opts} setCommand cmd opts = opts{command=Just cmd} setFlakeGeneration opts = opts{generateFlake=True} + setPrioritiseLocalPinnedSystem opts = opts {prioritiseLocalPinnedSystem=True} returnError errorText remaining = OptionsParser remaining $ Left errorText consumePackageArgs :: [Text] -> (Packages, [Text]) @@ -99,7 +102,7 @@ hasShellArg (hd:tl) | isSwitch hd = hasShellArg tl isSwitch = isPrefixOf "-" instance Default Options where - def = Options [] Nothing False + def = Options [] Nothing False False instance Eq Options where a == b = isEqual command diff --git a/src/TemplateGeneration.hs b/src/TemplateGeneration.hs index 394a9e3..3d42b5f 100644 --- a/src/TemplateGeneration.hs +++ b/src/TemplateGeneration.hs @@ -7,18 +7,17 @@ import ShellifyTemplate import Data.Bifunctor (bimap) import Data.Bool (bool) -import Data.List (find, sort, sortBy) +import Data.List (find, sort, sortBy, sortOn) import Data.Maybe (fromMaybe) import Data.Set (fromList, toList) -import Data.String.Utils (strip) import Data.Text (Text(), isInfixOf, isPrefixOf, pack, splitOn, unpack) import Development.Shake.Command (cmd, Exit(Exit), Stderr(Stderr), Stdout(Stdout)) import System.Exit (ExitCode (ExitSuccess)) -import Text.ParserCombinators.Parsec (Parser, char, endBy, eof, many1, noneOf, parse, sepBy, string, (<|>)) +import Text.ParserCombinators.Parsec (Parser, char, endBy, eof, many1, noneOf, parse, string, (<|>)) import Text.StringTemplate (newSTMP, render, setAttribute) generateFlakeText :: Text -> Options -> Maybe Text -generateFlakeText db Options{packages=packages, generateFlake=shouldGenerateFlake} = +generateFlakeText db Options{packages=packages, generateFlake=shouldGenerateFlake, prioritiseLocalPinnedSystem=prioritiseLocalPinnedSystem} = bool Nothing (Just $ render @@ -36,7 +35,7 @@ generateFlakeText db Options{packages=packages, generateFlake=shouldGenerateFlak either (error . ("Unexpected output from nix registry call: " <>)) (fromMaybe "PLEASE ENTER input here") - . findFlakeRepoUrl db $ repoName + . findFlakeRepoUrl prioritiseLocalPinnedSystem db $ repoName pkgsVar = (<> "Pkgs") pkgsVars = pkgsVar <$> repos pkgsDecls = (\repo -> pkgsDecl (pkgsVar repo) repo) <$> repos @@ -96,12 +95,12 @@ getRegistryDB = (Right $ pack out) (ex == ExitSuccess) -findFlakeRepoUrl :: Text -> Text -> Either String (Maybe Text) -findFlakeRepoUrl haystack needle = +findFlakeRepoUrl :: Bool -> Text -> Text -> Either String (Maybe Text) +findFlakeRepoUrl prioritiseLocalPinnedSystem haystack needle = bimap ((<>) "Error processing nix registry list output: " . show) (fmap repoUrl . find ((needle ==) . repoName) - . sortBy compareRepoEntries) - $ parse parseRepos "" . strip . unpack $ haystack + . (if prioritiseLocalPinnedSystem then sortOn repoType else sortBy compareRepoEntries)) + $ parse parseRepos "" . unpack $ haystack compareRepoEntries repoA repoB | repoHasLocalPinning repoA && not (repoHasLocalPinning repoB) = GT @@ -119,22 +118,16 @@ data FlakeRepo = FlakeRepo { } parseRepos :: Parser [FlakeRepo] -parseRepos = do res <- parseLines +parseRepos = do res <- endBy parseLine (char '\n') eof return res ---parseRepos = endBy parseLines eof - -parseLines :: Parser [FlakeRepo] -parseLines = sepBy parseLine (char '\n') - -parseLine :: Parser FlakeRepo -parseLine = do repoType <- parseRepoType - char ' ' - flakeName <- string "flake:" >> parseParam - char ' ' - repoUrl <- parseParam - return $ FlakeRepo (pack flakeName) (pack repoUrl) repoType - where parseParam = many1 (noneOf " \n") + where parseLine = do repoType <- parseRepoType + char ' ' + flakeName <- string "flake:" >> parseParam + char ' ' + repoUrl <- parseParam + return $ FlakeRepo (pack flakeName) (pack repoUrl) repoType + parseParam = many1 (noneOf " \n") parseRepoType = (string "global" >> return Global) <|> (string "system" >> return System) <|> (string "user" >> return User) diff --git a/test/Spec.hs b/test/Spec.hs index 1bc49bd..ca6c4bf 100644 --- a/test/Spec.hs +++ b/test/Spec.hs @@ -1,4 +1,4 @@ -import Test.Hspec (describe, hspec, it, shouldBe) +import Test.Hspec (describe, hspec, it, shouldBe, specify) import Options import TestHelpers @@ -6,48 +6,9 @@ import TestHelpers main = hspec $ do - describe "where system is local and global is available fall through to global" $ - whereALocalSystemAndFlakeGlobalNixpkgsExistsShellifyWithArgs "shell nixpkgs#cowsay" - `shouldReturnShellAndFlakeTextDefinedBy` - "cowsay-from-global-nixpkgs" - - describe "where system is local and no user or global is available, use local" $ - whereALocalSystemNixpkgsExistsShellifyWithArgs "shell nixpkgs#cowsay" - `shouldReturnShellAndFlakeTextDefinedBy` - "cowsay-from-local-nixpkgs" - - describe "When the nixpkgs in the registry is configured such that it defines a user registry" $ - whereOnlyAUserNixpkgsExistsShellifyWithArgs "shell nixpkgs#cowsay" - `shouldReturnShellAndFlakeTextDefinedBy` - "cowsay-from-user-nixpkgs" - - describe "When the custompkgs in the registry is configured such that it defines a global and system registry" $ - whereASystemAndGlobalCustomPkgsExistsShellifyWithArgs "shell custompkgs#cowsay" - `shouldReturnShellAndFlakeTextDefinedBy` - "cowsay-from-system-custompkgs" - - describe "When the custompkgs in the registry is configured such that it defines a system and global registry" $ - whereAGlobalAndSystemCustomPkgsExistsShellifyWithArgs "shell custompkgs#cowsay" - `shouldReturnShellAndFlakeTextDefinedBy` - "cowsay-from-system-custompkgs" - - describe "When the nixpkgs in the registry is configured such that it defines a system registry" $ - whereASystemAndGlobalNixpkgsExistsShellifyWithArgs "shell nixpkgs#cowsay" - `shouldReturnShellAndFlakeTextDefinedBy` - "cowsay-from-system-nixpkgs" - - describe "When the nixpkgs in the registry is configured such that it defines a system registry with the global registry listed first" $ - whereAGlobalAndSystemNixpkgsExistsShellifyWithArgs "shell nixpkgs#cowsay" - `shouldReturnShellAndFlakeTextDefinedBy` - "cowsay-from-system-nixpkgs" - - describe "When the nixpkgs in the registry is configured such that it defines only a global registry" $ - whereOnlyAGlobalNixpkgsExistsShellifyWithArgs "shell nixpkgs#cowsay" - `shouldReturnShellAndFlakeTextDefinedBy` - "cowsay-from-global-nixpkgs" - describe "When passing option combinations" $ do - it "should print a message saying no package is specified when no argument is supplied" $ + + it "prints a message saying no package is specified when no argument is supplied" $ shellifyWithArgs "" `shouldReturnSubstring` "without any packages specified" @@ -57,12 +18,12 @@ main = hspec $ do `shouldReturnSubstring` "without any packages specified" - it "should show help text when requested" $ do + it "shows help text when requested" $ do shellifyWithArgs "-h" `shouldReturnSubstring` "USAGE:" shellifyWithArgs "--help" `shouldReturnSubstring` "USAGE:" - it "should show the version number when requested" $ do + it "shows the version number when requested" $ do shellifyWithArgs "--version" `shouldReturnSubstring` "Shellify 0." @@ -74,93 +35,145 @@ main = hspec $ do `shouldBe` Left "--packages not supported with new style commands" - it "should allow a simple command to be specified with a package" $ - theOptions "-p python --command cowsay" - `shouldBe` - Right def{packages=["python"], command=Just "cowsay"} + describe "When using the --command option" $ do - it "should allow a simple command to be specified before a package" $ - theOptions "--run cowsay -p python" - `shouldBe` - Right def{packages=["python"], command=Just "cowsay"} + it "produces a shell with a shell hook" $ + shellifyWithArgs "-p python -p cowsay --command cowsay" + `shouldReturnShellTextDefinedBy` + "two-build-inputs-and-command" - it "should allow a simple command to be specified before and after a package" $ - theOptions "-p cowsay --command cowsay -p python" - `shouldBe` - Right def{packages=[ "cowsay", "python" ], command=Just "cowsay"} + it "allows a command to be specified with a package" $ + theOptions "-p python --command cowsay" + `shouldBe` + Right def{packages=["python"], command=Just "cowsay"} - it "Should fail if command has no argument" $ do - shellifyWithArgs "--command -p python" - `shouldReturnSubstring` "Argument missing to switch" - shellifyWithArgs "--command" - `shouldReturnSubstring` "Argument missing to switch" + it "allows a command to be specified before a package" $ + theOptions "--run cowsay -p python" + `shouldBe` + Right def{packages=["python"], command=Just "cowsay"} - it "should be able to specify one program to install after other arguments" $ + it "allows a command to be specified before and after a package" $ + theOptions "-p cowsay --command cowsay -p python" + `shouldBe` + Right def{packages=[ "cowsay", "python" ], command=Just "cowsay"} + + it "fails if command has no argument" $ do + shellifyWithArgs "--command -p python" + `shouldReturnSubstring` "Argument missing to switch" + shellifyWithArgs "--command" + `shouldReturnSubstring` "Argument missing to switch" + + it "supports specifying one program to install after other arguments" $ "foo -p python" `shouldResultInPackages` [ "python" ] - it "should support multiple packages passed to -p" $ + it "supports multiple packages passed to -p" $ "-p python cowsay" `shouldResultInPackages` [ "cowsay", "python" ] - it "should only accept packages up to the next switch" $ + it "only accepts packages up to the next switch" $ "-p python --arg x 2" `shouldResultInPackages` [ "python" ] - it "should support multiple adjacent -p switches" $ + it "supports multiple adjacent -p switches" $ "-p python -p cowsay" `shouldResultInPackages` [ "python", "cowsay" ] - it "should support separated -p switches" $ + it "supports separated -p switches" $ "-p cowsay --foo -p python" `shouldResultInPackages` [ "cowsay", "python" ] - it "should support long switches" $ + it "supports long switches" $ "--packages cowsay" `shouldResultInPackages` [ "cowsay" ] - it "should support new shell commands" $ + it "supports new shell commands" $ theOptions "shell nixpkgs#python nixpkgs#cowsay" `shouldBe` Right def{packages=[ "nixpkgs#python", "nixpkgs#cowsay" ], generateFlake=True} - describe "when one buildInputs is required from an unknown source" $ - shellifyWithArgs "--with-flake shell foo#cowsay" - `shouldReturnShellAndFlakeTextDefinedBy` - "inputs-from-unknown-source" - - describe "when two buildInputs are required from two sources" $ - shellifyWithArgs "--with-flake shell foo#cowsay nixpkgs#python" - `shouldReturnShellAndFlakeTextDefinedBy` - "inputs-from-know-and-unknown-sources" - - describe "when using 2 simple buildInputs from one source" $ - shellifyWithArgs "shell --with-flake python cowsay" - `shouldReturnShellAndFlakeTextDefinedBy` - "two-nixpkgs-inputs" - - describe "when pulling from 2 different known sources" $ - shellifyWithArgs "shell nixpkgs#python blender-bin#blender_3_5" - `shouldReturnShellAndFlakeTextDefinedBy` - "inputs-from-different-registries" - - describe "when working with 2 nixkgs buildInputs" $ - shellifyWithArgs "shell nixpkgs#python nixpkgs#cowsay" - `shouldReturnShellTextDefinedBy` + describe "When dealing with multiple source repositories it should produce the correct output files for" $ do + + specify "one buildInput required from an unknown source" $ + shellifyWithArgs "--with-flake shell foo#cowsay" + `shouldReturnShellAndFlakeTextDefinedBy` + "inputs-from-unknown-source" + + specify "two buildInputs required from two sources" $ + shellifyWithArgs "--with-flake shell foo#cowsay nixpkgs#python" + `shouldReturnShellAndFlakeTextDefinedBy` + "inputs-from-know-and-unknown-sources" + + specify "2 buildInputs from one source" $ + shellifyWithArgs "shell --with-flake python cowsay" + `shouldReturnShellAndFlakeTextDefinedBy` "two-nixpkgs-inputs" - describe "when working with multiple repos for known and unknown sources" $ - shellifyWithArgs "shell nixpkgs#python foo#cowsay" - `shouldReturnShellTextDefinedBy` - "multiple-repository-sources" + specify "pulling from 2 different known sources" $ + shellifyWithArgs "shell nixpkgs#python blender-bin#blender_3_5" + `shouldReturnShellAndFlakeTextDefinedBy` + "inputs-from-different-registries" + + specify "2 nixpkgs buildInputs" $ + shellifyWithArgs "shell nixpkgs#python nixpkgs#cowsay" + `shouldReturnShellTextDefinedBy` + "two-nixpkgs-inputs" + + specify "multiple repos for known and unknown sources" $ + shellifyWithArgs "shell nixpkgs#python foo#cowsay" + `shouldReturnShellTextDefinedBy` + "multiple-repository-sources" + + describe "Where repository URLs need retrieving from the Nix Registry" $ do + + it "falls through to global where system is local and global is available" $ + whereALocalSystemAndFlakeGlobalNixpkgsExistsShellifyWithArgs "shell nixpkgs#cowsay" + `shouldReturnShellAndFlakeTextDefinedBy` + "cowsay-from-global-nixpkgs" + + it "prefers system to global where system is local and always-take-from-system-registry is specified" $ + whereALocalSystemAndFlakeGlobalNixpkgsExistsShellifyWithArgs "--allow-local-pinned-registries-to-be-prioritized shell nixpkgs#cowsay" + `shouldReturnShellAndFlakeTextDefinedBy` + "cowsay-from-local-nixpkgs" + + it "uses the local url where system has a local URL and no user or global repository is available" $ + whereALocalSystemNixpkgsExistsShellifyWithArgs "shell nixpkgs#cowsay" + `shouldReturnShellAndFlakeTextDefinedBy` + "cowsay-from-local-nixpkgs" + + it "uses the user registry when no system or global alternative exists" $ + whereAUserNixpkgsExistsShellifyWithArgs "shell nixpkgs#cowsay" + `shouldReturnShellAndFlakeTextDefinedBy` + "cowsay-from-user-nixpkgs" + + it "uses the system custom registry when a system and then global alternative are defined" $ + whereASystemAndGlobalCustomPkgsExistsShellifyWithArgs "shell custompkgs#cowsay" + `shouldReturnShellAndFlakeTextDefinedBy` + "cowsay-from-system-custompkgs" + + it "uses the system custom registry when a global and then system alternative are defined" $ + whereAGlobalAndSystemCustomPkgsExistsShellifyWithArgs "shell custompkgs#cowsay" + `shouldReturnShellAndFlakeTextDefinedBy` + "cowsay-from-system-custompkgs" + + it "uses the system nixpkgs when a system and then global alternative exist" $ + whereASystemAndGlobalNixpkgsExistsShellifyWithArgs "shell nixpkgs#cowsay" + `shouldReturnShellAndFlakeTextDefinedBy` + "cowsay-from-system-nixpkgs" + + it "uses the system nixpkgs when a global and then system alternative exist" $ + whereAGlobalAndSystemNixpkgsExistsShellifyWithArgs "shell nixpkgs#cowsay" + `shouldReturnShellAndFlakeTextDefinedBy` + "cowsay-from-system-nixpkgs" + + it "uses the global nixpkgs when no alternative exists" $ + whereOnlyAGlobalNixpkgsExistsShellifyWithArgs "shell nixpkgs#cowsay" + `shouldReturnShellAndFlakeTextDefinedBy` + "cowsay-from-global-nixpkgs" - describe "when a command is specified" $ - shellifyWithArgs "-p python -p cowsay --command cowsay" - `shouldReturnShellTextDefinedBy` - "two-build-inputs-and-command" diff --git a/test/TestHelpers.hs b/test/TestHelpers.hs index 6546601..2b928c8 100644 --- a/test/TestHelpers.hs +++ b/test/TestHelpers.hs @@ -1,11 +1,10 @@ module TestHelpers where -import Prelude hiding (last, putStrLn, readFile, reverse, tail, words) +import Prelude hiding (last, putStrLn, readFile, reverse, tail, unlines, words) import Data.Bool (bool) -import Data.Text (isInfixOf, last, reverse, tail, Text(), unpack, words) +import Data.Text (isInfixOf, last, reverse, tail, Text(), unpack, unlines, words) import Data.Text.IO (putStrLn, readFile) import Test.Hspec (Expectation(), expectationFailure, it, shouldBe, shouldContain) - import Options import Shellify import TemplateGeneration @@ -17,50 +16,107 @@ shouldReturnSubstring shellifyOutput expectedSubstring = shellifyOutput shellifyWithArgs :: Text -> Either Text [(Text, Text)] -shellifyWithArgs = parseOptionsAndCalculateExpectedFiles db "nix-shellify" . words - -shellifyWithArgsWithDb :: Text -> Text -> Either Text [(Text, Text)] -shellifyWithArgsWithDb customDb = parseOptionsAndCalculateExpectedFiles customDb "nix-shellify" . words - -whereOnlyAUserNixpkgsExistsShellifyWithArgs :: Text -> Either Text [(Text, Text)] -whereOnlyAUserNixpkgsExistsShellifyWithArgs = shellifyWithArgsWithDb dbWithGlobalToUserNixpkgs +shellifyWithArgs = shellifyWithArgsWithDb realDbExample + +realDbExample = + [ "global flake:agda github:agda/agda" + , "global flake:arion github:hercules-ci/arion" + , "global flake:blender-bin github:edolstra/nix-warez?dir=blender" + , "global flake:composable github:ComposableFi/composable" + , "global flake:dreampkgs github:nix-community/dreampkgs" + , "global flake:dwarffs github:edolstra/dwarffs" + , "global flake:emacs-overlay github:nix-community/emacs-overlay" + , "global flake:fenix github:nix-community/fenix" + , "global flake:flake-parts github:hercules-ci/flake-parts" + , "global flake:flake-utils github:numtide/flake-utils" + , "global flake:gemini github:nix-community/flake-gemini" + , "global flake:hercules-ci-effects github:hercules-ci/hercules-ci-effects" + , "global flake:hercules-ci-agent github:hercules-ci/hercules-ci-agent" + , "global flake:home-manager github:nix-community/home-manager" + , "global flake:hydra github:NixOS/hydra" + , "global flake:mach-nix github:DavHau/mach-nix" + , "global flake:nimble github:nix-community/flake-nimble" + , "global flake:nix github:NixOS/nix" + , "global flake:nix-darwin github:LnL7/nix-darwin" + , "global flake:nixops github:NixOS/nixops" + , "global flake:nixos-hardware github:NixOS/nixos-hardware" + , "global flake:nixos-homepage github:NixOS/nixos-homepage" + , "global flake:nixos-search github:NixOS/nixos-search" + , "global flake:nur github:nix-community/NUR" + , "global flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-unstable" + , "global flake:templates github:NixOS/templates" + , "global flake:patchelf github:NixOS/patchelf" + , "global flake:poetry2nix github:nix-community/poetry2nix" + , "global flake:nix-serve github:edolstra/nix-serve" + , "global flake:nickel github:tweag/nickel" + , "global flake:bundlers github:NixOS/bundlers" + , "global flake:pridefetch github:SpyHoodle/pridefetch" + , "global flake:systems github:nix-systems/default" + , "global flake:helix github:helix-editor/helix" + , "global flake:sops-nix github:Mic92/sops-nix" + ] + +shellifyWithArgsWithDb :: [Text] -> Text -> Either Text [(Text, Text)] +shellifyWithArgsWithDb customDb = parseOptionsAndCalculateExpectedFiles (unlines customDb) "nix-shellify" . words + +whereAUserNixpkgsExistsShellifyWithArgs :: Text -> Either Text [(Text, Text)] +whereAUserNixpkgsExistsShellifyWithArgs = shellifyWithArgsWithDb + [ "global flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-global-registry" + , "system flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-system-registry" + , "user flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-user-registry" + ] whereASystemAndGlobalCustomPkgsExistsShellifyWithArgs :: Text -> Either Text [(Text, Text)] -whereASystemAndGlobalCustomPkgsExistsShellifyWithArgs = shellifyWithArgsWithDb dbWithGlobalToSystemCustomPkgs +whereASystemAndGlobalCustomPkgsExistsShellifyWithArgs = shellifyWithArgsWithDb + [ "global flake:custompkgs github:NixOS/custompkgs/custompkgs-global-registry" + , "system flake:custompkgs github:NixOS/custompkgs/custompkgs-system-registry" + , "global flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-unstable" + ] whereAGlobalAndSystemCustomPkgsExistsShellifyWithArgs :: Text -> Either Text [(Text, Text)] -whereAGlobalAndSystemCustomPkgsExistsShellifyWithArgs = shellifyWithArgsWithDb dbWithSystemToGlobalCustomPkgs +whereAGlobalAndSystemCustomPkgsExistsShellifyWithArgs = shellifyWithArgsWithDb + [ "system flake:custompkgs github:NixOS/custompkgs/custompkgs-system-registry" + , "global flake:custompkgs github:NixOS/custompkgs/custompkgs-global-registry" + , "global flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-unstable" + ] whereASystemAndGlobalNixpkgsExistsShellifyWithArgs :: Text -> Either Text [(Text, Text)] -whereASystemAndGlobalNixpkgsExistsShellifyWithArgs = shellifyWithArgsWithDb dbWithSystemAndGlobalNixpkgs +whereASystemAndGlobalNixpkgsExistsShellifyWithArgs = shellifyWithArgsWithDb + [ "system flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-system-registry" + , "global flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-global-registry" + ] whereAGlobalAndSystemNixpkgsExistsShellifyWithArgs :: Text -> Either Text [(Text, Text)] -whereAGlobalAndSystemNixpkgsExistsShellifyWithArgs = shellifyWithArgsWithDb dbWithGlobalToSystemNixpkgs - -whereOnlyASystemAndGlobalNixpkgsExistsShellifyWithArgs :: Text -> Either Text [(Text, Text)] -whereOnlyASystemAndGlobalNixpkgsExistsShellifyWithArgs = error "TODO" - -whereAUserSystemAndGlobalNixpkgsExistsShellifyWithArgs :: Text -> Either Text [(Text, Text)] -whereAUserSystemAndGlobalNixpkgsExistsShellifyWithArgs = error "TODO" +whereAGlobalAndSystemNixpkgsExistsShellifyWithArgs = shellifyWithArgsWithDb + [ "global flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-global-registry" + , "system flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-system-registry" + ] whereOnlyAGlobalNixpkgsExistsShellifyWithArgs :: Text -> Either Text [(Text, Text)] -whereOnlyAGlobalNixpkgsExistsShellifyWithArgs = shellifyWithArgsWithDb dbWithOnlyGlobalNixpkgs +whereOnlyAGlobalNixpkgsExistsShellifyWithArgs = shellifyWithArgsWithDb + [ "global flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-global-registry" + ] whereALocalSystemAndFlakeGlobalNixpkgsExistsShellifyWithArgs :: Text -> Either Text [(Text, Text)] -whereALocalSystemAndFlakeGlobalNixpkgsExistsShellifyWithArgs = shellifyWithArgsWithDb dbWithLocalSystemToGlobalNixpkgs +whereALocalSystemAndFlakeGlobalNixpkgsExistsShellifyWithArgs = shellifyWithArgsWithDb + [ "system flake:nixpkgs path:/local/nixpkgs/path" + , "global flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-global-registry" + ] whereALocalSystemNixpkgsExistsShellifyWithArgs :: Text -> Either Text [(Text, Text)] -whereALocalSystemNixpkgsExistsShellifyWithArgs = shellifyWithArgsWithDb dbWithLocalSystemNixpkgs +whereALocalSystemNixpkgsExistsShellifyWithArgs = shellifyWithArgsWithDb + [ "system flake:nixpkgs path:/local/nixpkgs/path" + , "global flake:templates github:NixOS/templates" + ] +shouldReturnShellAndFlakeTextDefinedBy :: Either Text [(Text, Text)] -> FilePath -> Expectation shouldReturnShellAndFlakeTextDefinedBy result expectedOutput = - it "should produce the expected shell.nix and flake.nix" $ - do expShell <- readNixTemplate (shellFile expectedOutput) - expFlake <- readNixTemplate (flakeFile expectedOutput) - result `shouldBe` - Right [("shell.nix", expShell),("flake.nix", expFlake)] + do expShell <- readNixTemplate (shellFile expectedOutput) + expFlake <- readNixTemplate (flakeFile expectedOutput) + result `shouldBe` + Right [("shell.nix", expShell),("flake.nix", expFlake)] shouldReturnShellTextDefinedBy result expectedOutput = - it "should produce the expected shell.nix" $ do expShell <- readNixTemplate (shellFile expectedOutput) either (const $ expectationFailure "Expected Right but got Left") @@ -69,14 +125,14 @@ shouldReturnShellTextDefinedBy result expectedOutput = fileName `shouldBe` "shell.nix") result -theOptions = options "nix-shellify" . words - shouldResultInPackages :: Text -> [Text] -> Expectation shouldResultInPackages parameters packages = theOptions parameters `shouldBe` Right def{packages=packages} +theOptions = options "nix-shellify" . words + instance Show Options readNixTemplate :: FilePath -> IO Text @@ -89,26 +145,3 @@ readNixTemplate fileName = flakeFile = (<> "-flake.nix") shellFile = (<> "-shell.nix") -db = "global flake:agda github:agda/agda\nglobal flake:arion github:hercules-ci/arion\nglobal flake:blender-bin github:edolstra/nix-warez?dir=blender\nglobal flake:composable github:ComposableFi/composable\nglobal flake:dreampkgs github:nix-community/dreampkgs\nglobal flake:dwarffs github:edolstra/dwarffs\nglobal flake:emacs-overlay github:nix-community/emacs-overlay\nglobal flake:fenix github:nix-community/fenix\nglobal flake:flake-parts github:hercules-ci/flake-parts\nglobal flake:flake-utils github:numtide/flake-utils\nglobal flake:gemini github:nix-community/flake-gemini\nglobal flake:hercules-ci-effects github:hercules-ci/hercules-ci-effects\nglobal flake:hercules-ci-agent github:hercules-ci/hercules-ci-agent\nglobal flake:home-manager github:nix-community/home-manager\nglobal flake:hydra github:NixOS/hydra\nglobal flake:mach-nix github:DavHau/mach-nix\nglobal flake:nimble github:nix-community/flake-nimble\nglobal flake:nix github:NixOS/nix\nglobal flake:nix-darwin github:LnL7/nix-darwin\nglobal flake:nixops github:NixOS/nixops\nglobal flake:nixos-hardware github:NixOS/nixos-hardware\nglobal flake:nixos-homepage github:NixOS/nixos-homepage\nglobal flake:nixos-search github:NixOS/nixos-search\nglobal flake:nur github:nix-community/NUR\nglobal flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-unstable\nglobal flake:templates github:NixOS/templates\nglobal flake:patchelf github:NixOS/patchelf\nglobal flake:poetry2nix github:nix-community/poetry2nix\nglobal flake:nix-serve github:edolstra/nix-serve\nglobal flake:nickel github:tweag/nickel\nglobal flake:bundlers github:NixOS/bundlers\nglobal flake:pridefetch github:SpyHoodle/pridefetch\nglobal flake:systems github:nix-systems/default\nglobal flake:helix github:helix-editor/helix\nglobal flake:sops-nix github:Mic92/sops-nix\n" :: Text - -dbWithUserNixpkgs = "global flake:agda github:agda/agda\nglobal flake:arion github:hercules-ci/arion\nglobal flake:blender-bin github:edolstra/nix-warez?dir=blender\nglobal flake:composable github:ComposableFi/composable\nglobal flake:dreampkgs github:nix-community/dreampkgs\nglobal flake:dwarffs github:edolstra/dwarffs\nglobal flake:emacs-overlay github:nix-community/emacs-overlay\nglobal flake:fenix github:nix-community/fenix\nglobal flake:flake-parts github:hercules-ci/flake-parts\nglobal flake:flake-utils github:numtide/flake-utils\nglobal flake:gemini github:nix-community/flake-gemini\nglobal flake:hercules-ci-effects github:hercules-ci/hercules-ci-effects\nglobal flake:hercules-ci-agent github:hercules-ci/hercules-ci-agent\nglobal flake:home-manager github:nix-community/home-manager\nglobal flake:hydra github:NixOS/hydra\nglobal flake:mach-nix github:DavHau/mach-nix\nglobal flake:nimble github:nix-community/flake-nimble\nglobal flake:nix github:NixOS/nix\nglobal flake:nix-darwin github:LnL7/nix-darwin\nglobal flake:nixops github:NixOS/nixops\nglobal flake:nixos-hardware github:NixOS/nixos-hardware\nglobal flake:nixos-homepage github:NixOS/nixos-homepage\nglobal flake:nixos-search github:NixOS/nixos-search\nglobal flake:nur github:nix-community/NUR\nglobal flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-global-registry\nuser flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-user-registry\nglobal flake:templates github:NixOS/templates\nglobal flake:patchelf github:NixOS/patchelf\nglobal flake:poetry2nix github:nix-community/poetry2nix\nglobal flake:nix-serve github:edolstra/nix-serve\nglobal flake:nickel github:tweag/nickel\nglobal flake:bundlers github:NixOS/bundlers\nglobal flake:pridefetch github:SpyHoodle/pridefetch\nglobal flake:systems github:nix-systems/default\nglobal flake:helix github:helix-editor/helix\nglobal flake:sops-nix github:Mic92/sops-nix\n" :: Text - -dbWithSystemNixpkgs = "global flake:agda github:agda/agda\nglobal flake:arion github:hercules-ci/arion\nglobal flake:blender-bin github:edolstra/nix-warez?dir=blender\nglobal flake:composable github:ComposableFi/composable\nglobal flake:dreampkgs github:nix-community/dreampkgs\nglobal flake:dwarffs github:edolstra/dwarffs\nglobal flake:emacs-overlay github:nix-community/emacs-overlay\nglobal flake:fenix github:nix-community/fenix\nglobal flake:flake-parts github:hercules-ci/flake-parts\nglobal flake:flake-utils github:numtide/flake-utils\nglobal flake:gemini github:nix-community/flake-gemini\nglobal flake:hercules-ci-effects github:hercules-ci/hercules-ci-effects\nglobal flake:hercules-ci-agent github:hercules-ci/hercules-ci-agent\nglobal flake:home-manager github:nix-community/home-manager\nglobal flake:hydra github:NixOS/hydra\nglobal flake:mach-nix github:DavHau/mach-nix\nglobal flake:nimble github:nix-community/flake-nimble\nglobal flake:nix github:NixOS/nix\nglobal flake:nix-darwin github:LnL7/nix-darwin\nglobal flake:nixops github:NixOS/nixops\nglobal flake:nixos-hardware github:NixOS/nixos-hardware\nglobal flake:nixos-homepage github:NixOS/nixos-homepage\nglobal flake:nixos-search github:NixOS/nixos-search\nglobal flake:nur github:nix-community/NUR\nglobal flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-global-registry\nsystem flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-system-registry\nglobal flake:templates github:NixOS/templates\nglobal flake:patchelf github:NixOS/patchelf\nglobal flake:poetry2nix github:nix-community/poetry2nix\nglobal flake:nix-serve github:edolstra/nix-serve\nglobal flake:nickel github:tweag/nickel\nglobal flake:bundlers github:NixOS/bundlers\nglobal flake:pridefetch github:SpyHoodle/pridefetch\nglobal flake:systems github:nix-systems/default\nglobal flake:helix github:helix-editor/helix\nglobal flake:sops-nix github:Mic92/sops-nix\n" :: Text - -dbWithUserToGlobalNixpkgs = "global flake:agda github:agda/agda\nglobal flake:arion github:hercules-ci/arion\nglobal flake:blender-bin github:edolstra/nix-warez?dir=blender\nglobal flake:composable github:ComposableFi/composable\nglobal flake:dreampkgs github:nix-community/dreampkgs\nglobal flake:dwarffs github:edolstra/dwarffs\nglobal flake:emacs-overlay github:nix-community/emacs-overlay\nglobal flake:fenix github:nix-community/fenix\nglobal flake:flake-parts github:hercules-ci/flake-parts\nglobal flake:flake-utils github:numtide/flake-utils\nglobal flake:gemini github:nix-community/flake-gemini\nglobal flake:hercules-ci-effects github:hercules-ci/hercules-ci-effects\nglobal flake:hercules-ci-agent github:hercules-ci/hercules-ci-agent\nglobal flake:home-manager github:nix-community/home-manager\nglobal flake:hydra github:NixOS/hydra\nglobal flake:mach-nix github:DavHau/mach-nix\nglobal flake:nimble github:nix-community/flake-nimble\nglobal flake:nix github:NixOS/nix\nglobal flake:nix-darwin github:LnL7/nix-darwin\nglobal flake:nixops github:NixOS/nixops\nglobal flake:nixos-hardware github:NixOS/nixos-hardware\nglobal flake:nixos-homepage github:NixOS/nixos-homepage\nglobal flake:nixos-search github:NixOS/nixos-search\nglobal flake:nur github:nix-community/NUR\nuser flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-user-registry\nsystem flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-system-registry\nglobal flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-global-registry\nglobal flake:templates github:NixOS/templates\nglobal flake:patchelf github:NixOS/patchelf\nglobal flake:poetry2nix github:nix-community/poetry2nix\nglobal flake:nix-serve github:edolstra/nix-serve\nglobal flake:nickel github:tweag/nickel\nglobal flake:bundlers github:NixOS/bundlers\nglobal flake:pridefetch github:SpyHoodle/pridefetch\nglobal flake:systems github:nix-systems/default\nglobal flake:helix github:helix-editor/helix\nglobal flake:sops-nix github:Mic92/sops-nix\n" :: Text - -dbWithLocalSystemToGlobalNixpkgs = "global flake:agda github:agda/agda\nglobal flake:arion github:hercules-ci/arion\nglobal flake:blender-bin github:edolstra/nix-warez?dir=blender\nglobal flake:composable github:ComposableFi/composable\nglobal flake:dreampkgs github:nix-community/dreampkgs\nglobal flake:dwarffs github:edolstra/dwarffs\nglobal flake:emacs-overlay github:nix-community/emacs-overlay\nglobal flake:fenix github:nix-community/fenix\nglobal flake:flake-parts github:hercules-ci/flake-parts\nglobal flake:flake-utils github:numtide/flake-utils\nglobal flake:gemini github:nix-community/flake-gemini\nglobal flake:hercules-ci-effects github:hercules-ci/hercules-ci-effects\nglobal flake:hercules-ci-agent github:hercules-ci/hercules-ci-agent\nglobal flake:home-manager github:nix-community/home-manager\nglobal flake:hydra github:NixOS/hydra\nglobal flake:mach-nix github:DavHau/mach-nix\nglobal flake:nimble github:nix-community/flake-nimble\nglobal flake:nix github:NixOS/nix\nglobal flake:nix-darwin github:LnL7/nix-darwin\nglobal flake:nixops github:NixOS/nixops\nglobal flake:nixos-hardware github:NixOS/nixos-hardware\nglobal flake:nixos-homepage github:NixOS/nixos-homepage\nglobal flake:nixos-search github:NixOS/nixos-search\nglobal flake:nur github:nix-community/NUR\nsystem flake:nixpkgs path:/local/nixpkgs/path\nglobal flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-global-registry\nglobal flake:templates github:NixOS/templates\nglobal flake:patchelf github:NixOS/patchelf\nglobal flake:poetry2nix github:nix-community/poetry2nix\nglobal flake:nix-serve github:edolstra/nix-serve\nglobal flake:nickel github:tweag/nickel\nglobal flake:bundlers github:NixOS/bundlers\nglobal flake:pridefetch github:SpyHoodle/pridefetch\nglobal flake:systems github:nix-systems/default\nglobal flake:helix github:helix-editor/helix\nglobal flake:sops-nix github:Mic92/sops-nix\n" :: Text - -dbWithLocalSystemNixpkgs = "global flake:agda github:agda/agda\nglobal flake:arion github:hercules-ci/arion\nglobal flake:blender-bin github:edolstra/nix-warez?dir=blender\nglobal flake:composable github:ComposableFi/composable\nglobal flake:dreampkgs github:nix-community/dreampkgs\nglobal flake:dwarffs github:edolstra/dwarffs\nglobal flake:emacs-overlay github:nix-community/emacs-overlay\nglobal flake:fenix github:nix-community/fenix\nglobal flake:flake-parts github:hercules-ci/flake-parts\nglobal flake:flake-utils github:numtide/flake-utils\nglobal flake:gemini github:nix-community/flake-gemini\nglobal flake:hercules-ci-effects github:hercules-ci/hercules-ci-effects\nglobal flake:hercules-ci-agent github:hercules-ci/hercules-ci-agent\nglobal flake:home-manager github:nix-community/home-manager\nglobal flake:hydra github:NixOS/hydra\nglobal flake:mach-nix github:DavHau/mach-nix\nglobal flake:nimble github:nix-community/flake-nimble\nglobal flake:nix github:NixOS/nix\nglobal flake:nix-darwin github:LnL7/nix-darwin\nglobal flake:nixops github:NixOS/nixops\nglobal flake:nixos-hardware github:NixOS/nixos-hardware\nglobal flake:nixos-homepage github:NixOS/nixos-homepage\nglobal flake:nixos-search github:NixOS/nixos-search\nglobal flake:nur github:nix-community/NUR\nsystem flake:nixpkgs path:/local/nixpkgs/path\nglobal flake:templates github:NixOS/templates\nglobal flake:patchelf github:NixOS/patchelf\nglobal flake:poetry2nix github:nix-community/poetry2nix\nglobal flake:nix-serve github:edolstra/nix-serve\nglobal flake:nickel github:tweag/nickel\nglobal flake:bundlers github:NixOS/bundlers\nglobal flake:pridefetch github:SpyHoodle/pridefetch\nglobal flake:systems github:nix-systems/default\nglobal flake:helix github:helix-editor/helix\nglobal flake:sops-nix github:Mic92/sops-nix\n" :: Text - -dbWithGlobalToUserNixpkgs = "global flake:agda github:agda/agda\nglobal flake:arion github:hercules-ci/arion\nglobal flake:blender-bin github:edolstra/nix-warez?dir=blender\nglobal flake:composable github:ComposableFi/composable\nglobal flake:dreampkgs github:nix-community/dreampkgs\nglobal flake:dwarffs github:edolstra/dwarffs\nglobal flake:emacs-overlay github:nix-community/emacs-overlay\nglobal flake:fenix github:nix-community/fenix\nglobal flake:flake-parts github:hercules-ci/flake-parts\nglobal flake:flake-utils github:numtide/flake-utils\nglobal flake:gemini github:nix-community/flake-gemini\nglobal flake:hercules-ci-effects github:hercules-ci/hercules-ci-effects\nglobal flake:hercules-ci-agent github:hercules-ci/hercules-ci-agent\nglobal flake:home-manager github:nix-community/home-manager\nglobal flake:hydra github:NixOS/hydra\nglobal flake:mach-nix github:DavHau/mach-nix\nglobal flake:nimble github:nix-community/flake-nimble\nglobal flake:nix github:NixOS/nix\nglobal flake:nix-darwin github:LnL7/nix-darwin\nglobal flake:nixops github:NixOS/nixops\nglobal flake:nixos-hardware github:NixOS/nixos-hardware\nglobal flake:nixos-homepage github:NixOS/nixos-homepage\nglobal flake:nixos-search github:NixOS/nixos-search\nglobal flake:nur github:nix-community/NUR\nglobal flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-global-registry\nsystem flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-system-registry\nuser flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-user-registry\nglobal flake:templates github:NixOS/templates\nglobal flake:patchelf github:NixOS/patchelf\nglobal flake:poetry2nix github:nix-community/poetry2nix\nglobal flake:nix-serve github:edolstra/nix-serve\nglobal flake:nickel github:tweag/nickel\nglobal flake:bundlers github:NixOS/bundlers\nglobal flake:pridefetch github:SpyHoodle/pridefetch\nglobal flake:systems github:nix-systems/default\nglobal flake:helix github:helix-editor/helix\nglobal flake:sops-nix github:Mic92/sops-nix\n" :: Text - -dbWithSystemAndGlobalNixpkgs = "global flake:agda github:agda/agda\nglobal flake:arion github:hercules-ci/arion\nglobal flake:blender-bin github:edolstra/nix-warez?dir=blender\nglobal flake:composable github:ComposableFi/composable\nglobal flake:dreampkgs github:nix-community/dreampkgs\nglobal flake:dwarffs github:edolstra/dwarffs\nglobal flake:emacs-overlay github:nix-community/emacs-overlay\nglobal flake:fenix github:nix-community/fenix\nglobal flake:flake-parts github:hercules-ci/flake-parts\nglobal flake:flake-utils github:numtide/flake-utils\nglobal flake:gemini github:nix-community/flake-gemini\nglobal flake:hercules-ci-effects github:hercules-ci/hercules-ci-effects\nglobal flake:hercules-ci-agent github:hercules-ci/hercules-ci-agent\nglobal flake:home-manager github:nix-community/home-manager\nglobal flake:hydra github:NixOS/hydra\nglobal flake:mach-nix github:DavHau/mach-nix\nglobal flake:nimble github:nix-community/flake-nimble\nglobal flake:nix github:NixOS/nix\nglobal flake:nix-darwin github:LnL7/nix-darwin\nglobal flake:nixops github:NixOS/nixops\nglobal flake:nixos-hardware github:NixOS/nixos-hardware\nglobal flake:nixos-homepage github:NixOS/nixos-homepage\nglobal flake:nixos-search github:NixOS/nixos-search\nglobal flake:nur github:nix-community/NUR\nsystem flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-system-registry\nglobal flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-global-registry\nglobal flake:templates github:NixOS/templates\nglobal flake:patchelf github:NixOS/patchelf\nglobal flake:poetry2nix github:nix-community/poetry2nix\nglobal flake:nix-serve github:edolstra/nix-serve\nglobal flake:nickel github:tweag/nickel\nglobal flake:bundlers github:NixOS/bundlers\nglobal flake:pridefetch github:SpyHoodle/pridefetch\nglobal flake:systems github:nix-systems/default\nglobal flake:helix github:helix-editor/helix\nglobal flake:sops-nix github:Mic92/sops-nix\n" :: Text - -dbWithOnlyGlobalNixpkgs = "global flake:agda github:agda/agda\nglobal flake:arion github:hercules-ci/arion\nglobal flake:blender-bin github:edolstra/nix-warez?dir=blender\nglobal flake:composable github:ComposableFi/composable\nglobal flake:dreampkgs github:nix-community/dreampkgs\nglobal flake:dwarffs github:edolstra/dwarffs\nglobal flake:emacs-overlay github:nix-community/emacs-overlay\nglobal flake:fenix github:nix-community/fenix\nglobal flake:flake-parts github:hercules-ci/flake-parts\nglobal flake:flake-utils github:numtide/flake-utils\nglobal flake:gemini github:nix-community/flake-gemini\nglobal flake:hercules-ci-effects github:hercules-ci/hercules-ci-effects\nglobal flake:hercules-ci-agent github:hercules-ci/hercules-ci-agent\nglobal flake:home-manager github:nix-community/home-manager\nglobal flake:hydra github:NixOS/hydra\nglobal flake:mach-nix github:DavHau/mach-nix\nglobal flake:nimble github:nix-community/flake-nimble\nglobal flake:nix github:NixOS/nix\nglobal flake:nix-darwin github:LnL7/nix-darwin\nglobal flake:nixops github:NixOS/nixops\nglobal flake:nixos-hardware github:NixOS/nixos-hardware\nglobal flake:nixos-homepage github:NixOS/nixos-homepage\nglobal flake:nixos-search github:NixOS/nixos-search\nglobal flake:nur github:nix-community/NUR\nglobal flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-global-registry\nglobal flake:templates github:NixOS/templates\nglobal flake:patchelf github:NixOS/patchelf\nglobal flake:poetry2nix github:nix-community/poetry2nix\nglobal flake:nix-serve github:edolstra/nix-serve\nglobal flake:nickel github:tweag/nickel\nglobal flake:bundlers github:NixOS/bundlers\nglobal flake:pridefetch github:SpyHoodle/pridefetch\nglobal flake:systems github:nix-systems/default\nglobal flake:helix github:helix-editor/helix\nglobal flake:sops-nix github:Mic92/sops-nix\n" :: Text - -dbWithGlobalToSystemNixpkgs = "global flake:agda github:agda/agda\nglobal flake:arion github:hercules-ci/arion\nglobal flake:blender-bin github:edolstra/nix-warez?dir=blender\nglobal flake:composable github:ComposableFi/composable\nglobal flake:dreampkgs github:nix-community/dreampkgs\nglobal flake:dwarffs github:edolstra/dwarffs\nglobal flake:emacs-overlay github:nix-community/emacs-overlay\nglobal flake:fenix github:nix-community/fenix\nglobal flake:flake-parts github:hercules-ci/flake-parts\nglobal flake:flake-utils github:numtide/flake-utils\nglobal flake:gemini github:nix-community/flake-gemini\nglobal flake:hercules-ci-effects github:hercules-ci/hercules-ci-effects\nglobal flake:hercules-ci-agent github:hercules-ci/hercules-ci-agent\nglobal flake:home-manager github:nix-community/home-manager\nglobal flake:hydra github:NixOS/hydra\nglobal flake:mach-nix github:DavHau/mach-nix\nglobal flake:nimble github:nix-community/flake-nimble\nglobal flake:nix github:NixOS/nix\nglobal flake:nix-darwin github:LnL7/nix-darwin\nglobal flake:nixops github:NixOS/nixops\nglobal flake:nixos-hardware github:NixOS/nixos-hardware\nglobal flake:nixos-homepage github:NixOS/nixos-homepage\nglobal flake:nixos-search github:NixOS/nixos-search\nglobal flake:nur github:nix-community/NUR\nglobal flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-global-registry\nsystem flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-system-registry\nglobal flake:templates github:NixOS/templates\nglobal flake:patchelf github:NixOS/patchelf\nglobal flake:poetry2nix github:nix-community/poetry2nix\nglobal flake:nix-serve github:edolstra/nix-serve\nglobal flake:nickel github:tweag/nickel\nglobal flake:bundlers github:NixOS/bundlers\nglobal flake:pridefetch github:SpyHoodle/pridefetch\nglobal flake:systems github:nix-systems/default\nglobal flake:helix github:helix-editor/helix\nglobal flake:sops-nix github:Mic92/sops-nix\n" :: Text - -dbWithGlobalToSystemCustomPkgs = "global flake:arion github:hercules-ci/arion\nglobal flake:blender-bin github:edolstra/nix-warez?dir=blender\nglobal flake:composable github:ComposableFi/composable\nglobal flake:dreampkgs github:nix-community/dreampkgs\nglobal flake:dwarffs github:edolstra/dwarffs\nglobal flake:emacs-overlay github:nix-community/emacs-overlay\nglobal flake:fenix github:nix-community/fenix\nglobal flake:flake-parts github:hercules-ci/flake-parts\nglobal flake:flake-utils github:numtide/flake-utils\nglobal flake:gemini github:nix-community/flake-gemini\nglobal flake:hercules-ci-effects github:hercules-ci/hercules-ci-effects\nglobal flake:hercules-ci-agent github:hercules-ci/hercules-ci-agent\nglobal flake:home-manager github:nix-community/home-manager\nglobal flake:hydra github:NixOS/hydra\nglobal flake:mach-nix github:DavHau/mach-nix\nglobal flake:nimble github:nix-community/flake-nimble\nglobal flake:nix github:NixOS/nix\nglobal flake:nix-darwin github:LnL7/nix-darwin\nglobal flake:nixops github:NixOS/nixops\nglobal flake:nixos-hardware github:NixOS/nixos-hardware\nglobal flake:nixos-homepage github:NixOS/nixos-homepage\nglobal flake:nixos-search github:NixOS/nixos-search\nglobal flake:nur github:nix-community/NUR\nglobal flake:custompkgs github:NixOS/custompkgs/custompkgs-global-registry\nsystem flake:custompkgs github:NixOS/custompkgs/custompkgs-system-registry\nglobal flake:templates github:NixOS/templates\nglobal flake:patchelf github:NixOS/patchelf\nglobal flake:poetry2nix github:nix-community/poetry2nix\nglobal flake:nix-serve github:edolstra/nix-serve\nglobal flake:nickel github:tweag/nickel\nglobal flake:bundlers github:NixOS/bundlers\nglobal flake:pridefetch github:SpyHoodle/pridefetch\nglobal flake:systems github:nix-systems/default\nglobal flake:helix github:helix-editor/helix\nglobal flake:sops-nix github:Mic92/sops-nix\nglobal flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-unstable\n" :: Text - -dbWithSystemToGlobalCustomPkgs = "global flake:flake-utils github:numtide/flake-utils\nsystem flake:custompkgs github:NixOS/custompkgs/custompkgs-system-registry\nglobal flake:custompkgs github:NixOS/custompkgs/custompkgs-global-registry\nglobal flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-unstable\n" :: Text