Compare commits
No commits in common. "7486f2409b0ff9f66b49c8cc4bbb8eed6eef80e6" and "4213303810dc15b3c54fe66b7c76f2dd9fe56e65" have entirely different histories.
7486f2409b
...
4213303810
2 changed files with 20 additions and 56 deletions
46
flake.nix
46
flake.nix
|
@ -17,25 +17,17 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs = { self, nixpkgs, ... }@inputs:
|
||||||
{ self, nixpkgs, ... }@inputs:
|
|
||||||
{
|
{
|
||||||
nixosConfigurations =
|
nixosConfigurations =
|
||||||
let
|
let
|
||||||
lib = import ./lib { inherit (nixpkgs) lib; };
|
cleanHostname = config: builtins.removeAttrs config [ "hostname" ];
|
||||||
|
toNixosConfigPart = config: { name = config.hostname; value = nixpkgs.lib.nixosSystem (cleanHostname config); };
|
||||||
cleanHostname =
|
in
|
||||||
config:
|
builtins.listToAttrs
|
||||||
builtins.removeAttrs config [ "hostname" ];
|
(map toNixosConfigPart
|
||||||
toPartialNixosConfigSet =
|
(map
|
||||||
config:
|
({ hostname, system }: {
|
||||||
{
|
|
||||||
name = config.hostname;
|
|
||||||
value = nixpkgs.lib.nixosSystem (cleanHostname config);
|
|
||||||
};
|
|
||||||
toNixosSystemConfig =
|
|
||||||
{ hostname, system }:
|
|
||||||
{
|
|
||||||
inherit system hostname;
|
inherit system hostname;
|
||||||
specialArgs = { inherit inputs; };
|
specialArgs = { inherit inputs; };
|
||||||
modules = [
|
modules = [
|
||||||
|
@ -43,23 +35,11 @@
|
||||||
./hosts/${hostname}/configuration.nix
|
./hosts/${hostname}/configuration.nix
|
||||||
inputs.home-manager.nixosModules.default
|
inputs.home-manager.nixosModules.default
|
||||||
];
|
];
|
||||||
};
|
})
|
||||||
compileSystems = systems: lib.right builtins.listToAttrs (map toPartialNixosConfigSet) (map toNixosSystemConfig) systems;
|
|
||||||
in
|
|
||||||
compileSystems
|
|
||||||
[
|
[
|
||||||
{
|
{ hostname = "snowhawk"; system = "x86_64-linux"; }
|
||||||
hostname = "snowhawk";
|
{ hostname = "sprite"; system = "aarch64-linux"; }
|
||||||
system = "x86_64-linux";
|
{ hostname = "nixos"; system = "x86_64-linux"; }
|
||||||
}
|
]));
|
||||||
{
|
|
||||||
hostname = "sprite";
|
|
||||||
system = "aarch64-linux";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
hostname = "nixos";
|
|
||||||
system = "x86_64-linux";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
{ lib, ... }:
|
|
||||||
with lib;
|
|
||||||
rec {
|
|
||||||
# Ternary operator
|
|
||||||
# Exaample:
|
|
||||||
# tern false 1 2 => 2
|
|
||||||
# tern true 1 2 => 1
|
|
||||||
tern = pred: x: y: if pred then x else y;
|
|
||||||
|
|
||||||
# Right-associate and chain following single-operand functions
|
|
||||||
# Example:
|
|
||||||
# right f g h 1 => f(g(h(1)))
|
|
||||||
right = f: g: tern (isFunction g)
|
|
||||||
(right (x: f (g (x))))
|
|
||||||
(f (g));
|
|
||||||
}
|
|
Loading…
Reference in a new issue