lib: move buildPerlApplication
to dedicated build-support
module
Signed-off-by: Christoph Heiss <christoph@c8h4.io>
This commit is contained in:
parent
6f656dff2f
commit
200355c7ec
31
flake.nix
31
flake.nix
|
@ -65,13 +65,20 @@
|
|||
outputs = { self, nixpkgs, home-manager, nixos-hardware
|
||||
, simple-nixos-mailserver, nixgl, flake-utils, treefmt-nix, nixinate
|
||||
, sops-nix, lix-module, ... }:
|
||||
flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system:
|
||||
let
|
||||
lib = nixpkgs.lib.extend (import ./lib);
|
||||
overlays = [
|
||||
(nixpkgs.lib.composeManyExtensions
|
||||
[ (import ./pkgs/build-support.nix) ])
|
||||
(_: super: import ./pkgs super)
|
||||
(_: super: {
|
||||
vimPlugins = super.vimPlugins
|
||||
// (import ./pkgs/vim-plugins.nix super);
|
||||
})
|
||||
];
|
||||
in (flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ (import ./lib) ];
|
||||
};
|
||||
inherit (pkgs) lib;
|
||||
pkgs = import nixpkgs { inherit lib overlays system; };
|
||||
inherit (flake-utils.lib) mkApp;
|
||||
|
||||
treefmt = treefmt-nix.lib.evalModule pkgs {
|
||||
|
@ -146,15 +153,7 @@
|
|||
};
|
||||
|
||||
packages = (import ./pkgs) null pkgs;
|
||||
}) // (let
|
||||
overlays = [
|
||||
(nixpkgs.lib.composeManyExtensions [ (import ./lib) ])
|
||||
(import ./pkgs)
|
||||
(self: super: {
|
||||
vimPlugins = super.vimPlugins
|
||||
// (import ./pkgs/vim-plugins.nix self super);
|
||||
})
|
||||
];
|
||||
})) // (let
|
||||
machines = {
|
||||
back = { };
|
||||
fort = { };
|
||||
|
@ -163,10 +162,12 @@
|
|||
[ nixos-hardware.nixosModules.framework-12th-gen-intel ];
|
||||
zero = { };
|
||||
};
|
||||
|
||||
mkSystem = name:
|
||||
{ extraModules ? [ ], system ? "x86_64-linux" }:
|
||||
nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = { inherit lib; };
|
||||
modules = [
|
||||
sops-nix.nixosModules.sops
|
||||
simple-nixos-mailserver.nixosModules.mailserver
|
||||
|
|
|
@ -1,31 +1,3 @@
|
|||
_:
|
||||
{ lib, writeTextFile, perl, perlPackages, ... }:
|
||||
_: _:
|
||||
|
||||
{
|
||||
c8h4.buildPerlApplication = { name, text, perlInputs ? (_: [ ])
|
||||
, runtimeInputs ? [ ], derivationArgs ? { } }:
|
||||
writeTextFile {
|
||||
inherit name derivationArgs;
|
||||
executable = true;
|
||||
destination = "/bin/${name}";
|
||||
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
${lib.getExe perlPackages.PerlCritic} $target
|
||||
runHook postCheck
|
||||
'';
|
||||
|
||||
text = ''
|
||||
#!${lib.getExe (perl.withPackages perlInputs)}
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
$ENV{PATH} = "${lib.makeBinPath runtimeInputs}:$ENV{PATH}";
|
||||
|
||||
${text}
|
||||
'';
|
||||
|
||||
meta.mainProgram = name;
|
||||
};
|
||||
}
|
||||
{ }
|
||||
|
|
31
pkgs/build-support.nix
Normal file
31
pkgs/build-support.nix
Normal file
|
@ -0,0 +1,31 @@
|
|||
_:
|
||||
{ lib, perl, perlPackages, writeTextFile, ... }:
|
||||
|
||||
{
|
||||
c8h4.buildPerlApplication = { name, text, perlInputs ? (_: [ ])
|
||||
, runtimeInputs ? [ ], derivationArgs ? { } }:
|
||||
writeTextFile {
|
||||
inherit name derivationArgs;
|
||||
executable = true;
|
||||
destination = "/bin/${name}";
|
||||
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
${lib.getExe perlPackages.PerlCritic} $target
|
||||
runHook postCheck
|
||||
'';
|
||||
|
||||
text = ''
|
||||
#!${lib.getExe (perl.withPackages perlInputs)}
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
$ENV{PATH} = "${lib.makeBinPath runtimeInputs}:$ENV{PATH}";
|
||||
|
||||
${text}
|
||||
'';
|
||||
|
||||
meta.mainProgram = name;
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue