Skip to content

Commit

Permalink
simplify expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
DavHau committed Apr 13, 2021
1 parent c16e284 commit b2a7c83
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 31 deletions.
1 change: 0 additions & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ with builtins;
perl ? pkgs.perl,
pkgs ? import <nixpkgs> {},
xz ? pkgs.pkgsStatic.xz,
zstd ? pkgs.pkgsStatic.zstd,
...
}:
let
Expand Down
36 changes: 9 additions & 27 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,25 @@

nixPortableForSystem = { system, crossSystem ? null, }:
let
# libcap static is broken on recent nixpkgs,
# therefore basing bwrap static off of older nixpkgs
# bwrap with musl requires a recent fix in musl, see:
# https://github.com/flathub/org.signal.Signal/issues/129
# https://github.com/containers/bubblewrap/issues/387
pkgsBwrapStatic = import inp.nixpkgsOld {
inherit system crossSystem;
overlays = [(curr: prev: {
musl = pkgsUnstableCached.musl;
bwrap = pkgsBwrapStatic.pkgsStatic.bubblewrap.overrideAttrs (_:{
# TODO: enable priv mode setuid to improve compatibility
configureFlags = _.configureFlags ++ [
# "--with-priv-mode=setuid"
];
});
})];
};
pkgs = import inp.nixpkgs { inherit system crossSystem; };
pkgsUnstable = import inp.nixpkgsUnstable { inherit system crossSystem; };
pkgsCached = if crossSystem == null then pkgs else import inp.nixpkgs { system = crossSystem; };
pkgsUnstableCached = if crossSystem == null then pkgs else import inp.nixpkgsUnstable { system = crossSystem; };

# the static proot built with nix somehow didn't work on other systems,
# therefore using the proot static build from proot gitlab
proot = if crossSystem != null then throw "fix proot for crossSytem" else import ./proot/gitlab.nix { inherit pkgs; };
in
pkgs.callPackage ./default.nix rec {

inherit pkgs;
inherit pkgs proot;

# frankensteined static bubblewrap
bwrap = pkgsBwrapStatic.pkgsStatic.bwrap;
bwrap = pkgsUnstable.pkgsStatic.bubblewrap;

nix = pkgsCached.nixFlakes.overrideAttrs (_:{
patches = [ ./nix-nfs.patch ];
nix = pkgs.nixFlakes.overrideAttrs (_:{
patches = (_.patches or []) ++ [ ./nix-nfs.patch ];
});

# the static proot built with nix somehow didn't work on other systems,
# therefore using the proot static build from proot gitlab
proot = if crossSystem != null then throw "fix proot for crossSytem" else import ./proot/gitlab.nix { inherit pkgs; };

busybox = pkgsCached.busybox;
compression = "xz -1 -T $(nproc)";
gnutar = pkgs.pkgsStatic.gnutar;
Expand All @@ -57,7 +40,6 @@
nixpkgsSrc = pkgs.path;
perl = pkgs.pkgsBuildBuild.perl;
xz = pkgs.pkgsStatic.xz;
zstd = pkgs.pkgsStatic.zstd;
};

in
Expand Down
5 changes: 2 additions & 3 deletions proot/nixpkgs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let
];
});
};
overlayedPkgs = import pkgs.path { overlays = [overlay]; };
overlayedPkgs = import pkgs.path { overlays = [overlay]; inherit (pkgs) system; };
static = overlayedPkgs.pkgsStatic;
proot = static.proot.override { enablePython = false; };
in
Expand All @@ -23,9 +23,8 @@ proot.overrideAttrs (old:{
rev = "8c0ccf7db18b5d5ca2f47e1afba7897fb1bb39c0";
sha256 = "sha256-vFdUH1WrW6+MfdlW9s+9LOhk2chPxKJUjaFy01+r49Q=";
};
buildInputs = with static; [ talloc ];
nativeBuildInputs = with static; old.nativeBuildInputs ++ [
libarchive.dev ncurses pkg-config
libarchive.dev pkg-config
];
PKG_CONFIG_PATH = [
"${static.libarchive.dev}/lib/pkgconfig"
Expand Down

0 comments on commit b2a7c83

Please sign in to comment.