diff --git a/docs/user/guide/initialization.rst b/docs/user/guide/initialization.rst index 4fc48e669962229f6a17ab3c78b2ed6312f365ce..7c687176bd019839e6eb81ca1abdcba947a03f96 100644 --- a/docs/user/guide/initialization.rst +++ b/docs/user/guide/initialization.rst @@ -25,7 +25,14 @@ dependencies locked to specific versions so everybody can produce the same ident .. tab:: From Ubuntu repositories Nix can also be installed from the Ubuntu repositories. - The following has been tested on an Ubuntu 24.04 LTS system: + The following has been tested on an Ubuntu 24.04 LTS system. + + .. note:: + + If you are not on Ubuntu 24.04 or later, the Nix version provided by your repository is probably + too old which may lead to incompatibilities with YAOOK/K8s. In order to mitigate this issue, we + provide the latest Nix version used by our images at `the project's package registry `. + You can download and install it using `sudo dpkg -i nix-${version}_amd64.deb` before running the commands below. .. code:: console diff --git a/flake.nix b/flake.nix index 272a52917002f66b391905545d196e45d5f7bc08..e512c8dbfe8820144df60e8792c5c97ac2a8d312 100644 --- a/flake.nix +++ b/flake.nix @@ -14,6 +14,7 @@ systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"]; debug = true; imports = [ + ./nix/debian.nix ./nix/renderDocs.nix ./nix/yk8s-env.nix ./nix/templates diff --git a/nix/debian.nix b/nix/debian.nix new file mode 100644 index 0000000000000000000000000000000000000000..01610cda10b8582e48acd5aa852eda8d96f4c0be --- /dev/null +++ b/nix/debian.nix @@ -0,0 +1,62 @@ +{flake-parts-lib, ...}: { + options = { + perSystem = + flake-parts-lib.mkPerSystemOption + ({pkgs, ...}: let + buildSingleDeb = { + lib, + stdenv, + referencesByPopularity, + fpm, + drv, + fpmArgs ? {}, + }: let + fpmArgLine = lib.strings.escapeShellArgs ( + lib.foldlAttrs (acc: n: v: + acc ++ (builtins.foldl' (acc: a: acc ++ ["--${n}" a]) [] (lib.lists.toList v))) [] + fpmArgs + ); + in + stdenv.mkDerivation { + name = "deb-single-${drv.name}"; + buildInputs = [ + fpm + ]; + + unpackPhase = "true"; + + buildPhase = '' + export HOME=$PWD + mkdir -p ./nix/store/ + mkdir -p ./bin + for item in "$(cat ${referencesByPopularity drv})" + do + cp -r $item ./nix/store/ + done + + cp -r ${drv}/bin/* ./bin/ + + chmod -R a+rwx ./nix + chmod -R a+rwx ./bin + fpm -s dir -t deb --name ${drv.pname} -v ${drv.version} ${lib.traceVal fpmArgLine} nix bin + ''; + + installPhase = '' + mkdir -p $out + cp -r *.deb $out + ''; + }; + in { + packages.nixForDebian = pkgs.callPackage buildSingleDeb { + drv = pkgs.nix; + fpmArgs = { + provides = ["nix-bin"]; + license = "LGPL-2.1"; + maintainer = "The TAROOK Authors"; + url = "https://github.com/NixOS/nix"; + description = "Nix, the purely functional package manager"; + }; + }; + }); + }; +}