1

Nixos: Move deprecated modules/derivation to separate folder

This commit is contained in:
2024-10-12 12:34:42 +02:00
parent 12443de899
commit f4992a38f4
36 changed files with 2 additions and 18 deletions

View File

@ -0,0 +1,26 @@
{
lib,
stdenv,
src,
}:
stdenv.mkDerivation {
pname = "adwaita-for-steam";
version = "unstable";
inherit src;
dontConfigure = true;
dontBuild = true;
doCheck = false;
installPhase = ''
mkdir -p $out/share/adwaita-for-steam
cp -r Adwaita $out/share/adwaita-for-steam/
'';
meta = with lib; {
description = "A GNOME theme for Steam";
homepage = "https://github.com/tkashkin/Adwaita-for-Steam";
license = licenses.mit;
};
}

View File

@ -0,0 +1,30 @@
# We need to wrap the dconf-editor to use the correct XDG_DATA_DIRS
# By default XDG_DATA_DIRS on NixOS contains paths to the gsettings-schemas like
# /nix/store/z3gxkwakzgiswvakfrpbirhpcach509j-mutter-42.3/share/gsettings-schemas/mutter-42.3
# but this is the wrong path for dconf-editor to find the schema, correct one would be
# /nix/store/z3gxkwakzgiswvakfrpbirhpcach509j-mutter-42.3/share/gsettings-schemas/mutter-42.3/glib-2.0/schemas
{pkgs}: let
find-gsettings-schemas = pkgs.callPackage ./find-gsettings-schemas.nix {};
dconf-editor-wrapped = pkgs.writeShellScriptBin "dconf-editor-wrapped" ''
XDG_DATA_DIRS=$(${find-gsettings-schemas}/bin/find-gsettings-schemas) ${pkgs.gnome.dconf-editor}/bin/dconf-editor
'';
desktop-icon = pkgs.makeDesktopItem {
name = "Dconf Editor (Wrapped)";
desktopName = "Dconf Editor (Wrapped)";
exec = "${dconf-editor-wrapped}/bin/dconf-editor-wrapped";
icon = "ca.desrt.dconf-editor";
comment = "Modify the Gnome/GTK settings database";
genericName = "Desktop application to manage Gnome/GTK settings.";
categories = ["GNOME" "GTK" "System"];
};
in
# Combine multiple derivations into a single store path
pkgs.symlinkJoin {
name = "dconf-editor-wrapped";
paths = [
dconf-editor-wrapped
desktop-icon
];
}

View File

