Skip to content

Instantly share code, notes, and snippets.

@jakobrs
Last active May 24, 2020 14:46
Show Gist options
  • Save jakobrs/56d929e751fec1e6e472fea055753f98 to your computer and use it in GitHub Desktop.
Save jakobrs/56d929e751fec1e6e472fea055753f98 to your computer and use it in GitHub Desktop.
with import <nixpkgs> {};
let
original = with import <nixpkgs/nixos> { configuration = import ./file.nix; }; config.system.build.isoImage;
rot13 = callPackage ./rot13.nix {};
first-layer = rot13 {
name = "first-layer";
from = original;
};
second-layer = rot13 {
name = "second-layer";
from = first-layer;
};
in second-layer
{ lib, ... }:
{
imports = [
<nixos/nixos/modules/installer/cd-dvd/installation-cd-graphical-plasma5-new-kernel.nix>
];
fileSystems."/" = lib.mkForce {
device = "/dev/disk/by-label/btrfs-files";
fsType = "btrfs";
options = [ "subvol=root" ];
};
fileSystems."/nix/var" = {
device = "tmpfs";
fsType = "tmpfs";
neededForBoot = true;
};
/* Alternatively
fileSystems."/nix/.rw-store" = lib.mkForce {
device = "/dev/disk/by-label/btrfs-files";
fsType = "btrfs";
neededForBoot = true;
};
*/
virtualisation.virtualbox.host.enable = true;
}
{ stdenv, writeScript, bsdgames }:
{ from, name ? "${from.name}-rot13" }:
stdenv.mkDerivation {
inherit name from;
buildInputs = [ bsdgames ];
builder = writeScript "builder.sh" ''
source $stdenv/setup
mkdir $out
cd $from
for file in $(find *); do
echo "Processing: $file"
if [ -d "$file" ]; then
mkdir "$out/$file";
else
rot13 <$file >$out/$file
fi
done
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment