-
Notifications
You must be signed in to change notification settings - Fork 12
Add flake; #112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add flake; #112
Changes from all commits
984deb9
70bafbc
7af1f97
ea524b9
147f052
e4d5c27
b9f4ac1
cc9e920
f898fd6
e896db4
ccbb307
65fe01a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
export GOPATH=$PWD | ||
export PATH=$GOPATH/bin:$PATH | ||
strict_env | ||
|
||
if has nix | ||
then | ||
use flake | ||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Adapt Nix hashes | ||
on: | ||
workflow_dispatch: {} # 🚧 To-do: Remove this debug code. | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- ".github/workflows/nix_adapt_hashes.yaml" | ||
- "go.mod" | ||
- "go.sum" | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- ".github/workflows/nix_adapt_hashes.yaml" | ||
- "go.mod" | ||
- "go.sum" | ||
|
||
concurrency: | ||
group: "${{ github.workflow }}/${{ github.ref }}" | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
check-tidy-go-mod: | ||
name: Adapt the hashes in Nix-package-definitions. | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
# With push token that can trigger new PR jobs. | ||
token: ${{ secrets.APP_AUTOSCALER_CI_TOKEN }} | ||
|
||
- name: Install Nix | ||
uses: cachix/install-nix-action@v26 | ||
with: | ||
github_access_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Install nix-update | ||
run: nix profile install 'nixpkgs/nixos-unstable#nix-update' | ||
|
||
- name: Run nix-update | ||
shell: bash | ||
run: | | ||
#! /usr/bin/env bash | ||
set -eu -o pipefail | ||
|
||
nix-update 'app-autoscaler-cli-plugin' --flake | ||
|
||
declare -i -r num_changed_files="$(git status --porcelain | wc --lines)" | ||
if ((num_changed_files > 0)) | ||
then | ||
echo 'Changes to some files were necessary!' | ||
declare -r tidy_message='🤖🦾🛠️ Update Nix-package-hashes' | ||
git add . | ||
git commit --message="${tidy_message}" | ||
git push | ||
else | ||
echo 'No hash-changes necessary!' | ||
fi | ||
echo '🏁' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/out/ | ||
/pkg/ | ||
/bin/ | ||
# Editor-configurations | ||
.idea | ||
build | ||
|
||
# ❄ Nix build-results | ||
/result | ||
/result-* | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{ | ||
description = '' | ||
Flake for the cf-cli-plugin for app-autoscaler | ||
|
||
For more on app-autoscaler, see: <https://github.com/cloudfoundry/app-autoscaler-release> | ||
geigerj0 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
''; | ||
|
||
inputs = { | ||
nixpkgs.url = github:NixOS/nixpkgs/nixos-23.11; | ||
}; | ||
|
||
outputs = { self, nixpkgs, flake-utils }: | ||
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; }); | ||
in flake-utils.lib.eachSystem supportedSystems (system: { | ||
packages = { | ||
app-autoscaler-cli-plugin = nixpkgsFor.${system}.buildGoModule rec { | ||
pname = "app-autoscaler-cli-plugin"; | ||
version = | ||
let | ||
lastModifiedDate = self.lastModifiedDate or self.lastModified or "19700101"; | ||
in "${builtins.substring 0 8 lastModifiedDate}-dev"; | ||
Comment on lines
+25
to
+28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we get a new There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. No, we don't: https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake#flake-reference-attributes What could be better? 🤔
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It feels like none of the options are ideal as long as we don't have automation which takes care of the versioning.
I vote for 👆
|
||
src = ./.; | ||
|
||
# 🔨🚧 To-do: Create automation to get that updated if necessary per pull-request. | ||
# As long as this automation does not exist, it needs to be updated manually. | ||
vendorHash = "sha256-NzEStcOv8ZQsHOA8abLABKy+ZE3/SiYbRD/ZVxo0CEk="; | ||
joergdw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
doCheck = false; | ||
|
||
meta = { | ||
description = '' | ||
App-AutoScaler plug-in provides the command line interface to manage | ||
[App AutoScaler](<https://github.com/cloudfoundry/app-autoscaler-release>) | ||
policies, retrieve metrics and scaling event history. | ||
''; | ||
homepage = "https://github.com/cloudfoundry/app-autoscaler-cli-plugin"; | ||
license = [nixpkgs.lib.licenses.apsl20]; | ||
}; | ||
}; | ||
}; | ||
|
||
devShells = | ||
let | ||
nixpkgs = nixpkgsFor.${system}; | ||
in { | ||
default = nixpkgs.mkShell { | ||
buildInputs = with nixpkgs; [ | ||
delve | ||
go | ||
gopls | ||
]; | ||
}; | ||
}; | ||
}); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#!/bin/bash | ||
#! /usr/bin/env bash | ||
|
||
set -e | ||
|
||
ROOT_DIR=$(cd $(dirname $(dirname $0)) && pwd) | ||
ROOT_DIR="$(cd $(dirname $(dirname $0)) && pwd)" | ||
|
||
go build -o $ROOT_DIR/out/ascli cli | ||
go build -o "${ROOT_DIR}/out/ascli/cli" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would at least keep the
.idea
folder to ignore stuff from IntelliJThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But isn't that an ideal use-case for a global ignore-pattern? See last item in the description of the official documentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt most of the people has confgured that, I would really keep it : D