Skip to content

Commit

Permalink
Clean up flake.nix
Browse files Browse the repository at this point in the history
  • Loading branch information
arunoruto committed Oct 14, 2024
1 parent 6ee737d commit c7619f3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 183 deletions.
1 change: 1 addition & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,4 @@ To clean up such systems, you can use the following commands:

- [use-the-fork](https://github.com/use-the-fork) helped me to [move](https://www.reddit.com/r/NixOS/comments/1eely7a/access_homemanager_config_from_my_nixos_config/) from a standalone config for home-manager to using it as a module
- [u/paulgdp](https://www.reddit.com/user/paulgdp/) gave [advice](https://www.reddit.com/r/NixOS/comments/19c5een/comment/kiwxy8b/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button) on how `nixosConfig` is an attribute of `args` if the config is used in NixOS, used in `modules/home-manager/imports.nix`
- `olmokramer` gave an example on how to use `lib.genAttrs` in a [forum post](https://discourse.nixos.org/t/flakes-how-to-automatically-set-machine-hostname-to-nixosconfiguration-name/45217/2) to configure NixOS systems -> extended it for home-manager too
195 changes: 12 additions & 183 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@
home-manager,
...
} @ inputs: let
# currently onlu x86 linux is used
# will maybe change in the future!
# -> look into flake parts/utils
system = "x86_64-linux";

# Some customization
# scheme = "catppuccin-macchiato";
# scheme = "tokyo-night-dark";
scheme = "gruvbox-material-dark-hard";
Expand Down Expand Up @@ -122,15 +127,9 @@
# })
];
};
# stylix-config = {
# stylix.image = nixpkgs.lib.mkDefault ./modules/home-manager/theming/wallpaper.png;
# # scheme = "tokyo-night-dark";
# # image = "anime/jjk/satoru-gojo-jujutsu-kaisen-5k-ac.jpg";
# };
nixos-modules = [
nixpkgs-config
nur.nixosModules.nur
# stylix-config
{
theming = {
inherit scheme;
Expand All @@ -154,23 +153,18 @@
inherit image;
};
}
# stylix-config
# {
# stylix.image = nixpkgs.lib.mkDefault ./home-manager/desktop/default-wallpaper.png;
# #stylix.targets.nixvim.enable = nixpkgs.lib.mkDefault false;
# }
];

hostname-users = {
# Personal
"isshin" = "mirza";
"zangetsu" = "mirza";
"yhwach" = "mirza";
"kuchiki" = "mirza";
"yoruichi" = "mirza";
"narouter" = "mirza";
"isshin" = "mirza"; # Framework Laptop AMD 7040
"zangetsu" = "mirza"; # Framework Case Intel 11th
"yhwach" = "mirza"; # Tower PC
"kuchiki" = "mirza"; # New NAS Server
"yoruichi" = "mirza"; # Crappy AMD Mini PC
"narouter" = "mirza"; # Firewall
# Work
"kyuubi" = "mar";
"kyuubi" = "mar"; # Crappy Work PC
};
in {
nixosConfigurations = nixpkgs.lib.genAttrs (builtins.attrNames hostname-users) (hostname:
Expand All @@ -189,140 +183,6 @@
./homes
];
});
# nixosConfigurations = nixpkgs.lib.attrsets.mapAttrs (user: hosts:
# nixpkgs.lib.attrsets.map (
# host: {
# ${host} = nixpkgs.lib.nixosSystem {
# inherit system;
# specialArgs = {
# inherit inputs;
# username = "${user}";
# };
# modules =
# nixos-modules
# ++ [
# ./hosts/${host}
# home-manager.nixosModules.home-manager
# ./homes
# ];
# };
# }
# )
# hosts)
# users-hostnames;

# nixosConfigurations = {
# # Framework Laptop AMD 7040
# isshin = nixpkgs.lib.nixosSystem {
# inherit system;
# specialArgs = {
# inherit inputs;
# username = "mirza";
# };
# modules =
# nixos-modules
# ++ [
# ./hosts/isshin
# home-manager.nixosModules.home-manager
# ./homes
# ];
# };

# # Framework Case Intel 11th
# zangetsu = nixpkgs.lib.nixosSystem {
# inherit system;
# specialArgs = {
# inherit inputs;
# username = "mirza";
# };
# modules =
# nixos-modules
# ++ [
# ./hosts/zangetsu
# home-manager.nixosModules.home-manager
# ./homes
# ];
# };

# # Tower PC
# yhwach = nixpkgs.lib.nixosSystem {
# inherit system;
# specialArgs = {
# inherit inputs;
# username = "mirza";
# };
# modules =
# nixos-modules
# ++ [
# ./hosts/yhwach
# home-manager.nixosModules.home-manager
# ./homes
# ];
# };

# # Work PC
# kyuubi = nixpkgs.lib.nixosSystem {
# inherit system;
# specialArgs = {
# inherit inputs;
# username = "mar";
# };
# modules =
# nixos-modules
# ++ [
# ./hosts/kyuubi
# home-manager.nixosModules.home-manager
# ./homes
# ];
# };

# # New NAS Server
# kuchiki = nixpkgs.lib.nixosSystem {
# inherit system;
# specialArgs = {
# inherit inputs;
# username = "mirza";
# };
# modules =
# nixos-modules
# ++ [
# ./hosts/kuchiki
# home-manager.nixosModules.home-manager
# ./homes
# ];
# };

# # Crappy AMD Mini PC
# yoruichi = nixpkgs.lib.nixosSystem {
# inherit system;
# specialArgs = {
# inherit inputs;
# username = "mirza";
# };
# modules =
# nixos-modules
# ++ [
# ./hosts/yoruichi
# home-manager.nixosModules.home-manager
# ./homes
# ];
# };
# # Firewall
# narouter = nixpkgs.lib.nixosSystem {
# inherit system;
# specialArgs = {
# inherit inputs;
# username = "mirza";
# };
# modules =
# nixos-modules
# ++ [
# ./hosts/narouter
# home-manager.nixosModules.home-manager
# ./homes
# ];
# };
# };

homeConfigurations = nixpkgs.lib.genAttrs (nixpkgs.lib.lists.unique (builtins.attrValues hostname-users)) (user:
home-manager.lib.homeManagerConfiguration {
Expand All @@ -334,37 +194,6 @@
# user = user;
};
});
# homeConfigurations = {
# # mirza = home-manager.lib.homeManagerConfiguration {
# # inherit pkgs;

# # # Specify your home configuration modules here, for example,
# # # the path to your home.nix.
# # modules =
# # home-manager-modules
# # ++ [
# # ./nixos/hosts/zangetsu/home.nix
# # ];

# # # Optionally use extraSpecialArgs
# # # to pass through arguments to home.nix
# # extraSpecialArgs = {
# # inherit inputs;
# # inherit scheme;
# # inherit image;
# # user = "mirza";
# # };
# # };

# mar = home-manager.lib.homeManagerConfiguration {
# inherit pkgs;
# modules = home-manager-modules;
# extraSpecialArgs = {
# inherit inputs;
# user = "mar";
# };
# };
# };

devShells.${system}.default = pkgs.mkShell {
buildInputs = with pkgs; [
Expand Down

0 comments on commit c7619f3

Please sign in to comment.