Use overlay

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2025-08-17 19:41:21 +03:00
parent 00d04c73f6
commit 779c08870c
9 changed files with 27 additions and 40 deletions

View File

@@ -10,20 +10,22 @@
outputs =
inputs:
(
{
overlays.default = import ./overlay;
}
// (
let
system = "x86_64-linux";
pkgs = import inputs.nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [ inputs.self.overlays.default ];
};
treefmt = inputs.treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
in
{
lib.${system} = import ./lib { inherit pkgs; };
formatter.${system} = treefmt.config.build.wrapper;
checks.${system}.formatting = treefmt.config.build.check inputs.self;
}

View File

@@ -1,8 +0,0 @@
{ pkgs, ... }:
let
callPackage = pkgs.lib.callPackageWith { inherit pkgs; };
in
{
fetchers = callPackage ./fetchers { };
runtime = callPackage ./runtime { };
}

View File

@@ -1,7 +0,0 @@
{ pkgs, ... }:
let
callPackage = pkgs.lib.callPackageWith { inherit pkgs; };
in
{
sshKnownHosts = callPackage ./sshKnownHosts { };
}

View File

@@ -1,7 +0,0 @@
{ pkgs, ... }:
let
callPackage = pkgs.lib.callPackageWith { inherit pkgs; };
in
{
merge = callPackage ./merge { };
}

View File

@@ -1,7 +0,0 @@
{ pkgs, ... }:
let
callPackage = pkgs.lib.callPackageWith { inherit pkgs; };
in
{
keyValue = callPackage ./keyValue { };
}

14
overlay/default.nix Normal file
View File

@@ -0,0 +1,14 @@
final: prev:
{
lib = prev.lib.recursiveUpdate prev.lib {
fetchers = {
sshKnownHosts = import ./fetchers/sshKnownHosts final prev;
};
runtime = {
merge = {
keyValue = import ./runtime/merge/keyValue final prev;
};
};
};
}

View File

@@ -1,5 +1,5 @@
{ pkgs, ... }:
pkgs.lib.fetchers.withNormalizedHash { } (
final: prev:
prev.lib.fetchers.withNormalizedHash { } (
{
host,
name ? "ssh-known-hosts-${host}",
@@ -13,15 +13,15 @@ pkgs.lib.fetchers.withNormalizedHash { } (
],
}:
let
keyTypeArgs = pkgs.lib.concatStringsSep "," keyTypes;
keyTypeArgs = prev.lib.concatStringsSep "," keyTypes;
in
pkgs.runCommandLocal name
prev.runCommandLocal name
{
inherit outputHash outputHashAlgo;
outputHashMode = "flat";
preferLocalBuild = true;
nativeBuildInputs = with pkgs; [
nativeBuildInputs = with final; [
openssh
gnugrep
coreutils

View File

@@ -1,8 +1,8 @@
{ pkgs, ... }:
final: prev:
"${
pkgs.writeShellApplication {
prev.writeShellApplication {
name = "merge-key-value";
runtimeInputs = with pkgs; [
runtimeInputs = with final; [
coreutils
gawk
];