Skip to content

Commit

Permalink
[fix] flake: actually use lix in the docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
jalil-salame committed May 18, 2024
1 parent 260b1a5 commit a0628a5
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 35 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Build Docker Image
run: |
nix build --accept-flake-config --print-build-logs
cp -v "$(realpath result)" lix-image.tar.gz
cp -v "$(realpath result/image.tar.gz)" lix-image.tar.gz
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
Expand All @@ -47,8 +47,9 @@ jobs:
- name: Push docker image
run: |
docker load <lix-image.tar.gz
docker login --username "${{ github.actor }}" --password "${{ secrets.GITHUB_TOKEN }}" "$REGISTRY"
docker image tag nix:latest "$REGISTRY/$IMAGE_NAME:latest"
docker image list
echo "${{ secrets.GITHUB_TOKEN }}" | docker login --username "${{ github.actor }}" --password-stdin "$REGISTRY"
docker image tag nix:2.90.0-beta.1 "$REGISTRY/$IMAGE_NAME:latest"
docker push "$REGISTRY/$IMAGE_NAME:latest"
lockfile:
runs-on: ubuntu-22.04
Expand Down
67 changes: 54 additions & 13 deletions flake.lock

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

36 changes: 17 additions & 19 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
description = "A starting point for your devshell";

inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
nixpkgs.follows = "lix/nixpkgs";
systems.url = "github:nix-systems/default";
lix = {
url = "https://git.lix.systems/lix-project/lix/archive/main.tar.gz";
flake = false;
url = "https://git.lix.systems/lix-project/lix/archive/2.90-beta.1.tar.gz";
inputs.nixpkgs-regression.follows = "";
};
};

Expand All @@ -24,29 +24,27 @@
nixpkgs,
systems,
lix,
...
}: let
lixImage = pkgs: pkgs.callPackage (import (lix + "/docker.nix")) {inherit pkgs;};
lixImage = system: lix.packages.${system}.dockerImage;
allSystems = import systems;
forEachSystem = f:
nixpkgs.lib.genAttrs allSystems (system:
f {
inherit system;
pkgs = nixpkgs.legacyPackages.${system};
});
forEachSystem = nixpkgs.lib.genAttrs allSystems;
nixpkgsFor = forEachSystem (system:
import nixpkgs {
inherit system;
overlays = [lix.overlays.default];
});
in {
# Nix code formatter; I like alejandra, but nixpkgsfmt, nixfmt-classic, and nixfmt-rfc-style also exist
formatter = forEachSystem ({pkgs, ...}: pkgs.alejandra);
formatter = forEachSystem (system: nixpkgsFor.${system}.alejandra);
# Packages exported by this flake
packages = forEachSystem ({
pkgs,
system,
}: {
packages = forEachSystem (system: {
default = self.packages.${system}.lixImage;
lixImage = lixImage pkgs;
lixImage = lixImage system;
});
devShells = forEachSystem ({pkgs, ...}: {
default = pkgs.mkShell {packages = [];};
devShells = forEachSystem (system: let
pkgs = nixpkgsFor.${system};
in {
default = pkgs.mkShellNoCC {packages = [];};
});
};
}

0 comments on commit a0628a5

Please sign in to comment.