nix: touchups

This commit is contained in:
Aylur
2024-09-11 21:48:26 +00:00
parent 0e259e4935
commit e2b9013d38
2 changed files with 28 additions and 28 deletions

View File

@@ -8,8 +8,8 @@
inherit (builtins) replaceStrings readFile;
version = replaceStrings ["\n"] [""] (readFile ./version);
system = "x86_64-linux";
pkgs = import nixpkgs {inherit system;};
system = "x86_64-linux"; # TODO: other architectures
pkgs = nixpkgs.legacyPackages.${system};
mkPkg = name: src: inputs:
pkgs.stdenv.mkDerivation {
@@ -33,9 +33,11 @@
inherit self pkgs;
};
mkLuaPackage = import ./nix/lua.nix {
inherit pkgs;
astal = self;
lib = {
mkLuaPackage = import ./nix/lua.nix {
inherit pkgs;
astal = self;
};
};
packages.${system} = with pkgs; {

View File

@@ -4,7 +4,7 @@ defaults: {
name ? "astal-lua",
src,
extraLuaPackages ? (ps: []),
extraPacakges ? [],
extraPackages ? [],
}: let
lua = pkgs.lua.withPackages (ps:
(extraLuaPackages ps)
@@ -22,37 +22,35 @@ defaults: {
}))
]);
nativeBuildInputs = with pkgs; [
wrapGAppsHook
gobject-introspection
];
buildInputs =
extraPacakges
++ [
lua
astal.packages.${pkgs.system}.default
];
script = pkgs.writeScript "astal-lua" ''
script = ''
#!${lua}/bin/lua
package.path = package.path .. ";${src}/?.lua"
require "app"
'';
in
pkgs.stdenv.mkDerivation {
inherit nativeBuildInputs buildInputs src name;
pkgs.stdenvNoCC.mkDerivation {
inherit src name;
nativeBuildInputs = with pkgs; [
wrapGAppsHook
gobject-introspection
];
buildInputs =
extraPackages
++ [
lua
astal.packages.${pkgs.system}.default
];
installPhase = ''
mkdir -p $out/bin
cp -r * $out/bin
cp ${script} $out/bin/${name}
chmod +x $out/bin/${name}
echo '${script}' > astal-lua
install -m 755 astal-lua $out/bin/${name}
'';
preFixup = ''
gappsWrapperArgs+=(
--prefix PATH : "${pkgs.lib.makeBinPath extraPacakges}"
)
'';
gappsWrapperArgs = [
"--prefix PATH : ${pkgs.lib.makeBinPath extraPackages}"
];
}