Better packaging of extra packages

Split into different files and use callPackage to build them. Also add
them to a 'package' attribute in the flake, to be able to call them
outside.
This commit is contained in:
Quentin Boyer 2022-11-20 18:37:35 +01:00
parent e519da4d3a
commit e3e0011cf0
8 changed files with 137 additions and 32 deletions

View file

@ -16,21 +16,28 @@
zsh-traxys = {
url = "github:traxys/zsh-flake";
};
xdg-ninja = {
url = "github:traxys/xdg-ninja";
flake = false;
};
rust-overlay.url = "github:oxalica/rust-overlay";
naersk.url = "github:nix-community/naersk";
comma.url = "github:nix-community/comma";
raclette.url = "github:traxys/raclette";
poetry2nix.url = "github:nix-community/poetry2nix";
nur.url = "github:nix-community/NUR";
# Extra Package Sources
simulationcraft = {
url = "github:simulationcraft/simc";
flake = false;
};
oscclip = {
url = "github:rumpelsepp/oscclip";
flake = false;
};
kabalist = {
url = "github:traxys/kabalist";
flake = false;
};
comma.url = "github:nix-community/comma";
raclette.url = "github:traxys/raclette";
poetry2nix.url = "github:nix-community/poetry2nix";
oscclip = {
url = "github:rumpelsepp/oscclip";
xdg-ninja = {
url = "github:b3nj5m1n/xdg-ninja";
flake = false;
};
};
@ -40,13 +47,27 @@
home-manager,
nixpkgs,
...
} @ inputs: {
} @ inputs: let
sources =
{
inherit (inputs) oscclip xdg-ninja simulationcraft kabalist;
}
// (nixpkgs.legacyPackages.x86_64-linux.callPackage ./_sources/generated.nix {});
in {
templates = {
rust = {
path = ./templates/rust;
description = "My rust template using rust-overlay and direnv";
};
};
packages.x86_64-linux = let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
in
import ./pkgs/default.nix {
inherit sources;
callPackage = pkgs.callPackage;
naersk = inputs.naersk.lib.x86_64-linux;
};
nixosConfigurations = {
ZeNixLaptop = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
@ -58,29 +79,13 @@
inputs.nix-alien.overlay
inputs.comma.overlays.default
inputs.poetry2nix.overlay
(final: prev:
import ./pkgs/default.nix {
inherit sources;
callPackage = prev.callPackage;
naersk = inputs.naersk.lib."${system}";
})
(final: prev: {
oscclip = prev.poetry2nix.mkPoetryApplication {
projectDir = inputs.oscclip;
};
xdg-ninja = with pkgs;
stdenv.mkDerivation rec {
pname = "xdg-ninja";
version = "0.1";
src = inputs.xdg-ninja;
installPhase = ''
mkdir -p $out/bin
cp xdg-ninja.sh $out/bin
cp -r programs $out/bin
wrapProgram $out/bin/xdg-ninja.sh \
--prefix PATH : ${lib.makeBinPath [bash jq glow]}
'';
buildInputs = [jq glow bash];
nativeBuildInputs = [makeWrapper];
};
kabalist_cli = inputs.naersk.lib."${system}".buildPackage {
cargoBuildOptions = opts: opts ++ ["--package=kabalist_cli"];
root = inputs.kabalist;
};
raclette = inputs.raclette.defaultPackage."${system}";
})
];

15
pkgs/default.nix Normal file
View file

@ -0,0 +1,15 @@
{
callPackage,
sources,
naersk,
}: {
oscclip = callPackage ./oscclip.nix {oscclip-src = sources.oscclip;};
xdg-ninja = callPackage ./xdg-ninja.nix {xdg-ninja-src = sources.xdg-ninja;};
wowup = callPackage ./wowup.nix {};
simulationcraft = callPackage ./simulationcraft.nix {simulationcraft-src = sources.simulationcraft;};
proton-ge = callPackage ./proton-ge.nix {proton-ge-src = sources.proton-ge;};
kabalist_cli = callPackage ./kabalist.nix {
inherit naersk;
kabalist-src = sources.kabalist;
};
}

8
pkgs/kabalist.nix Normal file
View file

@ -0,0 +1,8 @@
{
naersk,
kabalist-src,
}:
naersk.buildPackage {
cargoBuildOptions = opts: opts ++ ["--package=kabalist_cli"];
root = kabalist-src;
}

8
pkgs/oscclip.nix Normal file
View file

@ -0,0 +1,8 @@
{
oscclip-src,
poetry2nix,
...
}:
poetry2nix.mkPoetryApplication {
projectDir = oscclip-src;
}

14
pkgs/proton-ge.nix Normal file
View file

@ -0,0 +1,14 @@
{
stdenv,
proton-ge-src,
}:
stdenv.mkDerivation {
inherit (proton-ge-src) pname src version;
nativeBuildInputs = [];
installPhase = ''
mkdir -p $out
mv * $out/
'';
}

21
pkgs/simulationcraft.nix Normal file
View file

@ -0,0 +1,21 @@
{
simulationcraft-src,
stdenv,
qt5,
cmake,
curl,
}:
stdenv.mkDerivation {
pname = "simulationcraft";
version = "master";
src = simulationcraft-src;
buildInputs = [
qt5.qtbase
qt5.qtwebengine
cmake
curl
];
nativeBuildInputs = [qt5.wrapQtAppsHook];
}

11
pkgs/wowup.nix Normal file
View file

@ -0,0 +1,11 @@
{
appimageTools,
fetchurl,
}:
appimageTools.wrapType2 {
name = "wowup";
src = fetchurl {
url = "https://github.com/WowUp/WowUp.CF/releases/download/v2.9.2-beta.3/WowUp-CF-2.9.2-beta.3.AppImage";
sha256 = "sha256-iijulvH4yjU9vQOyQ0vCBYLR93GGL9Ak/SmVPB+ZDvY=";
};
}

23
pkgs/xdg-ninja.nix Normal file
View file

@ -0,0 +1,23 @@
{
xdg-ninja-src,
lib,
stdenv,
bash,
jq,
glow,
makeWrapper,
}:
stdenv.mkDerivation {
pname = "xdg-ninja";
version = "0.1";
src = xdg-ninja-src;
installPhase = ''
mkdir -p $out/bin
cp xdg-ninja.sh $out/bin
cp -r programs $out/bin
wrapProgram $out/bin/xdg-ninja.sh \
--prefix PATH : ${lib.makeBinPath [bash jq glow]}
'';
buildInputs = [jq glow bash];
nativeBuildInputs = [makeWrapper];
}