Compare commits

...

2 Commits

Author SHA1 Message Date
10930e85d6 Use overlay
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2025-08-17 19:57:22 +03:00
37d2ba1946 Add envrc
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2025-08-17 19:57:12 +03:00
10 changed files with 27 additions and 40 deletions

1
.envrc Normal file
View File

@@ -0,0 +1 @@
use flake self#nix

View File

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

13
overlays/default.nix Normal file
View File

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

View File

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