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.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;
+              });
             };
           };
         });