-
Notifications
You must be signed in to change notification settings - Fork 293
The Nix pipelines #1573
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
Open
Sk7Str1p3
wants to merge
20
commits into
o2sh:main
Choose a base branch
from
Sk7Str1p3:feat/crane
base: main
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
The Nix pipelines #1573
Changes from 3 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
8c71204
crane: init
Sk7Str1p3 7928e44
direnv: init
Sk7Str1p3 0211e90
workflow: attempt on automatic flake update
Sk7Str1p3 77afd70
flake: fixes
Sk7Str1p3 f2b9f7b
flake: binary caches
Sk7Str1p3 b7d3fe6
crane: additionals init
Sk7Str1p3 7d29e15
flake: fmt, comments, renames
Sk7Str1p3 5eda373
flake: fix packages
Sk7Str1p3 575e04c
onefetch-image: make clippy happy
Sk7Str1p3 6f6e2a3
onefetch-image: make clippy unhappy again((
Sk7Str1p3 8241a02
taplo: detailed configuration
Sk7Str1p3 c2ae2b3
taplo: disable CRLF
Sk7Str1p3 5586b14
flake: sources filter
Sk7Str1p3 2827fe6
flake: set default CARGO_PROFILE to "dev"
Sk7Str1p3 7607154
taplo: remove odd comment
Sk7Str1p3 5c33e8a
nix: treefmt formatter
Sk7Str1p3 15759b6
toml: fmt
Sk7Str1p3 ac320ca
flake update
Sk7Str1p3 1a6f4d9
workflow: implement flake.lock automatic update
Sk7Str1p3 e32a721
Merge branch 'main' into feat/crane
Sk7Str1p3 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
This file contains hidden or 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 | ||||
---|---|---|---|---|---|---|
@@ -1,11 +1,11 @@ | ||||||
{ | ||||||
description = "Git repository summary on your terminal"; | ||||||
description = '' | ||||||
Git repository summary on your terminal | ||||||
''; | ||||||
|
||||||
inputs = { | ||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; | ||||||
|
||||||
crane.url = "github:ipetkov/crane"; | ||||||
|
||||||
flake-utils.url = "github:numtide/flake-utils"; | ||||||
|
||||||
advisory-db = { | ||||||
|
@@ -14,8 +14,17 @@ | |||||
}; | ||||||
}; | ||||||
|
||||||
outputs = { self, nixpkgs, crane, flake-utils, advisory-db, ... }: | ||||||
flake-utils.lib.eachDefaultSystem (system: | ||||||
outputs = | ||||||
{ | ||||||
self, | ||||||
nixpkgs, | ||||||
crane, | ||||||
flake-utils, | ||||||
advisory-db, | ||||||
... | ||||||
}: | ||||||
flake-utils.lib.eachDefaultSystem ( | ||||||
system: | ||||||
let | ||||||
pkgs = nixpkgs.legacyPackages.${system}; | ||||||
|
||||||
|
@@ -25,92 +34,111 @@ | |||||
src = ./.; | ||||||
|
||||||
# Common arguments can be set here to avoid repeating them later | ||||||
commonArgs = { | ||||||
common = { | ||||||
inherit src; | ||||||
strictDeps = true; | ||||||
|
||||||
buildInputs = with pkgs; | ||||||
# Bunch of libraries required for package proper work | ||||||
buildInputs = | ||||||
with pkgs; | ||||||
[ | ||||||
# package dependencies | ||||||
zstd | ||||||
] ++ lib.optionals pkgs.stdenv.isDarwin (with pkgs; [ | ||||||
] | ||||||
++ lib.optionals pkgs.stdenv.isDarwin ( | ||||||
with pkgs; | ||||||
[ | ||||||
# additional dependencies on Darwin systems | ||||||
CoreFoundation | ||||||
libresolv | ||||||
Security | ||||||
]); | ||||||
nativeBuildInputs = with pkgs; [ cmake pkg-config ]; | ||||||
] | ||||||
); | ||||||
# Software required for project build | ||||||
nativeBuildInputs = with pkgs; [ | ||||||
cmake | ||||||
pkg-config | ||||||
]; | ||||||
# Tools required for checks | ||||||
nativeCheckInputs = with pkgs; [ git ]; | ||||||
|
||||||
# Additional environment variables can be set directly | ||||||
# MY_CUSTOM_VAR = "some value"; | ||||||
}; | ||||||
|
||||||
# Build *just* the cargo dependencies, so we can reuse | ||||||
# all of that work (e.g. via cachix) when running in CI | ||||||
cargoArtifacts = craneLib.buildDepsOnly commonArgs; | ||||||
# Build dependencies only, so we will be able to reuse them further | ||||||
cargoArtifacts = craneLib.buildDepsOnly common; | ||||||
|
||||||
# Build the actual crate itself, reusing the dependency | ||||||
# artifacts from above. | ||||||
onefetch = | ||||||
craneLib.buildPackage (commonArgs // { inherit cargoArtifacts; }); | ||||||
in { | ||||||
build = craneLib.buildPackage (common // { inherit cargoArtifacts; }); | ||||||
in | ||||||
{ | ||||||
checks = { | ||||||
# Build the crate as part of `nix flake check` for convenience | ||||||
inherit onefetch; | ||||||
inherit build; | ||||||
|
||||||
# Run clippy (and deny all warnings) on the crate source, | ||||||
# again, reusing the dependency artifacts from above. | ||||||
# | ||||||
# Note that this is done as a separate derivation so that | ||||||
# we can block the CI if there are issues here, but not | ||||||
# prevent downstream consumers from building our crate by itself. | ||||||
onefetch-clippy = craneLib.cargoClippy (commonArgs // { | ||||||
clippy = craneLib.cargoClippy ( | ||||||
common | ||||||
// { | ||||||
inherit cargoArtifacts; | ||||||
cargoClippyExtraArgs = "--all-targets -- --deny warnings"; | ||||||
}); | ||||||
} | ||||||
); | ||||||
|
||||||
onefetch-doc = | ||||||
craneLib.cargoDoc (commonArgs // { inherit cargoArtifacts; }); | ||||||
doc = craneLib.cargoDoc (common // { inherit cargoArtifacts; }); | ||||||
|
||||||
# Check formatting | ||||||
onefetch-fmt = craneLib.cargoFmt { inherit src; }; | ||||||
fmt = craneLib.cargoFmt { inherit src; }; | ||||||
|
||||||
onefetch-toml-fmt = craneLib.taploFmt { | ||||||
tomlFmt = craneLib.taploFmt { | ||||||
src = pkgs.lib.sources.sourceFilesBySuffices src [ ".toml" ]; | ||||||
# taplo arguments can be further customized below as needed | ||||||
# taploExtraArgs = "--config ./taplo.toml"; | ||||||
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. The commented taplo configuration line references './taplo.toml' but the actual taplo.toml file exists at the project root. This should be uncommented and the path corrected to just 'taplo.toml' or removed if not needed.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
}; | ||||||
|
||||||
# Audit dependencies | ||||||
onefetch-audit = craneLib.cargoAudit { inherit src advisory-db; }; | ||||||
audit = craneLib.cargoAudit { inherit src advisory-db; }; | ||||||
|
||||||
# Audit licenses | ||||||
onefetch-deny = craneLib.cargoDeny { inherit src; }; | ||||||
deny = craneLib.cargoDeny { inherit src; }; | ||||||
|
||||||
# Run tests with cargo-nextest | ||||||
# Consider setting `doCheck = false` on `my-crate` if you do not want | ||||||
# the tests to run twice | ||||||
onefetch-nextest = craneLib.cargoNextest (commonArgs // { | ||||||
nextest = craneLib.cargoNextest ( | ||||||
common | ||||||
// { | ||||||
inherit cargoArtifacts; | ||||||
partitions = 1; | ||||||
partitionType = "count"; | ||||||
cargoNextestPartitionsExtraArgs = "--no-tests=pass"; | ||||||
}); | ||||||
} | ||||||
); | ||||||
}; | ||||||
|
||||||
packages = rec { | ||||||
onefetch-debug = onefetch // { | ||||||
cargoExtraArgs = lib.concatStringsSep " " [ | ||||||
# Just to get more human-readable look | ||||||
"--profile dev" | ||||||
]; | ||||||
}; | ||||||
inherit onefetch; | ||||||
onefetch-debug = craneLib.buildPackage ( | ||||||
common | ||||||
// { | ||||||
inherit cargoArtifacts; | ||||||
doCheck = false; | ||||||
CARGO_PROFILE = "dev"; | ||||||
} | ||||||
); | ||||||
onefetch = craneLib.buildPackage ( | ||||||
common | ||||||
// { | ||||||
inherit cargoArtifacts; | ||||||
doCheck = false; | ||||||
} | ||||||
); | ||||||
default = onefetch-debug; | ||||||
}; | ||||||
|
||||||
apps.default = flake-utils.lib.mkApp { drv = onefetch; }; | ||||||
apps.default = flake-utils.lib.mkApp { drv = build; }; | ||||||
|
||||||
devShells.default = craneLib.devShell { | ||||||
# Inherit inputs from checks. | ||||||
|
@@ -123,14 +151,17 @@ | |||||
packages = with pkgs; [ | ||||||
# pkgs.ripgrep | ||||||
nixd | ||||||
nixfmt | ||||||
nixfmt-rfc-style | ||||||
]; | ||||||
}; | ||||||
}); | ||||||
} | ||||||
); | ||||||
# Sets substituters to avoid locally building something already built | ||||||
nixConfig = { | ||||||
extra-substituters = | ||||||
[ "https://crane.cachix.org" "https://cache.garnix.io" ]; | ||||||
extra-substituters = [ | ||||||
"https://crane.cachix.org" | ||||||
"https://cache.garnix.io" | ||||||
]; | ||||||
extra-trusted-public-keys = [ | ||||||
"crane.cachix.org-1:8Scfpmn9w+hGdXH/Q9tTLiYAE/2dnJYRJP7kl80GuRk=" | ||||||
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" | ||||||
|
This file contains hidden or 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
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.