This commit is contained in:
Emery Hemingway 2022-12-22 16:14:07 -06:00
parent cc273ed535
commit fcc25dddfb
17 changed files with 148 additions and 40 deletions

3
.envrc Normal file
View File

@ -0,0 +1,3 @@
use flake .#
PATH_add bin
PATH_add nim/bin

9
.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
.direnv
.tup
bin
##### TUP GITIGNORE #####
##### Lines below automatically generated by Tup.
##### Do not edit.
.tup
/.gitignore
/bin

15
.gitmodules vendored
View File

@ -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

View File

@ -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)

0
Tupfile.ini Normal file
View File

View File

@ -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>
preserves-schemac = $(TUP_CWD)/preserves-schemac
!preserves-schemac = | $(preserves-schemac) |> $(preserves-schemac) |> $(PRESERVES_TOP)/<schemas>
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)/<preserves_schema_nim> |> ^o generate nim module %B^ $(BIN_DIR)/preserves_schema_nim %f |>
!preserves_schemac = | $(BIN_DIR)/<preserves_schemac> |> ^o^ $(BIN_DIR)/preserves_schemac |>

27
flake.lock Normal file
View File

@ -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
}

35
flake.nix Normal file
View File

@ -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;
};
}

1
getdns Submodule

@ -0,0 +1 @@
Subproject commit c73cbe288d9f9480586b8fa87f6d794ffb6a6ce6

1
nim Submodule

@ -0,0 +1 @@
Subproject commit 86dfe484caaec8f6c39e33b7377ddb7dc97c86f8

View File

@ -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 ];
}

1
npeg Submodule

@ -0,0 +1 @@
Subproject commit 1d54c2ffa57600ab0d797179790e1113e91c28a3

@ -1 +1 @@
Subproject commit d3132391bd832f88aee497dd5317aa59c8e75ce6
Subproject commit 66a653a77514f94fdb53aef807248b5e780c3a8a

@ -1 +1 @@
Subproject commit ca92d99c524d99b6d3be04a0ba5383ec5a65b550
Subproject commit 4c03646567eec97016ee08426bad7adfb593e288

1
taps Submodule

@ -0,0 +1 @@
Subproject commit b5b7d299f446378a2939f2debca306df756fc119

1
tkrzw Submodule

@ -0,0 +1 @@
Subproject commit efd87edb7b063182c1a1fa018006a87b515d589b

43
tup.patch Normal file
View File

@ -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).