Cfg updated
All checks were successful
Nix Build / build-nixos (push) Successful in 4m51s

This commit is contained in:
soraefir 2024-04-17 08:26:08 +02:00
parent b644c87517
commit 150d2f2e07
Signed by: sora
GPG Key ID: A362EA0491E2EEA0
8 changed files with 74 additions and 104 deletions

View File

@ -30,67 +30,23 @@
}; };
outputs = inputs: outputs = inputs:
let let gen = import ./generator.nix { inherit inputs; };
gen = import ./generator.nix { inherit inputs; };
sys = builtins.attrNames
# (builtins.filterSource (path: type: type == "directory")
(builtins.readDir ./systems); # );
gensys = builtins.listToAttrs
(builtins.map (x: gen.generate { syspath = x; }) sys);
in { in {
devShells = import ./shells { inherit inputs; }; devShells = import ./shells { inherit inputs; };
inherit gensys;
# nixosConfigurations = { nixosConfigurations = {
# valinor = gen.generate { valinor = gen.generate { host = "valinor"; };
# type = "nixos"; iriy = gen.generate { host = "iriy"; };
# system = ""; efir = gen.generate { host = "efir"; };
# host = "valinor"; avalon = gen.generate { host = "avalon"; };
# }; ci = gen.generate { host = "ci"; };
# iriy = gen.generate { sandbox = gen.generate { host = "sandbox"; };
# type = "nixos"; };
# system = "x86_64-linux"; darwinConfigurations = { asgard = gen.generate { host = "asgard"; }; };
# host = "iriy"; homeConfigurations = {
# }; yomi = gen.generate { host = "example"; };
# efir = gen.generate { example = gen.generate { host = "example"; };
# type = "nixos"; };
# system = "x86_64-linux";
# host = "efir";
# };
# avalon = gen.generate {
# type = "nixos";
# system = "x86_64-linux";
# host = "avalon";
# };
# ci = gen.generate {
# type = "nixos";
# system = "x86_64-linux";
# host = "ci";
# };
# sandbox = gen.generate {
# type = "nixos";
# system = "x86_64-linux";
# host = "sandbox";
# };
# };
# darwinConfigurations = {
# asgard = gen.generate {
# type = "macos";
# system = "x86_64-darwin";
# host = "asgard";
# };
# };
# homeConfigurations = {
# yomi = gen.generate {
# type = "home";
# system = "arm-64";
# host = "example";
# };
# example = gen.generate {
# type = "home";
# system = "-"; # supports any
# host = "example";
# };
# };
}; };
# ===== Unsupported/NotImplemented ====== # ===== Unsupported/NotImplemented ======

View File

@ -1,19 +1,17 @@
{ inputs, ... }: { { inputs, ... }: {
generate = { syspath }: generate = { host }:
let let
syscfg = import ./systems/${syspath}/cfg.nix; syscfg = import ./systems/${host}/cfg.nix;
nameValuePair = name: value: { inherit name value; }; nameValuePair = name: value: { inherit name value; };
in ({ in ({
"nixos" = { "nixos" = inputs.nixpkgs.lib.nixosSystem {
nisoxConfigurations."${syscfg.hostname}" = system = syscfg.syscfg.system;
inputs.nixpkgs.lib.nixosSystem {
system = syscfg.system;
modules = [ modules = [
./modules/shared/syscfg ./modules/shared/syscfg
./modules/shared/sops ./modules/shared/sops
./modules/nixos ./modules/nixos
syscfg syscfg
syspath ./systems/${host}
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
{ {
@ -35,31 +33,33 @@
} }
]; ];
}; };
};
"macos" = inputs.darwin.lib.darwinSystem { "macos" = inputs.darwin.lib.darwinSystem {
system = syscfg.system; system = syscfg.system;
modules = [ modules = [
./modules/shared/syscfg
./modules/shared/sops
syscfg
./systems/${host}
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
syspath
inputs.home-manager.darwinModules.home-manager inputs.home-manager.darwinModules.home-manager
{ {
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inherit inputs; }; home-manager.extraSpecialArgs = { inherit inputs; };
home-manager.users.sora = { home-manager.users = builtins.listToAttrs (map (userConfig:
nameValuePair userConfig.username {
imports = [ imports = [
inputs.nix-colors.homeManagerModule inputs.nix-colors.homeManagerModule
inputs.hyprland.homeManagerModules inputs.hyprland.homeManagerModules
./systems/${syspath}/home.nix
]; ];
}; }) syscfg.syscfg.users);
} }
]; ];
}; };
"home" = inputs.home-manager.lib.homeManagerConfiguration { "home" = inputs.home-manager.lib.homeManagerConfiguration {
modules = [ ./modules/home ./systems/${syscfg.hostname}/home.nix ]; modules = [ ./modules/home ];
}; };
_ = throw "Unsupported system"; _ = throw "Unsupported system";
}.${syscfg.type}); }.${syscfg.syscfg.type});
} }

View File

@ -1,3 +1,8 @@
{ {
syscfg = {
hostname = "asguard";
defaultUser = "sora";
type = "macos";
system = "x86_64-darwin";
};
} }

View File

@ -1,6 +1,8 @@
{ {
syscfg = { syscfg = {
hostname = "avalon"; hostname = "avalon";
system = "x86_64-linux";
type = "nixos";
defaultUser = "sora"; defaultUser = "sora";
users = [ users = [
{ {
@ -36,7 +38,6 @@
enable = true; enable = true;
ip4 = "10.10.1.2/32"; ip4 = "10.10.1.2/32";
ip6 = "fd10:10:10::2/128"; ip6 = "fd10:10:10::2/128";
pk = config.sops.secrets.avalon_wg_priv.path;
}; };
}; };
} }

View File

@ -1,6 +1,8 @@
{ {
syscfg = { syscfg = {
hostname = "ci"; hostname = "ci";
type = "nixos";
system = "x86_64-linux";
defaultUser = "ci"; defaultUser = "ci";
users = [{ users = [{
username = "ci"; username = "ci";

View File

@ -1,6 +1,8 @@
{ {
syscfg = { syscfg = {
hostname = "iriy"; hostname = "iriy";
type = "nixos";
system = "x86_64-linux";
defaultUser = "sora"; defaultUser = "sora";
users = [{ users = [{
username = "sora"; username = "sora";

View File

@ -1,6 +1,8 @@
{ {
syscfg = { syscfg = {
hostname = "sandbox"; hostname = "sandbox";
type = "nixos";
system = "x86_64-linux";
defaultUser = "sora"; defaultUser = "sora";
users = [{ users = [{
username = "sora"; username = "sora";

View File

@ -1,6 +1,8 @@
{ {
syscfg = { syscfg = {
hostname = "valinor"; hostname = "valinor";
type = "nixos";
system = "x86_64-linux";
defaultUser = "sora"; defaultUser = "sora";
users = [{ users = [{
username = "sora"; username = "sora";