Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# Build output
/target
.direnv
result
51 changes: 31 additions & 20 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,41 @@
pkgsForEach = system: nixpkgs.legacyPackages.${system};
in {
nixosModules = {
ncro = ./nix/module.nix;
default = self.nixosModules.ncro;
default = {pkgs, ...} @ args:
import ./nix/module.nix (
args
// {
ncroPackage = self.packages.${pkgs.system}.ncro;
}
);
};

packages = forEachSystem (system: let
pkgs = pkgsForEach system;
in {
ncro = pkgs.callPackage ./nix/package.nix {};
default = self.packages.${system}.ncro;
});
packages = forEachSystem (
system: let
pkgs = pkgsForEach system;
in rec {
ncro = pkgs.callPackage ./nix/package.nix {};
default = ncro;
}
);

devShells = forEachSystem (system: let
pkgs = pkgsForEach system;
in {
default = pkgs.callPackage ./nix/shell.nix {};
});
devShells = forEachSystem (
system: let
pkgs = pkgsForEach system;
in {
default = pkgs.callPackage ./nix/shell.nix {};
}
);

checks = forEachSystem (system: let
pkgs = pkgsForEach system;
in {
p2p-discovery = pkgs.callPackage ./nix/tests/p2p.nix {inherit self;};
e2e = pkgs.callPackage ./nix/tests/e2e.nix {inherit self;};
s3 = pkgs.callPackage ./nix/tests/s3.nix {inherit self;};
});
checks = forEachSystem (
system: let
pkgs = pkgsForEach system;
in {
p2p-discovery = pkgs.callPackage ./nix/tests/p2p.nix {inherit self;};
e2e = pkgs.callPackage ./nix/tests/e2e.nix {inherit self;};
s3 = pkgs.callPackage ./nix/tests/s3.nix {inherit self;};
}
);

# Provides the default formatter for 'nix fmt'.
formatter = forEachSystem (
Expand Down
6 changes: 3 additions & 3 deletions nix/module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
config,
pkgs,
lib,
necroPackage,
...
}: let
inherit (lib.modules) mkIf;
Expand Down Expand Up @@ -37,7 +38,7 @@ in {

package = mkOption {
type = package;
default = pkgs.callPackage ./package.nix {};
default = necroPackage;
defaultText = literalExpression "inputs.ncro.packages.$${system}.ncro";
description = "The ncro package to use.";
example = literalExpression "inputs.ncro.packages.$${system}.ncro";
Expand Down Expand Up @@ -79,8 +80,7 @@ in {
};

config = mkIf cfg.enable {
nix.settings.trusted-public-keys =
mkIf cfg.addUpstreamPublicKeys (lib.mkAfter upstreamPublicKeys);
nix.settings.trusted-public-keys = mkIf cfg.addUpstreamPublicKeys (lib.mkAfter upstreamPublicKeys);

systemd.services.ncro = {
description = "Nix Cache Route Optimizer";
Expand Down