Skip to content

Commit

Permalink
add helper function in nixos/default.nix
Browse files Browse the repository at this point in the history
also some formatting
  • Loading branch information
luqmanishere committed Apr 29, 2024
1 parent 218eb02 commit 4e43399
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 42 deletions.
16 changes: 10 additions & 6 deletions home/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,23 @@
# for specific systems

luqman-asuna = {
imports = [
self.homeModules.common
imports = [
self.homeModules.common
./luqman-home.nix
self.homeModules.gui
self.homeModules.wayland
self.homeModules.misc-gui
];

self.homeModules.gui
self.homeModules.wayland
self.homeModules.misc-gui
];
};

luqman-sinon = {
imports = [
self.homeModules.common
./luqman-home.nix

./tools/fonts.nix
./terminals/kitty.nix
];
};
};
Expand Down
75 changes: 39 additions & 36 deletions nixos/default.nix
Original file line number Diff line number Diff line change
@@ -1,50 +1,53 @@
{
self,
config,
...
}: {
{self, ...}: let
# create entry for a system
mkSystem = {
# hostname of the system
hostname ? "nixos",
# additional nixos modules (applied after common modules)
nixosModules ? [],
# additonal home manager modules (applied after default hostname specific module)
homeManagerModules ? [],
# extra config applied after all modules
extraConfig ? {},
}: {
imports = [self.nixosModules.common] ++ nixosModules ++ [extraConfig];

home-manager.users.luqman = {
imports = [self.homeModules."luqman-${hostname}"] ++ homeManagerModules;
};
};
in {
flake = {
# declare our modules here
nixosModules = {
# common modules that should be present on all systems
common.imports = [
./nix.nix
self.nixosModules.home-manager

./users.nix
./groups.nix
./dev.nix
./shells.nix
];
common = {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
imports = [
./nix.nix
self.nixosModules.home-manager

./users.nix
./groups.nix
./dev.nix
./shells.nix
];

home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
};

# system specific configurations
###### system specific configurations

# main laptop configuration
asuna = {
imports = [
self.nixosModules.common
./steam.nix
];

# never forget to import important things
home-manager.users.luqman = {
imports = [self.homeModules.luqman-asuna];
};
asuna = mkSystem {
hostname = "asuna";
nixosModules = [./steam.nix];
};

# wsl setup
sinon = {
imports = [
self.nixosModules.common
./wsl.nix
];
home-manager.users.luqman = {
imports = [self.homeModules.luqman-sinon];
};
# wsl2 config
sinon = mkSystem {
hostname = "sinon";
nixosModules = [./wsl.nix];
};
};
};
Expand Down

0 comments on commit 4e43399

Please sign in to comment.