From 457bc7438a4f0801dbf332fa2369248bddf5da0c Mon Sep 17 00:00:00 2001 Message-Id: <457bc7438a4f0801dbf332fa2369248bddf5da0c.1678309546.git.dev@jpoiret.xyz> From: Josselin Poiret Date: Wed, 8 Mar 2023 18:31:52 +0100 Subject: [PATCH] Add environment variable for library directories AGDA_LIBDIRS is a new environment colon-separated variable for site libraries. Agda will look for .agda-lib files directly inside direct descendants of these. --- src/full/Agda/Interaction/Library.hs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/full/Agda/Interaction/Library.hs b/src/full/Agda/Interaction/Library.hs index 09c1f2a82..774cc3e74 100644 --- a/src/full/Agda/Interaction/Library.hs +++ b/src/full/Agda/Interaction/Library.hs @@ -323,13 +323,25 @@ getInstalledLibraries overrideLibFile = mkLibM [] $ do raiseErrors' [ LibrariesFileNotFound theOverrideLibFile ] return [] Right file -> do - if not (lfExists file) then return [] else do + siteLibDirs <- liftIO $ fromMaybe [] . fmap splitAtColon . lookup "AGDA_LIBDIRS" <$> getEnvironment + siteLibs <- liftIO $ concat <$> mapM findSiteLibs siteLibDirs + if not (lfExists file) then parseLibFiles Nothing $ nubOn snd ((0,) <$> siteLibs) else do ls <- liftIO $ stripCommentLines <$> UTF8.readFile (lfPath file) files <- liftIO $ sequence [ (i, ) <$> expandEnvironmentVariables s | (i, s) <- ls ] - parseLibFiles (Just file) $ nubOn snd files + parseLibFiles (Just file) $ nubOn snd (files ++ fmap (0,) siteLibs) `catchIO` \ e -> do raiseErrors' [ ReadError e "Failed to read installed libraries." ] return [] + where splitAtColon :: String -> [String] + splitAtColon "" = [] + splitAtColon str = case break (==':') str of + (a, _:b) -> a : splitAtColon b + (a, "") -> [a] + findSiteLibs :: String -> IO [String] + findSiteLibs dir = do + subDirs <- filterM doesDirectoryExist =<< map (dir ) <$> listDirectory dir + subFiles <- mapM (\dir -> map (dir ) <$> listDirectory dir) subDirs + return $ concatMap (filter (List.isSuffixOf ".agda-lib")) subFiles -- | Parse the given library files. -- base-commit: 183534bc41af5a53daf685122997dc98883f2be2 -- 2.39.1 amples?id=e09c04809a93faa21e3ab63d831077c361a4a677'>examples/plasma.tmpl
AgeCommit message (Expand)Author
2023-08-22examples: Avoid duplicate SDDM service for Plasma on aarch64-linux....This is a followup to cf28f46930f1ea4087d84c162cfacfcdff842b1f. * gnu/system/examples/plasma.tmpl (services): Remove both 'gdm-service-type' and 'sddm-service-type' from %DESKTOP-SERVICES. Ludovic Courtès
2023-08-21examples: Avoid 'modify-services' to remove GDM....This led to a 'tests/guix-system.sh' failure on aarch64-linux: …/plasma.tmpl:60:13: error: modify-services: service 'gdm' not found in service list This is because 'gdm-service-type' is not among %DESKTOP-SERVICES on that architecture. * gnu/system/examples/plasma.tmpl (services): Use 'remove' rather 'modify-services' + 'delete'. Ludovic Courtès
2023-08-03examples: Add plasma operating-system example template....* gnu/system/examples/plasma.tmpl: New file. * Makefile.am (EXAMPLES): register it. Signed-off-by: 宋文武 <iyzsong@member.fsf.org> Zheng Junjie