CI: Run a nix task
All checks were successful
/ Publish (push) Successful in 33s

This commit is contained in:
Jan-Erik Rediger 2023-09-25 22:54:26 +02:00
parent 9e05fafbcb
commit 908991eb68
5 changed files with 60 additions and 2 deletions

View file

@ -1,10 +1,13 @@
on: push
jobs:
Publish:
runs-on: docker
runs-on: flakes-action
steps:
- uses: actions/checkout@v3
name: Checkout
- name: Build
run: |
echo "Hello World!"
nix build
- name: Run
run: |
./result/bin/hello

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
result/

26
flake.lock Normal file
View file

@ -0,0 +1,26 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1695673361,
"narHash": "sha256-Y8TzvhN7zBKooJrIQ0FjKZSZ0iuistIURCx89C4DPXE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0fbc32585c7617c1fb7b7acbb1db9f13d54c3d04",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

24
flake.nix Normal file
View file

@ -0,0 +1,24 @@
{
description = "A flake for building Hello World";
inputs.nixpkgs.url = github:NixOS/nixpkgs;
outputs = { self, nixpkgs }: {
defaultPackage.x86_64-linux =
with import nixpkgs { system = "x86_64-linux"; };
stdenv.mkDerivation {
name = "hello";
src = self;
buildPhase = "cc -o hello ./hello.c";
installPhase = "mkdir -p $out/bin; install -t $out/bin hello";
};
defaultPackage.aarch64-darwin =
with import nixpkgs { system = "aarch64-darwin"; };
stdenv.mkDerivation {
name = "hello";
src = self;
buildPhase = "cc -o hello ./hello.c";
installPhase = "mkdir -p $out/bin; install -t $out/bin hello";
};
};
}

4
hello.c Normal file
View file

@ -0,0 +1,4 @@
int main(void) {
printf("Hello World\n");
return 0;
}