Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sridhar Ratnakumar
flake-to-gitlab-ci
Commits
49a5283a
Commit
49a5283a
authored
2 years ago
by
Daniel Firth
Browse files
Options
Download
Plain Diff
Merge branch 'lc/flake-parts' into 'master'
hlint See merge request
haskell/flake-to-gitlab-ci!8
parents
04f61f53
85a47de8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
src/FlakeToGitlabCI.hs
src/FlakeToGitlabCI.hs
+7
-7
No files found.
src/FlakeToGitlabCI.hs
View file @
49a5283a
...
...
@@ -30,7 +30,7 @@ nixBin :: FilePath
nixBin
=
$
(
staticWhich
"nix"
)
type
Step
::
Type
data
Step
=
Step
{
newtype
Step
=
Step
{
script
::
[
Text
]
}
deriving
stock
(
Show
,
Eq
,
Generic
)
deriving
anyclass
(
FromJSON
,
ToJSON
)
...
...
@@ -51,13 +51,13 @@ getDevShellsJSON :: Value -> [Text]
getDevShellsJSON
=
Map
.
keys
.
toMapText
.
view
(
_Object
.
ix
"devShells"
.
_Object
.
ix
"x86_64-linux"
.
_Object
)
mkCheck
::
Text
->
(
Text
,
Step
)
mkCheck
x
=
(
sformat
(
"checks."
%
stext
)
x
,
Step
$
[
sformat
nixBuildCmd
"checks.x86_64-linux"
x
]
)
mkCheck
x
=
(
sformat
(
"checks."
%
stext
)
x
,
Step
[
sformat
nixBuildCmd
"checks.x86_64-linux"
x
]
)
mkPkg
::
Text
->
(
Text
,
Step
)
mkPkg
x
=
(
sformat
(
"packages."
%
stext
)
x
,
Step
$
[
sformat
nixBuildCmd
"packages.x86_64-linux"
x
])
mkPkg
x
=
(
sformat
(
"packages."
%
stext
)
x
,
Step
[
sformat
nixBuildCmd
"packages.x86_64-linux"
x
])
mkDevShell
::
Text
->
(
Text
,
Step
)
mkDevShell
x
=
(
sformat
(
"devShells."
%
stext
)
x
,
Step
$
[
sformat
nixBuildCmd
"devShells.x86_64-linux"
x
])
mkDevShell
x
=
(
sformat
(
"devShells."
%
stext
)
x
,
Step
[
sformat
nixBuildCmd
"devShells.x86_64-linux"
x
])
main
::
IO
()
main
=
do
...
...
@@ -65,7 +65,7 @@ main = do
case
A
.
eitherDecode
@
Value
x
of
Left
e
->
error
$
"Could not decode nix flake show --allow-import-from-derivation --json"
<>
show
e
Right
r
->
do
let
pkgs
=
fmap
mkPkg
$
getPackagesJSON
r
chks
=
fmap
mkCheck
$
getChecksJSON
r
ds
=
fmap
mkDevShell
$
getDevShellsJSON
r
let
pkgs
=
mkPkg
<$>
getPackagesJSON
r
chks
=
mkCheck
<$>
getChecksJSON
r
ds
=
mkDevShell
<$>
getDevShellsJSON
r
BS
.
putStr
$
Y
.
encodePretty
Y
.
defConfig
$
Map
.
fromList
$
pkgs
<>
chks
<>
ds
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment