@@ -11,6 +11,11 @@ getVersion = do
1111 let y4:y3:y2:y1:'-':m2:m1:'-':d2:d1:[] = head (words v)
1212 return (read ('[':y4:y3:y2:y1:',':m2:m1:',':d2:d1:"]"))
1313
14+getGitVersion :: IO String
15+getGitVersion = do
16+ [v] <- fmap lines (readProcess "git" ["describe", "--dirty"] "")
17+ return v
18+
1419getAuthors :: IO [NonEmptyString]
1520getAuthors = do
1621 buf <- readProcess "sh" ["-c", "git log --pretty=short | git shortlog --numbered --summary"] ""
@@ -88,6 +93,11 @@ mkTest test opt = testSuite test $ exitcodeFields (test++".hs") ++ opt ++ hsSour
8893
8994main :: IO ()
9095main = defaultMain $ do
96+ liftIO $ do ('v':gv) <- getGitVersion
97+ writeFile "src/Cabal2Nix/Version.hs" $
98+ "module Cabal2Nix.Version where\n\
99+ \version :: String\n\
100+ \version = " ++ show gv ++ "\n"
91101 libraryModules <- modules "src"
92102 props <- properties
93103 return ( props