diff --git a/.gitignore b/.gitignore index ba8b4afc..8d0cb04b 100755 --- a/.gitignore +++ b/.gitignore @@ -140,3 +140,10 @@ __pycache__ snap/.snapcraft tcp-proxy/tcp-proxy rustybits/target + +#direnv +.envrc + +#nix stuff +result +result-man diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..80d833b4 --- /dev/null +++ b/flake.lock @@ -0,0 +1,64 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1744157173, + "narHash": "sha256-bWSjxDwq7iVePrhmA7tY2dyMWHuNJo8knkO4y+q4ZkY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6a39c6e495eefabc935d8ddf66aa45d85b85fa3f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "nixpkgs-zerotier-base": [ + "nixpkgs" + ] + } + }, + "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/flake.nix b/flake.nix new file mode 100644 index 00000000..dd025679 --- /dev/null +++ b/flake.nix @@ -0,0 +1,35 @@ +{ + description = "Custom ZeroTierOne build with private patches"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + + # Pin to specific nixpkgs version for zerotierone base package + nixpkgs-zerotier-base = { + url = "github:NixOS/nixpkgs/d9d87c51960050e89c79e4025082ed965e770d68"; + follows = "nixpkgs"; + }; + + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, nixpkgs-zerotier-base, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + in + { + packages = { + zerotierone-tspu = pkgs.callPackage ./package.nix { + zerotierone = (import nixpkgs-zerotier-base { inherit system; }).zerotierone; + }; + + default = self.packages.${system}.zerotierone-tspu; + }; + + devShells.default = import ./shell.nix { + inherit pkgs; + }; + } + ); +} diff --git a/package.nix b/package.nix new file mode 100644 index 00000000..f1e8333e --- /dev/null +++ b/package.nix @@ -0,0 +1,18 @@ +{ zerotierone, lib }: + +zerotierone.overrideAttrs (oldAttrs: { + pname = "zerotierone-tspu"; + version = "1.14.2-tspu"; + + src = builtins.fetchGit { + url = "git@git.dltech.ge:global-it/infra/zerotiertspu.git"; + ref = "1.14.2"; + }; + + patches = []; + nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [ ]; + + meta = oldAttrs.meta // { + description = "Custom ZeroTierOne build with private patches"; + }; +}) diff --git a/shell.nix b/shell.nix new file mode 100644 index 00000000..93119a0d --- /dev/null +++ b/shell.nix @@ -0,0 +1,16 @@ +{ pkgs ? import { } }: + +let + zerotieroneCustom = pkgs.callPackage ./package.nix {}; +in +pkgs.mkShell { + packages = [ ] + ++ zerotieroneCustom.buildInputs + ++ zerotieroneCustom.nativeBuildInputs; + + SSH_AUTH_SOCK = builtins.getEnv "SSH_AUTH_SOCK"; + NIXPKGS_ALLOW_UNFREE = "1"; + + shellHook = '' + ''; +}