diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..5c7ef0e --- /dev/null +++ b/default.nix @@ -0,0 +1,22 @@ +{ + config, + lib, + pkgs, + ... +}: let + creamlinux = pkgs.callPackage (./package.nix) {}; +in { + options.cfg.gaming = { + creamlinux.enable = lib.mkOption { + type = lib.types.bool; + default = false; + description = "Enables creamlinux-installer."; + }; + }; + + config = { + home.packages = with pkgs; [ + (lib.mkIf config.cfg.gaming.creamlinux.enable creamlinux) + ]; + }; +} diff --git a/package.nix b/package.nix new file mode 100644 index 0000000..181c3d2 --- /dev/null +++ b/package.nix @@ -0,0 +1,53 @@ +{ + pkgs, + fetchFromGitHub, +}: let + pythonEnv = pkgs.python3.withPackages (ps: + with ps; [ + requests + zipfile2 + tqdm + rich + ]); +in + pkgs.stdenv.mkDerivation rec { + pname = "creamlinux"; + version = "1.0.9"; + + src = fetchFromGitHub { + owner = "Novattz"; + repo = "creamlinux-installer"; + # rev = "v${version}"; + rev = "f9e7c2f614d45d3c286692ea9f0356788c515103"; + sha256 = "sha256-ej61Kl9TLnUh1HWbQ2PLV1n6hNeWcN2MHxqCvZ1jOpc="; + }; + + buildInputs = [pythonEnv]; + + # Apply local patch file + patches = [./001-use-xdg.patch]; + + buildPhase = "true"; + + installPhase = '' + mkdir -p $out/{bin,lib/${pname}} + + cp *.py $out/lib/${pname}/ + + sed -i '1i #!/usr/bin/env python3' $out/lib/${pname}/main.py + chmod +x $out/lib/${pname}/main.py + + # Create wrapper that adds --no-update + cat > $out/bin/${pname} <