aboutsummaryrefslogtreecommitdiff
path: root/default.nix
blob: cf40d935bbc5c9fda088487cb04332e600b73b64 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
let
  pkgsSrc = fetchTarball {
    # As of 2022-07-19
    url = "https://github.com/NixOS/nixpkgs/archive/d2db10786f27619d5519b12b03fb10dc8ca95e59.tar.gz";
    sha256 = "0s9gigs3ylnq5b94rfcmxvrmmr3kzhs497gksajf638d5bv7zcl5";
  };
  gomod2nix = fetchGit {
    url = "https://github.com/tweag/gomod2nix.git";
    ref = "master";
    rev = "40d32f82fc60d66402eb0972e6e368aeab3faf58";
  };

  pkgs = import pkgsSrc { 
    overlays = [
      (self: super: {
        gomod = super.callPackage "${gomod2nix}/builder/" { };
      })
    ];
  };
in rec {
  bin = pkgs.gomod.buildGoApplication {
    pname = "guichet-bin";
    version = "0.1.0";
    src = ./.;
    modules = ./gomod2nix.toml;

    CGO_ENABLED=0;

    meta = with pkgs.lib; {
      description = "Interface web pour gérer le LDAP: changer son mot de passe, ses infos de profil, inviter des gens, administration";
      homepage = "https://git.deuxfleurs.fr/Deuxfleurs/guichet";
      license = licenses.gpl3Plus;
      platforms = platforms.linux;
    };
  };
  pkg = pkgs.stdenv.mkDerivation {
    pname = "guichet";
    version = "0.1.0";
    src = ./.;

    installPhase = ''
      mkdir -p $out/
      cp ${bin}/bin/guichet $out/guichet
      cp -r templates static $out/
    '';
  };
  docker = pkgs.dockerTools.buildImage {
    name = "dxflrs/guichet";
    config = {
      Cmd = [ "${pkg}/guichet" ];
    };
  };
}