Skip to content

Commit

Permalink
🎨 languageSettingsの分割
Browse files Browse the repository at this point in the history
  • Loading branch information
Kentaro1043 committed Dec 23, 2024
1 parent 82b48df commit 7e50a66
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 31 deletions.
32 changes: 1 addition & 31 deletions exec-container/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -83,37 +83,7 @@
self.packages.${system}.environment
];
};
languageSettings = let
interpreters = import ./interpreters {inherit allpkgs;};
compilers = import ./compilers {inherit allpkgs;};

languagesArray = {
languages = interpreters.traojudge ++ compilers.traojudge;
};
jsonOutput = builtins.toJSON languagesArray;
jsonFile = pkgs.writeText "languages.json" jsonOutput;
in
pkgs.stdenv.mkDerivation {
name = "language-settings";
nativeBuildInputs = [pkgs.check-jsonschema];
srcs = [
jsonFile
./schema.json
];
unpackPhase = ''
for _src in $srcs; do
cp "$_src" $(stripHash "$_src")
done
'';
dontBuild = true;
doCheck = true;
checkPhase = ''
check-jsonschema --schemafile schema.json languages.json
'';
installPhase = ''
mv languages.json $out
'';
};
languageSettings = import ./languageSettings.nix { inherit pkgs allpkgs; };
};

formatter = pkgs.alejandra;
Expand Down
32 changes: 32 additions & 0 deletions exec-container/languageSettings.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{ pkgs, allpkgs }:
let
interpreters = import ./interpreters { inherit allpkgs; };
compilers = import ./compilers { inherit allpkgs; };

languagesArray = {
languages = interpreters.traojudge ++ compilers.traojudge;
};
jsonOutput = builtins.toJSON languagesArray;
jsonFile = pkgs.writeText "languages.json" jsonOutput;
in
pkgs.stdenv.mkDerivation {
name = "language-settings";
nativeBuildInputs = [ pkgs.check-jsonschema ];
srcs = [
jsonFile
./schema.json
];
unpackPhase = ''
for _src in $srcs; do
cp "$_src" $(stripHash "$_src")
done
'';
dontBuild = true;
doCheck = true;
checkPhase = ''
check-jsonschema --schemafile schema.json languages.json
'';
installPhase = ''
mv languages.json $out
'';
}

0 comments on commit 7e50a66

Please sign in to comment.