diff options
author | Silvan Mosberger <contact@infinisil.com> | 2024-03-14 16:46:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-14 16:46:22 +0100 |
commit | f60515ddea75f772f61624f72ea06fd1471cc647 (patch) | |
tree | 67b3710925e38d65de393a078a63fa5c1c20d760 /pkgs | |
parent | ef4a46d82e5aecfa069d00e81207dcbb8be4602c (diff) | |
parent | 1d85557b5025a67d94d31c3c0508253c26b90f07 (diff) | |
download | nixlib-f60515ddea75f772f61624f72ea06fd1471cc647.tar nixlib-f60515ddea75f772f61624f72ea06fd1471cc647.tar.gz nixlib-f60515ddea75f772f61624f72ea06fd1471cc647.tar.bz2 nixlib-f60515ddea75f772f61624f72ea06fd1471cc647.tar.lz nixlib-f60515ddea75f772f61624f72ea06fd1471cc647.tar.xz nixlib-f60515ddea75f772f61624f72ea06fd1471cc647.tar.zst nixlib-f60515ddea75f772f61624f72ea06fd1471cc647.zip |
Merge pull request #293416 from DanielSidhion/remove-makesnap
snapTools: remove
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/build-support/snap/default.nix | 4 | ||||
-rw-r--r-- | pkgs/build-support/snap/make-snap.nix | 84 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 2 |
3 files changed, 1 insertions, 89 deletions
diff --git a/pkgs/build-support/snap/default.nix b/pkgs/build-support/snap/default.nix deleted file mode 100644 index ba5271868911..000000000000 --- a/pkgs/build-support/snap/default.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ callPackage, hello }: -{ - makeSnap = callPackage ./make-snap.nix { }; -} diff --git a/pkgs/build-support/snap/make-snap.nix b/pkgs/build-support/snap/make-snap.nix deleted file mode 100644 index cef7500bcbaf..000000000000 --- a/pkgs/build-support/snap/make-snap.nix +++ /dev/null @@ -1,84 +0,0 @@ -{ - runCommand, squashfsTools, closureInfo, lib, jq, writeText -}: - -{ - # The meta parameter is the contents of the `snap.yaml`, NOT the - # `snapcraft.yaml`. - # - # - `snap.yaml` is what is inside of the final Snap, - # - `snapcraft.yaml` is used by `snapcraft` to build snaps - # - # Since we skip the `snapcraft` tool, we skip the `snapcraft.yaml` - # file. For more information: - # - # https://docs.snapcraft.io/snap-format - # - # Note: unsquashfs'ing an existing snap from the store can be helpful - # for determining what you you're missing. - # - meta -}: let - snap_yaml = let - # Validate the snap's meta contains a name. - # Also: automatically set the `base` parameter and the layout for - # the `/nix` bind. - validate = { name, ... } @ args: - args // { - # Combine the provided arguments with the required options. - - # base: built from https://github.com/NixOS/snapd-nix-base - # and published as The NixOS Foundation on the Snapcraft store. - base = "nix-base"; - layout = (args.layout or {}) // { - # Bind mount the Snap's root nix directory to `/nix` in the - # execution environment's filesystem namespace. - "/nix".bind = "$SNAP/nix"; - }; - }; - in writeText "snap.yaml" - (builtins.toJSON (validate meta)); - - # These are specifically required by snapd, so don't change them - # unless you've verified snapcraft / snapd can handle them. Best bet - # is to just mirror this list against how snapcraft creates images. - # from: https://github.com/snapcore/snapcraft/blob/b88e378148134383ffecf3658e3a940b67c9bcc9/snapcraft/internal/lifecycle/_packer.py#L96-L98 - mksquashfs_args = [ - "-noappend" "-comp" "xz" "-no-xattrs" "-no-fragments" - - # Note: We want -all-root every time, since all the files are - # owned by root anyway. This is true for Nix, but not true for - # other builds. - # from: https://github.com/snapcore/snapcraft/blob/b88e378148134383ffecf3658e3a940b67c9bcc9/snapcraft/internal/lifecycle/_packer.py#L100 - "-all-root" - ]; - -in runCommand "squashfs.img" { - nativeBuildInputs = [ squashfsTools jq ]; - - closureInfo = closureInfo { - rootPaths = [ snap_yaml ]; - }; -} '' - root=$PWD/root - mkdir $root - - ( - # Put the snap.yaml in to `/meta/snap.yaml`, setting the version - # to the hash part of the store path - mkdir $root/meta - version=$(echo $out | cut -d/ -f4 | cut -d- -f1) - cat ${snap_yaml} | jq ". + { version: \"$version\" }" \ - > $root/meta/snap.yaml - ) - - ( - # Copy the store closure in to the root - mkdir -p $root/nix/store - cat $closureInfo/store-paths | xargs -I{} cp -r {} $root/nix/store/ - ) - - # Generate the squashfs image. - mksquashfs $root $out \ - ${lib.concatStringsSep " " mksquashfs_args} -'' diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1c0c47c6e9d5..a97dd3e0f331 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -889,7 +889,7 @@ with pkgs; tarsum = callPackage ../build-support/docker/tarsum.nix { }; - snapTools = callPackage ../build-support/snap { }; + snapTools = throw "snapTools was removed because makeSnap produced broken snaps and it was the only function in snapTools. See https://github.com/NixOS/nixpkgs/issues/100618 for more details."; # 2024-03-04; nix-prefetch-docker = callPackage ../build-support/docker/nix-prefetch-docker.nix { }; |