Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: cache.komunix.org web #17

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion .envrc.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use_nix
use flake

export TF_VAR_do_token=
export TF_VAR_linode_token=
Expand Down
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
secrets/*.yaml diff=sopsdiffer
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ terraform.tfstate.*
.direnv

# End of https://www.toptal.com/developers/gitignore/api/direnv

.pre-commit-config.yaml

result
11 changes: 11 additions & 0 deletions .sops.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
keys:
r17x marked this conversation as resolved.
Show resolved Hide resolved
- &r17x B0B63B776767DFAA669D06715CA1E57AFBF76F90
- &komunix-dev age13rrpdnr7f9knpgdvafvjkp74ejacuhcvzhdw2j8h5xjwyrmrhv4s4tvr8j
creation_rules:
- path_regex: secrets/(?:[^/]+/)*[^/]+\.(yaml|json|env|ini)$
key_groups:
- pgp:
- *r17x
age:
- *komunix-dev

179 changes: 179 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
description = "area13";

outputs =
inputs@{ flake-parts, pre-commit-hooks, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"aarch64-darwin"
"aarch64-linux"
"x86_64-linux"
];

imports = [
pre-commit-hooks.flakeModule
./nix
];
};

inputs = {
# utilities for Flake
flake-parts.url = "github:hercules-ci/flake-parts";

## -- nixpkgs
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs.follows = "nixpkgs-unstable";

# secret management
sops.url = "github:Mic92/sops-nix";
sops.inputs.nixpkgs.follows = "nixpkgs";
sops.inputs.nixpkgs-stable.follows = "nixpkgs-stable";

# utilities
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
};
}
94 changes: 94 additions & 0 deletions nix/cache.html.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>cache.komunix.org (di raspi) - UP</title>
</head>
<body>
<pre>













__ __
/\ \ /\ \ __
___ __ ___\ \ \___ __ \ \ \/'\ ___ ___ ___ __ __ ___ /\_\ __ _ ___ _ __ __
/'___\ /'__`\ /'___\ \ _ `\ /'__`\ \ \ , < / __`\ /' __` __`\/\ \/\ \ /' _ `\/\ \ /\ \/'\ / __`\/\`'__\/'_ `\
/\ \__//\ \L\.\_/\ \__/\ \ \ \ \/\ __/ __\ \ \\`\ /\ \L\ \/\ \/\ \/\ \ \ \_\ \/\ \/\ \ \ \\/> / __/\ \L\ \ \ \//\ \L\ \
\ \____\ \__/.\_\ \____\\ \_\ \_\ \____\/\_\\ \_\ \_\ \____/\ \_\ \_\ \_\ \____/\ \_\ \_\ \_\/\_/\_\/\_\ \____/\ \_\\ \____ \
\/____/\/__/\/_/\/____/ \/_/\/_/\/____/\/_/ \/_/\/_/\/___/ \/_/\/_/\/_/\/___/ \/_/\/_/\/_/\//\/_/\/_/\/___/ \/_/ \/___L\ \
/\____/
\_/__/

<b>/nix/store milik bersama</b> | <b>[email protected]</b>





> NixOS

# /etc/nixos/configuration.nix

{ nix.settings.substituters = [ https://cache.komunix.org/ ]; }

> GNU/Linux

# /etc/nix/nix.conf

fallback = true
binary-caches = https://cache.komunix.org/ https://cache.nixos.org/

# OR

fallback = true
substituters = https://cache.komunix.org


> Mac OS

# $HOME/.nixpkgs/darwin-configuration.nix

nix.settings.substituters = pkgs.lib.mkBefore [ "https://cache.komunix.org/" ];

> Flake

nix.settings.experimental-features = [ "nix-command" "flakes" ];
nix.settings.trusted-substituters = [ "https://cache.komunix.org" ];

# Recomendation
nix.settings.fallback = true;


enjoy :^)

---

# stats for nerds

$> find /home/komunix/nfs/nix-cache -type f | wc -l

$TOTAL_CACHE

$> du -sh /home/komunix/nfs/nix-cache; echo; df -h /home/komunix/nfs/nix-cache; echo; date +%s

$NICE

Filesystem Size Used Avail Use% Mounted on
$USAGE

$TIMESTAMP
</pre>
</body>
</html>
Loading