summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorseth <[email protected]>2024-01-07 20:42:07 -0500
committerseth <[email protected]>2024-01-07 21:08:57 -0500
commit90ad9d652f009a53b57115c924446baf6f1d3b7b (patch)
tree6df1841fc082fefd37846391a0d9964cb482b401 /flake.nix
parent4578d68f3106f95607e9d3e713936ba2a565322b (diff)
feat: use nix to build images
this should result in smaller images, as well as safer updates
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix34
1 files changed, 34 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..8008d76
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,34 @@
+{
+ description = "a docker image to serve packwiz modpacks";
+
+ inputs.nixpkgs.url = "nixpkgs/nixpkgs-unstable";
+
+ outputs = {
+ self,
+ nixpkgs,
+ ...
+ }: let
+ systems = [
+ "x86_64-linux"
+ "aarch64-linux"
+ ];
+
+ forAllSystems = fn: nixpkgs.lib.genAttrs systems (sys: fn nixpkgs.legacyPackages.${sys});
+ in {
+ formatter = forAllSystems (pkgs: pkgs.alejandra);
+
+ packages = forAllSystems ({
+ pkgs,
+ system,
+ ...
+ }: let
+ containerFor = import ./container.nix pkgs;
+ arch = pkgs.stdenv.hostPlatform.uname.processor;
+ in {
+ container-x86_64 = containerFor "x86_64";
+ container-aarch64 = containerFor "aarch64";
+
+ default = self.packages.${system}."container-${arch}";
+ });
+ };
+}