From fcc25dddfb586ad5afed563231b6b20823b46bda Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Thu, 22 Dec 2022 16:14:07 -0600 Subject: [PATCH] Big mess --- .envrc | 3 +++ .gitignore | 9 +++++++++ .gitmodules | 15 +++++++++++++++ Tupfile | 6 ------ Tupfile.ini | 0 Tuprules.tup | 33 +++++++++------------------------ flake.lock | 27 +++++++++++++++++++++++++++ flake.nix | 35 +++++++++++++++++++++++++++++++++++ getdns | 1 + nim | 1 + nim.shell.nix | 8 -------- npeg | 1 + preserves-nim | 2 +- syndicate-protocols | 2 +- taps | 1 + tkrzw | 1 + tup.patch | 43 +++++++++++++++++++++++++++++++++++++++++++ 17 files changed, 148 insertions(+), 40 deletions(-) create mode 100644 .envrc create mode 100644 .gitignore delete mode 100644 Tupfile create mode 100644 Tupfile.ini create mode 100644 flake.lock create mode 100644 flake.nix create mode 160000 getdns create mode 160000 nim delete mode 100644 nim.shell.nix create mode 160000 npeg create mode 160000 taps create mode 160000 tkrzw create mode 100644 tup.patch diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..a46e564 --- /dev/null +++ b/.envrc @@ -0,0 +1,3 @@ +use flake .# +PATH_add bin +PATH_add nim/bin diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7749efe --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +.direnv +.tup +bin +##### TUP GITIGNORE ##### +##### Lines below automatically generated by Tup. +##### Do not edit. +.tup +/.gitignore +/bin diff --git a/.gitmodules b/.gitmodules index b4cdf35..0274059 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,18 @@ [submodule "syndicate/syndicate-protocols"] path = syndicate-protocols url = https://git.syndicate-lang.org/syndicate-lang/syndicate-protocols.git +[submodule "nim"] + path = nim + url = https://github.com/nim-lang/nim.git +[submodule "npeg"] + path = npeg + url = https://github.com/zevv/npeg.git +[submodule "getdns"] + path = getdns + url = https://git.sr.ht/~ehmry/getdns-nim +[submodule "taps"] + path = taps + url = https://git.sr.ht/~ehmry/nim_taps +[submodule "tkrzw"] + path = tkrzw + url = https://git.sr.ht/~ehmry/nim-tkrzw diff --git a/Tupfile b/Tupfile deleted file mode 100644 index 1730a05..0000000 --- a/Tupfile +++ /dev/null @@ -1,6 +0,0 @@ -include_rules -: preserves-nim/src/preserves/preserves_schema_nim.nim |> !nim |> $(preserves_schema_nim) -: preserves-nim/src/preserves/schemac.nim |> !nim |> $(preserves-schemac) - -: |> nix build --offline $(PKGS_FLAKE)#dhall --out-link %o |> $(DHALL_LINK) -: |> nix build --offline $(PKGS_FLAKE)#lowdown --out-link %o |> $(LOWDOWN_LINK) diff --git a/Tupfile.ini b/Tupfile.ini new file mode 100644 index 0000000..e69de29 diff --git a/Tuprules.tup b/Tuprules.tup index 157ec3c..26d6bc4 100644 --- a/Tuprules.tup +++ b/Tuprules.tup @@ -1,31 +1,16 @@ +.gitignore export NIX_PATH export XDG_CACHE_HOME -NIX_SHELL = nix-shell --run -PKGS_FLAKE = "github:nixos/nixpkgs/release-22.11" +DIRENV = direnv exec . -DHALL_LINK = $(TUP_CWD)/dhall -!dhall = | $(DHALL_LINK) |> $(DHALL_LINK)/bin/dhall |> +BIN_DIR = $(TUP_CWD)/bin -LOWDOWN_LINK = $(TUP_CWD)/lowdown -!lowdown = | $(LOWDOWN_LINK) |> $(LOWDOWN_LINK)/bin/lowdown |> +NIM_BACKEND = compile +!nim = |> ^o nim compile %B^ $(DIRENV) nim $(NIM_BACKEND) --hints:off -o:%o %f |> %B +!nim_run = |> ^ nim run %B^$(DIRENV) nim c $(NIM_PATH) --hints:off -o:%o -r %f |> %B.run -NODEJS_LINK = $(TUP_CWD)/nodejs -!nodejs = | $(NODEJS_LINK) |> $(NODEJS_LINK)/bin/node |> +!symlink = |> ln -s %f %o |> -preserves_schema_nim = $(TUP_CWD)/preserves_schema_nim - -NIM = $(TUP_CWD)/nim/bin/nim -!nim = |> $(NIM) c --hints:off $(NIM_PATH) -o:%o %f |> %B -!nim_run = |> $(NIM) c --hints:off -o:%o -r %f |> %B.run - -PRESERVES_TOP = $(TUP_CWD) - -!preserves_schema_nim = | $(preserves_schema_nim) |> $(preserves_schema_nim) %f |> $(PRESERVES_TOP)/ - -preserves-schemac = $(TUP_CWD)/preserves-schemac -!preserves-schemac = | $(preserves-schemac) |> $(preserves-schemac) |> $(PRESERVES_TOP)/ - -NIM_PATH += --path:$(TUP_CWD)/preserves-nim/src -NIM_PATH += --path:$(TUP_CWD)/syndicate-nim/src -NIM_PATH += --path:$(TUP_CWD)/taps/src +!preserves_schema_nim = | $(BIN_DIR)/ |> ^o generate nim module %B^ $(BIN_DIR)/preserves_schema_nim %f |> +!preserves_schemac = | $(BIN_DIR)/ |> ^o^ $(BIN_DIR)/preserves_schemac |> diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..fb88f6b --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1670701925, + "narHash": "sha256-2iF54l6UW7cm/8Fqa0hsHnLNKZGm6NxqfA5NHB94zgI=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "9bc8e04ebb30c1f7cbf9bc55a8e32bb092dbefa2", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "release-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..236ff7a --- /dev/null +++ b/flake.nix @@ -0,0 +1,35 @@ +{ + description = "Packages pin"; + inputs.nixpkgs.url = "github:nixos/nixpkgs/release-22.11"; + outputs = { self, nixpkgs }: + let inherit (nixpkgs) lib; + in { + + overlay = final: prev: { + tup = let + tup' = prev.tup.overrideAttrs + ({ patches ? [ ], ... }: { patches = patches ++ [ ./tup.patch ]; }); + in with final; + writeScriptBin "tup" '' + export PATH=${lib.makeBinPath [ coreutils direnv gitMinimal nix ]} + exec ${tup'}/bin/tup $@ + ''; + }; + + legacyPackages = lib.mapAttrs (_: { extend, ... }: extend self.overlay) + nixpkgs.legacyPackages; + + packages = + lib.mapAttrs (_: pkgs: { inherit (pkgs) tup; }) self.legacyPackages; + + devShells = lib.mapAttrs (_: pkgs: + with pkgs.extend self.overlay; { + default = mkShell { packages = [ ccacheWrapper tup ]; }; + nim = mkShell { packages = [ ccacheWrapper nim-unwrapped ]; }; + config = mkShell { packages = [ gnused ]; }; + eris = mkShell { packages = [ getdns pkg-config solo5 tkrzw ]; }; + getdns = mkShell { packages = [ getdns pkg-config ]; }; + }) nixpkgs.legacyPackages; + + }; +} diff --git a/getdns b/getdns new file mode 160000 index 0000000..c73cbe2 --- /dev/null +++ b/getdns @@ -0,0 +1 @@ +Subproject commit c73cbe288d9f9480586b8fa87f6d794ffb6a6ce6 diff --git a/nim b/nim new file mode 160000 index 0000000..86dfe48 --- /dev/null +++ b/nim @@ -0,0 +1 @@ +Subproject commit 86dfe484caaec8f6c39e33b7377ddb7dc97c86f8 diff --git a/nim.shell.nix b/nim.shell.nix deleted file mode 100644 index 958e0ac..0000000 --- a/nim.shell.nix +++ /dev/null @@ -1,8 +0,0 @@ -let - ops = builtins.getFlake "ops"; - pkgs = ops.legacyPackages.x86_64-linux; -in with pkgs; -mkShell { - packages = [ gitMinimal nim-unwrapped which ]; - inputsFrom = [ nim-unwrapped ]; -} diff --git a/npeg b/npeg new file mode 160000 index 0000000..1d54c2f --- /dev/null +++ b/npeg @@ -0,0 +1 @@ +Subproject commit 1d54c2ffa57600ab0d797179790e1113e91c28a3 diff --git a/preserves-nim b/preserves-nim index d313239..66a653a 160000 --- a/preserves-nim +++ b/preserves-nim @@ -1 +1 @@ -Subproject commit d3132391bd832f88aee497dd5317aa59c8e75ce6 +Subproject commit 66a653a77514f94fdb53aef807248b5e780c3a8a diff --git a/syndicate-protocols b/syndicate-protocols index ca92d99..4c03646 160000 --- a/syndicate-protocols +++ b/syndicate-protocols @@ -1 +1 @@ -Subproject commit ca92d99c524d99b6d3be04a0ba5383ec5a65b550 +Subproject commit 4c03646567eec97016ee08426bad7adfb593e288 diff --git a/taps b/taps new file mode 160000 index 0000000..b5b7d29 --- /dev/null +++ b/taps @@ -0,0 +1 @@ +Subproject commit b5b7d299f446378a2939f2debca306df756fc119 diff --git a/tkrzw b/tkrzw new file mode 160000 index 0000000..efd87ed --- /dev/null +++ b/tkrzw @@ -0,0 +1 @@ +Subproject commit efd87edb7b063182c1a1fa018006a87b515d589b diff --git a/tup.patch b/tup.patch new file mode 100644 index 0000000..0448aba --- /dev/null +++ b/tup.patch @@ -0,0 +1,43 @@ +diff --git a/src/tup/pel_group.c b/src/tup/pel_group.c +index 0a3bc4c3..db3848fa 100644 +--- a/src/tup/pel_group.c ++++ b/src/tup/pel_group.c +@@ -47,6 +47,10 @@ int pel_ignored(const char *path, int len) + return 1; + if(len == 4 && strncmp(path, ".svn", 4) == 0) + return 1; ++ if(len == 7 && strncmp(path, ".direnv", 7) == 0) ++ return 1; ++ if(len == 10 && strncmp(path, ".gitignore", 10) == 0) ++ return 1; + if(len == 7 && strncmp(path, ".ccache", 7) == 0) + return 1; + /* See also fuse_fs.c:is_hidden() */ +diff --git a/src/tup/server/fuse_fs.c b/src/tup/server/fuse_fs.c +index 108051e5..88737580 100644 +--- a/src/tup/server/fuse_fs.c ++++ b/src/tup/server/fuse_fs.c +@@ -100,6 +100,10 @@ static int is_hidden(const char *path) + return 1; + if(strstr(path, "/.bzr") != NULL) + return 1; ++ if(strstr(path, "/.direnv") != NULL) ++ return 1; ++ if(strstr(path, "/.gitignore") != NULL) ++ return 1; + if(is_ccache_path(path)) + return 1; + return 0; +diff --git a/tup.1 b/tup.1 +index 208629fe..ae0c54ce 100644 +--- a/tup.1 ++++ b/tup.1 +@@ -291,7 +291,7 @@ Set to '1' to keep building as much as possible even if errors are encountered. + Set to '1' to track dependencies on files outside of the tup hierarchy. The default is '0', which only tracks dependencies within the tup hierarchy. For example, if you want all C files to be re-compiled when gcc is updated on your system, you should set this to '1'. In Linux and OSX, using full dependencies requires that the tup binary is suid as root so that it can run sub-processes in a chroot environment. Alternatively on Linux, if your kernel supports user namespaces, then you don't need to make the binary suid. Note that if this value is set to '1' from '0', tup will rebuild the entire project. Disabling this option when it was previously enabled does not require a full rebuild, but does take some time since the nodes representing external files are cleared out. NOTE: This does not currently work with ccache or other programs that may write to external files due to issues with locking. This may be fixed in the future. + .TP + .B updater.warnings (defaults to '1') +-Set to '0' to disable warnings about writing to hidden files. Tup doesn't track files that are hidden. If a sub-process writes to a hidden file, then by default tup will display a warning that this file was created. By disabling this option, those warnings are not displayed. Hidden filenames (or directories) include: ., .., .tup, .git, .hg, .bzr, .svn. ++Set to '0' to disable warnings about writing to hidden files. Tup doesn't track files that are hidden. If a sub-process writes to a hidden file, then by default tup will display a warning that this file was created. By disabling this option, those warnings are not displayed. Hidden filenames (or directories) include: ., .., .tup, .git, .hg, .bzr, .svn, .direnv. + .TP + .B display.color (default 'auto') + Set to 'never' to disable ANSI escape codes for colored output, or 'always' to always use ANSI escape codes for colored output. The default is 'auto', which displays uses colored output if stdout is connected to a tty, and uses no colors otherwise (ie: if stdout is redirected to a file).