@ -0,0 +1,12 @@
{pkgs, ...}:
pkgs.writeShellScriptBin "find-gsettings-schemas" ''
schemas=""
for d in $(ls -1 --ignore "*.drv" /nix/store); do
schemas_dir=$(echo /nix/store/"$d"/share/gsettings-schemas/*)
if [[ -d "$schemas_dir" ]]; then
schemas="$schemas''${schemas:+:}$schemas_dir"
fi
done
echo "$schemas"
''

View File

@ -0,0 +1,64 @@
{
lib,
stdenv,
fetchurl,
fetchFromGitHub,
autoPatchelfHook,
zlib,
bzip2,
ncurses,
gmp,
}: let
resources = fetchFromGitHub {
owner = "decker-edu";
repo = "decker";
rev = "f3a2c918514d59ca611490901926bd078823b93d";
sha256 = "sha256-0gTg9TJ06YCF0lJx9+nVa50+GhmPsvgKIeM8DQr7G9I=";
};
in
stdenv.mkDerivation rec {
pname = "decker";
version = "0.13.4";
src = fetchurl {
url = "https://github.com/decker-edu/decker/releases/download/v0.13.4/${pname}-v${version}-Linux-X64";
sha256 = "sha256-LZ0j2X0zCP9XsWglc488nL25w3VmWh/TYxK1x6K6yOI=";
};
nativeBuildInputs = [
autoPatchelfHook
];
unpackCmd = ''
mkdir -p root
cp $curSrc root/decker
'';
dontBuild = true;
buildInputs = [
stdenv.cc.cc.lib
zlib
bzip2
ncurses
gmp
];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp decker $out/bin/decker
cp -r ${resources}/resource $out/bin/resource
chmod +x $out/bin/decker
runHook postInstall
'';
meta = with lib; {
description = "A tool to create interactive web-based presentations.";
homepage = "https://github.com/decker-edu/decker";
license = licenses.gpl3Only;
platforms = ["x86_64-linux"];
};
}

View File

@ -0,0 +1,62 @@
{
lib,
stdenv,
fetchurl,
autoPatchelfHook,
cups,
libusb1,
}:
stdenv.mkDerivation rec {
pname = "B1160_B1160w_UnifiedLinuxDriver";
version = "1.01";
src = fetchurl {
url = "https://dl.dell.com/FOLDER00947576M/1/${pname}_${version}.tar.gz";
sha256 = "10b75a899ba7aff3b95158f6fc49f09d6eef670608480ee48c179337c5337375";
curlOptsList = ["--user-agent" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:89.0) Gecko/20100101 Firefox/89.0"];
};
# https://nixos.org/manual/nixpkgs/unstable/#setup-hook-autopatchelfhook
# https://nixos.wiki/wiki/Packaging/Binaries
# https://unix.stackexchange.com/questions/522822/different-methods-to-run-a-non-nixos-executable-on-nixos/522823#522823
# TODO: This step does not work
nativeBuildInputs = [
cups
stdenv.cc.cc.lib
libusb1
autoPatchelfHook
];
unpackCmd = ''
mkdir -p root
tar xvf $curSrc --directory=root
'';
# This is already built
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir -p $out
mkdir -p $out/cups
mkdir -p $out/lib
mkdir -p $out/lib64
mkdir -p $out/sbin
cp -r cdroot/Linux/x86_64/at_root/usr/sbin/* $out/sbin/
cp -r cdroot/Linux/x86_64/at_root/usr/lib64/*.so.* $out/lib64/
cp -r cdroot/Linux/x86_64/at_root/usr/lib64/cups/* $out/cups/
cp -r cdroot/Linux/x86_64/at_root/opt/smfp-common/lib/* $out/lib/
runHook postInstall
'';
meta = with lib; {
description = "CUPS driver for the Dell B1160w printer.";
longDescription = "CUPS driver for the Dell B1160w printer.";
homepage = "https://www.dell.com/support/home/de-de/drivers/driversdetails?driverid=1m4pc";
license = licenses.unfree;
platforms = ["x86_64-linux"];
};
}

View File

@ -0,0 +1,32 @@
# Taken from https://github.com/tadfisher/flake/blob/main/pkgs/firefox-gnome-theme/default.nix
# We don't use fetchTarbal or fetchFromGithub because we are using flakes:
# - Specify the firefox-gnome-theme github repo as input in flake.nix
# - We don't need to add sha256 or commit revision because it is automatically locked in flake.lock
# - Pass the input to overlays/default.nix and from there to derivations/default.nix
# - There we plug the input into the src argument of this derivation
{
lib,
stdenv,
src,
}:
stdenv.mkDerivation {
pname = "firefox-gnome-theme";
version = "unstable";
inherit src;
dontConfigure = true;
dontBuild = true;
doCheck = false;
installPhase = ''
mkdir -p $out/share/firefox-gnome-theme
cp -r theme/* $out/share/firefox-gnome-theme
'';
meta = with lib; {
description = "A GNOME theme for Firefox";
homepage = "https://github.com/rafaelmardojai/firefox-gnome-theme";
license = licenses.unlicense;
};
}

View File

@ -0,0 +1,118 @@
# TODO: Can I replicate something similar for the mylib?
{
stdenv,
lib,
pkgs,
mylib,
...
}: let
# create a module that only contains the options, type can be home or system
toModule = type: name: {options.modules.${name} = import ../../${type}/modules/${name}/options.nix {inherit lib mylib;};};
# evaluate a single module
evalModule = type: name: (lib.evalModules {modules = [(toModule type name)];});
# generate a single module doc
optionsDoc = type: name: pkgs.nixosOptionsDoc {options = (evalModule type name).options;};
# copy the markdown for a single generated optionsDoc
optionsMD = type: name:
stdenv.mkDerivation {
src = ./.;
name = "options-doc-${name}";
buildPhase = ''
mkdir $out
cat ${(optionsDoc type name).optionsCommonMark} >> $out/${name}.md
'';
};
# copy the markdown for all generated optionsDocs
allOptionsMDs = let
index = stdenv.mkDerivation {
src = ./.;
name = "modules-options-index-md";
buildPhase = ''
mkdir $out
echo "# Chriphost NixOS Modules Options" >> $out/index.md
'';
};
in
home-modules: system-modules:
pkgs.symlinkJoin {
name = "modules-options-doc-md";
paths = (map (optionsMD "home") home-modules) ++ (map (optionsMD "system") system-modules) ++ [index];
};
# generate the actual package (calls all of the above)
home-modules = [
"audio"
"chromium"
"emacs"
"email"
"firefox"
"fish"
"flatpak"
"gaming"
"helix"
"hyprland"
"kitty"
"misc"
"neovim"
"nextcloud"
"nnn"
"ranger"
"rofi"
"vscode"
"waybar"
];
system-modules = [
"containers"
"systemd-networkd"
];
docs = allOptionsMDs home-modules system-modules;
in
stdenv.mkDerivation {
src = ./.;
name = "modules-options-doc";
# depend on our options doc derivation
buildInput = [docs];
# mkdocs dependencies
nativeBuildInputs = with pkgs; [
mkdocs
python310Packages.mkdocs-material
python310Packages.pygments
];
# TODO: Use a file, this is stupid
# TODO: Fix the navigation sections
# TODO: Customize features
# TODO: Remove or fix ToC
# symlink our generated docs into the correct folder before generating
buildPhase = ''
# configure mkdocs
echo "site_name: Chriphost NixOS Options" >> ./mkdocs.yml
echo "use_directory_urls: false" >> ./mkdocs.yml
echo "theme:" >> ./mkdocs.yml
echo " name: material" >> ./mkdocs.yml
echo " features:" >> ./mkdocs.yml
echo " - navigation.sections" >> ./mkdocs.yml
echo "nav:" >> ./mkdocs.yml
echo " - System:"
echo -e " - ${builtins.concatStringsSep ".md\n - " system-modules}.md" >> ./mkdocs.yml
echo " - Home:"
echo -e " - ${builtins.concatStringsSep ".md\n - " home-modules}.md" >> ./mkdocs.yml
# mkdir ./docs
ln -s ${docs} "./docs"
# generate the site
mkdocs build
'';
# copy the resulting output to the derivation's $out directory
installPhase = ''
mv site $out
'';
}

View File

@ -0,0 +1,99 @@
{
lib,
python310,
fetchFromGitHub,
ffmpeg,
}:
python310.pkgs.buildPythonApplication rec {
pname = "spotdl";
version = "4.1.6";
format = "pyproject";
src = fetchFromGitHub {
owner = "spotDL";
repo = "spotify-downloader";
rev = "v${version}";
hash = "sha256-sKkhZqn386iOKkZ3pzz7YxBPNAfEK9M0Agu+yR6+HsA=";
};
nativeBuildInputs = with python310.pkgs; [
poetry-core
pythonRelaxDepsHook
];
pythonRelaxDeps = true;
propagatedBuildInputs = with python310.pkgs; [
setuptools
spotipy
ytmusicapi
pytube
yt-dlp
mutagen
rich
beautifulsoup4
requests
rapidfuzz
python-slugify
uvicorn
pydantic
fastapi
platformdirs
pykakasi
syncedlyrics
];
nativeCheckInputs = with python310.pkgs; [
pytestCheckHook
pytest-mock
pytest-vcr
pyfakefs
pytest-subprocess
];
preCheck = ''
export HOME=$TMPDIR
'';
disabledTestPaths = [
# require networking
"tests/test_init.py"
"tests/test_matching.py"
"tests/utils/test_m3u.py"
"tests/utils/test_metadata.py"
"tests/utils/test_search.py"
];
disabledTests = [
# require networking
"test_album_from_string"
"test_album_from_url"
"test_album_length"
"test_artist_from_url"
"test_artist_from_string"
"test_convert"
"test_download_ffmpeg"
"test_download_song"
"test_playlist_from_string"
"test_playlist_from_url"
"test_playlist_length"
"test_preload_song"
"test_song_from_search_term"
"test_song_from_url"
];
makeWrapperArgs = [
"--prefix"
"PATH"
":"
(lib.makeBinPath [ffmpeg])
];
meta = with lib; {
description = "Download your Spotify playlists and songs along with album art and metadata";
homepage = "https://github.com/spotDL/spotify-downloader";
changelog = "https://github.com/spotDL/spotify-downloader/releases/tag/v${version}";
license = licenses.mit;
maintainers = with maintainers; [dotlambda];
};
}

View File

@ -0,0 +1,96 @@
# Has a problem with vertically offset UI, replaced by distrho for now but kept as an example
# TODO: Flake derivation
# Damn I hate this style
{
lib,
stdenv,
fetchurl,
dpkg,
autoPatchelfHook,
alsa-lib,
freetype,
gcc,
glib,
glibc,
curlWithGnuTls,
libGL,
libglvnd,
libsecret,
}:
# Adapted from https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=vital-synth
# Example https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/audio/bitwig-studio/bitwig-studio4.nix
let
# Variables from AUR pkgbuild
maintainer = "jackreeds";
pkgname_deb = "VitalInstaller";
in
stdenv.mkDerivation rec {
pname = "vital-synth";
version = "1.0.8";
src = fetchurl {
url = "https://github.com/${maintainer}/${pkgname_deb}/releases/download/${version}/${pkgname_deb}.deb";
sha512 = "829d29a0c41ac9f79ca6d069e2e4f404a501abdcdc487fbb4e1e8afd44bf870c6c41095587c98f810fb946d946179468f8d5f417e67785313152a1613cf4a832";
};
# autoPatchelfHook patches the binary to use the dynamic loader and "tells it" where all the libraries are that
# the program wants to dynamically load at runtime.
# This is necessary because NixOS doesn't have the linux typical static location where these libraries are placed,
# so the binary needs the correct paths to the nix store for each one.
# autoPatchelfHook propagates all the buildInputs so they are available at runtime.
# View also:
# https://nixos.org/manual/nixpkgs/unstable/#setup-hook-autopatchelfhook
# https://nixos.wiki/wiki/Packaging/Binaries
# https://unix.stackexchange.com/questions/522822/different-methods-to-run-a-non-nixos-executable-on-nixos/522823#522823
nativeBuildInputs = [
dpkg
autoPatchelfHook
];
# We downloaded a .deb file, unpack it to root = [ usr/bin usr/lib usr/share ]
unpackCmd = ''
mkdir -p root
dpkg-deb -x $curSrc root
'';
# This is already built
dontBuild = true;
# From AUR pkgbuild:
# depends=('alsa-lib>=1.0.16' 'freetype2>=2.2.1' 'gcc-libs' 'gcc>=3.3.1' 'glib2>=2.12.0' 'glibc>=2.17'
# 'libcurl-gnutls>=7.16.2' 'libgl' 'libglvnd' 'libsecret>=0.7')
buildInputs = [
alsa-lib
freetype
gcc.cc.lib
gcc.cc
glib
glibc
curlWithGnuTls
libGL
libglvnd
libsecret
];
# Copy the contents of the .deb package to the $out directory that nix creates for built derivations
# Very simple as the vital .deb has a very basic format (only [ usr/bin usr/lib usr/share ])
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r usr/* $out/
chmod +x $out/bin/vital
runHook postInstall
'';
meta = with lib; {
description = "A wavetable synthesizer.";
longDescription = ''
Powerful wavetable synthesizer with realtime modulation feedback.
Vital is a MIDI enabled polyphonic music synthesizer with an easy to use
parameter modulation system with real-time graphical feedback.
'';
homepage = "https://vital.audio/";
license = licenses.gpl3Only;
platforms = ["x86_64-linux"];
};
}

View File

@ -0,0 +1,85 @@
{
lib,
stdenv,
pkgs,
fetchurl,
fetchFromGitHub,
gsettings-desktop-schemas,
gtk3,
}:
# TODO: This doesn't run. Why does it work like this (APPIMAGE_DEBUG_EXEC=bash appimage-run WiiUDownloader-Linux-x86_64.AppImage) though?
# pkgs.appimageTools.wrapType2 rec {
# name = "WiiUDownloader";
# version = "v1.32";
# src = fetchurl {
# url = "https://github.com/Xpl0itU/WiiUDownloader/releases/download/${version}/WiiUDownloader-Linux-x86_64.AppImage";
# sha256 = "sha256-YWLQd/Wmz5BDyc+oe6JQkT849DaPc5HtJXIDZKUdHNE=";
# };
# profile = ''
# export XDG_DATA_DIRS=${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}:${gtk3}/share/gsettings-schemas/${gtk3.name}:$XDG_DATA_DIRS
# '';
# # extraPkgs = pkgs: with pkgs; [
# # ];
# }
let
titlesfile = fetchurl {
url = "https://napi.nbg01.v10lator.de/db";
sha256 = "sha256-BQl1/AcDEqkFSQdbA2/2AFthUirB5G3oD8rtu2lSUuw=";
curlOptsList = ["--user-agent" "NUSspliBuilder/2.1"];
};
wiiu-downloader = stdenv.mkDerivation {
name = "WiiUDownloader";
src = fetchFromGitHub {
owner = "Xpl0itU";
repo = "WiiUDownloader";
rev = "v1.32";
# NOTE: When supplying the hash without submodules for fetchFromGitHub with fetchSubmodules = true, the derivation
# will just fail, without a hash mismatch but empty submodule directories!!!
sha256 = "sha256-R3FiNiK27Q2x5HbHmWw3F4LPJNKz5BAoOyl4fYAEQlc=";
fetchSubmodules = true;
};
nativeBuildInputs = with pkgs; [
gcc
gnumake
cmake
pkg-config
python310
];
buildInputs = with pkgs; [
gsettings-desktop-schemas
gtk3
gtkmm3
mbedtls
curl
];
dontUseCmakeConfigure = true;
patches = [
./gtitles.patch
];
buildPhase = ''
cp ${titlesfile} src/gtitles.c
python build.py
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp build/WiiUDownloader $out/bin
runHook postInstall
'';
};
in
pkgs.writeShellScriptBin "wiiu-downloader-wrapped" ''
XDG_DATA_DIRS="${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}:${gtk3}/share/gsettings-schemas/${gtk3.name}:$XDG_DATA_DIRS" ${wiiu-downloader}/bin/WiiUDownloader
''

View File

@ -0,0 +1,31 @@
diff --git a/build.py b/build.py
index 16ae162..7305a04 100644
--- a/build.py
+++ b/build.py
@@ -5,17 +5,17 @@ import urllib.request
# Don't edit below this line
-def checkAndDeleteFile(file):
- if os.path.exists(file):
- print(f"Deleting {file}")
- os.remove(file)
+# def checkAndDeleteFile(file):
+# if os.path.exists(file):
+# print(f"Deleting {file}")
+# os.remove(file)
-opener = urllib.request.build_opener()
-opener.addheaders = [("User-agent", "NUSspliBuilder/2.1")]
-urllib.request.install_opener(opener)
+# opener = urllib.request.build_opener()
+# opener.addheaders = [("User-agent", "NUSspliBuilder/2.1")]
+# urllib.request.install_opener(opener)
-checkAndDeleteFile("src/gtitles.c")
-urllib.request.urlretrieve("https://napi.nbg01.v10lator.de/db", "src/gtitles.c")
+# checkAndDeleteFile("src/gtitles.c")
+# urllib.request.urlretrieve("https://napi.nbg01.v10lator.de/db", "src/gtitles.c")
try:
os.mkdir("build")

View File

@ -0,0 +1,67 @@
# NOTE: Adapted from nixpkgs xdg-desktop-portal-wlr derivation
{
lib,
stdenv,
fetchFromGitHub,
fetchpatch,
makeWrapper,
meson,
ninja,
pkg-config,
wayland-protocols,
wayland-scanner,
# , grim
inih,
libdrm,
mesa,
pipewire,
scdoc,
# , slurp
systemd,
wayland,
}:
stdenv.mkDerivation rec {
pname = "xdg-desktop-portal-termfilechooser";
version = "0.1.0";
src = fetchFromGitHub {
owner = "GermainZ";
repo = pname;
rev = "71dc7ab06751e51de392b9a7af2b50018e40e062"; # Was last commit on 17.04.2023
sha256 = "sha256-645hoLhQNncqfLKcYCgWLbSrTRUNELh6EAdgUVq3ypM=";
};
# scdoc: mark as build-time dependency
# https://github.com/emersion/xdg-desktop-portal-wlr/pull/248
# patches = [(fetchpatch {
# url = "https://github.com/emersion/xdg-desktop-portal-wlr/commit/92ccd62428082ba855e359e83730c4370cd1aac7.patch";
# hash = "sha256-mU1whfp7BoSylaS3y+YwfABImZFOeuItSXCon0C7u20=";
# })];
# Add hyprland to portal metainformation
patches = [
(fetchpatch {
url = "https://patch-diff.githubusercontent.com/raw/GermainZ/xdg-desktop-portal-termfilechooser/pull/6.patch";
hash = "sha256-GjK6GL15liHYm5U0XBSIf5H8Cc4RIWBD0O47lLWcep0=";
})
];
strictDeps = true;
depsBuildBuild = [pkg-config];
nativeBuildInputs = [meson ninja pkg-config scdoc wayland-scanner makeWrapper];
buildInputs = [inih libdrm mesa pipewire systemd wayland wayland-protocols];
mesonFlags = [
"-Dsd-bus-provider=libsystemd"
];
# postInstall = ''
# wrapProgram $out/libexec/xdg-desktop-portal-termfilechooser --prefix PATH ":" ${lib.makeBinPath [ grim slurp ]}
# '';
meta = with lib; {
homepage = "https://github.com/GermainZ/xdg-desktop-portal-termfilechooser";
platforms = platforms.linux;
license = licenses.mit;
};
}