initial commit

This commit is contained in:
Charlotte 🦝 Delenk 2022-04-01 14:11:16 +01:00
commit fa2d43d85d
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122
6 changed files with 122 additions and 0 deletions

5
README.md Normal file
View file

@ -0,0 +1,5 @@
# Cursed Idea
What if I made The Sims 2 a nix derivation
Requires the original ISOs and product keys to be stored in the nix-store

16
flake.nix Normal file
View file

@ -0,0 +1,16 @@
{
inputs = {
nixpkgs.url = github:NixOS/nixpkgs;
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, ... }: flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let
pkgs = import nixpkgs {
inherit system;
};
in
rec {
packages = pkgs.callPackage./pkgs/merged.nix { };
hydraJobs = packages;
});
}

32
pkgs/disks.nix Normal file
View file

@ -0,0 +1,32 @@
# Raw ISO
{ emptyDirectory, p7zip, stdenvNoCC, ... }:
let
build_iso = args: stdenvNoCC.mkDerivation ({
buildPhase = ''
echo "You need to manually add the iso to the nix store"
exit 1
'';
outputHashAlgo = "sha256";
outputHashMode = "flat";
} // args);
in
rec {
isos = {
sims2-cd1 = build_iso {
name = "Sims2_1.iso";
outputHash = "19l3xblr5ay3ym2iwfyaksfnxisbhk9cgz876j4hs0hr1876bpp5";
};
sims2-cd2 = build_iso {
name = "Sims2_2.iso";
outputHash = "1d4bn02fmanh3y42lbdg6212wdzkdyfwv9fzb3v06szy263ig567";
};
sims2-cd3 = build_iso {
name = "Sims2_3.iso";
outputHash = "0612rzmjzwmqkr2rdrc9pvbiwqbcv2220dlnwaxjcf4fiw3s070a";
};
sims2-cd4 = build_iso {
name = "Sims2_4.iso";
outputHash = "0g6pjwrfb8v7fc2bnflv35iz68scgylx4yd1pq8lj09560bh3iq0";
};
};
}

38
pkgs/extracted.nix Normal file
View file

@ -0,0 +1,38 @@
# Disk extraction
{ emptyDirectory, p7zip, libarchive, stdenvNoCC, callPackage }:
let
isos = (callPackage ./disks.nix { }).isos;
extract_iso = iso: stdenvNoCC.mkDerivation {
name = "${iso.name}-extracted";
nativeBuildInputs = [
p7zip
];
buildPhase = "true";
src = emptyDirectory;
installPhase = ''
mkdir $out
cd $out
7z x ${iso}
'';
};
extract_compressed_zip = iso_ex: stdenvNoCC.mkDerivation {
name = "${iso_ex.name}-extracted";
nativeBuildInputs = [
libarchive
];
buildPhase = "true";
src = iso_ex;
installPhase = ''
mkdir $out
cd $out
bsdtar -xvvf $src/compressed.zip
if [ -f $src/en-us_compressed.zip ]; then
bsdtar -xvvf $src/en-us_compressed.zip
fi
'';
};
in
rec {
extracted_iso = builtins.mapAttrs (_: extract_iso) isos;
extracted_all = builtins.mapAttrs (_: extract_compressed_zip) extracted_iso;
}

19
pkgs/merged.nix Normal file
View file

@ -0,0 +1,19 @@
{ callPackage, symlinkJoin }:
let
extracted = callPackage ./extracted.nix { };
in
{
sims2 = symlinkJoin {
name = "The Sims 2";
paths = [
extracted.extracted_all.sims2-cd1
extracted.extracted_iso.sims2-cd1
extracted.extracted_all.sims2-cd2
extracted.extracted_iso.sims2-cd2
extracted.extracted_all.sims2-cd3
extracted.extracted_iso.sims2-cd3
extracted.extracted_all.sims2-cd4
extracted.extracted_iso.sims2-cd4
];
};
}

12
pkgs/wineprefix.nix Normal file
View file

@ -0,0 +1,12 @@
{ emptyDirectory, stdenvNoCC, wineWowPackages }:
stdenvNoCC.mkDerivation {
name = "wine-prefix-base";
src = emptyDirectory;
buildPhase = "true";
nativeBuildInputs = [ wineWowPackages.staging ];
installPhase = ''
mkdir -p $out
export WINEPREFIX=$out/pfx
wineboot -i
'';
}