About
History
New snippet →
Upload snippet →
Snippet #2345 (by symphorien, yaml)
#2345
Expires in: 0 minutes
View Raw
#builder.sh:
# #!/bin/sh
# <$file $bsdgames/bin/rot13 > $out
with import <nixpkgs> {};
let
squashfsTools = pkgs.squashfsTools.override { lz4Support = true; };
mkSquashFs = settings
: contents
:
stdenv.mkDerivation {
name = "squashfs.img";
nativeBuildInputs = [ squashfsTools ];
buildCommand = ''
closureInfo=${closureInfo { rootPaths = contents; }}
mksquashfs $(cat $closureInfo/store-paths) $out \
-keep-as-directory -all-root -b 1048576 ${settings}
'';
};
mkSquashFsLz4 = mkSquashFs "-comp lz4 -Xhc";
image = mkSquashFsLz4 [ bash ];
rot13 = file
:
derivation {
name = file.name + "-rot13";
inherit file;
bsdgames = pkgsi686Linux.bsdgames;
system = builtins.currentSystem;
builder = ./builder.sh;
allowedReferences = [];
preferLocalBuild = true;
};
in
rot13 (rot13 image)
# the first rot13 derivation has no reference
# the second will scan for references among its inputs:
# * (rot13 image) which has no references
# * 32 bit bsdgames and its deps
# This will build iff the squash image does not reference any of the runtime
# dependencies of the 32bit bsdgame. That's why I use a 32 bit bsdgames, otherwise
# they have glibc in common.
Wrap long lines
Reply to this snippet →
Honeypot, don't fill.
#builder.sh: # #!/bin/sh # <$file $bsdgames/bin/rot13 > $out with import <nixpkgs> {}; let squashfsTools = pkgs.squashfsTools.override { lz4Support = true; }; mkSquashFs = settings: contents: stdenv.mkDerivation { name = "squashfs.img"; nativeBuildInputs = [ squashfsTools ]; buildCommand = '' closureInfo=${closureInfo { rootPaths = contents; }} mksquashfs $(cat $closureInfo/store-paths) $out \ -keep-as-directory -all-root -b 1048576 ${settings} ''; }; mkSquashFsLz4 = mkSquashFs "-comp lz4 -Xhc"; image = mkSquashFsLz4 [ bash ]; rot13 = file: derivation { name = file.name + "-rot13"; inherit file; bsdgames = pkgsi686Linux.bsdgames; system = builtins.currentSystem; builder = ./builder.sh; allowedReferences = []; preferLocalBuild = true; }; in rot13 (rot13 image) # the first rot13 derivation has no reference # the second will scan for references among its inputs: # * (rot13 image) which has no references # * 32 bit bsdgames and its deps # This will build iff the squash image does not reference any of the runtime # dependencies of the 32bit bsdgame. That's why I use a 32 bit bsdgames, otherwise # they have glibc in common.
Text (preformatted)
Text (not code)
----------
ABAP
ApacheConf
AppleScript
ActionScript
Bash
BBCode
C
Clojure
COBOL
CSS
CUDA
Dart
Delphi
Diff
Django
Erlang
Fortran
Go
Groovy
Haml
Haskell
HTML
HTTP
INI
IRC
Java
JavaScript
JSON
Lua
Makefile
Mako
Mason
Matlab
Modula
Monkey
MySQL
NumPy
OCaml
Perl
PHP
PostScript
PowerShell
Prolog
Properties
Puppet
Python
Ruby
reStructuredText
Rust
Sass
Scala
Scheme
Scilab
SCSS
Smalltalk
Smarty
SQL
Tcl
Tcsh
TeX
Text (Preformatted)
Text (non-code)
VB.net
VimL
XML
XQuery
XSLT
YAML
Author:
⌘+⏎ or Ctrl+⏎
Expire in
One Time Snippet
In one hour
In one week
In one month