diff --git a/flake.nix b/flake.nix index e3a194f61..532734515 100644 --- a/flake.nix +++ b/flake.nix @@ -200,6 +200,19 @@ }; }; + templates = { + c.description = "C flake template."; + container.description = "Container template"; + cpp.description = "CPP flake template"; + dotnetf.description = "Dotnet FSharp template"; + flake-compat.description = "Flake-compat shell and default files."; + go.description = "Go template"; + node.description = "Node template"; + python.description = "Python template"; + rust.description = "Rust template"; + rust-web-server.description = "Rust web server template"; + }; + deploy = lib.mkDeploy { inherit (inputs) self; }; outputs-builder = channels: { formatter = channels.nixpkgs.nixfmt-rfc-style; }; diff --git a/templates/c/Makefile.in b/templates/c/Makefile.in new file mode 100644 index 000000000..f937d5a8e --- /dev/null +++ b/templates/c/Makefile.in @@ -0,0 +1,13 @@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ + +hello: hello.c + $(CC) -Wall -O3 -o hello hello.c + +clean: + rm -f hello + +install: hello + install -d $(bindir) + install -t $(bindir) hello diff --git a/templates/c/configure.ac b/templates/c/configure.ac new file mode 100644 index 000000000..347364e4a --- /dev/null +++ b/templates/c/configure.ac @@ -0,0 +1,4 @@ +AC_INIT([Hello], 1.0) +AC_PROG_CC +AC_CONFIG_FILES(Makefile) +AC_OUTPUT diff --git a/templates/c/flake.nix b/templates/c/flake.nix new file mode 100644 index 000000000..0da1b7057 --- /dev/null +++ b/templates/c/flake.nix @@ -0,0 +1,125 @@ +{ + description = "An over-engineered Hello World in C"; + + # Nixpkgs / NixOS version to use. + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; + + outputs = + { self, nixpkgs }: + let + + # to work with older version of flakes + lastModifiedDate = self.lastModifiedDate or self.lastModified or "19700101"; + + # Generate a user-friendly version number. + version = builtins.substring 0 8 lastModifiedDate; + + # System types to support. + supportedSystems = [ + "x86_64-linux" + "x86_64-darwin" + "aarch64-linux" + "aarch64-darwin" + ]; + + # Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'. + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; + + # Nixpkgs instantiated for supported system types. + nixpkgsFor = forAllSystems ( + system: + import nixpkgs { + inherit system; + overlays = [ self.overlay ]; + } + ); + in + + { + + # A Nixpkgs overlay. + overlay = final: _prev: { + + hello = + with final; + stdenv.mkDerivation rec { + pname = "hello"; + inherit version; + + src = ./.; + + nativeBuildInputs = [ autoreconfHook ]; + }; + }; + + # Provide some binary packages for selected system types. + packages = forAllSystems (system: { + inherit (nixpkgsFor.${system}) hello; + }); + + # The default package for 'nix build'. This makes sense if the + # flake provides only one package or there is a clear "main" + # package. + defaultPackage = forAllSystems (system: self.packages.${system}.hello); + + # A NixOS module, if applicable (e.g. if the package provides a system service). + nixosModules.hello = + { pkgs, ... }: + { + nixpkgs.overlays = [ self.overlay ]; + + environment.systemPackages = [ pkgs.hello ]; + + #systemd.services = { ... }; + }; + + # Tests run by 'nix flake check' and by Hydra. + checks = forAllSystems ( + system: + with nixpkgsFor.${system}; + + { + inherit (self.packages.${system}) hello; + + # Additional tests, if applicable. + test = stdenv.mkDerivation { + pname = "hello-test"; + inherit version; + + buildInputs = [ hello ]; + + dontUnpack = true; + + buildPhase = '' + echo 'running some integration tests' + [[ $(hello) = 'Hello Nixers!' ]] + ''; + + installPhase = "mkdir -p $out"; + }; + } + + // lib.optionalAttrs stdenv.isLinux { + # A VM test of the NixOS module. + vmTest = + with import (nixpkgs + "/nixos/lib/testing-python.nix") { inherit system; }; + + makeTest { + nodes = { + client = + { ... }: + { + imports = [ self.nixosModules.hello ]; + }; + }; + + testScript = '' + start_all() + client.wait_for_unit("multi-user.target") + client.succeed("hello") + ''; + }; + } + ); + }; +} diff --git a/templates/c/hello.c b/templates/c/hello.c new file mode 100644 index 000000000..e3cbfe103 --- /dev/null +++ b/templates/c/hello.c @@ -0,0 +1,3 @@ +#include "stdio.h" + +int main(int argc, char **argv) { printf("Hello Nixers!\n"); } diff --git a/templates/container/flake.nix b/templates/container/flake.nix new file mode 100644 index 000000000..40ed7cb79 --- /dev/null +++ b/templates/container/flake.nix @@ -0,0 +1,31 @@ +{ + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; + + outputs = + { self, nixpkgs }: + { + + nixosConfigurations.container = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + (_: { + boot.isContainer = true; + + # Let 'nixos-version --json' know about the Git revision + # of this flake. + system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev; + + # Network configuration. + networking.useDHCP = false; + networking.firewall.allowedTCPPorts = [ 80 ]; + + # Enable a web server. + services.httpd = { + enable = true; + adminAddr = "khaneliman@example.org"; + }; + }) + ]; + }; + }; +} diff --git a/templates/cpp/.editorconfig b/templates/cpp/.editorconfig new file mode 100644 index 000000000..f2676050e --- /dev/null +++ b/templates/cpp/.editorconfig @@ -0,0 +1,15 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.c] +ident_style = space +ident_size = 4 + +[Makefile*] +ident_style = tab +ident_size = 4 diff --git a/templates/cpp/.gitignore b/templates/cpp/.gitignore new file mode 100644 index 000000000..c7efe2a9c --- /dev/null +++ b/templates/cpp/.gitignore @@ -0,0 +1,3 @@ +# ignore build artifacts +result +build diff --git a/templates/cpp/Makefile b/templates/cpp/Makefile new file mode 100644 index 000000000..f3185509b --- /dev/null +++ b/templates/cpp/Makefile @@ -0,0 +1,42 @@ +PREFIX ?= /usr/local # this is overridden by the derivation makeFlags +BIN_DIR ?= $(PREFIX)/bin + + +TARGET_EXEC ?= foo-bar +BUILD_DIR ?= ./build +SRC_DIRS ?= ./src + +SRCS := $(shell find $(SRC_DIRS) -name *.cpp -or -name *.c) +OBJS := $(SRCS:%=$(BUILD_DIR)/%.o) +DEPS := $(OBJS:.o=.d) + +INC_DIRS := $(shell find $(SRC_DIRS) -type d) +INC_FLAGS := $(addprefix -I,$(INC_DIRS)) + +CPPFLAGS ?= $(INC_FLAGS) -MMD -MP + +$(BUILD_DIR)/$(TARGET_EXEC): $(OBJS) + $(CXX) $(OBJS) -o $@ $(LDFLAGS) + +# c source +$(BUILD_DIR)/%.c.o: %.c + mkdir -p $(dir $@) + $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@ + +# c++ source +$(BUILD_DIR)/%.cpp.o: %.cpp + mkdir -p $(dir $@) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@ + +.PHONY: clean install run + +clean: + rm -r $(BUILD_DIR) + +install: $(BUILD_DIR)/$(TARGET_EXEC) + install -Dt $(BIN_DIR) $< + +run: $(BUILD_DIR)/$(TARGET_EXEC) + ./$< + +-include $(DEPS) diff --git a/templates/cpp/default.nix b/templates/cpp/default.nix new file mode 100644 index 000000000..9dbbbc898 --- /dev/null +++ b/templates/cpp/default.nix @@ -0,0 +1,9 @@ +{ clangStdenv }: +clangStdenv.mkDerivation { + pname = "sample-c-cpp"; + version = "0.0.1"; + + src = ./.; + + makeFlags = [ "PREFIX=$(out)" ]; +} diff --git a/templates/cpp/flake.nix b/templates/cpp/flake.nix new file mode 100644 index 000000000..88544b8ad --- /dev/null +++ b/templates/cpp/flake.nix @@ -0,0 +1,27 @@ +{ + description = "C/C++ Project Template"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; + }; + + outputs = + { nixpkgs, ... }: + let + systems = [ + "x86_64-linux" + "aarch64-linux" + ]; + forEachSystem = nixpkgs.lib.genAttrs systems; + + pkgsForEach = nixpkgs.legacyPackages; + in + { + packages = forEachSystem (system: { + default = pkgsForEach.${system}.callPackage ./default.nix { }; + }); + + devShells = forEachSystem (system: { + default = pkgsForEach.${system}.callPackage ./shell.nix { }; + }); + }; +} diff --git a/templates/cpp/shell.nix b/templates/cpp/shell.nix new file mode 100644 index 000000000..01008821e --- /dev/null +++ b/templates/cpp/shell.nix @@ -0,0 +1,35 @@ +{ + callPackage, + clang-tools, + gnumake, + cmake, + bear, + libcxx, + cppcheck, + llvm, + gdb, + glm, + SDL2, + SDL2_gfx, +}: +let + mainPkg = callPackage ./default.nix { }; +in +mainPkg.overrideAttrs (oa: { + nativeBuildInputs = [ + clang-tools # fix headers not found + gnumake # builder + cmake # another builder + bear # bear. + libcxx # stdlib for cpp + cppcheck # static analysis + llvm.lldb # debugger + gdb # another debugger + llvm.libstdcxxClang # LSP and compiler + llvm.libcxx # stdlib for C++ + # libs + glm + SDL2 + SDL2_gfx + ] ++ (oa.nativeBuildInputs or [ ]); +}) diff --git a/templates/cpp/src/main.cpp b/templates/cpp/src/main.cpp new file mode 100644 index 000000000..027a27333 --- /dev/null +++ b/templates/cpp/src/main.cpp @@ -0,0 +1,7 @@ +#include + +int main() { + std::cout << "Hello, World!"; + + return 0; +} diff --git a/templates/dotnetf/.editorconfig b/templates/dotnetf/.editorconfig new file mode 100644 index 000000000..f66f3df19 --- /dev/null +++ b/templates/dotnetf/.editorconfig @@ -0,0 +1,37 @@ +root=true + +[*] +charset=utf-8 +trim_trailing_whitespace=true +insert_final_newline=true +indent_style=space +indent_size=4 + +# ReSharper properties +resharper_xml_indent_size=2 +resharper_xml_max_line_length=100 +resharper_xml_tab_width=2 + +[*.{csproj,fsproj,sqlproj,targets,props,ts,tsx,css,json}] +indent_size=2 + +[*.{fs,fsi}] +fsharp_bar_before_discriminated_union_declaration=true +fsharp_space_before_uppercase_invocation=true +fsharp_space_before_class_constructor=true +fsharp_space_before_member=true +fsharp_space_before_colon=true +fsharp_space_before_semicolon=true +fsharp_multiline_block_brackets_on_same_column=true +fsharp_newline_between_type_definition_and_members=true +fsharp_align_function_signature_to_indentation=true +fsharp_alternative_long_member_definitions=true +fsharp_multi_line_lambda_closing_newline=true +fsharp_experimental_keep_indent_in_branch=true +fsharp_max_value_binding_width=80 +fsharp_max_record_width=0 +max_line_length=120 + +[*.{appxmanifest,build,dtd,nuspec,xaml,xamlx,xoml,xsd}] +indent_size=2 +tab_width=2 diff --git a/templates/dotnetf/.gitattributes b/templates/dotnetf/.gitattributes new file mode 100644 index 000000000..e8e317cba --- /dev/null +++ b/templates/dotnetf/.gitattributes @@ -0,0 +1,3 @@ +* eol=auto +*.sh eol=lf +*.nix eol=lf diff --git a/templates/dotnetf/.gitignore b/templates/dotnetf/.gitignore new file mode 100644 index 000000000..ebe9cad78 --- /dev/null +++ b/templates/dotnetf/.gitignore @@ -0,0 +1,5 @@ +bin/ +obj/ +result +*.DotSettings.user +.idea/ diff --git a/templates/dotnetf/HelloWorld.Test/HelloWorld.Test.fsproj b/templates/dotnetf/HelloWorld.Test/HelloWorld.Test.fsproj new file mode 100644 index 000000000..984052c61 --- /dev/null +++ b/templates/dotnetf/HelloWorld.Test/HelloWorld.Test.fsproj @@ -0,0 +1,26 @@ + + + + net7.0 + false + false + true + + + + + + + + + + + + + + + + + + + diff --git a/templates/dotnetf/HelloWorld.Test/TestProgram.fs b/templates/dotnetf/HelloWorld.Test/TestProgram.fs new file mode 100644 index 000000000..201a79cb6 --- /dev/null +++ b/templates/dotnetf/HelloWorld.Test/TestProgram.fs @@ -0,0 +1,12 @@ +namespace HelloWorld.Test + +open HelloWorld +open NUnit.Framework +open FsUnitTyped + +[] +module TestSchema = + + [] + let ``Interpolates correctly`` () = + Program.construct "Nix" |> shouldEqual "Hello, Nix!" diff --git a/templates/dotnetf/HelloWorld.sln b/templates/dotnetf/HelloWorld.sln new file mode 100644 index 000000000..a8fe77421 --- /dev/null +++ b/templates/dotnetf/HelloWorld.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "HelloWorld", "HelloWorld\HelloWorld.fsproj", "{289B2402-80C5-47EB-896F-BEF9A751DE61}" +EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "HelloWorld.Test", "HelloWorld.Test\HelloWorld.Test.fsproj", "{4F472FBB-36FB-4073-A7B1-FC102D2D209E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {289B2402-80C5-47EB-896F-BEF9A751DE61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {289B2402-80C5-47EB-896F-BEF9A751DE61}.Debug|Any CPU.Build.0 = Debug|Any CPU + {289B2402-80C5-47EB-896F-BEF9A751DE61}.Release|Any CPU.ActiveCfg = Release|Any CPU + {289B2402-80C5-47EB-896F-BEF9A751DE61}.Release|Any CPU.Build.0 = Release|Any CPU + {4F472FBB-36FB-4073-A7B1-FC102D2D209E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4F472FBB-36FB-4073-A7B1-FC102D2D209E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4F472FBB-36FB-4073-A7B1-FC102D2D209E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4F472FBB-36FB-4073-A7B1-FC102D2D209E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/templates/dotnetf/HelloWorld/HelloWorld.fsproj b/templates/dotnetf/HelloWorld/HelloWorld.fsproj new file mode 100644 index 000000000..f86a39e4e --- /dev/null +++ b/templates/dotnetf/HelloWorld/HelloWorld.fsproj @@ -0,0 +1,13 @@ + + + + net7.0 + Exe + true + + + + + + + diff --git a/templates/dotnetf/HelloWorld/Program.fs b/templates/dotnetf/HelloWorld/Program.fs new file mode 100644 index 000000000..6c5a8e3ff --- /dev/null +++ b/templates/dotnetf/HelloWorld/Program.fs @@ -0,0 +1,16 @@ +namespace HelloWorld + +[] +module Program = + + let construct (name : string) : string = sprintf "Hello, %s!" name + + [] + let main argv = + match argv |> Array.tryExactlyOne with + | Some name -> + printfn "%s" (construct name) + 0 + | None -> + eprintfn "Expected exactly one argument" + 1 diff --git a/templates/dotnetf/README.md b/templates/dotnetf/README.md new file mode 100644 index 000000000..bb7fd6ad0 --- /dev/null +++ b/templates/dotnetf/README.md @@ -0,0 +1,24 @@ +# Hello, World in .NET + +This flake defines: + +* `nix run .#fantomas -- -r .` to run the [Fantomas](https://fsprojects.github.io/fantomas/) F# source formatter. +* `nix develop . --command alejandra .` to run the [Alejandra](https://github.com/kamadorueda/alejandra) Nix source formatter. +* `nix develop . --command markdown-link-check README.md` to check that this README's links are not broken. +* `nix develop . --command bash -c "find . -type f -name '*.sh' | xargs shellcheck"` to check all shell scripts in this repository. +* `nix run . --` to run the application. +* `nix run .#fetchDeps` to collect the [NuGet] dependencies of the project into the [lockfile](./nix/deps.nix). (You only have to run this after you change the NuGet dependencies of the .NET projects.) + +## Development + +When you want to add a [NuGet] dependency, you will have to rerun `nix run .#fetchDeps`, whose final line of output will tell you which file in your machine's temporary storage it's written its output to. +Copy that file to `./nix/deps.nix`. +If you forget to do this, you'll see `nix build` fail at the NuGet restore stage, because it's not talking to NuGet but instead is using the dependencies present in the Nix store; if you haven't run `fetchDeps`, those dependencies will not be in the store. +(Note that the file as generated does not conform to Alejandra's formatting requirements, so you will probably also want to `nix develop . --command alejandra .` afterwards.) + +## Style guidelines + +This template is *opinionated* about the style guidelines it uses. +The F# community at large tends to disagree with these guidelines, and you may wish to adjust the [editorconfig](./.editorconfig) file to suit your own needs. + +[NuGet](https://www.nuget.org) diff --git a/templates/dotnetf/flake.nix b/templates/dotnetf/flake.nix new file mode 100644 index 000000000..2a64433cf --- /dev/null +++ b/templates/dotnetf/flake.nix @@ -0,0 +1,94 @@ +{ + description = "Hello World in .NET"; + inputs = { + nixpkgs.url = "nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + outputs = + { nixpkgs, flake-utils, ... }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = import nixpkgs { inherit system; }; + projectFile = "./HelloWorld/HelloWorld.fsproj"; + testProjectFile = "./HelloWorld.Test/HelloWorld.Test.fsproj"; + pname = "dotnet-helloworld"; + dotnet-sdk = pkgs.dotnet-sdk_7; + dotnet-runtime = pkgs.dotnetCorePackages.runtime_7_0; + version = "0.0.1"; + dotnetSixTool = + toolName: toolVersion: sha256: + pkgs.stdenvNoCC.mkDerivation rec { + name = toolName; + version = toolVersion; + nativeBuildInputs = [ pkgs.makeWrapper ]; + src = pkgs.fetchNuGet { + pname = name; + inherit version sha256; + installPhase = ''mkdir -p $out/bin && cp -r tools/net6.0/any/* $out/bin''; + }; + installPhase = '' + runHook preInstall + mkdir -p "$out/lib" + cp -r ./bin/* "$out/lib" + makeWrapper "${dotnet-runtime}/bin/dotnet" "$out/bin/${name}" --add-flags "$out/lib/${name}.dll" + runHook postInstall + ''; + }; + in + { + packages = { + fantomas = dotnetSixTool "fantomas" "5.1.5" "sha256-qzIs6JiZV9uHUS0asrgWLAbaKJsNtr5h01fJxmOR2Mc="; + fetchDeps = + let + runtimeIds = map ( + system: pkgs.dotnetCorePackages.systemToDotnetRid system + ) dotnet-sdk.meta.platforms; + in + pkgs.writeShellScriptBin "fetch-${pname}-deps" ( + builtins.readFile ( + pkgs.substituteAll { + src = ./nix/fetchDeps.sh; + inherit pname; + inherit (dotnet-sdk) packages; + binPath = pkgs.lib.makeBinPath [ + pkgs.coreutils + dotnet-sdk + (pkgs.nuget-to-nix.override { inherit dotnet-sdk; }) + ]; + projectFiles = toString (pkgs.lib.toList projectFile); + testProjectFiles = toString (pkgs.lib.toList testProjectFile); + rids = pkgs.lib.concatStringsSep "\" \"" runtimeIds; + storeSrc = pkgs.srcOnly { + src = ./.; + inherit pname version; + }; + } + ) + ); + default = pkgs.buildDotnetModule { + pname = "HelloWorld"; + inherit + version + dotnet-sdk + dotnet-runtime + projectFile + ; + src = ./.; + nugetDeps = ./nix/deps.nix; + doCheck = true; + }; + }; + devShells = { + default = pkgs.mkShell { + buildInputs = [ + pkgs.dotnet-sdk_7 + pkgs.git + pkgs.alejandra + pkgs.nodePackages.markdown-link-check + ]; + }; + }; + } + ); +} diff --git a/templates/dotnetf/nix/deps.nix b/templates/dotnetf/nix/deps.nix new file mode 100644 index 000000000..b88337a35 --- /dev/null +++ b/templates/dotnetf/nix/deps.nix @@ -0,0 +1,360 @@ +# This file was automatically generated. +# Please don't edit it manually; your changes might get overwritten! +{ fetchNuGet }: +[ + (fetchNuGet { + pname = "FSharp.Core"; + version = "7.0.0"; + sha256 = "1pgk3qk9p1s53wvja17744x4bf7zs3a3wf0dmxi66w1w06z7i85x"; + }) + (fetchNuGet { + pname = "FsUnit"; + version = "5.0.0"; + sha256 = "0r535cw9ikm8xmyla6ah7qx3hb7nvz5m9fi0dqgbkd3wsrc8jlpl"; + }) + (fetchNuGet { + pname = "Microsoft.CodeCoverage"; + version = "17.1.0"; + sha256 = "1ijl3w14lnj15hi052jlshf5k8vb90x0py7yrs897mf126qp8ivy"; + }) + (fetchNuGet { + pname = "Microsoft.CSharp"; + version = "4.0.1"; + sha256 = "0zxc0apx1gcx361jlq8smc9pfdgmyjh6hpka8dypc9w23nlsh6yj"; + }) + (fetchNuGet { + pname = "Microsoft.NET.Test.Sdk"; + version = "17.1.0"; + sha256 = "1jaq11fhcfiylnn6wvbp2k9hrgq4cz755sfqjqjqcdxlkiyj2dkw"; + }) + (fetchNuGet { + pname = "Microsoft.NETCore.Platforms"; + version = "1.0.1"; + sha256 = "01al6cfxp68dscl15z7rxfw9zvhm64dncsw09a1vmdkacsa2v6lr"; + }) + (fetchNuGet { + pname = "Microsoft.NETCore.Platforms"; + version = "1.1.0"; + sha256 = "08vh1r12g6ykjygq5d3vq09zylgb84l63k49jc4v8faw9g93iqqm"; + }) + (fetchNuGet { + pname = "Microsoft.NETCore.Targets"; + version = "1.0.1"; + sha256 = "0ppdkwy6s9p7x9jix3v4402wb171cdiibq7js7i13nxpdky7074p"; + }) + (fetchNuGet { + pname = "Microsoft.TestPlatform.ObjectModel"; + version = "17.1.0"; + sha256 = "0jw577vbrplv9kga22lsipz91ww9iqi6j1wgpwga0vrayhggjsk2"; + }) + (fetchNuGet { + pname = "Microsoft.TestPlatform.TestHost"; + version = "17.1.0"; + sha256 = "0j9i078hv4qqrg2433p20pykmcjvmzarc1cy1k5f7kc7739q6vx5"; + }) + (fetchNuGet { + pname = "NETStandard.Library"; + version = "2.0.0"; + sha256 = "1bc4ba8ahgk15m8k4nd7x406nhi0kwqzbgjk2dmw52ss553xz7iy"; + }) + (fetchNuGet { + pname = "NETStandard.Library"; + version = "2.0.3"; + sha256 = "1fn9fxppfcg4jgypp2pmrpr6awl3qz1xmnri0cygpkwvyx27df1y"; + }) + (fetchNuGet { + pname = "Newtonsoft.Json"; + version = "9.0.1"; + sha256 = "0mcy0i7pnfpqm4pcaiyzzji4g0c8i3a5gjz28rrr28110np8304r"; + }) + (fetchNuGet { + pname = "NuGet.Frameworks"; + version = "5.11.0"; + sha256 = "0wv26gq39hfqw9md32amr5771s73f5zn1z9vs4y77cgynxr73s4z"; + }) + (fetchNuGet { + pname = "NUnit"; + version = "3.13.3"; + sha256 = "0wdzfkygqnr73s6lpxg5b1pwaqz9f414fxpvpdmf72bvh4jaqzv6"; + }) + (fetchNuGet { + pname = "NUnit.Analyzers"; + version = "3.3.0"; + sha256 = "00wp5q361f845aywrhhfbrpwd2srgygiam30pvn846b5dbl41vy0"; + }) + (fetchNuGet { + pname = "NUnit3TestAdapter"; + version = "4.2.1"; + sha256 = "0gildh4xcb6gkxcrrgh5a1j7lq0a7l670jpbs71akl5b5bgy5gc3"; + }) + (fetchNuGet { + pname = "runtime.any.System.Collections"; + version = "4.0.11"; + sha256 = "1x44bm1cgv28zmrp095wf9mn8a6a0ivnzp9v14dcbhx06igxzgg0"; + }) + (fetchNuGet { + pname = "runtime.any.System.Diagnostics.Tools"; + version = "4.0.1"; + sha256 = "0qcpm90hrm9gx9pmxlvfml65jm0bwpr5dg3r7l7xm9nvmibvc7n7"; + }) + (fetchNuGet { + pname = "runtime.any.System.Globalization"; + version = "4.0.11"; + sha256 = "0240rp66pi5bw1xklmh421hj7arwcdmjmgfkiq1cbc6nrm8ah286"; + }) + (fetchNuGet { + pname = "runtime.any.System.IO"; + version = "4.1.0"; + sha256 = "0kasfkjiml2kk8prnyn1990nhsahnjggvqwszqjdsfwfl43vpcb5"; + }) + (fetchNuGet { + pname = "runtime.any.System.Reflection"; + version = "4.1.0"; + sha256 = "06kcs059d5czyakx75rvlwa2mr86156w18fs7chd03f7084l7mq6"; + }) + (fetchNuGet { + pname = "runtime.any.System.Reflection.Extensions"; + version = "4.0.1"; + sha256 = "05k34ijz9g9csh0vbbv3g3lrxl163izwcfncmbcl7k073h32rzkr"; + }) + (fetchNuGet { + pname = "runtime.any.System.Reflection.Primitives"; + version = "4.0.1"; + sha256 = "1zxrpvixr5fqzkxpnin6g6gjq6xajy1snghz99ds2dwbhm276rhz"; + }) + (fetchNuGet { + pname = "runtime.any.System.Resources.ResourceManager"; + version = "4.0.1"; + sha256 = "1jmgs7hynb2rff48623wnyb37558bbh1q28k9c249j5r5sgsr5kr"; + }) + (fetchNuGet { + pname = "runtime.any.System.Runtime"; + version = "4.1.0"; + sha256 = "0mjr2bi7wvnkphfjqgkyf8vfyvy15a829jz6mivl6jmksh2bx40m"; + }) + (fetchNuGet { + pname = "runtime.any.System.Runtime.Handles"; + version = "4.0.1"; + sha256 = "1kswgqhy34qvc49i981fk711s7knd6z13bp0rin8ms6axkh98nas"; + }) + (fetchNuGet { + pname = "runtime.any.System.Runtime.InteropServices"; + version = "4.1.0"; + sha256 = "0gm8if0hcmp1qys1wmx4970k2x62pqvldgljsyzbjhiy5644vl8z"; + }) + (fetchNuGet { + pname = "runtime.any.System.Text.Encoding"; + version = "4.0.11"; + sha256 = "0m4vgmzi1ky8xlj0r7xcyazxln3j9dlialnk6d2gmgrfnzf8f9m7"; + }) + (fetchNuGet { + pname = "runtime.any.System.Text.Encoding.Extensions"; + version = "4.0.11"; + sha256 = "0d1rxxpvg9v7wlibsfgz0r4hwigpadas822qf8m8fs1gma9gs877"; + }) + (fetchNuGet { + pname = "runtime.any.System.Threading.Tasks"; + version = "4.0.11"; + sha256 = "1qzdp09qs8br5qxzlm1lgbjn4n57fk8vr1lzrmli2ysdg6x1xzvk"; + }) + (fetchNuGet { + pname = "runtime.native.System"; + version = "4.0.0"; + sha256 = "1ppk69xk59ggacj9n7g6fyxvzmk1g5p4fkijm0d7xqfkig98qrkf"; + }) + (fetchNuGet { + pname = "runtime.native.System.Security.Cryptography"; + version = "4.0.0"; + sha256 = "0k57aa2c3b10wl3hfqbgrl7xq7g8hh3a3ir44b31dn5p61iiw3z9"; + }) + (fetchNuGet { + pname = "runtime.unix.System.Diagnostics.Debug"; + version = "4.0.11"; + sha256 = "05ndbai4vpqrry0ghbfgqc8xblmplwjgndxmdn1zklqimczwjg2d"; + }) + (fetchNuGet { + pname = "runtime.unix.System.IO.FileSystem"; + version = "4.0.1"; + sha256 = "02wnlydnbhai0zy7c3kihg0cis0l1b2z78kyi1ci47c5v0jklwha"; + }) + (fetchNuGet { + pname = "runtime.unix.System.Private.Uri"; + version = "4.0.1"; + sha256 = "0ic5dgc45jkhcr1g9xmmzjm7ffiw4cymm0fprczlx4fnww4783nm"; + }) + (fetchNuGet { + pname = "runtime.unix.System.Runtime.Extensions"; + version = "4.1.0"; + sha256 = "0x1cwd7cvifzmn5x1wafvj75zdxlk3mxy860igh3x1wx0s8167y4"; + }) + (fetchNuGet { + pname = "System.Collections"; + version = "4.0.11"; + sha256 = "1ga40f5lrwldiyw6vy67d0sg7jd7ww6kgwbksm19wrvq9hr0bsm6"; + }) + (fetchNuGet { + pname = "System.Diagnostics.Debug"; + version = "4.0.11"; + sha256 = "0gmjghrqmlgzxivd2xl50ncbglb7ljzb66rlx8ws6dv8jm0d5siz"; + }) + (fetchNuGet { + pname = "System.Diagnostics.Tools"; + version = "4.0.1"; + sha256 = "19cknvg07yhakcvpxg3cxa0bwadplin6kyxd8mpjjpwnp56nl85x"; + }) + (fetchNuGet { + pname = "System.Dynamic.Runtime"; + version = "4.0.11"; + sha256 = "1pla2dx8gkidf7xkciig6nifdsb494axjvzvann8g2lp3dbqasm9"; + }) + (fetchNuGet { + pname = "System.Globalization"; + version = "4.0.11"; + sha256 = "070c5jbas2v7smm660zaf1gh0489xanjqymkvafcs4f8cdrs1d5d"; + }) + (fetchNuGet { + pname = "System.IO"; + version = "4.1.0"; + sha256 = "1g0yb8p11vfd0kbkyzlfsbsp5z44lwsvyc0h3dpw6vqnbi035ajp"; + }) + (fetchNuGet { + pname = "System.IO.FileSystem"; + version = "4.0.1"; + sha256 = "0kgfpw6w4djqra3w5crrg8xivbanh1w9dh3qapb28q060wb9flp1"; + }) + (fetchNuGet { + pname = "System.IO.FileSystem.Primitives"; + version = "4.0.1"; + sha256 = "1s0mniajj3lvbyf7vfb5shp4ink5yibsx945k6lvxa96r8la1612"; + }) + (fetchNuGet { + pname = "System.Linq"; + version = "4.1.0"; + sha256 = "1ppg83svb39hj4hpp5k7kcryzrf3sfnm08vxd5sm2drrijsla2k5"; + }) + (fetchNuGet { + pname = "System.Linq.Expressions"; + version = "4.1.0"; + sha256 = "1gpdxl6ip06cnab7n3zlcg6mqp7kknf73s8wjinzi4p0apw82fpg"; + }) + (fetchNuGet { + pname = "System.ObjectModel"; + version = "4.0.12"; + sha256 = "1sybkfi60a4588xn34nd9a58png36i0xr4y4v4kqpg8wlvy5krrj"; + }) + (fetchNuGet { + pname = "System.Private.Uri"; + version = "4.0.1"; + sha256 = "0k57qhawjysm4cpbfpc49kl4av7lji310kjcamkl23bwgij5ld9j"; + }) + (fetchNuGet { + pname = "System.Reflection"; + version = "4.1.0"; + sha256 = "1js89429pfw79mxvbzp8p3q93il6rdff332hddhzi5wqglc4gml9"; + }) + (fetchNuGet { + pname = "System.Reflection.Emit"; + version = "4.0.1"; + sha256 = "0ydqcsvh6smi41gyaakglnv252625hf29f7kywy2c70nhii2ylqp"; + }) + (fetchNuGet { + pname = "System.Reflection.Emit.ILGeneration"; + version = "4.0.1"; + sha256 = "1pcd2ig6bg144y10w7yxgc9d22r7c7ww7qn1frdfwgxr24j9wvv0"; + }) + (fetchNuGet { + pname = "System.Reflection.Emit.Lightweight"; + version = "4.0.1"; + sha256 = "1s4b043zdbx9k39lfhvsk68msv1nxbidhkq6nbm27q7sf8xcsnxr"; + }) + (fetchNuGet { + pname = "System.Reflection.Extensions"; + version = "4.0.1"; + sha256 = "0m7wqwq0zqq9gbpiqvgk3sr92cbrw7cp3xn53xvw7zj6rz6fdirn"; + }) + (fetchNuGet { + pname = "System.Reflection.Metadata"; + version = "1.6.0"; + sha256 = "1wdbavrrkajy7qbdblpbpbalbdl48q3h34cchz24gvdgyrlf15r4"; + }) + (fetchNuGet { + pname = "System.Reflection.Primitives"; + version = "4.0.1"; + sha256 = "1bangaabhsl4k9fg8khn83wm6yial8ik1sza7401621jc6jrym28"; + }) + (fetchNuGet { + pname = "System.Reflection.TypeExtensions"; + version = "4.1.0"; + sha256 = "1bjli8a7sc7jlxqgcagl9nh8axzfl11f4ld3rjqsyxc516iijij7"; + }) + (fetchNuGet { + pname = "System.Resources.ResourceManager"; + version = "4.0.1"; + sha256 = "0b4i7mncaf8cnai85jv3wnw6hps140cxz8vylv2bik6wyzgvz7bi"; + }) + (fetchNuGet { + pname = "System.Runtime"; + version = "4.1.0"; + sha256 = "02hdkgk13rvsd6r9yafbwzss8kr55wnj8d5c7xjnp8gqrwc8sn0m"; + }) + (fetchNuGet { + pname = "System.Runtime.Extensions"; + version = "4.1.0"; + sha256 = "0rw4rm4vsm3h3szxp9iijc3ksyviwsv6f63dng3vhqyg4vjdkc2z"; + }) + (fetchNuGet { + pname = "System.Runtime.Handles"; + version = "4.0.1"; + sha256 = "1g0zrdi5508v49pfm3iii2hn6nm00bgvfpjq1zxknfjrxxa20r4g"; + }) + (fetchNuGet { + pname = "System.Runtime.InteropServices"; + version = "4.1.0"; + sha256 = "01kxqppx3dr3b6b286xafqilv4s2n0gqvfgzfd4z943ga9i81is1"; + }) + (fetchNuGet { + pname = "System.Runtime.Serialization.Primitives"; + version = "4.1.1"; + sha256 = "042rfjixknlr6r10vx2pgf56yming8lkjikamg3g4v29ikk78h7k"; + }) + (fetchNuGet { + pname = "System.Text.Encoding"; + version = "4.0.11"; + sha256 = "1dyqv0hijg265dwxg6l7aiv74102d6xjiwplh2ar1ly6xfaa4iiw"; + }) + (fetchNuGet { + pname = "System.Text.Encoding.Extensions"; + version = "4.0.11"; + sha256 = "08nsfrpiwsg9x5ml4xyl3zyvjfdi4mvbqf93kjdh11j4fwkznizs"; + }) + (fetchNuGet { + pname = "System.Text.RegularExpressions"; + version = "4.1.0"; + sha256 = "1mw7vfkkyd04yn2fbhm38msk7dz2xwvib14ygjsb8dq2lcvr18y7"; + }) + (fetchNuGet { + pname = "System.Threading"; + version = "4.0.11"; + sha256 = "19x946h926bzvbsgj28csn46gak2crv2skpwsx80hbgazmkgb1ls"; + }) + (fetchNuGet { + pname = "System.Threading.Tasks"; + version = "4.0.11"; + sha256 = "0nr1r41rak82qfa5m0lhk9mp0k93bvfd7bbd9sdzwx9mb36g28p5"; + }) + (fetchNuGet { + pname = "System.Threading.Tasks.Extensions"; + version = "4.0.0"; + sha256 = "1cb51z062mvc2i8blpzmpn9d9mm4y307xrwi65di8ri18cz5r1zr"; + }) + (fetchNuGet { + pname = "System.Xml.ReaderWriter"; + version = "4.0.11"; + sha256 = "0c6ky1jk5ada9m94wcadih98l6k1fvf6vi7vhn1msjixaha419l5"; + }) + (fetchNuGet { + pname = "System.Xml.XDocument"; + version = "4.0.11"; + sha256 = "0n4lvpqzy9kc7qy1a4acwwd7b7pnvygv895az5640idl2y9zbz18"; + }) +] diff --git a/templates/dotnetf/nix/fetchDeps.sh b/templates/dotnetf/nix/fetchDeps.sh new file mode 100644 index 000000000..7c7994c71 --- /dev/null +++ b/templates/dotnetf/nix/fetchDeps.sh @@ -0,0 +1,73 @@ +#!/bin/bash + +# This file was adapted from +# https://github.com/NixOS/nixpkgs/blob/b981d811453ab84fb3ea593a9b33b960f1ab9147/pkgs/build-support/dotnet/build-dotnet-module/default.nix#L173 +set -euo pipefail +export PATH="@binPath@" +for arg in "$@"; do + case "$arg" in + --keep-sources | -k) + keepSources=1 + shift + ;; + --help | -h) + echo "usage: $0 [--keep-sources] [--help] " + echo " The path to write the lockfile to. A temporary file is used if this is not set" + echo " --keep-sources Don't remove temporary directories upon exit; useful for debugging" + echo " --help Show this help message" + exit + ;; + esac +done +tmp=$(mktemp -td "@pname@-tmp-XXXXXX") +export tmp +HOME=$tmp/home +exitTrap() { + test -n "${ranTrap-}" && return + ranTrap=1 + if test -n "${keepSources-}"; then + echo -e "Path to the source: $tmp/src\nPath to the fake home: $tmp/home" + else + rm -rf "$tmp" + fi + # Since mktemp is used this will be empty if the script didn't successfully complete + if ! test -s "$depsFile"; then + rm -rf "$depsFile" + fi +} +trap exitTrap EXIT INT TERM +dotnetRestore() { + local -r project="${1-}" + local -r rid="$2" + dotnet restore "${project-}" \ + -p:ContinuousIntegrationBuild=true \ + -p:Deterministic=true \ + --packages "$tmp/nuget_pkgs" \ + --runtime "$rid" \ + --no-cache \ + --force +} +declare -a projectFiles=(@projectFiles@) +declare -a testProjectFiles=(@testProjectFiles@) +export DOTNET_NOLOGO=1 +export DOTNET_CLI_TELEMETRY_OPTOUT=1 +depsFile=$(realpath "${1:-$(mktemp -t "@pname@-deps-XXXXXX.nix")}") +mkdir -p "$tmp/nuget_pkgs" +storeSrc="@storeSrc@" +src="$tmp/src" +cp -rT "$storeSrc" "$src" +chmod -R +w "$src" +cd "$src" +echo "Restoring project..." +rids=("@rids@") +for rid in "${rids[@]}"; do + ((${#projectFiles[@]} == 0)) && dotnetRestore "" "$rid" + for project in "${projectFiles[@]-}" "${testProjectFiles[@]-}"; do + dotnetRestore "$project" "$rid" + done +done +echo "Successfully restored project" +echo "Writing lockfile..." +echo -e "# This file was automatically generated.\n# Please don't edit it manually; your changes might get overwritten!\n" >"$depsFile" +nuget-to-nix "$tmp/nuget_pkgs" "@packages@" >>"$depsFile" +echo "Successfully wrote lockfile to $depsFile" diff --git a/templates/flake-compat/default.nix b/templates/flake-compat/default.nix new file mode 100644 index 000000000..12efe7599 --- /dev/null +++ b/templates/flake-compat/default.nix @@ -0,0 +1,3 @@ +(import (fetchTarball "https://github.com/edolstra/flake-compat/archive/master.tar.gz") { + src = builtins.fetchGit ./.; +}).defaultNix diff --git a/templates/flake-compat/shell.nix b/templates/flake-compat/shell.nix new file mode 100644 index 000000000..ff8955618 --- /dev/null +++ b/templates/flake-compat/shell.nix @@ -0,0 +1,3 @@ +(import (fetchTarball "https://github.com/edolstra/flake-compat/archive/master.tar.gz") { + src = builtins.fetchGit ./.; +}).shellNix diff --git a/templates/go/.envrc b/templates/go/.envrc new file mode 100644 index 000000000..3550a30f2 --- /dev/null +++ b/templates/go/.envrc @@ -0,0 +1 @@ +use flake diff --git a/templates/go/cmd/main.go b/templates/go/cmd/main.go new file mode 100644 index 000000000..a3dd973f0 --- /dev/null +++ b/templates/go/cmd/main.go @@ -0,0 +1,7 @@ +package main + +import "fmt" + +func main() { + fmt.Println("Hello, World!") +} diff --git a/templates/go/default.nix b/templates/go/default.nix new file mode 100644 index 000000000..ba15d0e8d --- /dev/null +++ b/templates/go/default.nix @@ -0,0 +1,14 @@ +{ buildGoModule }: +buildGoModule { + pname = "sample-go"; + version = "0.0.1"; + + src = ./.; + + vendorHash = ""; + + ldflags = [ + "-s" + "-w" + ]; +} diff --git a/templates/go/flake.nix b/templates/go/flake.nix new file mode 100644 index 000000000..d08f4673c --- /dev/null +++ b/templates/go/flake.nix @@ -0,0 +1,29 @@ +{ + description = "Golang Project Template"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs"; + }; + + outputs = + { nixpkgs }: + let + systems = [ + "x86_64-linux" + "aarch64-linux" + ]; + forEachSystem = nixpkgs.lib.genAttrs systems; + + pkgsForEach = nixpkgs.legacyPackages; + in + rec { + packages = forEachSystem (system: { + default = pkgsForEach.${system}.callPackage ./default.nix { }; + }); + + devShells = forEachSystem (system: { + default = pkgsForEach.${system}.callPackage ./shell.nix { }; + }); + + hydraJobs = packages; + }; +} diff --git a/templates/go/shell.nix b/templates/go/shell.nix new file mode 100644 index 000000000..7ebb1e23a --- /dev/null +++ b/templates/go/shell.nix @@ -0,0 +1,16 @@ +{ + callPackage, + go, + gopls, + delve, +}: +let + mainPkg = callPackage ./default.nix { }; +in +mainPkg.overrideAttrs (oa: { + nativeBuildInputs = [ + delve + go + gopls + ] ++ (oa.nativeBuildInputs or [ ]); +}) diff --git a/templates/node/.gitignore b/templates/node/.gitignore new file mode 100644 index 000000000..d5397511d --- /dev/null +++ b/templates/node/.gitignore @@ -0,0 +1,3 @@ +result +build +node_modules diff --git a/templates/node/default.nix b/templates/node/default.nix new file mode 100644 index 000000000..e5e30de93 --- /dev/null +++ b/templates/node/default.nix @@ -0,0 +1,9 @@ +{ lib, buildNpmPackage }: +buildNpmPackage { + pname = "foo-bar"; + version = "0.1.0"; + + src = ./.; + + npmDepsHash = lib.fakeSha256; +} diff --git a/templates/node/flake.nix b/templates/node/flake.nix new file mode 100644 index 000000000..c811bf749 --- /dev/null +++ b/templates/node/flake.nix @@ -0,0 +1,29 @@ +{ + description = "NodeJS Project Template"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs"; + }; + + outputs = + { nixpkgs }: + let + systems = [ + "x86_64-linux" + "aarch64-linux" + ]; + forEachSystem = nixpkgs.lib.genAttrs systems; + + pkgsForEach = nixpkgs.legacyPackages; + in + rec { + packages = forEachSystem (system: { + default = pkgsForEach.${system}.callPackage ./default.nix { }; + }); + + devShells = forEachSystem (system: { + default = pkgsForEach.${system}.callPackage ./shell.nix { }; + }); + + hydraJobs = packages; + }; +} diff --git a/templates/node/package.json b/templates/node/package.json new file mode 100644 index 000000000..5fc1164a1 --- /dev/null +++ b/templates/node/package.json @@ -0,0 +1,19 @@ +{ + "name": "sample-nodejs", + "version": "0.0.1", + "description": "Sample node program", + "bin": { + "sample-node": "build/index.js" + }, + "scripts": { + "build": "tsc", + "start": "npm run build && node build/index.js" + }, + "author": "NotAShelf", + "license": "MIT", + "devDependencies": { + "@types/node": "^20.1.2", + "typescript": "^5.0.4", + "typescript-language-server": "^3.3.2" + } +} diff --git a/templates/node/shell.nix b/templates/node/shell.nix new file mode 100644 index 000000000..b9c76e7f0 --- /dev/null +++ b/templates/node/shell.nix @@ -0,0 +1,23 @@ +{ + callPackage, + writeShellScriptBin, + eslint_d, + prettierd, +}: +let + mainPkg = callPackage ./default.nix { }; + mkNpxAlias = name: writeShellScriptBin name "npx ${name} \"$@\""; +in +mainPkg.overrideAttrs (oa: { + nativeBuildInputs = [ + eslint_d + prettierd + (mkNpxAlias "tsc") + (mkNpxAlias "tsserver") + ] ++ (oa.nativeBuildInputs or [ ]); + + shellHook = '' + eslint_d start # start eslint daemon + eslint_d status # inform user about eslint daemon status + ''; +}) diff --git a/templates/node/src/index.ts b/templates/node/src/index.ts new file mode 100644 index 000000000..940a3ff0e --- /dev/null +++ b/templates/node/src/index.ts @@ -0,0 +1 @@ +console.log("Hello world!"); diff --git a/templates/node/tsconfig.json b/templates/node/tsconfig.json new file mode 100644 index 000000000..0b9d711ed --- /dev/null +++ b/templates/node/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "target": "es2016", + "lib": [ + "es6" + ], + "module": "commonjs", + "rootDir": "src", + "resolveJsonModule": true, + "allowJs": true, + "outDir": "build", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitAny": true, + "skipLibCheck": true + } +} diff --git a/templates/python/README.md b/templates/python/README.md new file mode 100644 index 000000000..69b3c7911 --- /dev/null +++ b/templates/python/README.md @@ -0,0 +1,7 @@ +To get started, run the following: + +``` +$ nix develop +$ poetry run python -m sample_package +Hello, world! +``` \ No newline at end of file diff --git a/templates/python/flake.nix b/templates/python/flake.nix new file mode 100644 index 000000000..47e71d78c --- /dev/null +++ b/templates/python/flake.nix @@ -0,0 +1,47 @@ +{ + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + inputs.poetry2nix.url = "github:nix-community/poetry2nix"; + + outputs = + { + self, + nixpkgs, + poetry2nix, + }: + let + supportedSystems = [ + "x86_64-linux" + "x86_64-darwin" + "aarch64-linux" + "aarch64-darwin" + ]; + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; + pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system}); + in + { + packages = forAllSystems ( + system: + let + inherit (poetry2nix.lib.mkPoetry2Nix { pkgs = pkgs.${system}; }) mkPoetryApplication; + in + { + default = mkPoetryApplication { projectDir = self; }; + } + ); + + devShells = forAllSystems ( + system: + let + inherit (poetry2nix.lib.mkPoetry2Nix { pkgs = pkgs.${system}; }) mkPoetryEnv; + in + { + default = pkgs.${system}.mkShellNoCC { + packages = with pkgs.${system}; [ + (mkPoetryEnv { projectDir = self; }) + poetry + ]; + }; + } + ); + }; +} diff --git a/templates/python/poetry.lock b/templates/python/poetry.lock new file mode 100644 index 000000000..ddb15267a --- /dev/null +++ b/templates/python/poetry.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand. +package = [] + +[metadata] +lock-version = "2.0" +python-versions = "^3.10" +content-hash = "53f2eabc9c26446fbcc00d348c47878e118afc2054778c3c803a0a8028af27d9" diff --git a/templates/python/pyproject.toml b/templates/python/pyproject.toml new file mode 100644 index 000000000..444f40ed4 --- /dev/null +++ b/templates/python/pyproject.toml @@ -0,0 +1,17 @@ +[tool.poetry] +name = "sample-project" +version = "0.1.0" +description = "" +authors = ["Author Name "] +# readme = "README.md" +# license = "BSD" +packages = [ + { include = "sample_package" } +] + +[tool.poetry.dependencies] +python = "^3.10" + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" \ No newline at end of file diff --git a/templates/python/sample_package/__init__.py b/templates/python/sample_package/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/templates/python/sample_package/__main__.py b/templates/python/sample_package/__main__.py new file mode 100644 index 000000000..7576b1dcf --- /dev/null +++ b/templates/python/sample_package/__main__.py @@ -0,0 +1,2 @@ +if __name__ == "__main__": + print("Hello, world!") \ No newline at end of file diff --git a/templates/rust-web-server/Cargo.lock b/templates/rust-web-server/Cargo.lock new file mode 100644 index 000000000..56f0bc389 --- /dev/null +++ b/templates/rust-web-server/Cargo.lock @@ -0,0 +1,1783 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "actix-codec" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78d1833b3838dbe990df0f1f87baf640cf6146e898166afe401839d1b001e570" +dependencies = [ + "bitflags", + "bytes 0.5.6", + "futures-core", + "futures-sink", + "log", + "pin-project 0.4.28", + "tokio", + "tokio-util", +] + +[[package]] +name = "actix-connect" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "177837a10863f15ba8d3ae3ec12fac1099099529ed20083a27fdfe247381d0dc" +dependencies = [ + "actix-codec", + "actix-rt", + "actix-service", + "actix-utils", + "derive_more", + "either", + "futures-util", + "http", + "log", + "trust-dns-proto", + "trust-dns-resolver", +] + +[[package]] +name = "actix-http" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "452299e87817ae5673910e53c243484ca38be3828db819b6011736fc6982e874" +dependencies = [ + "actix-codec", + "actix-connect", + "actix-rt", + "actix-service", + "actix-threadpool", + "actix-utils", + "base64", + "bitflags", + "brotli2", + "bytes 0.5.6", + "cookie", + "copyless", + "derive_more", + "either", + "encoding_rs", + "flate2", + "futures-channel", + "futures-core", + "futures-util", + "fxhash", + "h2", + "http", + "httparse", + "indexmap", + "itoa", + "language-tags", + "lazy_static", + "log", + "mime", + "percent-encoding", + "pin-project 1.0.8", + "rand", + "regex", + "serde", + "serde_json", + "serde_urlencoded", + "sha-1", + "slab", + "time", +] + +[[package]] +name = "actix-macros" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ca8ce00b267af8ccebbd647de0d61e0674b6e61185cc7a592ff88772bed655" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "actix-router" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ad299af73649e1fc893e333ccf86f377751eb95ff875d095131574c6f43452c" +dependencies = [ + "bytestring", + "http", + "log", + "regex", + "serde", +] + +[[package]] +name = "actix-rt" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "143fcc2912e0d1de2bcf4e2f720d2a60c28652ab4179685a1ee159e0fb3db227" +dependencies = [ + "actix-macros", + "actix-threadpool", + "copyless", + "futures-channel", + "futures-util", + "smallvec", + "tokio", +] + +[[package]] +name = "actix-server" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45407e6e672ca24784baa667c5d32ef109ccdd8d5e0b5ebb9ef8a67f4dfb708e" +dependencies = [ + "actix-codec", + "actix-rt", + "actix-service", + "actix-utils", + "futures-channel", + "futures-util", + "log", + "mio", + "mio-uds", + "num_cpus", + "slab", + "socket2", +] + +[[package]] +name = "actix-service" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0052435d581b5be835d11f4eb3bce417c8af18d87ddf8ace99f8e67e595882bb" +dependencies = [ + "futures-util", + "pin-project 0.4.28", +] + +[[package]] +name = "actix-testing" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47239ca38799ab74ee6a8a94d1ce857014b2ac36f242f70f3f75a66f691e791c" +dependencies = [ + "actix-macros", + "actix-rt", + "actix-server", + "actix-service", + "log", + "socket2", +] + +[[package]] +name = "actix-threadpool" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d209f04d002854b9afd3743032a27b066158817965bf5d036824d19ac2cc0e30" +dependencies = [ + "derive_more", + "futures-channel", + "lazy_static", + "log", + "num_cpus", + "parking_lot", + "threadpool", +] + +[[package]] +name = "actix-tls" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24789b7d7361cf5503a504ebe1c10806896f61e96eca9a7350e23001aca715fb" +dependencies = [ + "actix-codec", + "actix-service", + "actix-utils", + "futures-util", +] + +[[package]] +name = "actix-utils" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e9022dec56632d1d7979e59af14f0597a28a830a9c1c7fec8b2327eb9f16b5a" +dependencies = [ + "actix-codec", + "actix-rt", + "actix-service", + "bitflags", + "bytes 0.5.6", + "either", + "futures-channel", + "futures-sink", + "futures-util", + "log", + "pin-project 0.4.28", + "slab", +] + +[[package]] +name = "actix-web" +version = "3.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e641d4a172e7faa0862241a20ff4f1f5ab0ab7c279f00c2d4587b77483477b86" +dependencies = [ + "actix-codec", + "actix-http", + "actix-macros", + "actix-router", + "actix-rt", + "actix-server", + "actix-service", + "actix-testing", + "actix-threadpool", + "actix-tls", + "actix-utils", + "actix-web-codegen", + "awc", + "bytes 0.5.6", + "derive_more", + "encoding_rs", + "futures-channel", + "futures-core", + "futures-util", + "fxhash", + "log", + "mime", + "pin-project 1.0.8", + "regex", + "serde", + "serde_json", + "serde_urlencoded", + "socket2", + "time", + "tinyvec", + "url", +] + +[[package]] +name = "actix-web-codegen" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad26f77093333e0e7c6ffe54ebe3582d908a104e448723eec6d43d08b07143fb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "aho-corasick" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +dependencies = [ + "memchr", +] + +[[package]] +name = "async-trait" +version = "0.1.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b98e84bbb4cbcdd97da190ba0c58a1bb0de2c1fdf67d159e192ed766aeca722" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "autocfg" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" + +[[package]] +name = "awc" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b381e490e7b0cfc37ebc54079b0413d8093ef43d14a4e4747083f7fa47a9e691" +dependencies = [ + "actix-codec", + "actix-http", + "actix-rt", + "actix-service", + "base64", + "bytes 0.5.6", + "cfg-if 1.0.0", + "derive_more", + "futures-core", + "log", + "mime", + "percent-encoding", + "rand", + "serde", + "serde_json", + "serde_urlencoded", +] + +[[package]] +name = "base-x" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b" + +[[package]] +name = "base64" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" + +[[package]] +name = "bitflags" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", +] + +[[package]] +name = "brotli-sys" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4445dea95f4c2b41cde57cc9fee236ae4dbae88d8fcbdb4750fc1bb5d86aaecd" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "brotli2" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cb036c3eade309815c15ddbacec5b22c4d1f3983a774ab2eac2e3e9ea85568e" +dependencies = [ + "brotli-sys", + "libc", +] + +[[package]] +name = "bumpalo" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c59e7af012c713f529e7a3ee57ce9b31ddd858d4b512923602f74608b009631" + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "bytes" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" + +[[package]] +name = "bytes" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" + +[[package]] +name = "bytestring" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90706ba19e97b90786e19dc0d5e2abd80008d99d4c0c5d1ad0b5e72cec7c494d" +dependencies = [ + "bytes 1.0.1", +] + +[[package]] +name = "cc" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e70cc2f62c6ce1868963827bd677764c62d07c3d9a3e1fb1177ee1a9ab199eb2" + +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "const_fn" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f92cfa0fd5690b3cf8c1ef2cabbd9b7ef22fa53cf5e1f92b05103f6d5d1cf6e7" + +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + +[[package]] +name = "cookie" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03a5d7b21829bc7b4bf4754a978a241ae54ea55a40f92bb20216e54096f4b951" +dependencies = [ + "percent-encoding", + "time", + "version_check", +] + +[[package]] +name = "copyless" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2df960f5d869b2dd8532793fde43eb5427cceb126c929747a26823ab0eeb536" + +[[package]] +name = "cpufeatures" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66c99696f6c9dd7f35d486b9d04d7e6e202aa3e8c40d553f2fdf5e7e0c6a71ef" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "derive_more" +version = "0.99.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40eebddd2156ce1bb37b20bbe5151340a31828b1f2d22ba4141f3531710e38df" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version 0.3.3", + "syn", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "discard" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" + +[[package]] +name = "either" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" + +[[package]] +name = "encoding_rs" +version = "0.8.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80df024fbc5ac80f87dfef0d9f5209a252f2a497f7f42944cff24d8253cac065" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "enum-as-inner" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c5f0096a91d210159eceb2ff5e1c4da18388a170e1e3ce948aac9c8fdbbf595" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "flate2" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd3aec53de10fe96d7d8c565eb17f2c687bb5518a2ec453b5b1252964526abe0" +dependencies = [ + "cfg-if 1.0.0", + "crc32fast", + "libc", + "miniz_oxide", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +dependencies = [ + "matches", + "percent-encoding", +] + +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +dependencies = [ + "bitflags", + "fuchsia-zircon-sys", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" + +[[package]] +name = "futures" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7e43a803dae2fa37c1f6a8fe121e1f7bf9548b4dfc0522a42f34145dadfc27" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e682a68b29a882df0545c143dc3646daefe80ba479bcdede94d5a703de2871e2" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0402f765d8a89a26043b889b26ce3c4679d268fa6bb22cd7c6aad98340e179d1" + +[[package]] +name = "futures-io" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acc499defb3b348f8d8f3f66415835a9131856ff7714bf10dadfc4ec4bdb29a1" + +[[package]] +name = "futures-macro" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c40298486cdf52cc00cd6d6987892ba502c7656a16a4192a9992b1ccedd121" +dependencies = [ + "autocfg", + "proc-macro-hack", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a57bead0ceff0d6dde8f465ecd96c9338121bb7717d3e7b108059531870c4282" + +[[package]] +name = "futures-task" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a16bef9fc1a4dddb5bee51c989e3fbba26569cbb0e31f5b303c184e3dd33dae" + +[[package]] +name = "futures-util" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "feb5c238d27e2bf94ffdfd27b2c29e3df4a68c4193bb6427384259e2bf191967" +dependencies = [ + "autocfg", + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite 0.2.7", + "pin-utils", + "proc-macro-hack", + "proc-macro-nested", + "slab", +] + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "generic-array" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi", +] + +[[package]] +name = "h2" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e4728fd124914ad25e99e3d15a9361a879f6620f63cb56bbb08f95abb97a535" +dependencies = [ + "bytes 0.5.6", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", + "tracing-futures", +] + +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" + +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "hostname" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +dependencies = [ + "libc", + "match_cfg", + "winapi 0.3.9", +] + +[[package]] +name = "http" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527e8c9ac747e28542699a951517aa9a6945af506cd1f2e1b53a576c17b6cc11" +dependencies = [ + "bytes 1.0.1", + "fnv", + "itoa", +] + +[[package]] +name = "httparse" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a87b616e37e93c22fb19bcd386f02f3af5ea98a25670ad0fce773de23c5e68" + +[[package]] +name = "idna" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "indexmap" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" +dependencies = [ + "autocfg", + "hashbrown", +] + +[[package]] +name = "instant" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee0328b1209d157ef001c94dd85b4f8f64139adb0eac2659f4b08382b2f474d" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "iovec" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +dependencies = [ + "libc", +] + +[[package]] +name = "ipconfig" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7e2f18aece9709094573a9f24f483c4f65caa4298e2f7ae1b71cc65d853fad7" +dependencies = [ + "socket2", + "widestring", + "winapi 0.3.9", + "winreg", +] + +[[package]] +name = "itoa" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" + +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + +[[package]] +name = "language-tags" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790" + +[[package]] +name = "linked-hash-map" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" + +[[package]] +name = "lock_api" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0382880606dff6d15c9476c416d18690b72742aa7b605bb6dd6ec9030fbf07eb" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "lru-cache" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" +dependencies = [ + "linked-hash-map", +] + +[[package]] +name = "match_cfg" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" + +[[package]] +name = "matches" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" + +[[package]] +name = "memchr" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" + +[[package]] +name = "mime" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" + +[[package]] +name = "miniz_oxide" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" +dependencies = [ + "adler", + "autocfg", +] + +[[package]] +name = "mio" +version = "0.6.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" +dependencies = [ + "cfg-if 0.1.10", + "fuchsia-zircon", + "fuchsia-zircon-sys", + "iovec", + "kernel32-sys", + "libc", + "log", + "miow", + "net2", + "slab", + "winapi 0.2.8", +] + +[[package]] +name = "mio-uds" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" +dependencies = [ + "iovec", + "libc", + "mio", +] + +[[package]] +name = "miow" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" +dependencies = [ + "kernel32-sys", + "net2", + "winapi 0.2.8", + "ws2_32-sys", +] + +[[package]] +name = "net2" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae" +dependencies = [ + "cfg-if 0.1.10", + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "num_cpus" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "parking_lot" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018" +dependencies = [ + "cfg-if 1.0.0", + "instant", + "libc", + "redox_syscall", + "smallvec", + "winapi 0.3.9", +] + +[[package]] +name = "percent-encoding" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" + +[[package]] +name = "pest" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" +dependencies = [ + "ucd-trie", +] + +[[package]] +name = "pin-project" +version = "0.4.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918192b5c59119d51e0cd221f4d49dde9112824ba717369e903c97d076083d0f" +dependencies = [ + "pin-project-internal 0.4.28", +] + +[[package]] +name = "pin-project" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "576bc800220cc65dac09e99e97b08b358cfab6e17078de8dc5fee223bd2d0c08" +dependencies = [ + "pin-project-internal 1.0.8", +] + +[[package]] +name = "pin-project-internal" +version = "0.4.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3be26700300be6d9d23264c73211d8190e755b6b5ca7a1b28230025511b52a5e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-internal" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e8fe8163d14ce7f0cdac2e040116f22eac817edabff0be91e8aff7e9accf389" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" + +[[package]] +name = "pin-project-lite" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "ppv-lite86" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" + +[[package]] +name = "proc-macro-hack" +version = "0.5.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" + +[[package]] +name = "proc-macro-nested" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" + +[[package]] +name = "proc-macro2" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c7ed8b8c7b886ea3ed7dde405212185f423ab44682667c8c6dd14aa1d9f6612" +dependencies = [ + "unicode-xid", +] + +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + +[[package]] +name = "quote" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom", + "libc", + "rand_chacha", + "rand_core", + "rand_hc", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core", +] + +[[package]] +name = "redox_syscall" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ab49abadf3f9e1c4bc499e8845e152ad87d2ad2d30371841171169e9d75feee" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" + +[[package]] +name = "resolv-conf" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" +dependencies = [ + "hostname", + "quick-error", +] + +[[package]] +name = "rust-web-server" +version = "0.1.0" +dependencies = [ + "actix-rt", + "actix-web", +] + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver 0.9.0", +] + +[[package]] +name = "rustc_version" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" +dependencies = [ + "semver 0.11.0", +] + +[[package]] +name = "ryu" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser 0.7.0", +] + +[[package]] +name = "semver" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" +dependencies = [ + "semver-parser 0.10.2", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + +[[package]] +name = "semver-parser" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" +dependencies = [ + "pest", +] + +[[package]] +name = "serde" +version = "1.0.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha-1" +version = "0.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a0c8611594e2ab4ebbf06ec7cbbf0a99450b8570e96cbf5188b5d5f6ef18d81" +dependencies = [ + "block-buffer", + "cfg-if 1.0.0", + "cpufeatures", + "digest", + "opaque-debug", +] + +[[package]] +name = "sha1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" + +[[package]] +name = "signal-hook-registry" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" +dependencies = [ + "libc", +] + +[[package]] +name = "slab" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f173ac3d1a7e3b28003f40de0b5ce7fe2710f9b9dc3fc38664cebee46b3b6527" + +[[package]] +name = "smallvec" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" + +[[package]] +name = "socket2" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "standback" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff" +dependencies = [ + "version_check", +] + +[[package]] +name = "stdweb" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" +dependencies = [ + "discard", + "rustc_version 0.2.3", + "stdweb-derive", + "stdweb-internal-macros", + "stdweb-internal-runtime", + "wasm-bindgen", +] + +[[package]] +name = "stdweb-derive" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "serde_derive", + "syn", +] + +[[package]] +name = "stdweb-internal-macros" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" +dependencies = [ + "base-x", + "proc-macro2", + "quote", + "serde", + "serde_derive", + "serde_json", + "sha1", + "syn", +] + +[[package]] +name = "stdweb-internal-runtime" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" + +[[package]] +name = "syn" +version = "1.0.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1873d832550d4588c3dbc20f01361ab00bfe741048f71e3fecf145a7cc18b29c" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "thiserror" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93119e4feac1cbe6c798c34d3a53ea0026b0b1de6a120deef895137c0529bfe2" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "060d69a0afe7796bf42e9e2ff91f5ee691fb15c53d38b4b62a9a53eb23164745" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + +[[package]] +name = "time" +version = "0.2.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4752a97f8eebd6854ff91f1c1824cd6160626ac4bd44287f7f4ea2035a02a242" +dependencies = [ + "const_fn", + "libc", + "standback", + "stdweb", + "time-macros", + "version_check", + "winapi 0.3.9", +] + +[[package]] +name = "time-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1" +dependencies = [ + "proc-macro-hack", + "time-macros-impl", +] + +[[package]] +name = "time-macros-impl" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3c141a1b43194f3f56a1411225df8646c55781d5f26db825b3d98507eb482f" +dependencies = [ + "proc-macro-hack", + "proc-macro2", + "quote", + "standback", + "syn", +] + +[[package]] +name = "tinyvec" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "848a1e1181b9f6753b5e96a092749e29b11d19ede67dfbbd6c7dc7e0f49b5338" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + +[[package]] +name = "tokio" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6703a273949a90131b290be1fe7b039d0fc884aa1935860dfcbe056f28cd8092" +dependencies = [ + "bytes 0.5.6", + "futures-core", + "iovec", + "lazy_static", + "libc", + "memchr", + "mio", + "mio-uds", + "pin-project-lite 0.1.12", + "signal-hook-registry", + "slab", + "winapi 0.3.9", +] + +[[package]] +name = "tokio-util" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" +dependencies = [ + "bytes 0.5.6", + "futures-core", + "futures-sink", + "log", + "pin-project-lite 0.1.12", + "tokio", +] + +[[package]] +name = "tracing" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d" +dependencies = [ + "cfg-if 1.0.0", + "log", + "pin-project-lite 0.2.7", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9ff14f98b1a4b289c6248a023c1c2fa1491062964e9fed67ab29c4e4da4a052" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project 1.0.8", + "tracing", +] + +[[package]] +name = "trust-dns-proto" +version = "0.19.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cad71a0c0d68ab9941d2fb6e82f8fb2e86d9945b94e1661dd0aaea2b88215a9" +dependencies = [ + "async-trait", + "cfg-if 1.0.0", + "enum-as-inner", + "futures", + "idna", + "lazy_static", + "log", + "rand", + "smallvec", + "thiserror", + "tokio", + "url", +] + +[[package]] +name = "trust-dns-resolver" +version = "0.19.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "710f593b371175db53a26d0b38ed2978fafb9e9e8d3868b1acd753ea18df0ceb" +dependencies = [ + "cfg-if 0.1.10", + "futures", + "ipconfig", + "lazy_static", + "log", + "lru-cache", + "resolv-conf", + "smallvec", + "thiserror", + "tokio", + "trust-dns-proto", +] + +[[package]] +name = "typenum" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" + +[[package]] +name = "ucd-trie" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" + +[[package]] +name = "unicode-bidi" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeb8be209bb1c96b7c177c7420d26e04eccacb0eeae6b980e35fcb74678107e0" +dependencies = [ + "matches", +] + +[[package]] +name = "unicode-normalization" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" + +[[package]] +name = "unicode-xid" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" + +[[package]] +name = "url" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" +dependencies = [ + "form_urlencoded", + "idna", + "matches", + "percent-encoding", +] + +[[package]] +name = "version_check" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasm-bindgen" +version = "0.2.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd" +dependencies = [ + "cfg-if 1.0.0", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b33f6a0694ccfea53d94db8b2ed1c3a8a4c86dd936b13b9f0a15ec4a451b900" +dependencies = [ + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "088169ca61430fe1e58b8096c24975251700e7b1f6fd91cc9d59b04fb9b18bd4" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f" + +[[package]] +name = "widestring" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c168940144dd21fd8046987c16a46a33d5fc84eec29ef9dcddc2ac9e31526b7c" + +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "winreg" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9" +dependencies = [ + "winapi 0.3.9", +] + +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] diff --git a/templates/rust-web-server/Cargo.toml b/templates/rust-web-server/Cargo.toml new file mode 100644 index 000000000..6f455a3ca --- /dev/null +++ b/templates/rust-web-server/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "rust-web-server" +version = "0.1.0" +authors = ["Austin Horstman "] +edition = "2018" + +[dependencies] +actix-web = "3" + +[dev-dependencies] +actix-rt = "1" diff --git a/templates/rust-web-server/flake.nix b/templates/rust-web-server/flake.nix new file mode 100644 index 000000000..bb47ae171 --- /dev/null +++ b/templates/rust-web-server/flake.nix @@ -0,0 +1,152 @@ +{ + description = "A Rust web server including a NixOS module"; + + # Nixpkgs / NixOS version to use. + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + + inputs.import-cargo.url = "github:edolstra/import-cargo"; + + outputs = + { + self, + nixpkgs, + import-cargo, + }: + let + + # to work with older version of flakes + lastModifiedDate = self.lastModifiedDate or self.lastModified or "19700101"; + + # Generate a user-friendly version number. + version = "${builtins.substring 0 8 lastModifiedDate}-${self.shortRev or "dirty"}"; + + # System types to support. + systems = [ + "x86_64-linux" + "aarch64-linux" + ]; + forEachSystem = nixpkgs.lib.genAttrs systems; + + # Nixpkgs instantiated for supported system types. + nixpkgsFor = forEachSystem ( + system: + import nixpkgs { + inherit system; + overlays = [ self.overlay ]; + } + ); + in + { + + # A Nixpkgs overlay. + overlay = final: _prev: { + + rust-web-server = + with final; + final.callPackage ( + { + inShell ? false, + }: + stdenv.mkDerivation rec { + name = "rust-web-server-${version}"; + + # In 'nix develop', we don't need a copy of the source tree + # in the Nix store. + src = if inShell then null else ./.; + + buildInputs = + [ + rustc + cargo + ] + ++ ( + if inShell then + [ + # In 'nix develop', provide some developer tools. + rustfmt + clippy + ] + else + [ + (import-cargo.builders.importCargo { + lockFile = ./Cargo.lock; + inherit pkgs; + }).cargoHome + ] + ); + + target = "--release"; + + buildPhase = "cargo build ${target} --frozen --offline"; + + doCheck = true; + + checkPhase = "cargo test ${target} --frozen --offline"; + + installPhase = '' + mkdir -p $out + cargo install --frozen --offline --path . --root $out + rm $out/.crates.toml + ''; + } + ) { }; + }; + + # Provide some binary packages for selected system types. + packages = forAllSystems (system: { + inherit (nixpkgsFor.${system}) rust-web-server; + }); + + # The default package for 'nix build'. This makes sense if the + # flake provides only one package or there is a clear "main" + # package. + defaultPackage = forAllSystems (system: self.packages.${system}.rust-web-server); + + # Provide a 'nix develop' environment for interactive hacking. + devShell = forAllSystems ( + system: self.packages.${system}.rust-web-server.override { inShell = true; } + ); + + # A NixOS module. + nixosModules.rust-web-server = + { pkgs, ... }: + { + nixpkgs.overlays = [ self.overlay ]; + + systemd.services.rust-web-server = { + wantedBy = [ "multi-user.target" ]; + serviceConfig.ExecStart = "${pkgs.rust-web-server}/bin/rust-web-server"; + }; + }; + + # Tests run by 'nix flake check' and by Hydra. + checks = forAllSystems ( + system: + with nixpkgsFor.${system}; + + { + inherit (self.packages.${system}) rust-web-server; + + # A VM test of the NixOS module. + vmTest = + with import (nixpkgs + "/nixos/lib/testing-python.nix") { inherit system; }; + + makeTest { + nodes = { + client = + { ... }: + { + imports = [ self.nixosModules.rust-web-server ]; + }; + }; + + testScript = '' + start_all() + client.wait_for_unit("multi-user.target") + assert "Hello Nixers" in client.wait_until_succeeds("curl --fail http://localhost:8080/") + ''; + }; + } + ); + }; +} diff --git a/templates/rust-web-server/src/main.rs b/templates/rust-web-server/src/main.rs new file mode 100644 index 000000000..db1458178 --- /dev/null +++ b/templates/rust-web-server/src/main.rs @@ -0,0 +1,41 @@ +use actix_web::{web, App, HttpServer}; + +fn config(cfg: &mut web::ServiceConfig) { + cfg.service(web::resource("/").to(|| async { "Hello Nixers!\n" })); +} + +#[actix_web::main] +async fn main() -> std::io::Result<()> { + HttpServer::new(|| App::new().configure(config)) + .bind("127.0.0.1:8080")? + .run() + .await +} + +#[cfg(test)] +mod tests { + use super::*; + use actix_web::dev::Service; + use actix_web::{http, test, App, Error}; + + #[actix_rt::test] + async fn test() -> Result<(), Error> { + let mut app = test::init_service(App::new().configure(config)).await; + + let resp = app + .call(test::TestRequest::get().uri("/").to_request()) + .await + .unwrap(); + + assert_eq!(resp.status(), http::StatusCode::OK); + + let body = match resp.response().body().as_ref() { + Some(actix_web::body::Body::Bytes(bytes)) => bytes, + _ => panic!("Response error"), + }; + + assert_eq!(body, "Hello Nixers!\n"); + + Ok(()) + } +} diff --git a/templates/rust/Cargo.toml b/templates/rust/Cargo.toml new file mode 100644 index 000000000..c0a1285bd --- /dev/null +++ b/templates/rust/Cargo.toml @@ -0,0 +1,5 @@ +[package] +name = "sample-rust" +version = "0.0.1" +license = "MIT" +edition = "2021" diff --git a/templates/rust/default.nix b/templates/rust/default.nix new file mode 100644 index 000000000..d95e7199d --- /dev/null +++ b/templates/rust/default.nix @@ -0,0 +1,8 @@ +{ rustPlatform }: +rustPlatform.buildRustPackage { + pname = "sample-rust"; + version = "0.0.1"; + + src = ./.; + cargoLock.lockFile = ./Cargo.lock; +} diff --git a/templates/rust/flake.nix b/templates/rust/flake.nix new file mode 100644 index 000000000..3a0b9a99d --- /dev/null +++ b/templates/rust/flake.nix @@ -0,0 +1,29 @@ +{ + description = "Rust Project Template"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs"; + }; + + outputs = + { nixpkgs }: + let + systems = [ + "x86_64-linux" + "aarch64-linux" + ]; + forEachSystem = nixpkgs.lib.genAttrs systems; + + pkgsForEach = nixpkgs.legacyPackages; + in + rec { + packages = forEachSystem (system: { + default = pkgsForEach.${system}.callPackage ./default.nix { }; + }); + + devShells = forEachSystem (system: { + default = pkgsForEach.${system}.callPackage ./shell.nix { }; + }); + + hydraJobs = packages; + }; +} diff --git a/templates/rust/shell.nix b/templates/rust/shell.nix new file mode 100644 index 000000000..0f2420ab2 --- /dev/null +++ b/templates/rust/shell.nix @@ -0,0 +1,19 @@ +{ + callPackage, + rust-analyzer, + rustfmt, + clippy, + cargo, +}: +let + mainPkg = callPackage ./default.nix { }; +in +mainPkg.overrideAttrs (oa: { + nativeBuildInputs = [ + # Additional rust tooling + rust-analyzer + rustfmt + clippy + cargo + ] ++ (oa.nativeBuildInputs or [ ]); +}) diff --git a/templates/rust/src/main.rs b/templates/rust/src/main.rs new file mode 100644 index 000000000..e7a11a969 --- /dev/null +++ b/templates/rust/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +}