Skip to content
Merged
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
5 changes: 1 addition & 4 deletions checks/all-modules-have-maintainers.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
pkgs,
self,
}:
{ pkgs, self }:

let
# Get all modules and check their maintainers
Expand Down
26 changes: 7 additions & 19 deletions checks/apply.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
{
pkgs,
self,
}:
{ pkgs, self }:

let
# Create a simple wrapper module
helloModule = self.lib.wrapModule (
{ config, lib, ... }:
{
options.test = lib.mkOption {
type = lib.types.submodule {
freeformType = lib.types.attrs;
};
};
{ config, lib, ... }: {
options.test = lib.mkOption { type = lib.types.submodule { freeformType = lib.types.attrs; }; };
config.package = config.pkgs.hello;
config.flags = {
"--ff" = config.test.freeform;
Expand All @@ -30,8 +22,7 @@ let

# Extend the configuration
extendedConfig = initialConfig.apply (
{ lib, ... }:
{
{ lib, ... }: {
test.freeform = "freeform2";
flags."--greeting" = "extended";
flags."--extra" = "flag";
Expand All @@ -40,8 +31,7 @@ let

# Test mkForce to override a value
forcedConfig = initialConfig.apply (
{ lib, ... }:
{
{ lib, ... }: {
flags."--greeting" = lib.mkForce "forced";
flags."--forced-flag" = true;
}
Expand All @@ -54,16 +44,14 @@ let

# Test chaining apply multiple levels deep
doubleApply = extendedConfig.apply (
{ lib, ... }:
{
{ lib, ... }: {
flags."--greeting" = lib.mkOverride 90 "double";
flags."--double" = "level2";
}
);

tripleApply = doubleApply.apply (
{ lib, ... }:
{
{ lib, ... }: {
flags."--greeting" = lib.mkOverride 80 "triple";
flags."--triple" = "level3";
}
Expand Down
5 changes: 1 addition & 4 deletions checks/args-direct.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
pkgs,
self,
}:
{ pkgs, self }:

let
wrappedPackage = self.lib.wrapPackage {
Expand Down
5 changes: 1 addition & 4 deletions checks/escape-shell-arg-with-env.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
pkgs,
self,
}:
{ pkgs, self }:
let
lib = pkgs.lib;
escape = self.lib.escapeShellArgWithEnv;
Expand Down
5 changes: 1 addition & 4 deletions checks/exe-path-bin-name.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
pkgs,
self,
}:
{ pkgs, self }:
let
lib = pkgs.lib;

Expand Down
30 changes: 7 additions & 23 deletions checks/extend.nix
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
{
pkgs,
self,
}:
{ pkgs, self }:

let
lib = pkgs.lib;

# Create a wrapper module with a custom option
customModule = self.lib.wrapModule (
{ config, ... }:
{
{ config, ... }: {
options = {
customGreeting = lib.mkOption {
type = lib.types.str;
Expand All @@ -32,14 +28,11 @@ let
};

# Test 1: extend returns a module with config, extendModules, etc.
extended1 = initialConfig.extend {
customGreeting = lib.mkForce "extended";
};
extended1 = initialConfig.extend { customGreeting = lib.mkForce "extended"; };

# Test 2: Add a new option via extend
extended2 = initialConfig.extend (
{ config, ... }:
{
{ config, ... }: {
options = {
verboseMode = lib.mkOption {
type = lib.types.bool;
Expand All @@ -53,16 +46,11 @@ let
);

# Test 3: Use the new option
extended3 = extended2.extendModules {
modules = [
{ verboseMode = true; }
];
};
extended3 = extended2.extendModules { modules = [ { verboseMode = true; } ]; };

# Test 4: Combine custom option changes with new options
extended4 = initialConfig.extend (
{ config, ... }:
{
{ config, ... }: {
options = {
extraFlag = lib.mkOption {
type = lib.types.str;
Expand All @@ -76,11 +64,7 @@ let
);

# Test 5: Override the new option
extended5 = extended4.extendModules {
modules = [
{ extraFlag = "overridden"; }
];
};
extended5 = extended4.extendModules { modules = [ { extraFlag = "overridden"; } ]; };

in
pkgs.runCommand "extend-test" { } ''
Expand Down
5 changes: 1 addition & 4 deletions checks/filesToExclude-glob.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
pkgs,
self,
}:
{ pkgs, self }:

let
# Create a dummy package with multiple binaries and other files
Expand Down
5 changes: 1 addition & 4 deletions checks/filesToExclude-module.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
pkgs,
self,
}:
{ pkgs, self }:

let
# Create a dummy package with multiple binaries and other files
Expand Down
5 changes: 1 addition & 4 deletions checks/filesToExclude.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
pkgs,
self,
}:
{ pkgs, self }:

let
# Create a dummy package with multiple binaries and other files
Expand Down
5 changes: 1 addition & 4 deletions checks/filesToPatch.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
pkgs,
self,
}:
{ pkgs, self }:

let
# Create a dummy package with a desktop file that references itself
Expand Down
5 changes: 1 addition & 4 deletions checks/flags-empty-list.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
pkgs,
self,
}:
{ pkgs, self }:

let
wrappedPackage = self.lib.wrapPackage {
Expand Down
5 changes: 1 addition & 4 deletions checks/flags-equals-separator.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
pkgs,
self,
}:
{ pkgs, self }:

let
wrappedPackage = self.lib.wrapPackage {
Expand Down
5 changes: 1 addition & 4 deletions checks/flags-false.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
pkgs,
self,
}:
{ pkgs, self }:

let
wrappedPackage = self.lib.wrapPackage {
Expand Down
5 changes: 1 addition & 4 deletions checks/flags-list.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
pkgs,
self,
}:
{ pkgs, self }:

let
wrappedWithSpaceSep = self.lib.wrapPackage {
Expand Down
8 changes: 2 additions & 6 deletions checks/flags-module.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
{
pkgs,
self,
}:
{ pkgs, self }:

let
helloModule = self.lib.wrapModule (
{ config, ... }:
{
{ config, ... }: {
config.package = config.pkgs.hello;
config.flags = {
"--greeting" = "world";
Expand Down
8 changes: 2 additions & 6 deletions checks/flags-order.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
{
pkgs,
self,
}:
{ pkgs, self }:

let
helloModule = self.lib.wrapModule (
{ config, ... }:
{
{ config, ... }: {
config.package = config.pkgs.hello;
config.flags = {
# default order 1000: before "$@" (which is 1001)
Expand Down
5 changes: 1 addition & 4 deletions checks/flags-space-separator.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
pkgs,
self,
}:
{ pkgs, self }:

let
wrappedPackage = self.lib.wrapPackage {
Expand Down
5 changes: 1 addition & 4 deletions checks/formatting.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
pkgs,
self,
}:
{ pkgs, self }:

pkgs.runCommand "formatting-check" { } ''
cp -r ${../.}/ src
Expand Down
8 changes: 2 additions & 6 deletions checks/meta-maintainers.nix
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
{
pkgs,
self,
}:
{ pkgs, self }:

let
# Test with a nixpkgs maintainer (lassulus)
nixpkgsMaintainer = pkgs.lib.maintainers.lassulus;

helloModule = self.lib.wrapModule (
{ config, ... }:
{
{ config, ... }: {
config.package = config.pkgs.hello;
config.meta.maintainers = [ nixpkgsMaintainer ];
}
Expand Down
18 changes: 4 additions & 14 deletions checks/meta-platforms.nix
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
{
pkgs,
self,
}:
{ pkgs, self }:

let
# Test 1: Default platforms (should be lib.platforms.all)
helloModuleDefault = self.lib.wrapModule (
{ config, ... }:
{
config.package = config.pkgs.hello;
}
);
helloModuleDefault = self.lib.wrapModule ({ config, ... }: { config.package = config.pkgs.hello; });

moduleConfigDefault = helloModuleDefault.apply { inherit pkgs; };

# Test 2: Custom platforms (linux only)
helloModuleLinux = self.lib.wrapModule (
{ config, ... }:
{
{ config, ... }: {
config.package = config.pkgs.hello;
config.meta.platforms = pkgs.lib.platforms.linux;
}
Expand All @@ -27,8 +18,7 @@ let

# Test 3: Specific platforms list
helloModuleSpecific = self.lib.wrapModule (
{ config, ... }:
{
{ config, ... }: {
config.package = config.pkgs.hello;
config.meta.platforms = [
"x86_64-linux"
Expand Down
5 changes: 1 addition & 4 deletions checks/no-module-prefix-in-checks.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
pkgs,
self,
}:
{ pkgs, self }:

let
# Get all check files in checks/ directory
Expand Down
29 changes: 11 additions & 18 deletions checks/patchHook.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
pkgs,
self,
}:
{ pkgs, self }:

let
# Create a dummy package with a desktop file that references itself
Expand All @@ -24,19 +21,15 @@ let
};

in
pkgs.runCommand "patchHook-test"
{
wrappedPath = "${wrappedPackage}";
}
''
echo "Testing patchHook functionality..."
echo "Wrapped package path: $wrappedPath"
pkgs.runCommand "patchHook-test" { wrappedPath = "${wrappedPackage}"; } ''
echo "Testing patchHook functionality..."
echo "Wrapped package path: $wrappedPath"

if [ ! -f "$wrappedPath/test" ]; then
echo "FAIL: file not created in patched package"
exit 1
fi
if [ ! -f "$wrappedPath/test" ]; then
echo "FAIL: file not created in patched package"
exit 1
fi

echo "SUCCESS: patchHook executed correctly"
touch $out
''
echo "SUCCESS: patchHook executed correctly"
touch $out
''
5 changes: 1 addition & 4 deletions checks/systemd.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
pkgs,
self,
}:
{ pkgs, self }:

let
lib = pkgs.lib;
Expand Down
Loading
Loading