about summary refs log tree commit diff stats
path: root/flake.nix
diff options
context:
space:
mode:
authorAlan Pearce2024-04-19 16:11:33 +0200
committerAlan Pearce2024-04-19 22:13:42 +0200
commit30e4cb4e4af3a6eebd3b4fb431828d284a72a10a (patch)
treeca5ae02e140f9d1b35a9824da04a71e32a981a47 /flake.nix
parent0fc79f324d54cc7a45c0ad0ffa9c75cd716e0126 (diff)
downloadwebsite-30e4cb4e4af3a6eebd3b4fb431828d284a72a10a.tar.lz
website-30e4cb4e4af3a6eebd3b4fb431828d284a72a10a.tar.zst
website-30e4cb4e4af3a6eebd3b4fb431828d284a72a10a.zip
use nix to build docker images
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix33
1 files changed, 15 insertions, 18 deletions
diff --git a/flake.nix b/flake.nix
index 4d78ce1..78a2c53 100644
--- a/flake.nix
+++ b/flake.nix
@@ -12,37 +12,34 @@
     inputs.flake-utils.follows = "utils";
   };
 
-  outputs = { nixpkgs, utils, gomod2nix, ... }:
+  outputs = { self, nixpkgs, utils, gomod2nix, ... }:
     utils.lib.eachDefaultSystem
       (system:
         let
-          pkgs = nixpkgs.legacyPackages.${system};
-          nativeBuildInputs = with pkgs; [
-            git
-            go
-          ];
+          pkgs = import nixpkgs {
+            inherit system;
+            overlays = [ gomod2nix.overlays.default ];
+          };
+          nativeBuildInputs = with pkgs; [ go ];
+          packages = import ./nix/default.nix {
+            inherit pkgs self;
+          };
         in
-        rec {
+        {
+          inherit packages;
           devShells = {
             default = pkgs.mkShell {
               packages = with pkgs; [
                 gopls
                 gotools
                 go-tools
-                go-licenses
                 gomod2nix.packages.${system}.default
                 gci
                 flyctl
-                (writeShellScriptBin "watch-builder" ''
-                  ${pkgs.watchexec}/bin/watchexec -r -w flake.nix --shell fish "direnv exec . watchexec -i server.go -i public -r go run ./cmd/build $@"
-                '')
-                (writeShellScriptBin "watch-server" ''
-                  ${pkgs.watchexec}/bin/watchexec -r -w flake.nix --shell fish "direnv exec . watchexec -r go run ./server.go $@"
-                '')
-                (writeShellScriptBin "check-licenses" ''
-                  ${pkgs.go-licenses}/bin/go-licenses check --include_tests ./... --disallowed_types=restricted,forbidden
-                '')
-              ] ++ nativeBuildInputs;
+              ]
+              ++ (import ./nix/scripts.nix {
+                inherit pkgs;
+              });
             };
           };
         });