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
|
outputs = { self, nixpkgs, home-manager, nixos-hardware
|
||||||
, simple-nixos-mailserver, nixgl, flake-utils, treefmt-nix, nixinate
|
, simple-nixos-mailserver, nixgl, flake-utils, treefmt-nix, nixinate
|
||||||
, sops-nix, lix-module, ... }:
|
, 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
|
let
|
||||||
pkgs = import nixpkgs {
|
pkgs = import nixpkgs { inherit lib overlays system; };
|
||||||
inherit system;
|
|
||||||
overlays = [ (import ./lib) ];
|
|
||||||
};
|
|
||||||
inherit (pkgs) lib;
|
|
||||||
inherit (flake-utils.lib) mkApp;
|
inherit (flake-utils.lib) mkApp;
|
||||||
|
|
||||||
treefmt = treefmt-nix.lib.evalModule pkgs {
|
treefmt = treefmt-nix.lib.evalModule pkgs {
|
||||||
|
@ -146,15 +153,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
packages = (import ./pkgs) null pkgs;
|
packages = (import ./pkgs) null pkgs;
|
||||||
}) // (let
|
})) // (let
|
||||||
overlays = [
|
|
||||||
(nixpkgs.lib.composeManyExtensions [ (import ./lib) ])
|
|
||||||
(import ./pkgs)
|
|
||||||
(self: super: {
|
|
||||||
vimPlugins = super.vimPlugins
|
|
||||||
// (import ./pkgs/vim-plugins.nix self super);
|
|
||||||
})
|
|
||||||
];
|
|
||||||
machines = {
|
machines = {
|
||||||
back = { };
|
back = { };
|
||||||
fort = { };
|
fort = { };
|
||||||
|
@ -163,10 +162,12 @@
|
||||||
[ nixos-hardware.nixosModules.framework-12th-gen-intel ];
|
[ nixos-hardware.nixosModules.framework-12th-gen-intel ];
|
||||||
zero = { };
|
zero = { };
|
||||||
};
|
};
|
||||||
|
|
||||||
mkSystem = name:
|
mkSystem = name:
|
||||||
{ extraModules ? [ ], system ? "x86_64-linux" }:
|
{ extraModules ? [ ], system ? "x86_64-linux" }:
|
||||||
nixpkgs.lib.nixosSystem {
|
nixpkgs.lib.nixosSystem {
|
||||||
inherit system;
|
inherit system;
|
||||||
|
specialArgs = { inherit lib; };
|
||||||
modules = [
|
modules = [
|
||||||
sops-nix.nixosModules.sops
|
sops-nix.nixosModules.sops
|
||||||
simple-nixos-mailserver.nixosModules.mailserver
|
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