Skip to content

Commit 565c666

Browse files
committed
feat: add attic
Signed-off-by: Anthony Rabbito <arabbito@coreweave.com>
1 parent 4b0cbbe commit 565c666

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

flake.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
nixos-facter-modules.url = "github:nix-community/nixos-facter-modules";
5757
nix-reshade.url = "github:LovingMelody/nix-reshade";
5858
nix-reshade.inputs.nixpkgs.follows = "nixpkgs";
59+
attic.url = "github:zhaofengli/attic";
5960
};
6061

6162
outputs = {
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{inputs, pkgs, ...}: {
2+
home.packages = [inputs.attic.packages.${pkgs.system}.attic-client];
3+
programs.fish.functions = {
4+
nix-build-push = {
5+
description = "Build a nix package and push its full closure (including build deps) to an attic cache";
6+
body = ''
7+
if test (count $argv) -lt 2
8+
echo "Usage: nix-build-push <package> <cache>"
9+
echo "Example: nix-build-push .#cwctl attic-prod:coreweave"
10+
return 1
11+
end
12+
set -l package $argv[1]
13+
set -l cache $argv[2]
14+
15+
echo "Building $package..."
16+
nix build -L $package; or return 1
17+
18+
echo "Pushing build closure to $cache..."
19+
set -l drv (nix path-info --derivation $package)
20+
nix-store -qR --include-outputs "$drv" \
21+
| grep -v '\.drv$' \
22+
| while read -l p; test -e "$p" && echo "$p"; end \
23+
| xargs attic push $cache
24+
'';
25+
};
26+
};
27+
}

home-manager/personalities/cli/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
./direnv.nix
1414
./nh.nix
1515
./crush.nix
16+
./attic.nix
1617
];
1718
home.packages = with pkgs;
1819
[

0 commit comments

Comments
 (0)