Skip to content

Commit

Permalink
refac(build): fluidattacks#1007 remove attic logic
Browse files Browse the repository at this point in the history
- attic is not a cache solution that we should use,
  it does not solve anything that cachix cannot do
  • Loading branch information
Diego Restrepo committed Mar 8, 2023
1 parent b3d03bf commit 451cbab
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 81 deletions.
13 changes: 2 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1789,9 +1789,8 @@ Types:
- pubKey (`str`): Public key of the cache server.
- token (`str`): The name of the environment variable that contains the
token to push the cache.
- type: (`enum [cachix | attic]`): Binary cache type.
Can be [Cachix](https://docs.cachix.org/)
or [Attic](https://docs.attic.rs/introduction.html).
- type: (`enum [cachix]`): Binary cache type.
Can be [Cachix](https://docs.cachix.org/).
- url (`str`):
URL of the cache.
- write (`bool`): Enable pushing derivations to the cache. Requires `token`.
Expand All @@ -1811,14 +1810,6 @@ Example `makes.nix`:
cache = {
readNixos = true;
extra = {
local = {
enable = true;
pubKey = "local:nKOS5sOc0MKPoBJZmY4qWjbcXvoJFaO2S/zN6aUztII=";
token = "ATTIC_AUTH_TOKEN";
type = "attic";
url = "http://192.168.1.8:8085/local?priority=1";
write = true;
};
main = {
enable = true;
pubKey = "makes.cachix.org-1:zO7UjWLTRR8Vfzkgsu1PESjmb6ymy1e4OE9YfMmCQR4=";
Expand Down
1 change: 0 additions & 1 deletion makes/cli/env/runtime/main.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ makeSearchPaths {
__nixpkgs__.gzip
__nixpkgs__.nixStable
__nixpkgs__.openssh
# it is necessary to inject the attic client
];
source = [
outputs."/cli/env/runtime/pypi"
Expand Down
69 changes: 0 additions & 69 deletions src/cli/main/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,41 +264,6 @@ def _clone_src_cache_refresh(head: str, cache_key: str) -> None:
shutil.copytree(head, cached)


def _attic_login(caches: List[Dict[str, Any]]) -> None:
for config in caches:
if config["type"] == "attic" and config["token"] in environ:
_run(
args=[
"attic",
"login",
"local",
config["url"],
environ[config["token"]],
],
stderr=subprocess.DEVNULL,
stdout=subprocess.DEVNULL,
)
_run(
args=[
"attic",
"cache",
"create",
config["name"],
],
stderr=subprocess.DEVNULL,
stdout=subprocess.DEVNULL,
)
_run(
args=[
"attic",
"use",
config["name"],
],
stderr=subprocess.DEVNULL,
stdout=subprocess.DEVNULL,
)


def _nix_build(
*,
attr: str,
Expand All @@ -312,7 +277,6 @@ def _nix_build(
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
)
else:
_attic_login(cache)
substituters = " ".join(
[
item["url"]
Expand Down Expand Up @@ -704,39 +668,6 @@ def cache_push(cache: List[Dict[str, str]], out: str) -> None:
stderr=None,
stdout=sys.stderr.fileno(),
)
elif config["type"] == "attic":
_run(
args=[
"attic",
"login",
"local",
config["url"],
environ[config["token"]],
],
stderr=subprocess.DEVNULL,
stdout=subprocess.DEVNULL,
)
_run(
args=[
"attic",
"cache",
"create",
config["name"],
],
stderr=subprocess.DEVNULL,
stdout=subprocess.DEVNULL,
)
_run(
args=[
"attic",
"push",
"--ignore-upstream-cache-filter",
config["name"],
out,
],
stderr=sys.stderr.fileno(),
stdout=sys.stderr.fileno(),
)


def _get_sys_id() -> str:
Expand Down

0 comments on commit 451cbab

Please sign in to comment.