refactor package layout to conform better with NUR expectations

This commit is contained in:
Colin 2023-05-02 01:19:16 +00:00
parent 7d581f93cc
commit 2450bb6f06
96 changed files with 170 additions and 122 deletions

View File

@ -0,0 +1,20 @@
# Nix User Repository (NUR)
# - <https://github.com/nix-community/NUR>
#
# this file is not reachable from the top-level of my nixos configs (i.e. toplevel flake.nix)
# nor is it intended for anyone who wants to reference my config directly
# (consider the toplevel flake.nix outputs instead).
#
# rather, this is the entrypoint through which NUR finds my packages, modules, overlays.
# it's reachable only from those using this repo via NUR.
{ pkgs }:
let
sanePkgs = import ../../pkgs/additional pkgs;
in
({
overlays.pkgs = import ../../overlays/pkgs.nix;
pkgs = sanePkgs;
modules = import ../../modules { inherit (pkgs) lib; };
lib = import ../../modules/lib { inherit (pkgs) lib; };
} // sanePkgs)

View File

@ -1,4 +1,4 @@
{ lib, utils, ... }:
{ lib, ... }:
{
imports = [
@ -15,7 +15,7 @@
];
_module.args = {
sane-lib = import ./lib { inherit lib utils; };
sane-lib = import ./lib { inherit lib; };
sane-data = import ./data { inherit lib; };
};
}

View File

@ -1,12 +1,12 @@
{ lib, ... }@moduleArgs:
{ lib, ... }:
let
sane-lib = rec {
feeds = import ./feeds.nix moduleArgs;
fs = import ./fs.nix moduleArgs;
merge = import ./merge.nix ({ inherit sane-lib; } // moduleArgs);
path = import ./path.nix moduleArgs;
types = import ./types.nix moduleArgs;
feeds = import ./feeds.nix { inherit lib; };
fs = import ./fs.nix { inherit lib; };
merge = import ./merge.nix { inherit lib sane-lib; };
path = import ./path.nix { inherit lib; };
types = import ./types.nix { inherit lib; };
# re-exports
inherit (merge) mkTypedMerge;

View File

@ -1,4 +1,4 @@
{ lib, utils, ... }:
{ lib, ... }:
let path = rec {

View File

@ -1,64 +1,24 @@
(next: prev:
with next;
let
sane = rec {
sane-lib = import ../modules/lib next;
#### my own, non-upstreamable packages:
static-nix-shell = callPackages ../pkgs/static-nix-shell { };
sane-scripts = callPackage ../pkgs/sane-scripts { };
mx-sanebot = callPackage ../pkgs/mx-sanebot { };
feeds = recurseIntoAttrs (callPackage ../pkgs/feeds { });
tow-boot-pinephone = callPackage ../pkgs/tow-boot-pinephone { };
tow-boot-rpi4 = callPackage ../pkgs/tow-boot-rpi4 { };
bootpart-uefi-x86_64 = callPackage ../pkgs/bootpart-uefi-x86_64 { };
bootpart-tow-boot-rpi-aarch64 = callPackage ../pkgs/bootpart-tow-boot-rpi-aarch64 { };
bootpart-u-boot-rpi-aarch64 = callPackage ../pkgs/bootpart-u-boot-rpi-aarch64 { };
rtl8723cs-firmware = callPackage ../pkgs/rtl8723cs-firmware { };
linux-megous = callPackage ../pkgs/linux-megous {
kernelPatches = [
prev.kernelPatches.bridge_stp_helper
prev.kernelPatches.request_key_helper
];
};
sublime-music-mobile = callPackage ../pkgs/sublime-music-mobile { };
#### customized packages
fluffychat-moby = callPackage ../pkgs/fluffychat-moby { };
gpodder-configured = callPackage ../pkgs/gpodder-configured { };
# jackett doesn't allow customization of the bind address: this will probably always be here.
jackett = callPackage ../pkgs/jackett { inherit (prev) jackett; };
# mozilla keeps nerfing itself and removing configuration options
firefox-unwrapped = callPackage ../pkgs/firefox-unwrapped { inherit (prev) firefox-unwrapped; };
# patch rpi uboot with something that fixes USB HDD boot
ubootRaspberryPi4_64bit = callPackage ../pkgs/ubootRaspberryPi4_64bit { };
gocryptfs = callPackage ../pkgs/gocryptfs { inherit (prev) gocryptfs; };
browserpass = callPackage ../pkgs/browserpass { inherit (prev) browserpass; };
fractal-latest = callPackage ../pkgs/fractal-latest { };
#### TEMPORARY: PACKAGES WAITING TO BE UPSTREAMED
cargo-docset = callPackage ../pkgs/cargo-docset { };
additional = import ../pkgs/additional next;
python-packages = {
pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [
(py-final: py-prev: {
feedsearch-crawler = py-final.callPackage ../pkgs/feedsearch-crawler { };
})
(py-final: py-prev: import ../pkgs/python-packages { inherit (py-prev) callPackage; })
];
kaiteki = callPackage ../pkgs/kaiteki { };
lightdm-mobile-greeter = callPackage ../pkgs/lightdm-mobile-greeter { };
browserpass-extension = callPackage ../pkgs/browserpass-extension { };
gopass-native-messaging-host = callPackage ../pkgs/gopass-native-messaging-host { };
tokodon = prev.libsForQt5.callPackage ../pkgs/tokodon { };
# provided by nixpkgs patch or upstream preview
# splatmoji = callPackage ../pkgs/splatmoji { };
};
# to avoid infinite recursion, the patched packages require *unpatched* inputs,
# but we don't want to just send `prev` naively, else patched packages might
# take dependencies on unpatched versions of other packages we patch; or they
# won't be able to use inputs from `additional`, etc.
#
# so, call the patched packages using the `next` package set, except with
# they packages we're "about to" patch replaced with their versions from `prev`.
#
# we could alternatively pass `pkgs = prev // { inherit (next) callPackage; }`,
patched = import ../pkgs/patched (next // patchedInputs);
patchedInputs = builtins.mapAttrs (name: _patched: prev."${name}") patched;
sane = additional // python-packages // patched;
in sane // { inherit sane; }
)

View File

@ -0,0 +1,35 @@
# { callPackage, callPackages, libsForQt5, pkgs, recurseIntoAttrs }:
pkgs:
let
inherit (pkgs) callPackage callPackages libsForQt5 recurseIntoAttrs;
in {
sane-lib = import ../../modules/lib pkgs;
bootpart-tow-boot-rpi-aarch64 = callPackage ./bootpart-tow-boot-rpi-aarch64 { };
bootpart-u-boot-rpi-aarch64 = callPackage ./bootpart-u-boot-rpi-aarch64 { };
bootpart-uefi-x86_64 = callPackage ./bootpart-uefi-x86_64 { };
browserpass-extension = callPackage ./browserpass-extension { };
cargo-docset = callPackage ./cargo-docset { };
feeds = recurseIntoAttrs (callPackage ./feeds { });
fluffychat-moby = callPackage ./fluffychat-moby { };
fractal-latest = callPackage ./fractal-latest { };
gopass-native-messaging-host = callPackage ./gopass-native-messaging-host { };
gpodder-configured = callPackage ./gpodder-configured { };
kaiteki = callPackage ./kaiteki { };
lightdm-mobile-greeter = callPackage ./lightdm-mobile-greeter { };
linux-megous = callPackage ./linux-megous { };
mx-sanebot = callPackage ./mx-sanebot { };
rtl8723cs-firmware = callPackage ./rtl8723cs-firmware { };
sane-scripts = callPackage ./sane-scripts { };
static-nix-shell = callPackages ./static-nix-shell { };
sublime-music-mobile = callPackage ./sublime-music-mobile { };
tokodon = libsForQt5.callPackage ./tokodon { };
tow-boot-pinephone = callPackage ./tow-boot-pinephone { };
tow-boot-rpi4 = callPackage ./tow-boot-rpi4 { };
# patch rpi uboot with something that fixes USB HDD boot
ubootRaspberryPi4_64bit = callPackage ./ubootRaspberryPi4_64bit { };
# provided by nixpkgs patch or upstream PR
# splatmoji = callPackage ./splatmoji { };
}

View File

@ -1,4 +1,13 @@
{ lib, buildPackages, fetchFromGitHub, perl, buildLinux, nixosTests, modDirVersionArg ? null, ... } @ args:
{ lib
, buildLinux
, buildPackages
, fetchFromGitHub
, kernelPatches
, modDirVersionArg ? null
, nixosTests
, perl
, ...
} @ args:
with lib;
@ -15,6 +24,11 @@ in buildLinux (args // rec {
# branchVersion needs to be x.y
extraMeta.branch = versions.majorMinor version;
kernelPatches = [
kernelPatches.bridge_stp_helper
kernelPatches.request_key_helper
];
src = fetchFromGitHub {
# HOW TO UPDATE:
# - `git fetch` from megous' github.

View File

@ -2,14 +2,12 @@
, lib
, makeWrapper
, python3
, sane-lib
, stdenv
}:
let
inherit (builtins) attrNames attrValues concatStringsSep map typeOf;
inherit (builtins) attrNames attrValues concatStringsSep foldl' map typeOf;
inherit (lib) concatMapAttrs;
inherit (sane-lib) mapToAttrs;
pkgs' = pkgs;
in {
# transform a file which uses `#!/usr/bin/env nix-shell` shebang with a `python3` interpreter
@ -28,10 +26,9 @@ in {
# <value> = package to provide
pkgsToAttrs = prefix: pkgSet: expr: ({
"lambda" = expr: pkgsToAttrs prefix pkgSet (expr pkgSet);
"list" = expr: mapToAttrs (pname: {
name = prefix + pname;
value = pkgSet."${pname}";
}) expr;
"list" = expr: foldl' (acc: pname: acc // {
"${prefix + pname}" = pkgSet."${pname}";
}) {} expr;
"set" = expr: expr;
})."${typeOf expr}" expr;
pyEnv = python3.withPackages (ps: attrValues (

View File

@ -1,48 +0,0 @@
{ lib
, browserpass
, bash
, fetchFromGitea
, gnused
, sane-scripts
, sops
, stdenv
, substituteAll
}:
let
sane-browserpass-gpg = stdenv.mkDerivation {
pname = "sane-browserpass-gpg";
version = "0.1.0";
src = ./.;
inherit bash gnused sops;
sane_scripts = sane-scripts;
installPhase = ''
mkdir -p $out/bin
substituteAll ${./sops-gpg-adapter} $out/bin/gpg
chmod +x $out/bin/gpg
ln -s $out/bin/gpg $out/bin/gpg2
'';
};
in
(browserpass.overrideAttrs (upstream: {
src = fetchFromGitea {
domain = "git.uninsane.org";
owner = "colin";
repo = "browserpass-native";
# don't forcibly append '.gpg'
rev = "d3ef88e12cb127914fb0ead762b7baee6913592f";
hash = "sha256-FRnFmCJI/1f92DOI1VXSPivSBzIR372gmgLUfLLiuPc=";
};
installPhase = ''
make install
wrapProgram $out/bin/browserpass \
--prefix PATH : ${lib.makeBinPath [ sane-browserpass-gpg ]}
# This path is used by our firefox wrapper for finding native messaging hosts
mkdir -p $out/lib/mozilla/native-messaging-hosts
ln -s $out/lib/browserpass/hosts/firefox/*.json $out/lib/mozilla/native-messaging-hosts
'';
}))

View File

@ -0,0 +1,48 @@
{ lib
, browserpass
, bash
, fetchFromGitea
, gnused
, sane-scripts
, sops
, stdenv
, substituteAll
}:
let
sane-browserpass-gpg = stdenv.mkDerivation {
pname = "sane-browserpass-gpg";
version = "0.1.0";
src = ./.;
inherit bash gnused sops;
sane_scripts = sane-scripts;
installPhase = ''
mkdir -p $out/bin
substituteAll ${./sops-gpg-adapter} $out/bin/gpg
chmod +x $out/bin/gpg
ln -s $out/bin/gpg $out/bin/gpg2
'';
};
in
browserpass.overrideAttrs (upstream: {
src = fetchFromGitea {
domain = "git.uninsane.org";
owner = "colin";
repo = "browserpass-native";
# don't forcibly append '.gpg'
rev = "d3ef88e12cb127914fb0ead762b7baee6913592f";
hash = "sha256-FRnFmCJI/1f92DOI1VXSPivSBzIR372gmgLUfLLiuPc=";
};
installPhase = ''
make install
wrapProgram $out/bin/browserpass \
--prefix PATH : ${lib.makeBinPath [ sane-browserpass-gpg ]}
# This path is used by our firefox wrapper for finding native messaging hosts
mkdir -p $out/lib/mozilla/native-messaging-hosts
ln -s $out/lib/browserpass/hosts/firefox/*.json $out/lib/mozilla/native-messaging-hosts
'';
})

18
pkgs/patched/default.nix Normal file
View File

@ -0,0 +1,18 @@
pkgs:
let
inherit (pkgs) callPackage;
in {
# XXX: the `inherit`s here are because:
# - pkgs.callPackage draws from the _final_ package set.
# - pkgs.XYZ draws (selectively) from the _previous_ package set.
# see <overlays/pkgs.nix>
browserpass = callPackage ./browserpass { inherit (pkgs) browserpass; };
# mozilla keeps nerfing itself and removing configuration options
firefox-unwrapped = callPackage ./firefox-unwrapped { inherit (pkgs) firefox-unwrapped; };
gocryptfs = callPackage ./gocryptfs { inherit (pkgs) gocryptfs; };
# jackett doesn't allow customization of the bind address: this will probably always be here.
jackett = callPackage ./jackett { inherit (pkgs) jackett; };
}

View File

@ -0,0 +1,4 @@
{ callPackage }:
{
feedsearch-crawler = callPackage ./feedsearch-crawler { };
}