make system configurable

This commit is contained in:
Daylin Morgan 2025-02-20 10:00:45 -06:00
parent f74deacae0
commit 186fda577e
Signed by: daylin
GPG key ID: 950D13E9719334AD
3 changed files with 26 additions and 11 deletions

View file

@ -64,7 +64,7 @@ let
rec {
default = oizys;
oizys = pkgs.callPackage ../pkgs/oizys { };
iso = mkIso.config.system.build.isoImage;
iso-x86_64-linux = (mkIso "x86_64-linux").config.system.build.isoImage;
}
// (import ../pkgs { inherit pkgs lib inputs; })
);

View file

@ -140,6 +140,12 @@ let
pathFromHostName = host: ../. + "/hosts/${host}";
hostFiles = host: host |> pathFromHostName |> listFilesRecursive |> filter isNixFile;
hostSystem =
host:
let
f = (host |> pathFromHostName) + "/settings/system";
in
if pathExists f then readLinesNoComment f else "x86_64-linux";
# if the specified path doesn't exist returns an empty array
tryReadLinesNoComment = f: if pathExists f then (readLinesNoComment f) else [ ];
@ -208,6 +214,7 @@ in
listify
loadOverlays
hostFiles
hostSystem
oizysSettings
tryPkgsFromFile
;

View file

@ -15,6 +15,7 @@ let
listify
readSettings
hostFiles
hostSystem
;
flake = flakeFromSystem "x86_64-linux";
nixosModules = names: names |> listify |> map (n: inputs.${n}.nixosModules.default);
@ -30,10 +31,13 @@ let
;
};
mkIso = nixosSystem {
mkIso =
system:
nixosSystem {
system = system;
modules =
[
{ nixpkgs.hostPlatform = "x86_64-linux"; }
{ nixpkgs.hostPlatform = system; }
]
++ (nixosModules "lix-module")
++ (selfModules "essentials|iso");
@ -42,10 +46,14 @@ let
mkSystem =
hostName:
let
system = hostSystem hostName;
in
nixosSystem {
inherit system;
modules =
[
{ nixpkgs.hostPlatform = "x86_64-linux"; }
{ nixpkgs.hostPlatform = system; }
]
++ (selfModules ''oizys'')
++ (nixosModules ''lix-module|sops-nix'')