-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
509 additions
and
66 deletions.
There are no files selected for viewing
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 @@ | ||
-P ubuntu-latest=catthehacker/ubuntu:act-latest |
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 @@ | ||
use flake --accept-flake-config; |
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
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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
/target | ||
*.db | ||
result | ||
.direnv |
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,28 @@ | ||
default: | ||
@just --list --unsorted | ||
|
||
build: | ||
nix build . | ||
|
||
image: | ||
nix build .#image | ||
|
||
push-image: | ||
nix build .#pushImage && ./result/bin/push-image | ||
|
||
multiarch-push: | ||
nix build .#combineImages && ./result/bin/combine-images | ||
|
||
list-images: | ||
nix develop --command skopeo list-tags docker://ghcr.io/kasuboski/feedreader | ||
|
||
cache-nix: | ||
nix build --json \ | ||
| jq -r '.[].outputs | to_entries[].value' \ | ||
| cachix push kasuboski-feedreader | ||
|
||
nix develop --profile dev-profile --command 'true' # to preload or something :shrug: | ||
cachix push kasuboski-feedreader dev-profile | ||
|
||
local-workflow: | ||
act -s GITHUB_TOKEN="{{ env_var('GITHUB_TOKEN') }}" |
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,69 @@ | ||
{ | ||
nixpkgs, | ||
crane, | ||
flake-utils, | ||
rust-overlay, | ||
system, | ||
}: | ||
flake-utils.lib.eachDefaultSystem | ||
( | ||
crossSystem: let | ||
crossBuild = crossSystem != system; | ||
overlays = [(import rust-overlay)]; | ||
pkgs = import nixpkgs { | ||
inherit crossSystem; | ||
localSystem = system; | ||
inherit overlays; | ||
}; | ||
rustToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; | ||
# this is how we can tell crane to use our toolchain! | ||
craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain; | ||
additionalFilter = path: _type: builtins.match ".*html$|.*opml$" path != null; | ||
# https://crane.dev/API.html#cranelibfiltercargosources | ||
src = nixpkgs.lib.cleanSourceWith { | ||
src = craneLib.path ./.; | ||
filter = path: type: (additionalFilter path type) || (craneLib.filterCargoSources path type); | ||
}; | ||
nativeBuildInputs = with pkgs; [rustToolchain pkg-config]; | ||
buildInputs = with pkgs; [openssl sqlite]; | ||
# because we'll use it for both `cargoArtifacts` and `bin` | ||
archInfo = { | ||
x86_64-linux = { | ||
rustTarget = "x86_64-unknown-linux-gnu"; | ||
qemu = "x86_64"; | ||
}; | ||
aarch64-linux = { | ||
rustTarget = "aarch64-unknown-linux-gnu"; | ||
qemu = "aarch64"; | ||
}; | ||
}; | ||
baseArgs = { | ||
inherit src buildInputs nativeBuildInputs; | ||
}; | ||
crossArgs = { | ||
doCheck = false; | ||
depsBuildBuild = [pkgs.qemu]; | ||
cargoExtraArgs = "--target ${archInfo.${crossSystem}.rustTarget}"; | ||
"CARGO_TARGET_${pkgs.lib.strings.toUpper archInfo.${crossSystem}.qemu}_UNKNOWN_LINUX_GNU_LINKER" = "${pkgs.stdenv.cc.targetPrefix}cc"; | ||
"CARGO_TARGET_${pkgs.lib.strings.toUpper archInfo.${crossSystem}.qemu}_UNKNOWN_LINUX_GNU_RUNNER" = "qemu-${archInfo.${crossSystem}.qemu}"; | ||
HOST_CC = "${pkgs.stdenv.cc.nativePrefix}cc"; | ||
TARGET_CC = "${pkgs.stdenv.cc.targetPrefix}cc"; | ||
}; | ||
commonArgs = | ||
if crossBuild | ||
then baseArgs // crossArgs | ||
else baseArgs; | ||
cargoArtifacts = craneLib.buildDepsOnly commonArgs; | ||
bin = craneLib.buildPackage (commonArgs | ||
// { | ||
inherit cargoArtifacts; | ||
}); | ||
in rec { | ||
packages = { | ||
# that way we can build `bin` specifically, | ||
# but it's also the default. | ||
inherit bin; | ||
default = bin; | ||
}; | ||
} | ||
) |
Oops, something went wrong.