Skip to content

Commit

Permalink
refactor: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GTrunSec committed Oct 6, 2023
1 parent b695ff0 commit 6e36acb
Show file tree
Hide file tree
Showing 30 changed files with 180 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: DeterminateSystems/magic-nix-cache-action@main

- name: Build Example/nixos
run: nix -Lv build .#nixosConfigurations.nixos.config.system.build.toplevel --dry-run
run: nix -Lv build ./local#eval.nixos.expr.nixosConfiguration.config.system.build.toplevel --dry-run

- name: Run Eval check
run: nix -Lv eval ./local#checks --override-input namaka github:nix-community/namaka
Expand Down
8 changes: 0 additions & 8 deletions examples/nixos/pops/data.nix

This file was deleted.

15 changes: 4 additions & 11 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,12 @@
inherit omnibus;
};
};

nixosConfigurations =
(self.pops.exporters.addLoadExtender {
src = ./nixos/nixosConfigurations;
inputs = {
nixpkgs = omnibus.pops.loadInputs.outputs.nixpkgs;
exporters = self.pops.exporters.outputs.default;
};
}).outputs.default;
in
{
inherit (lib.outputs.default.exporters) pops;
inherit nixosConfigurations lib;
pops = lib.outputs.default.exporters.pops // {
inherit lib;
};
lib = lib.outputs.default;

templates.default = {
path = ./templates/nixos;
Expand Down
2 changes: 0 additions & 2 deletions lib/exporters/pops.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
self'.outPath + "/local/lock"
);
loadData = flops.haumea.pops.default.setInit {
src = self'.outPath + "/examples/__data";
loader = with haumea; [
matchers.json
matchers.toml
Expand Down Expand Up @@ -74,7 +73,6 @@

exporters = flops.haumea.pops.default.setInit {
loader = with haumea; loaders.scoped;
src = self'.outPath + "/examples";
inputs = {
self' = self;
inherit
Expand Down
79 changes: 70 additions & 9 deletions local/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 13 additions & 2 deletions local/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
inputs.std-ext.url = "github:gtrunsec/std-ext";
inputs.std-ext.inputs.org-roam-book-template.follows = "";
inputs.call-flake.url = "github:divnix/call-flake";
inputs.namaka.follows = "";
inputs.namaka.url = "github:nix-community/namaka";
inputs.haumea.follows = "namaka/haumea";

outputs =
{ std, self, ... }@inputs:
Expand All @@ -32,12 +33,22 @@
] ];
}
{
eval = inputs.haumea.lib.load {
src = ../tests;
inputs = omnibus.inputs // {
omnibus = omnibus;
lib = inputs.nixpkgs.lib // builtins;
inputs' = inputs;
trace = true;
};
};
checks = inputs.namaka.lib.load {
src = ../tests;
inputs = omnibus.inputs // {
omnibus = omnibus;
lib = inputs.nixpkgs.lib // omnibus.lib;
lib = inputs.nixpkgs.lib // builtins;
inputs' = inputs;
trace = false;
};
};
};
Expand Down
19 changes: 2 additions & 17 deletions namaka.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
[check]
cmd = [
"nix",
"flake",
"check",
"./local",
"--override-input",
"namaka",
"github:nix-community/namaka"
]
cmd = ["nix", "flake", "check", "./local"]

[eval]
cmd = [
"nix",
"eval",
"./local#checks",
"--override-input",
"namaka",
"github:nix-community/namaka"
]
cmd = ["nix", "eval", "./local#checks"]
9 changes: 0 additions & 9 deletions nixos/nixosConfigurations/nixos.nix

This file was deleted.

2 changes: 1 addition & 1 deletion templates/nixos/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
{
inherit pops;
lib = pops.outputs.default;
inherit (self.lib.exporters)
inherit (self.lib.exporter)
darwinConfigurations
nixosConfigurations
packages
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions tests/_snapshots/data
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#json
{"env":{"nixos":{"maintainer":"gtrunsec","profile":"omnibus"}},"personal":{"ssh":{"public-key":"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDLxc7EBr1Qi4M65O1KjXZf4bOBZMQ6YeDSFYzKzFan7 Desktop-guangtao-03-02-2023"}}}
13 changes: 13 additions & 0 deletions tests/_snapshots/nixos
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pretty
{
bootProfile = {
speedup = true;
systemd-boot = {
enable = true;
};
systemd-initrd = {
enable = false;
};
};
customModuleBootTimeOut = 10;
}
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions tests/data/expr.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{ omnibus, inputs' }:
let
loadDataAll =
(omnibus.pops.lib.addLoadExtender {
inputs = {
nixpkgs = inputs'.nixpkgs.legacyPackages.x86_64-linux;
};
}).outputs.default.loadDataAll;
in
(loadDataAll.addLoadExtender { src = ./__fixture; }).outputs.default
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 22 additions & 11 deletions examples/nixos/layouts.nix → tests/nixos/__fixture/layouts.nix
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
let
outputs = lib.mapAttrs (_: v: v.outputs) (
exporter = lib.mapAttrs (_: v: v.outputs) (
lib.removeAttrs super.pops [ "inputs" ]
);
in
{
inherit outputs;
data = outputs.data.default;
system = "x86_64-linux";

inherit data exporter;

nixosSuites = lib.flatten [
outputs.selfNixOSProfiles.default.bootstrap
exporter.selfNixOSProfiles.default.bootstrap

# self.nixosProfiles.default.presets.boot
outputs.nixosModules.default.programs.git
exporter.nixosModules.default.programs.git

# outputs.nixosModules.default.hardware.bluetooth
# load a suite profile from audio
# (outputs.nixosProfiles.default.audio {}).default

# # --custom profiles
outputs.nixosProfiles.customProfiles.presets.nix
outputs.nixosProfiles.customProfiles.presets.boot
outputs.srvos.default.common.nix
exporter.nixosProfiles.customProfiles.presets.nix
# exporter.nixosProfiles.customProfiles.presets.boot
exporter.srvos.default.common.nix

(omnibus.lib.outputs.default.mkHome
{
Expand All @@ -37,10 +38,20 @@ in
];

homeSuites = [
outputs.homeProfiles.customProfiles.presets.hyprland
outputs.homeProfiles.default.presets.bat
exporter.homeProfiles.customProfiles.presets.hyprland
exporter.homeProfiles.default.presets.bat
# # The parent directory of "presets" is categorized as a list type of "suites"
(outputs.homeProfiles.default.shell { }).default
(exporter.homeProfiles.default.shell { }).default
# super.pops.homeModules.outputs.default.wayland.windowManager.hyprland
];

nixosConfiguration =
module:
nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = lib.flatten [
self.nixosSuites
module
];
};
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
}
)
)).setSystem
"x86_64-linux"
root.layouts.system
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 6e36acb

Please sign in to comment.