-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
59 lines (51 loc) · 1.58 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-24.05";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system: let
pkgs = nixpkgs.legacyPackages.${system};
concatWords = nixpkgs.lib.strings.concatStringsSep " ";
mkKeysPackage = pkgs: import ./default.nix {inherit pkgs;};
mkKeysCmd = pkgs: [
"${pkgs.static-web-server}/bin/static-web-server"
"--root=${mkKeysPackage pkgs}"
"--index-files=index.txt"
"--port=8000"
"--health"
];
mkKeysApp = pkgs: (flake-utils.lib.mkApp
{
drv = pkgs.writeShellScriptBin "keys" (concatWords (mkKeysCmd pkgs));
});
mkKeysContainer = {
hostPkgs,
containerPkgs,
}: (hostPkgs.dockerTools.buildLayeredImage {
name = "keys";
tag = "latest";
config = {
Cmd = mkKeysCmd containerPkgs;
};
});
in rec {
packages.keys = mkKeysPackage pkgs;
packages.default = packages.keys;
apps.default = mkKeysApp pkgs;
packages.ociImage-amd64 = mkKeysContainer {
hostPkgs = pkgs.pkgsCross.musl64.pkgsStatic;
containerPkgs = pkgs.pkgsCross.musl64.pkgsStatic;
};
packages.ociImage-arm64 = mkKeysContainer {
hostPkgs = pkgs.pkgsCross.aarch64-multiplatform-musl.pkgsStatic;
containerPkgs = pkgs.pkgsCross.aarch64-multiplatform-musl.pkgsStatic;
};
}
);
}