about summary refs log tree commit diff stats
path: root/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'default.nix')
-rw-r--r--default.nix94
1 files changed, 2 insertions, 92 deletions
diff --git a/default.nix b/default.nix
index 2949836..779ea74 100644
--- a/default.nix
+++ b/default.nix
@@ -1,45 +1,10 @@
 let
   sources = import ./npins;
 
-  pkgs = import sources.nixpkgs {
-    overlays = [
-      (import "${sources.gomod2nix}/overlay.nix")
-    ];
-  };
+  pkgs = import sources.nixpkgs { };
   pre-commit-hooks = import sources.pre-commit-hooks;
-
-  inherit (pkgs)
-    buildGoApplication
-    lib
-    runCommandLocal;
-
-  version = "unstable";
-  mkDocker = type: { server, architecture ? pkgs.go.GOARCH }:
-    pkgs.dockerTools.${type} {
-      name = "registry.fly.io/alanpearce-eu";
-      contents = with pkgs; [
-        cacert
-      ];
-      inherit architecture;
-      config = {
-        Cmd = [ "${server}/bin/server" ];
-        Env = [
-          "PRODUCTION=true"
-          "LISTEN_ADDRESS=::"
-          "ROOT=/data"
-          "PORT=80"
-        ];
-        WorkingDir = "/data";
-        ExposedPorts = {
-          "80/tcp" = { };
-          "443/tcp" = { };
-        };
-      };
-    };
-  mkDockerStream = mkDocker "streamLayeredImage";
-  mkDockerImage = mkDocker "buildLayeredImage";
 in
-rec {
+{
   pre-commit-check = pre-commit-hooks.run {
     src = ./.;
     hooks = {
@@ -51,61 +16,6 @@ rec {
         entry = "${pkgs.go}/bin/go mod tidy";
         pass_filenames = false;
       };
-      gomod2nix = {
-        enable = true;
-        name = "gomod2nix";
-        description = "Import go.mod updates to nix";
-        types_or = [ "go-sum" ];
-        entry = "${pkgs.gomod2nix}/bin/gomod2nix --outdir nix";
-        pass_filenames = false;
-      };
-    };
-  };
-  server = buildGoApplication {
-    pname = "server";
-    inherit version;
-    CGO_ENABLED = 0;
-    src = with lib.fileset; toSource {
-      root = ./.;
-      fileset = unions [
-        ./go.mod
-        ./go.sum
-        ./cmd/server
-        ./internal
-        ./templates
-      ];
     };
-    modules = ./nix/gomod2nix.toml;
-    patchPhase = ''
-      ${pkgs.templ}/bin/templ generate
-    '';
-    subPackages = [ "cmd/server" ];
-    tags = [ "embed" ];
-    ldflags = [
-      "-s"
-      "-w"
-    ];
-  };
-  docker-stream = mkDockerStream { inherit server; };
-  docker-image = mkDockerImage { inherit server; };
-
-  server-amd64-linux = server.overrideAttrs (old: old // {
-    GOOS = "linux";
-    GOARCH = "amd64";
-    fixupPhase = ''
-      if [[ -d $out/bin/linux_amd64 ]]
-      then
-        mv $out/bin/linux_amd64/server $out/bin/server
-        rmdir $out/bin/linux_amd64
-      fi
-    '';
-  });
-  docker-image-amd64-linux = mkDockerImage {
-    server = server-amd64-linux;
-    architecture = "amd64";
-  };
-  docker-stream-amd64-linux = mkDockerStream {
-    server = server-amd64-linux;
-    architecture = "amd64";
   };
 }