Deployment and lifecycle management for Nix
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

add aarch64 support

+160 -5
+1 -1
.forgejo/workflows/build.yaml
··· 5 5 6 6 jobs: 7 7 flake-build: 8 - runs-on: stop/${{ matrix.system }} 8 + runs-on: sower/seed/${{ matrix.system }} 9 9 container: 10 10 options: "--volume /nix:/host/nix" 11 11
+8 -2
flake.nix
··· 12 12 flake-parts.lib.mkFlake { inherit inputs; } { 13 13 imports = [ ./nix/flakemodule.nix ]; 14 14 15 - systems = [ "x86_64-linux" ]; # needs support in package as well 15 + systems = [ 16 + # requires support in package.nix for tailwind/esbuild 17 + "x86_64-linux" 18 + "aarch64-linux" 19 + ]; 16 20 17 21 perSystem = 18 22 { ··· 40 44 41 45 pkgs.just 42 46 pkgs.mix2nix 47 + pkgs.nvfetcher 43 48 pkgs.process-compose 44 49 pkgs.sqlite 45 50 ] ++ (lib.optionals pkgs.stdenv.isLinux [ pkgs.inotify-tools ]); ··· 50 55 ]; 51 56 }; 52 57 53 - packages = { 58 + packages = rec { 54 59 default = pkgs.callPackage ./nix/package.nix { beamPackages = beam; }; 55 60 seed-ci = pkgs.callPackage ./nix/seed-ci.nix { inherit (inputs'.attic.packages) attic; }; 61 + seed-ci-docker = pkgs.callPackage ./nix/docker-image.nix { inherit seed-ci; }; 56 62 }; 57 63 }; 58 64
+3
justfile
··· 12 12 nix-lock: 13 13 mix2nix mix.lock > nix/mix.nix 14 14 15 + nvfetcher: 16 + cd nix; nvfetcher 17 + 15 18 start: 16 19 iex -S mix phx.server 17 20
+42
nix/_sources/generated.json
··· 1 + { 2 + "nix-aarch64-linux": { 3 + "cargoLocks": null, 4 + "date": null, 5 + "extract": null, 6 + "name": "nix-aarch64-linux", 7 + "passthru": null, 8 + "pinned": false, 9 + "src": { 10 + "arch": "arm64", 11 + "finalImageName": null, 12 + "finalImageTag": null, 13 + "imageDigest": "sha256:ab7306ccfa8168ad63f4e91a6217a73decdd641c49c7274212a93df19ee88938", 14 + "imageName": "docker.io/nixos/nix", 15 + "imageTag": "2.20.1", 16 + "os": null, 17 + "sha256": "sha256-7ymRm6Ts/OW6BZkHl9KOU2lwXzveI4mMXjP72/0QxC0=", 18 + "tlsVerify": null 19 + }, 20 + "version": "2.20.1" 21 + }, 22 + "nix-x86_64-linux": { 23 + "cargoLocks": null, 24 + "date": null, 25 + "extract": null, 26 + "name": "nix-x86_64-linux", 27 + "passthru": null, 28 + "pinned": false, 29 + "src": { 30 + "arch": "amd64", 31 + "finalImageName": null, 32 + "finalImageTag": null, 33 + "imageDigest": "sha256:ab7306ccfa8168ad63f4e91a6217a73decdd641c49c7274212a93df19ee88938", 34 + "imageName": "docker.io/nixos/nix", 35 + "imageTag": "2.20.1", 36 + "os": null, 37 + "sha256": "sha256-QC0NtbztqYuXKRCD8m6vGA0pbL/dKcZulPD+KPGAWD4=", 38 + "tlsVerify": null 39 + }, 40 + "version": "2.20.1" 41 + } 42 + }
+26
nix/_sources/generated.nix
··· 1 + # This file was generated by nvfetcher, please do not modify it manually. 2 + { fetchgit, fetchurl, fetchFromGitHub, dockerTools }: 3 + { 4 + nix-aarch64-linux = { 5 + pname = "nix-aarch64-linux"; 6 + version = "2.20.1"; 7 + src = dockerTools.pullImage { 8 + imageName = "docker.io/nixos/nix"; 9 + imageDigest = "sha256:ab7306ccfa8168ad63f4e91a6217a73decdd641c49c7274212a93df19ee88938"; 10 + sha256 = "sha256-7ymRm6Ts/OW6BZkHl9KOU2lwXzveI4mMXjP72/0QxC0="; 11 + finalImageTag = "2.20.1"; 12 + arch = "arm64"; 13 + }; 14 + }; 15 + nix-x86_64-linux = { 16 + pname = "nix-x86_64-linux"; 17 + version = "2.20.1"; 18 + src = dockerTools.pullImage { 19 + imageName = "docker.io/nixos/nix"; 20 + imageDigest = "sha256:ab7306ccfa8168ad63f4e91a6217a73decdd641c49c7274212a93df19ee88938"; 21 + sha256 = "sha256-QC0NtbztqYuXKRCD8m6vGA0pbL/dKcZulPD+KPGAWD4="; 22 + finalImageTag = "2.20.1"; 23 + arch = "amd64"; 24 + }; 25 + }; 26 + }
+65
nix/docker-image.nix
··· 1 + { 2 + seed-ci, 3 + extra-substituters ? null, 4 + extra-trusted-public-keys ? null, 5 + 6 + lib, 7 + dockerTools, 8 + fetchgit, 9 + fetchurl, 10 + fetchFromGitHub, 11 + hostPlatform, 12 + writeTextFile, 13 + 14 + coreutils, 15 + nodejs, 16 + }: 17 + let 18 + nvfetcher = import ./_sources/generated.nix { 19 + inherit 20 + fetchgit 21 + fetchurl 22 + fetchFromGitHub 23 + dockerTools 24 + ; 25 + }; 26 + in 27 + dockerTools.streamLayeredImage { 28 + name = "sower.dev/seed/ci"; 29 + 30 + fromImage = nvfetcher."nix-${hostPlatform.system}".src.outPath; 31 + tag = "latest-${hostPlatform.system}"; 32 + 33 + # upstream nix image is using 100 layers already 34 + maxLayers = 115; 35 + 36 + contents = [ 37 + seed-ci 38 + # act expects nodejs 39 + nodejs 40 + 41 + (writeTextFile { 42 + name = "nix.conf"; 43 + destination = "/etc/nix/nix.conf"; 44 + text = '' 45 + builders-use-substitutes = true 46 + experimental-features = nix-command flakes 47 + ${lib.optionalString (extra-substituters != null) extra-substituters} 48 + ${lib.optionalString (extra-trusted-public-keys != null) extra-trusted-public-keys} 49 + store = unix:///host/nix/var/nix/daemon-socket/socket?root=/host 50 + ''; 51 + }) 52 + ]; 53 + 54 + # forgejo uses /bin/sleep as the entrypoint 55 + extraCommands = '' 56 + mkdir -p bin 57 + ln -s ${coreutils}/bin/sleep bin/sleep 58 + ''; 59 + 60 + # replace the entire path so we can prepend /bin 61 + config.Env = [ 62 + "PATH=/bin:/root/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin" 63 + "NIX_EVAL_ARGS=--eval-store unix:///host/nix/var/nix/daemon-socket/socket?root=/host" 64 + ]; 65 + }
+9
nix/nvfetcher.toml
··· 1 + [nix-x86_64-linux] 2 + src.github_tag = "nixos/nix" 3 + fetch.docker = "docker.io/nixos/nix" 4 + docker.arch = "amd64" 5 + 6 + [nix-aarch64-linux] 7 + src.github_tag = "nixos/nix" 8 + fetch.docker = "docker.io/nixos/nix" 9 + docker.arch = "arm64"
+6 -2
nix/package.nix
··· 7 7 git, 8 8 libgit2, 9 9 sqlite, 10 + stdenv, 10 11 }: 12 + let 13 + arch = if stdenv.isAarch64 then "arm64" else "x64"; 14 + in 11 15 beamPackages.mixRelease { 12 16 pname = "sower"; 13 17 version = "0.0.1-dev"; ··· 48 52 49 53 postBuild = '' 50 54 # prevent mix from trying to download binaries 51 - ln -sfv ${lib.getExe esbuild} _build/esbuild-linux-x64 52 - ln -sfv ${lib.getExe tailwindcss} _build/tailwind-linux-x64 55 + ln -sfv ${lib.getExe esbuild} _build/esbuild-linux-${arch} 56 + ln -sfv ${lib.getExe tailwindcss} _build/tailwind-linux-${arch} 53 57 54 58 mix assets.deploy --no-deps-check 55 59 '';