-
Notifications
You must be signed in to change notification settings - Fork 52
/
flake.nix
122 lines (111 loc) · 5.45 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
{
description = "Dependencies of app-autoscaler-release";
inputs = {
nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
nixpkgs-bosh-cli-v7-3-1.url = github:NixOS/nixpkgs/1179c6c3705509ba25bd35196fca507d2a227bd0;
};
outputs = { self, nixpkgs, nixpkgs-bosh-cli-v7-3-1 }:
let
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
# Nixpkgs instantiated for supported system types.
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
nixpkgsFor-bosh-cli-v7-3-1 = forAllSystems (system: import nixpkgs-bosh-cli-v7-3-1 { inherit system; });
in {
packages = forAllSystems (system:
let
nixpkgs = nixpkgsFor.${system};
callPackages = nixpkgs.lib.customisation.callPackagesWith nixpkgs;
in callPackages ./nix/packages.nix {}
);
openapi-specifications = {
app-autoscaler-api =
let
apiPath = ./api;
in builtins.filterSource
(path: type: builtins.match ".*\.ya?ml" (baseNameOf path) != null && type == "regular")
apiPath;
};
devShells = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
pkgs-bosh-cli-v7-3-1 = nixpkgsFor-bosh-cli-v7-3-1.${system};
in {
default = pkgs.mkShell {
buildInputs = with pkgs; [
act
actionlint
self.packages.${system}.app-autoscaler-cli-plugin
self.packages.${system}.bosh-bootloader
# to make `bosh create-release` work in a Nix shell on macOS, use an older bosh-cli version that reuses
# a bosh-utils version under the hood that doesn't use the tar option `--no-mac-metadata`.
# unfortunately, Nix provides gnutar by default, which doesn't have the `--no-mac-metadata` option.
# bosh-utils assumes blindly bsdtar when building on macOS which comes with the `--no-mac-metadata` option,
# see bosh-utils change https://github.com/cloudfoundry/bosh-utils/commit/f79167bd43f3afc154065edc95799a464a80605f.
# this blind bsdtar assumption by bosh-utils breaks creating bosh releases in a Nix shell on macOS.
# a GitHub issue related to this problem can be found here: https://github.com/cloudfoundry/bosh-utils/issues/86.
pkgs-bosh-cli-v7-3-1.bosh-cli
cloudfoundry-cli
credhub-cli
delve # go-debugger
fly
ginkgo
gh
gnumake
go
go-tools
golangci-lint
gopls # See: <https://github.com/golang/vscode-go/blob/master/docs/tools.md>
google-cloud-sdk
jq
maven
nodejs
nodePackages.yaml-language-server
# # We use the binary-buildpack and nix-build-results have set the wrong ELF-Interpreter.
# # For more background, see:
# # <https://blog.thalheim.io/2022/12/31/nix-ld-a-clean-solution-for-issues-with-pre-compiled-executables-on-nixos>
# patchelf
ruby
rubocop
rubyPackages.solargraph
# The following package for cf-uaac is needed by our makefile as well.
# Until PR https://github.com/NixOS/nixpkgs/pull/189079 has been merged, this requires
# as additional input: `jdwpkgs.url = github:joergdw/nixpkgs/rubyPackages.cf-uaac;`
# Alternative solution 1: `gem install …` using https://direnv.net/man/direnv-stdlib.1.html#codelayout-rubycode
# to create a project-specific ruby-gem-path – This solution is currently applied!
#
# Alternative solution 2: produce a package here locally that contains cf-uaac
# by making use of <https://nixos.org/manual/nixpkgs/stable/#developing-with-ruby>, see
# chapter: 17.30.2.5. Packaging applications
#
# jdwpkgs.rubyPackages.cf-uaac
shellcheck
swagger-cli
temurin-bin
uutils-coreutils-noprefix
yq-go
];
# Needed to run with delve, see: <https://nixos.wiki/wiki/Go#Using_cgo_on_NixOS>
hardeningDisable = [ "fortify" ];
shellHook = ''
# install required CF CLI plugins
cf install-plugin -f \
'${self.packages.${system}.app-autoscaler-cli-plugin}/bin/app-autoscaler-cli-plugin'
aes_terminal_font_yellow='\e[38;2;255;255;0m'
aes_terminal_font_blink='\e[5m'
aes_terminal_reset='\e[0m'
echo -ne "$aes_terminal_font_yellow" "$aes_terminal_font_blink"
cat << 'EOF'
⚠️ If `whoami` does not work properly on your computer, `bosh ssh` commands may fail.
The solution is, to provide your nix dev-shell the path to the `libnss_sss.so.2` of
your host system, see: <https://github.com/NixOS/nixpkgs/issues/230110>
Adapt the following line to contain the correct path:
export LD_PRELOAD='/lib/x86_64-linux-gnu/libnss_sss.so.2'
EOF
echo -ne "$aes_terminal_reset"
'';
};
});
};
}