summaryrefslogtreecommitdiff
path: root/flake.nix
blob: d53099c868f60d208f896412edaa15412ac76732 (plain)
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
# mostly lifted from https://github.com/xddxdd/nur-packages, converted into a standalone flake
{
  description = "GNU cobol compiler";

  inputs = {
    gnucobol-3_2-src = {
      url = "https://ftp.gnu.org/gnu/gnucobol/gnucobol-3.2.tar.xz";
      flake = false;
    };
    gnucobol-3_1_2-src = {
      url = "https://ftp.gnu.org/gnu/gnucobol/gnucobol-3.1.2.tar.xz";
      flake = false;
    };
  };

  outputs =
    { self
    , nixpkgs
    , gnucobol-3_2-src
    , gnucobol-3_1_2-src
    }:
    let
      supportedSystems = [ "x86_64-linux" ];
      forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
      nixpkgsFor = forAllSystems (system: import nixpkgs {
        inherit system;
        overlays = [ self.overlays.default ];
      });
    in
    {
      overlays.default = final: prev: {
        gnucobol-3_1_2 =
          final.gnu-cobol.overrideAttrs {
            src = gnucobol-3_1_2-src;
            doInstallCheck = false;
          };

        gnucobol-3_2 =
          final.gnu-cobol.overrideAttrs {
            src = gnucobol-3_2-src;
            doInstallCheck = false;
          };
      };

      packages = forAllSystems (system: {
        inherit (nixpkgsFor."${system}") gnucobol-3_1_2 gnucobol-3_2;
      });

      defaultPackage = forAllSystems (system: self.packages."${system}".gnucobol-3_2);
    };
}