-
-
Notifications
You must be signed in to change notification settings - Fork 300
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
CI configs: add nix flake #1815
Open
aca
wants to merge
1
commit into
elves:master
Choose a base branch
from
aca:pr-flake
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{ | ||
description = "elvish"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; | ||
gomod2nix = { | ||
url = "github:nix-community/gomod2nix"; | ||
inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | ||
}; | ||
|
||
outputs = { self, nixpkgs, gomod2nix }: | ||
let | ||
allSystems = [ | ||
"x86_64-linux" # 64-bit Intel/AMD Linux | ||
"aarch64-linux" # 64-bit ARM Linux | ||
"x86_64-darwin" # 64-bit Intel macOS | ||
"aarch64-darwin" # 64-bit ARM macOS | ||
]; | ||
forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f { | ||
inherit system; | ||
pkgs = import nixpkgs { inherit system; }; | ||
}); | ||
in | ||
{ | ||
packages = forAllSystems ({ system, pkgs, ... }: | ||
let | ||
buildGoApplication = gomod2nix.legacyPackages.${system}.buildGoApplication; | ||
in | ||
rec { | ||
default = elvish; | ||
|
||
elvish = buildGoApplication { | ||
name = "elvish"; | ||
src = ./.; | ||
go = pkgs.go_1_21; | ||
pwd = ./.; | ||
subPackages = [ "cmd/elvish" ]; | ||
CGO_ENABLED = 0; | ||
flags = [ | ||
"-trimpath" | ||
]; | ||
ldflags = [ | ||
"-s" | ||
"-w" | ||
"-extldflags -static" | ||
]; | ||
}; | ||
}); | ||
|
||
# `nix develop` provides a shell containing development tools. | ||
devShell = forAllSystems ({ system, pkgs }: | ||
pkgs.mkShell { | ||
buildInputs = with pkgs; [ | ||
go_1_21 | ||
gomod2nix.legacyPackages.${system}.gomod2nix | ||
gopls | ||
]; | ||
}); | ||
|
||
overlays.default = final: prev: { | ||
elvish = self.packages.${final.stdenv.system}.elvish; | ||
}; | ||
}; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
schema = 3 | ||
|
||
[mod] | ||
[mod."github.com/creack/pty"] | ||
version = "v1.1.21" | ||
hash = "sha256-pjGw6wQlrVhN65XaIxZueNJqnXThGu00u24rKOLzxS0=" | ||
[mod."github.com/google/go-cmp"] | ||
version = "v0.6.0" | ||
hash = "sha256-qgra5jze4iPGP0JSTVeY5qV5AvEnEu39LYAuUCIkMtg=" | ||
[mod."github.com/mattn/go-isatty"] | ||
version = "v0.0.20" | ||
hash = "sha256-qhw9hWtU5wnyFyuMbKx+7RB8ckQaFQ8D+8GKPkN3HHQ=" | ||
[mod."github.com/sourcegraph/jsonrpc2"] | ||
version = "v0.2.0" | ||
hash = "sha256-UPJQN/TSg9CjRj0239EV9dbZTwe7grOCf8lFWMkqo8U=" | ||
[mod."go.etcd.io/bbolt"] | ||
version = "v1.3.9" | ||
hash = "sha256-98cKiMZcxl11laO3IiRHnhSgh7mEjl0iKlPxsSPdbww=" | ||
[mod."golang.org/x/sync"] | ||
version = "v0.6.0" | ||
hash = "sha256-LLims/wjDZtIqlYCVHREewcUOX4hwRwplEuZKPOJ/HI=" | ||
[mod."golang.org/x/sys"] | ||
version = "v0.17.0" | ||
hash = "sha256-e0qnE+SitE02IzvnJKI4Uzpq9EOZY+zvE8Wf5b2e6Kg=" | ||
[mod."pkg.nimblebun.works/go-lsp"] | ||
version = "v1.1.0" | ||
hash = "sha256-mJS7tsR4bPOIcHpvIsdKHQvZxpgFRm3hBSMVBMFcDZI=" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
How will this dependency data be kept in sync with the go.mod file? If someone submits a change that updates the version of any of these packages (which I have done more than once) do they also have to update this file or is file somehow automatically kept in sync with the go.mod file for the project?
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.
This has to be updated together with the command
nix develop --command gomod2nix
.If adding flake is OK, I'll try to add workflow that generates automatic PR when dependancy changes.