Compare commits
2 commits
5e7e6eb917
...
8a639c4553
Author | SHA1 | Date | |
---|---|---|---|
8a639c4553 | |||
b70ab8bd76 |
14 changed files with 109 additions and 59 deletions
|
@ -8,4 +8,4 @@ jobs:
|
|||
runs-on: native
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- run: nix flake check --all-systems
|
||||
- run: nix-build -A ci.check
|
||||
|
|
8
default.nix
Normal file
8
default.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
let
|
||||
nilla = import ./nilla.nix { };
|
||||
getPackage = name: nilla.packages.${name}.result.${builtins.currentSystem};
|
||||
in
|
||||
{
|
||||
ci.check = getPackage "ci-check";
|
||||
formatter = getPackage "formatter";
|
||||
}
|
|
@ -16,7 +16,7 @@ in
|
|||
./youko
|
||||
];
|
||||
|
||||
config.configBuilders =
|
||||
config.systems.builders =
|
||||
let
|
||||
sharedOptions = {
|
||||
_file = ./default.nix;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
config.configurations.nixos.hijiri-vm =
|
||||
config.systems.nixos.hijiri-vm.module =
|
||||
{
|
||||
modulesPath,
|
||||
lib,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
config.configurations.darwin.hijiri =
|
||||
config.systems.darwin.hijiri.module =
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
config.configurations.nixos.kazuki =
|
||||
config.systems.nixos.kazuki.module =
|
||||
{
|
||||
modulesPath,
|
||||
...
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
config.configurations.darwin.kogata =
|
||||
config.systems.darwin.kogata.module =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
nixpkgs.system = "aarch64-darwin";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
config.configurations.nixos.ude =
|
||||
config.systems.nixos.ude.module =
|
||||
{
|
||||
config,
|
||||
modulesPath,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
config.configurations.nixos.youko =
|
||||
config.systems.nixos.youko.module =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
{ config, lib }:
|
||||
{
|
||||
options = {
|
||||
configBuilders = {
|
||||
nixos = lib.options.create {
|
||||
type = lib.types.function lib.types.raw;
|
||||
default.value = _name: config.inputs.nixpkgs.result.lib.nixosSystem;
|
||||
};
|
||||
darwin = lib.options.create {
|
||||
type = lib.types.function lib.types.raw;
|
||||
default.value = _name: config.inputs.darwin.result.lib.darwinSystem;
|
||||
};
|
||||
home = lib.options.create {
|
||||
type = lib.types.function lib.types.raw;
|
||||
default.value = _name: config.inputs.home-manager.result.lib.homeManagerConfiguration;
|
||||
};
|
||||
};
|
||||
|
||||
configurations = {
|
||||
nixos = lib.options.create {
|
||||
type = lib.types.attrs.lazy lib.types.raw;
|
||||
default.value = { };
|
||||
};
|
||||
darwin = lib.options.create {
|
||||
type = lib.types.attrs.lazy lib.types.raw;
|
||||
default.value = { };
|
||||
};
|
||||
home = lib.options.create {
|
||||
type = lib.types.attrs.lazy lib.types.raw;
|
||||
default.value = { };
|
||||
};
|
||||
};
|
||||
|
||||
nixosConfigurations = lib.options.create {
|
||||
type = lib.types.attrs.lazy lib.types.raw;
|
||||
default.value = builtins.mapAttrs config.configBuilders.nixos config.configurations.nixos;
|
||||
};
|
||||
darwinConfigurations = lib.options.create {
|
||||
type = lib.types.attrs.lazy lib.types.raw;
|
||||
default.value = builtins.mapAttrs config.configBuilders.darwin config.configurations.darwin;
|
||||
};
|
||||
homeConfigurations = lib.options.create {
|
||||
type = lib.types.attrs.lazy lib.types.raw;
|
||||
default.value = builtins.mapAttrs config.configBuilders.home config.configurations.home;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
includes = [
|
||||
./builders
|
||||
./services.nix
|
||||
./configurations.nix
|
||||
./systems.nix
|
||||
./modules.nix
|
||||
./flake.nix
|
||||
];
|
||||
|
|
|
@ -18,11 +18,12 @@ in
|
|||
nixosModules
|
||||
darwinModules
|
||||
homeModules
|
||||
nixosConfigurations
|
||||
darwinConfigurations
|
||||
homeConfigurations
|
||||
;
|
||||
|
||||
nixosConfigurations = builtins.mapAttrs (_: system: system.result) config.systems.nixos;
|
||||
darwinConfigurations = builtins.mapAttrs (_: system: system.result) config.systems.darwin;
|
||||
homeConfigurations = builtins.mapAttrs (_: system: system.result) config.systems.home;
|
||||
|
||||
devShells = transpose config.shells;
|
||||
packages = transpose config.packages;
|
||||
|
||||
|
|
52
modules/nilla/systems.nix
Normal file
52
modules/nilla/systems.nix
Normal file
|
@ -0,0 +1,52 @@
|
|||
{ config, lib }:
|
||||
let
|
||||
mkBuilderOption =
|
||||
typ:
|
||||
lib.options.create {
|
||||
type = lib.types.function (lib.types.function lib.types.raw);
|
||||
default.value = _name: _module: throw "Builder for systems.${typ} is not implemented";
|
||||
};
|
||||
inherit (config.systems) builders;
|
||||
mkSystemModule =
|
||||
typ:
|
||||
{ config, name }:
|
||||
{
|
||||
options = {
|
||||
name = lib.options.create {
|
||||
type = lib.types.string;
|
||||
default.value = name;
|
||||
};
|
||||
module = lib.options.create {
|
||||
type = lib.types.raw;
|
||||
default.value = { };
|
||||
};
|
||||
builder = lib.options.create {
|
||||
type = lib.types.function (lib.types.function lib.types.raw);
|
||||
default.value = builders.${typ};
|
||||
};
|
||||
result = lib.options.create {
|
||||
type = lib.types.raw;
|
||||
writable = false;
|
||||
default.value = config.builder config.name config.module;
|
||||
};
|
||||
};
|
||||
};
|
||||
mkSystemOption =
|
||||
typ:
|
||||
lib.options.create {
|
||||
type = lib.types.attrs.of (lib.types.submodule (mkSystemModule typ));
|
||||
default.value = { };
|
||||
};
|
||||
in
|
||||
{
|
||||
options = {
|
||||
systems = {
|
||||
builders.nixos = mkBuilderOption "nixos";
|
||||
builders.darwin = mkBuilderOption "darwin";
|
||||
builders.home = mkBuilderOption "home";
|
||||
nixos = mkSystemOption "nixos";
|
||||
darwin = mkSystemOption "darwin";
|
||||
home = mkSystemOption "home";
|
||||
};
|
||||
};
|
||||
}
|
36
nilla.nix
36
nilla.nix
|
@ -76,6 +76,42 @@
|
|||
in
|
||||
eval.config.build.wrapper;
|
||||
};
|
||||
ci-check =
|
||||
let
|
||||
all-packages = builtins.attrValues (builtins.removeAttrs config.packages [ "ci-check" ]);
|
||||
all-packages' = lib.lists.flatten (map (pkg: builtins.attrValues pkg.result) all-packages);
|
||||
|
||||
nixos-systems = builtins.attrValues config.systems.nixos;
|
||||
nixos-systems' = map (system: system.result.config.system.build.toplevel) nixos-systems;
|
||||
|
||||
darwin-systems = builtins.attrValues config.systems.darwin;
|
||||
darwin-systems' = map (system: system.result.config.system.build.toplevel) darwin-systems;
|
||||
|
||||
all-drvs = all-packages' ++ nixos-systems' ++ darwin-systems';
|
||||
all-drvs' = lib.strings.concatMapSep "\n" builtins.unsafeDiscardStringContext all-drvs;
|
||||
in
|
||||
mkPackage (
|
||||
{
|
||||
lib,
|
||||
stdenvNoCC,
|
||||
system,
|
||||
}:
|
||||
stdenvNoCC.mkDerivation {
|
||||
name = "nilla-eval-check";
|
||||
src = lib.cleanSource ./.;
|
||||
doCheck = true;
|
||||
|
||||
allDerivations = all-drvs';
|
||||
formatter = lib.getExe config.packages.formatter.result.${system};
|
||||
|
||||
passAsFile = [ "allDerivations" ];
|
||||
|
||||
installPhase = ''touch "$out"'';
|
||||
checkPhase = ''
|
||||
"$formatter" --ci
|
||||
'';
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
config.shells.default = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue