Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
on:
workflow_call:
workflow_dispatch:
pull_request:
push:
branches: [main]

jobs:
build-artifacts:
runs-on: ${{ matrix.systems.runner }}
permissions:
id-token: write
contents: read
strategy:
matrix:
systems:
- nix-system: aarch64-darwin
runner: macos-latest-xlarge
artifact: flake-iter-ARM64-macOS
- nix-system: aarch64-linux
runner: namespace-profile-default-arm64
artifact: flake-iter-ARM64-Linux
- nix-system: x86_64-linux
runner: ubuntu-24.04
artifact: flake-iter-X64-Linux
steps:
- name: git checkout
uses: actions/checkout@v6

- name: Install Determinate Nix
uses: DeterminateSystems/determinate-nix-action@main

- name: Set up FlakeHub Cache
uses: DeterminateSystems/flakehub-cache-action@main

- name: Build package for ${{ matrix.systems.nix-system }}
run: |
nix build -L

- name: Prepare ${{ matrix.systems.nix-system }} artifact
run: |
mkdir -p artifacts
cp result/bin/flake-iter artifacts/${{ matrix.systems.artifact }}

- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: flake-iter-${{ matrix.systems.nix-system }}
path: artifacts/${{ matrix.systems.artifact }}
if-no-files-found: error
overwrite: true
retention-days: 1

upload-artifacts-to-s3:
needs: build-artifacts
# Upload only on PR merge
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-24.04
permissions:
id-token: write
contents: read
steps:
- name: Download artifacts directory
uses: actions/download-artifact@v7
with:
pattern: flake-iter-*
path: ./artifacts
merge-multiple: true

- name: Upload to S3
uses: DeterminateSystems/push-artifact-ids@main
with:
s3_upload_role: ${{ secrets.AWS_S3_UPLOAD_ROLE }}
bucket: ${{ secrets.AWS_S3_UPLOAD_BUCKET }}
directory: ./artifacts
ids_project_name: flake-iter
ids_binary_prefix: flake-iter
29 changes: 0 additions & 29 deletions .github/workflows/determinate-ci.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: DeterminateSystems/flakehub-cache-action@main

- name: Nix formatting
run: git ls-files '*.nix' | nix develop --command xargs nixpkgs-fmt --check
run: git ls-files '*.nix' | nix develop --command xargs nixfmt --check

- name: Nix Flake Check
- name: Nix flake check
run: nix flake check --print-build-logs --all-systems
38 changes: 19 additions & 19 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 16 additions & 10 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,29 @@
crane = {
url = "https://flakehub.com/f/ipetkov/crane/0.20";
};
flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*";
flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.1";
};

outputs =
inputs:
{ self, ... }@inputs:
let
inherit (inputs.nixpkgs) lib;

supportedSystems = [
"x86_64-linux"
"aarch64-darwin"
"aarch64-linux"
];

forEachSupportedSystem =
f:
inputs.nixpkgs.lib.genAttrs supportedSystems (
lib.genAttrs supportedSystems (
system:
f {
inherit system;
pkgs = import inputs.nixpkgs {
inherit system;
overlays = [ inputs.self.overlays.default ];
overlays = [ self.overlays.default ];
};
}
);
Expand All @@ -50,18 +54,18 @@
stable.rustfmt
stable.rust-src
]
++ inputs.nixpkgs.lib.optionals (system == "x86_64-linux") [
++ lib.optionals (system == "x86_64-linux") [
targets.x86_64-unknown-linux-musl.stable.rust-std
]
++ inputs.nixpkgs.lib.optionals (system == "aarch64-linux") [
++ lib.optionals (system == "aarch64-linux") [
targets.aarch64-unknown-linux-musl.stable.rust-std
]
);
craneLib = (inputs.crane.mkLib final).overrideToolchain rustToolchain;
};

devShells = forEachSupportedSystem (
{ pkgs }:
{ pkgs, system }:
rec {
default = pkgs.mkShell {
packages = with pkgs; [
Expand All @@ -70,9 +74,9 @@
cargo-watch
bacon
rust-analyzer
nixpkgs-fmt
cargo-machete
iconv
self.formatter.${system}
];

env = {
Expand All @@ -87,14 +91,16 @@
}
);

formatter = forEachSupportedSystem ({ pkgs, ... }: pkgs.nixfmt);

# These outputs are solely for local testing
packages = forEachSupportedSystem (
{ pkgs }:
{ pkgs, ... }:
rec {
default = pkgs.craneLib.buildPackage {
pname = meta.name;
inherit (meta) version;
src = inputs.self;
src = self;
doCheck = true;
buildInputs = with pkgs; [ iconv ];
};
Expand Down
1 change: 1 addition & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ enum FlakeIterCommand {

/// A tool for working with flake outputs.
#[derive(Parser)]
#[command(version)]
pub struct Cli {
/// Whether to display all Nix build output.
#[arg(
Expand Down
Loading