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

Add production cache #12

Merged
merged 29 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
249407a
feat(cache): add klarkc builder
klarkc Dec 21, 2023
5dc7549
feat(cache): upgrade keys
klarkc Dec 21, 2023
d847171
feat: change nix cache
klarkc Dec 21, 2023
8c55f96
feat(cache): add github
klarkc Dec 21, 2023
9019415
feat(cache): remove cachix and add builder user
klarkc Dec 21, 2023
9e56487
feat(cache): readd builder, remove other keys
klarkc Dec 22, 2023
917f722
fix(cache): add builder as trusted user
klarkc Dec 22, 2023
83bdb98
ci(test): add nix cache
klarkc Dec 22, 2023
c8b02b1
ci(test): add nix version
klarkc Dec 22, 2023
fa71870
fix(cache): missing config
klarkc Dec 22, 2023
e8dcdbb
ci(test): add debug
klarkc Dec 22, 2023
5fb1b90
ci(test): change to manual ssh key
klarkc Dec 22, 2023
9ff1e05
ci(test): disable check
klarkc Dec 22, 2023
4a38f4a
ci(test): move key add
klarkc Dec 22, 2023
c52c912
ci(test): readd agent
klarkc Dec 22, 2023
104f9b8
ci(test): add example
klarkc Dec 22, 2023
c05a970
ci(test): tryout with ng
klarkc Dec 22, 2023
5ce97fd
ci(test): try out derivation and all
klarkc Dec 22, 2023
2510f6e
ci(test): remove derivation
klarkc Dec 22, 2023
9a74365
ci(test): change nix installer
klarkc Dec 22, 2023
bbb82ae
ci(test): add from and flags
klarkc Dec 22, 2023
aa20c30
ci(test): change to closure
klarkc Dec 22, 2023
9a3b017
ci(test): change to xargs
klarkc Dec 22, 2023
c13acab
ci(test): return to nix copy simplified
klarkc Dec 22, 2023
74842ee
ci(test): return to cachix install
klarkc Dec 22, 2023
b26d85f
ci(test): reenable check
klarkc Dec 22, 2023
1389934
ci(test): try with store
klarkc Dec 22, 2023
89d9da1
ci(test): remove store and dervir, add def
klarkc Dec 22, 2023
ea22801
ci(test): add verbose, subst
klarkc Dec 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@ jobs:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
with:
install_url: https://releases.nixos.org/nix/nix-2.19.1/install
extra_nix_config: |
accept-flake-config = true
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v12
- uses: webfactory/[email protected]
with:
name: klarkc
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix flake check
ssh-private-key: ${{ secrets.BUILDER_TOKEN }}
- uses: gacts/run-and-post-run@v1
with:
run: nix -v flake check -L --show-trace
post: |
mkdir -p ~/.ssh/ && touch ~/.ssh/known_hosts
ssh-keyscan cache.tcp4.me >> ~/.ssh/known_hosts
nix -v copy -s --all --to ssh://[email protected]
9 changes: 4 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
inherit (setups.cache.machines) cache-vultr;
};

packages.${system} = {
packages.${system} = rec {
default = cache-vm;
inherit (setups.recover.packages) recover-efi recover-vm;
inherit (setups.cache.packages) cache-vm;
};
Expand All @@ -65,12 +66,10 @@
# Nix should ask for permission before using it,
# but remove it here if you do not want it to.
extra-substituters = [
"https://klarkc.cachix.org?priority=99"
"https://cache.nixos.org"
"https://cache.tcp4.me"
];
extra-trusted-public-keys = [
"klarkc.cachix.org-1:R+z+m4Cq0hMgfZ7AQ42WRpGuHJumLLx3k0XhwpNFq9U="
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"cache.tcp4.me:cmk2Iz81lQuX7FtTUcBgtqgI70E8p6SOamNAIcFDSew="
];
};
}
1 change: 1 addition & 0 deletions secrets/builder.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGPSuuFCsXXHk6JYXZ+hIrZGjb3d4wwRPoks0mrMmidk klarkc@ssdinarch
Binary file modified secrets/cache.age
Binary file not shown.
1 change: 1 addition & 0 deletions secrets/cache.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cache.tcp4.me:cmk2Iz81lQuX7FtTUcBgtqgI70E8p6SOamNAIcFDSew=
20 changes: 14 additions & 6 deletions setups/cache/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ let
domain = "cache.tcp4.me";
home = "/home/klarkc";
email = "[email protected]";
authorizedKeys.keys = [
(builtins.readFile ../../secrets/klarkc.pub)
];
cache-module = { disks ? [ "/dev/vda" ], config, ... }:
{
imports = [
Expand All @@ -19,9 +16,9 @@ let
disko
];
# cd secrets
# nix-store --generate-binary-cache-key cache.tcp4.me ./cache ./cache.skey
# cat cache | nix run github:ryantm/agenix -- -e cache.age -i cache-vultr.pub
# nix-store --generate-binary-cache-key cache.tcp4.me ./cache ./cache.pub
# scp ssh://[email protected]:/etc/ssh/ssh_host_ed25519_key.pub cache-vultr.pub
# cat cache | nix run github:ryantm/agenix -- -e cache.age -i cache-vultr.pub
age.secrets.cache.file = "${secrets}/cache.age";
system.stateVersion = config.system.nixos.version;
boot.loader.systemd-boot.enable = true;
Expand All @@ -30,6 +27,15 @@ let
22
config.services.nix-serve.port
];
# builders
nix.settings.trusted-users = [ "builder" ];
users.users.builder = {
home = "/home/builder";
isNormalUser = true;
openssh. authorizedKeys.keys = [
(builtins.readFile ../../secrets/builder.pub)
];
};
# cache service
services.nix-serve = {
enable = true;
Expand All @@ -41,7 +47,9 @@ let
'';
# SSH
services.sshd.enable = true;
users.users.root.openssh = { inherit authorizedKeys; };
users.users.root.openssh.authorizedKeys.keys = [
(builtins.readFile ../../secrets/klarkc.pub)
];
# beesd
services.beesd.filesystems = {
root = {
Expand Down