Skip to content

Commit

Permalink
nix: make system configurations dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
FredeEB committed Mar 23, 2024
1 parent e702bf8 commit 5402eef
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 20 deletions.
File renamed without changes.
File renamed without changes.
31 changes: 12 additions & 19 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,19 @@
let
overlays = [ neovim-nightly-overlay.overlay ];

base = [ { nixpkgs.overlays = overlays; } ./systems/base.nix ];
base = [ { nixpkgs.overlays = overlays; } ./common/base.nix ];
createSystem = (system-file:
let name = nixpkgs.lib.strings.removeSuffix ".nix" system-file;
in {
inherit name;
value = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = base ++ [ (./systems + "/${system-file}") ];
};
});
in {
nixosConfigurations = {
dt = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = base ++ [ ./systems/desktop.nix ./systems/dt.nix ];
};
yoga = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = base ++ [ ./systems/desktop.nix ./systems/yoga.nix ];
};
ideapad = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = base ++ [ ./systems/desktop.nix ./systems/ideapad.nix ];
};
server = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = base ++ [ ./systems/server.nix ./modules/ssh.nix ];
};
};
nixosConfigurations = builtins.listToAttrs
(map createSystem (builtins.attrNames (builtins.readDir ./systems)));

formatter."x86_64-linux" = nixpkgs.legacyPackages."x86_64-linux".nixfmt;
};
Expand Down
1 change: 1 addition & 0 deletions systems/dt.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{ config, lib, modulesPath, ... }: {
imports = [
../common/desktop.nix
../modules/default-system-layout.nix
(modulesPath + "/installer/scan/not-detected.nix")
];
Expand Down
1 change: 1 addition & 0 deletions systems/ideapad.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{ config, lib, modulesPath, ... }: {
imports = [
../common/desktop.nix
../modules/default-system-layout.nix
(modulesPath + "/installer/scan/not-detected.nix")
];
Expand Down
2 changes: 1 addition & 1 deletion systems/yoga.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ config, lib, modulesPath, ... }: {

imports = [
../common/desktop.nix
../modules/default-system-layout.nix
(modulesPath + "/installer/scan/not-detected.nix")
];
Expand Down

0 comments on commit 5402eef

Please sign in to comment.