From 2d2a929a9e6fb32b34f3032643fb6465c5173012 Mon Sep 17 00:00:00 2001 From: stubbfelnewpc Date: Thu, 25 Aug 2022 18:34:19 +0000 Subject: [PATCH] init --- .devcontainer/Dockerfile | 15 +++++++++++ .devcontainer/devcontainer.json | 31 +++++++++++++++++++++++ .gitignore | 45 +++++++++++++++++++++++++++++++++ LICENSE | 9 +++++++ README.md | 3 +++ default.nix | 17 +++++++++++++ 6 files changed, 120 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 default.nix diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..de3befc --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,15 @@ +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.241.1/containers/ubuntu/.devcontainer/base.Dockerfile + +# [Choice] Ubuntu version (use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon): ubuntu-22.04, ubuntu-20.04, ubuntu-18.04 +ARG VARIANT="jammy" +FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT} + +# [Optional] Uncomment this section to install additional OS packages. +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends xz-utils bc docker.io + +RUN mkdir /nix \ + && chown vscode /nix \ + && su vscode -c "sh <(curl -L https://releases.nixos.org/nix/nix-2.10.3/install) --no-daemon" + +RUN su vscode -c "/home/vscode/.nix-profile/bin/nix-env -i nixpkgs-fmt" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..fd6ed39 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,31 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.241.1/containers/ubuntu +{ + "name": "Ubuntu", + "build": { + "dockerfile": "Dockerfile", + // Update 'VARIANT' to pick an Ubuntu version: jammy / ubuntu-22.04, focal / ubuntu-20.04, bionic /ubuntu-18.04 + // Use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon. + "args": { + "VARIANT": "ubuntu-22.04" + } + }, + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "uname -a", + // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "vscode", + "features": { + "docker-from-docker": "latest" + }, + "customizations": { + "vscode": { + "extensions": [ + "mhutchie.git-graph", + "eamodio.gitlens", + "jnoortheen.nix-ide" + ] + } + } +} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..55c35ac --- /dev/null +++ b/.gitignore @@ -0,0 +1,45 @@ + +# Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,git +# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,git + +### Git ### +# Created by git for backups. To disable backups in Git: +# $ git config --global mergetool.keepBackup false +*.orig + +# Created by git when using merge tools for conflicts +*.BACKUP.* +*.BASE.* +*.LOCAL.* +*.REMOTE.* +*_BACKUP_*.txt +*_BASE_*.txt +*_LOCAL_*.txt +*_REMOTE_*.txt + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history +.ionide + +# Support for Project snippet scope +.vscode/*.code-snippets + +# Ignore code-workspaces +*.code-workspace + +# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,git diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..04d8fab --- /dev/null +++ b/LICENSE @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2022 stubbfel + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..f5cfbbb --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# UnicivSever nix + +nix files to run a Uniciv server diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..0aa5f4c --- /dev/null +++ b/default.nix @@ -0,0 +1,17 @@ +# nix-build --expr 'with import {}; callPackage ./default.nix {}' +{ pkgs ? import { } }: + +let + + jarFile = pkgs.fetchurl { + url = "https://github.com/yairm210/Unciv/releases/latest/download/UncivServer.jar"; + sha256 = "sha256-gGZCMG8+mqXK/2JgEN7ONBJ8QR7lAfl843EGB2j+N/E="; + }; + + uncivServerCmd = pkgs.writeShellScriptBin "UncivServer.sh" '' + ${pkgs.jre}/bin/java -jar ${jarFile} "$@" + ''; + +in + +uncivServerCmd