diff --git a/.envrc b/.envrc new file mode 100644 index 0000000000000000000000000000000000000000..6de8a8acd7e0568480ae14eb70819c9036a8666a --- /dev/null +++ b/.envrc @@ -0,0 +1,3 @@ +source_url "https://raw.githubusercontent.com/cachix/devenv/d1f7b48e35e6dee421cfd0f51481d17f77586997/direnvrc" "sha256-YBzqskFZxmNb3kYVoKD9ZixoPXJh1C9ZvTLGFRkauZ0=" + +use devenv \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..c4300bc28a417b16f22ee24fa6134754e796e36c --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ + +# Devenv +.devenv* +devenv.local.nix + +# direnv +.direnv + +# pre-commit +.pre-commit-config.yaml + diff --git a/devenv.lock b/devenv.lock new file mode 100644 index 0000000000000000000000000000000000000000..0f594d4a31c33da49681243ed27743ec75a0ba3a --- /dev/null +++ b/devenv.lock @@ -0,0 +1,156 @@ +{ + "nodes": { + "devenv": { + "locked": { + "dir": "src/modules", + "lastModified": 1689504341, + "narHash": "sha256-btK/nUaxB6HBCiuhnebiCTnohatHElVwWrBOWP+oWpI=", + "owner": "cachix", + "repo": "devenv", + "rev": "b9c9d83e89c0405ab02880132a0601911c477250", + "type": "github" + }, + "original": { + "dir": "src/modules", + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1689449371, + "narHash": "sha256-sK3Oi8uEFrFPL83wKPV6w0+96NrmwqIpw9YFffMifVg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "29bcead8405cfe4c00085843eb372cc43837bb9d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1685801374, + "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c37ca420157f4abc31e26f436c1145f8951ff373", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1689328505, + "narHash": "sha256-9B3+OeUn1a/CvzE3GW6nWNwS5J7PDHTyHGlpL3wV5oA=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "5e28316db471d1ac234beb70031b635437421dd6", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "devenv": "devenv", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": "pre-commit-hooks" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/devenv.nix b/devenv.nix new file mode 100644 index 0000000000000000000000000000000000000000..59ad99bed53f626e41c9d0f1aea5afc1ba1d831f --- /dev/null +++ b/devenv.nix @@ -0,0 +1,50 @@ +# See full reference at https://devenv.sh/reference/options/ +{ pkgs, inputs, phps, lib, config, modulesPath,... }: + +{ + + + # https://devenv.sh/packages/ + packages = [ + pkgs.git + pkgs.gcc12 + #pkgs.glibc + pkgs.go-task + pkgs.blackbox + pkgs.blackbox-terminal + pkgs.jq + pkgs.delve + pkgs.gdlv + pkgs.libffi + pkgs.zlib + pkgs.procps + pkgs.php81Extensions.xdebug + pkgs.ranger + pkgs.meld + pkgs.gnused + pkgs.coreutils-full # # https://search.nixos.org/packages?channel=23.05&show=coreutils-full&from=0&size=50&sort=relevance&type=packages&query=mkdir + pkgs.gnugrep + pkgs.gnumake + pkgs.util-linux + # pkgs.logrotate + pkgs.httpie + pkgs.netcat + pkgs.memcached + pkgs.fd + + #pkgs.process-compose + # pkgs.glibc_multi + # pkgs.curl + ]; + + ## curl geht nicht! + + # https://devenv.sh/languages/ + # languages.nix.enable = true; + languages = { + go = { enable = true; }; + }; + + +} + diff --git a/devenv.yaml b/devenv.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c7cb5cedadc04e17a1703f298db573f43c79cad8 --- /dev/null +++ b/devenv.yaml @@ -0,0 +1,3 @@ +inputs: + nixpkgs: + url: github:NixOS/nixpkgs/nixpkgs-unstable diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000000000000000000000000000000000000..486127dfa5ca37cb2354731c32c142ca5547ee63 --- /dev/null +++ b/flake.nix @@ -0,0 +1,87 @@ +{ + description = "Version is a program that automates and simplifies the process of incrementing version numbers for software projects."; + + # Nixpkgs / NixOS version to use. + inputs.nixpkgs.url = "nixpkgs/nixos-unstable"; + + 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; + + + rootPath = ./.; + releaseJson = builtins.fromJSON (builtins.readFile "${rootPath}/release.json"); + version = releaseJson.version; + + + # 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; }); + + in + { + + # Provide some binary packages for selected system types. + packages = forAllSystems (system: + let + pkgs = nixpkgsFor.${system}; + in + { + version = pkgs.buildGoModule { + pname = "version"; + inherit version; + # In 'nix develop', we don't need a copy of the source tree + # in the Nix store. + src = ././application/source; + + # This hash locks the dependencies of this package. It is + # necessary because of how Go requires network access to resolve + # VCS. See https://www.tweag.io/blog/2021-03-04-gomod2nix/ for + # details. Normally one can build with a fake sha256 and rely on native Go + # mechanisms to tell you what the hash should be or determine what + # it should be "out-of-band" with other tooling (eg. gomod2nix). + # To begin with it is recommended to set this, but one must + # remeber to bump this hash when your dependencies change. + vendorSha256 = pkgs.lib.fakeSha256; + + #vendorSha256 = "sha256-XdB+u94Rqsb29jVs4miyOq1NEYaVJHWFXg6QebFJzNQ="; + + + meta = with nixpkgs.legacyPackages.${system}.lib; { + description = "Version is a program that automates and simplifies the process of incrementing version numbers for software projects."; + homepage = "https://gitlab.schukai.com/oss/utilities/version"; + license = licenses.mit; + maintainers = with maintainers; [ "schukai GmbH" ]; + }; + + }; + }); + + # Add dependencies that are only needed for development + devShells = forAllSystems (system: + let + pkgs = nixpkgsFor.${system}; + in + { + default = pkgs.mkShell { + buildInputs = with pkgs; [ go gopls gotools go-tools ]; + }; + }); + + # 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}.version); + }; +} +