forked from adisbladis/gobuild.nix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
57 lines (50 loc) · 1.58 KB
/
flake.nix
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
54
55
56
57
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:katexochen/nixpkgs?ref=go/modules-txt-patch";
};
outputs =
{ self, nixpkgs }:
let
inherit (nixpkgs) lib;
forAllSystems = lib.genAttrs lib.systems.flakeExposed;
in
{
legacyPackages = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
pkgs.callPackages ./package.nix { }
);
devShells = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
default = pkgs.callPackage ./shell.nix { };
}
);
# Exposed for garnix CI.
# Currently, dots are not allowed in package names,
# see https://github.com/garnix-io/issues/issues/104.
# Also builds of legacyPackages are not supported yet,
# see https://github.com/garnix-io/issues/issues/92.
packages = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
filterDerivations = pkgs.lib.filterAttrs (n: v: pkgs.lib.isDerivation v);
prefixNameWith = prefix: pkgs.lib.mapAttrs' (n: v: pkgs.lib.nameValuePair (prefix + n) v);
removeDotsFromName = pkgs.lib.mapAttrs' (
n: v: pkgs.lib.nameValuePair (lib.replaceStrings [ "." ] [ "-" ] n) v
);
in
prefixNameWith "goPackages-" (
removeDotsFromName (filterDerivations self.legacyPackages.${system}.goPackages)
)
// (filterDerivations self.legacyPackages.${system})
);
};
}