@@ -31,12 +31,12 @@ resources:
|
|||||||
uri: https://git.weirdnatto.in/natto1784/singh3.git
|
uri: https://git.weirdnatto.in/natto1784/singh3.git
|
||||||
branch: master
|
branch: master
|
||||||
|
|
||||||
- name: rust-image
|
- name: nix
|
||||||
type: registry-image
|
type: registry-image
|
||||||
icon: docker
|
icon: docker
|
||||||
source:
|
source:
|
||||||
repository: arm64v8/rust
|
repository: nixos/nix
|
||||||
tag: latest
|
tag: latest-arm64
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
- name: configure-self
|
- name: configure-self
|
||||||
@@ -51,72 +51,30 @@ jobs:
|
|||||||
- get: repo
|
- get: repo
|
||||||
trigger: true
|
trigger: true
|
||||||
passed: [configure-self]
|
passed: [configure-self]
|
||||||
- get: rust-image
|
- get: nix
|
||||||
trigger: false
|
trigger: false
|
||||||
- task: format
|
|
||||||
image: rust-image
|
|
||||||
config:
|
|
||||||
inputs:
|
|
||||||
- name: repo
|
|
||||||
platform: linux
|
|
||||||
run:
|
|
||||||
path: sh
|
|
||||||
args:
|
|
||||||
- -c
|
|
||||||
- |
|
|
||||||
rustup component add rustfmt
|
|
||||||
cargo fmt
|
|
||||||
dir: repo
|
|
||||||
- task: build
|
- task: build
|
||||||
image: rust-image
|
image: nix
|
||||||
config:
|
config:
|
||||||
params:
|
params:
|
||||||
CARGO_HOME: cargo-home
|
CACHIX_NAME: ((cachix.name))
|
||||||
CARGO_TARGET_DIR: builddir
|
CACHIX_AUTH_TOKEN: ((cachix.token))
|
||||||
inputs:
|
inputs:
|
||||||
- name: repo
|
- name: repo
|
||||||
caches:
|
|
||||||
- path: builddir
|
|
||||||
- path: cargo-home
|
|
||||||
platform: linux
|
platform: linux
|
||||||
run:
|
run:
|
||||||
path: sh
|
path: sh
|
||||||
args:
|
args:
|
||||||
- -c
|
- -c
|
||||||
- |
|
- |
|
||||||
cargo build --release --manifest-path repo/Cargo.toml
|
nix-env -iA nixpkgs.cachix
|
||||||
mkdir release
|
cachix use $CACHIX_NAME
|
||||||
mv $CARGO_TARGET_DIR/release/singh3 bin
|
cachix watch-exec pain nix -- --extra-experimental-features "nix-command flakes" build ./repo
|
||||||
outputs:
|
nix --extra-experimental-features "nix-command flakes" build ./repo#image -o result
|
||||||
- name: bin
|
nix-shell -p gzip --run "gzip -c $(readlink result) > final"
|
||||||
- task: push-image
|
|
||||||
privileged: true
|
|
||||||
config:
|
|
||||||
platform: linux
|
|
||||||
image_resource:
|
|
||||||
type: registry-image
|
|
||||||
source:
|
|
||||||
repository: rdclda/concourse-oci-build-task
|
|
||||||
caches:
|
|
||||||
- path: cache
|
|
||||||
inputs:
|
|
||||||
- name: bin
|
|
||||||
outputs:
|
|
||||||
- name: image
|
|
||||||
run:
|
|
||||||
path: sh
|
|
||||||
args:
|
|
||||||
- -c
|
|
||||||
- |
|
|
||||||
cat <<EOF > Dockerfile
|
|
||||||
FROM arm64v8/ubuntu
|
|
||||||
COPY bin/singh3 /usr/bin/singh3
|
|
||||||
CMD ["singh3"]
|
|
||||||
EOF
|
|
||||||
build
|
|
||||||
- put: image
|
- put: image
|
||||||
params:
|
params:
|
||||||
image: image/image.tar
|
image: final
|
||||||
- put: nomad-job
|
- put: nomad-job
|
||||||
params:
|
params:
|
||||||
job_path: repo/singh3.nomad
|
job_path: repo/singh3.nomad
|
||||||
|
10
default.nix
Normal file
10
default.nix
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
(import
|
||||||
|
(
|
||||||
|
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
|
||||||
|
fetchTarball {
|
||||||
|
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
||||||
|
sha256 = lock.nodes.flake-compat.locked.narHash;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
{ src = ./.; }
|
||||||
|
).defaultNix
|
36
flake.nix
36
flake.nix
@@ -12,7 +12,6 @@
|
|||||||
utils.lib.eachDefaultSystem
|
utils.lib.eachDefaultSystem
|
||||||
(system:
|
(system:
|
||||||
let
|
let
|
||||||
|
|
||||||
overlays =
|
overlays =
|
||||||
[
|
[
|
||||||
(import "${cargo2nix}/overlay")
|
(import "${cargo2nix}/overlay")
|
||||||
@@ -30,42 +29,23 @@
|
|||||||
|
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
|
devShell = with pkgs; mkShell {
|
||||||
devShells = with pkgs; {
|
|
||||||
default = mkShell
|
|
||||||
{
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
rust-bin.nightly.latest.default
|
rust-bin.nightly.latest.default
|
||||||
rust-analyzer
|
rust-analyzer
|
||||||
postgresql
|
postgresql
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
withDB = mkShell
|
|
||||||
{
|
|
||||||
buildInputs = [
|
|
||||||
rust-bin.nightly.latest.default
|
|
||||||
postgresql
|
|
||||||
];
|
|
||||||
};
|
|
||||||
bare = mkShell
|
|
||||||
{
|
|
||||||
buildInputs = [
|
|
||||||
rust-bin.nightly.latest.default
|
|
||||||
];
|
|
||||||
};
|
|
||||||
withLSP = mkShell
|
|
||||||
{
|
|
||||||
buildInputs = [
|
|
||||||
rust-bin.nightly.latest.default
|
|
||||||
rust-analyzer
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
devShell = devShells.default;
|
|
||||||
|
|
||||||
packages = {
|
packages = {
|
||||||
default = (rustPkgs.workspace.singh3 { }).bin;
|
default = (rustPkgs.workspace.singh3 { }).bin;
|
||||||
|
image = pkgs.dockerTools.buildImage {
|
||||||
|
name = "singh3";
|
||||||
|
tag = "latest";
|
||||||
|
created = "now";
|
||||||
|
contents = packages.default;
|
||||||
|
config.Cmd = [ "/bin/singh3" ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
defaultPackage = packages.default;
|
defaultPackage = packages.default;
|
||||||
|
Reference in New Issue
Block a user