about summary refs log tree commit diff stats
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix59
1 files changed, 59 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..85f7915
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,59 @@
+{
+  description = "My website, alanpearce.eu";
+  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+  inputs.utils.url = "github:numtide/flake-utils";
+  inputs.flake-compat = {
+    url = "github:edolstra/flake-compat";
+    flake = false;
+  };
+  inputs.gomod2nix = {
+    url = "github:tweag/gomod2nix";
+    inputs.nixpkgs.follows = "nixpkgs";
+    inputs.flake-utils.follows = "utils";
+  };
+
+  outputs = { self, nixpkgs, utils, gomod2nix, ... }:
+    utils.lib.eachDefaultSystem
+      (system:
+        let
+          pkgs = import nixpkgs {
+            inherit system;
+            overlays = [ gomod2nix.overlays.default ];
+          };
+          packages = import ./nix/default.nix {
+            inherit pkgs self;
+          };
+          commonShellPackages = with pkgs; [
+            just
+            skopeo
+            flyctl
+          ];
+        in
+        {
+          inherit packages;
+          devShells = {
+            ci = pkgs.mkShell {
+              packages = commonShellPackages;
+            };
+            default = pkgs.mkShell {
+              inputsFrom = [ packages.builder ];
+              packages = with pkgs; [
+                gopls
+                gotools
+                go-tools
+                gomod2nix.packages.${system}.default
+                gci
+                netlify-cli
+                sentry-cli
+              ] ++ commonShellPackages;
+            };
+          };
+          checks = rec {
+            default = hyperlink;
+            hyperlink = pkgs.runCommandLocal "hyperlink" { } ''
+              ${pkgs.hyperlink}/bin/hyperlink ${packages.website}/website/public
+              touch $out
+            '';
+          };
+        });
+}