This commit is contained in:
soraefir 2024-04-17 00:25:54 +02:00
parent 6441652b8c
commit b644c87517
Signed by: sora
GPG Key ID: A362EA0491E2EEA0
6 changed files with 172 additions and 151 deletions

113
flake.nix
View File

@ -30,62 +30,67 @@
};
outputs = inputs:
let gen = import ./generator.nix { inherit inputs; };
let
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 {
devShells = import ./shells { inherit inputs; };
nixosConfigurations = {
valinor = gen.generate {
type = "nixos";
system = "x86_64-linux";
host = "valinor";
};
iriy = gen.generate {
type = "nixos";
system = "x86_64-linux";
host = "iriy";
};
efir = gen.generate {
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";
};
};
inherit gensys;
# nixosConfigurations = {
# valinor = gen.generate {
# type = "nixos";
# system = "";
# host = "valinor";
# };
# iriy = gen.generate {
# type = "nixos";
# system = "x86_64-linux";
# host = "iriy";
# };
# efir = gen.generate {
# 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 ======

View File

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

View File

@ -63,5 +63,6 @@
XDG_TEMPLATES_DIR="$HOME/media/templates"
XDG_VIDEOS_DIR="$HOME/media/video"
'';
})];
})
];
}

View File

@ -1,4 +1,4 @@
{ ... }:
{
virtualisation.arion.projects.
# virtualisation.arion.projects.
}

View File

@ -98,6 +98,14 @@ in with lib; {
options.usercfg = userOpt;
options.syscfg = {
hostname = mkOption { type = types.str; };
type = mkOption {
type = types.enum [ "nixos" "macos" "home" ];
default = "nixos";
};
system = mkOption {
type = types.enum [ "x86_64-linux" "x86_64-darwin" "-" ];
default = "x86_64-linux";
};
defaultUser = mkOption { type = types.str; };
make = makeOpt;
net = netOpt;

3
systems/asguard/cfg.nix Normal file
View File

@ -0,0 +1,3 @@
{
}