forked from VirtusLab/jenkins-operator
-
Notifications
You must be signed in to change notification settings - Fork 236
/
flake.nix
83 lines (74 loc) · 2.85 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{
description = "Jenkins Kubernetes Operator";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
go_15.url = "github:nixos/nixpkgs/4eccd6f731627ba5ad9915bcf600c9329a34ca78";
golangci.url = "github:nixos/nixpkgs/e912fb83d2155a393e7146da98cda0e455a80fb6";
hugo_099.url = "github:nixos/nixpkgs/d6df226c53d46821bd4773bd7ec3375f30238edb";
gomod2nix = {
url = "github:nix-community/gomod2nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
};
outputs = { self, nixpkgs, flake-utils, go_15, golangci, gomod2nix, hugo_099, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
go_15_pkgs = go_15.legacyPackages.${system};
golangci_pkgs = golangci.legacyPackages.${system};
hugo_099_pkgs = hugo_099.legacyPackages.${system};
operatorVersion = builtins.readFile ./VERSION.txt;
sdkVersion = ((builtins.fromTOML (builtins.readFile ./config.base.env)).OPERATOR_SDK_VERSION);
jenkinsLtsVersion = ((builtins.fromTOML (builtins.readFile ./config.base.env)).LATEST_LTS_VERSION);
in
{
# Nix fmt
formatter = nixpkgs.legacyPackages.${system}.nixpkgs-fmt;
# shell in nix develop
devShells.default = nixpkgs.legacyPackages.${system}.mkShell {
packages = [
pkgs.gnumake
pkgs.wget
pkgs.helm-docs
pkgs.pre-commit
(pkgs.writeShellApplication {
name = "make_matrix";
runtimeInputs = with pkgs; [ bash gnugrep gawk ];
text = builtins.readFile ./test/make_matrix_ginkgo.sh;
})
go_15_pkgs.go
golangci_pkgs.golangci-lint
pkgs.kind
(pkgs.bats.withLibraries (p: [
p.bats-support
p.bats-assert
p.bats-file
p.bats-detik
]))
];
shellHook = ''
echo Operator Version ${operatorVersion}
echo Latest Jenkins LTS version: ${jenkinsLtsVersion}
echo Operator SDK version: ${sdkVersion}
'';
};
# nix shell .#gomod
devShells.gomod = pkgs.callPackage ./nix/gomod-shell.nix {
inherit (gomod2nix.legacyPackages.${system}) mkGoEnv gomod2nix;
};
# nix shell .#website
devShells.website = pkgs.callPackage ./nix/website-shell.nix {
inherit pkgs system hugo_099_pkgs;
};
# nix build with gomod2nix
packages.default = pkgs.callPackage ./nix {
inherit (gomod2nix.legacyPackages.${system}) buildGoApplication;
};
packages.website = import ./nix/website-build.nix {
inherit pkgs system hugo_099_pkgs;
};
}
);
}