flake.nix 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. {
  2. description = "Nix Dotfiles with flake";
  3. inputs = {
  4. nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
  5. home-manager = {
  6. url = "github:nix-community/home-manager/release-26.05";
  7. inputs.nixpkgs.follows = "nixpkgs";
  8. };
  9. nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=v0.7.0";
  10. dms = {
  11. url = "github:AvengeMedia/DankMaterialShell/stable";
  12. inputs.nixpkgs.follows = "nixpkgs";
  13. };
  14. vm-curator.url = "github:mroboff/vm-curator";
  15. };
  16. outputs =
  17. {
  18. self,
  19. nix-flatpak,
  20. vm-curator,
  21. ...
  22. }@inputs:
  23. let
  24. hosts = import ./config/hosts.nix;
  25. mkHomeConfigurations =
  26. {
  27. host,
  28. nixpkgs,
  29. home-manager,
  30. modules ? [ ],
  31. }:
  32. home-manager.lib.homeManagerConfiguration {
  33. pkgs = import nixpkgs {
  34. system = host.arch;
  35. config = {
  36. allowUnfree = true;
  37. };
  38. };
  39. extraSpecialArgs = { inherit inputs; };
  40. modules = [
  41. ./hosts/${host.dir}/home.nix
  42. #mango.homeManagerModules.mango
  43. ] ++ modules;
  44. };
  45. mkNixOSConfigurations =
  46. {
  47. host,
  48. nixpkgs,
  49. home-manager,
  50. modules ? [ ],
  51. overlays ? [],
  52. }:
  53. nixpkgs.lib.nixosSystem {
  54. system = host.arch;
  55. specialArgs = {
  56. inherit inputs;
  57. };
  58. modules = [
  59. nix-flatpak.nixosModules.nix-flatpak
  60. ./hosts/${host.dir}/configuration.nix
  61. { nixpkgs.overlays = overlays; }
  62. home-manager.nixosModules.home-manager
  63. {
  64. home-manager.extraSpecialArgs = { inherit inputs; };
  65. home-manager.useGlobalPkgs = true;
  66. home-manager.users."${host.user}" = import ./hosts/${host.dir}/home.nix;
  67. }
  68. ] ++ modules;
  69. };
  70. mkISOConfiguration = # Build with: nix build .#nixosConfigurations.<hostname>-iso.config.system.build.isoImage
  71. {
  72. host,
  73. nixpkgs,
  74. }:
  75. nixpkgs.lib.nixosSystem {
  76. system = host.arch;
  77. modules = [
  78. ./hosts/${host.dir}/iso.nix
  79. { networking.hostName = "${host.hostname}-iso"; }
  80. ];
  81. };
  82. in
  83. {
  84. nixosConfigurations."${hosts.nixstation.hostname}" = mkNixOSConfigurations {
  85. host = hosts.nixstation;
  86. nixpkgs = inputs.nixpkgs;
  87. home-manager = inputs.home-manager;
  88. };
  89. nixosConfigurations."${hosts.dellaptop.hostname}" = mkNixOSConfigurations {
  90. host = hosts.dellaptop;
  91. nixpkgs = inputs.nixpkgs;
  92. home-manager = inputs.home-manager;
  93. };
  94. nixosConfigurations."${hosts.ideapad.hostname}" = mkNixOSConfigurations {
  95. host = hosts.ideapad;
  96. nixpkgs = inputs.nixpkgs;
  97. home-manager = inputs.home-manager;
  98. };
  99. nixosConfigurations."${hosts.nixstation.hostname}-iso" = mkISOConfiguration {
  100. host = hosts.nixstation;
  101. nixpkgs = inputs.nixpkgs;
  102. };
  103. nixosConfigurations."${hosts.dellaptop.hostname}-iso" = mkISOConfiguration {
  104. host = hosts.dellaptop;
  105. nixpkgs = inputs.nixpkgs;
  106. };
  107. nixosConfigurations."${hosts.ideapad.hostname}-iso" = mkISOConfiguration {
  108. host = hosts.ideapad;
  109. nixpkgs = inputs.nixpkgs;
  110. };
  111. homeConfigurations."${hosts.nixstation.user}@${hosts.nixstation.hostname}" = mkHomeConfigurations {
  112. host = hosts.nixstation;
  113. nixpkgs = inputs.nixpkgs;
  114. home-manager = inputs.home-manager;
  115. };
  116. homeConfigurations."${hosts.dellaptop.user}@${hosts.dellaptop.hostname}" = mkHomeConfigurations {
  117. host = hosts.dellaptop;
  118. nixpkgs = inputs.nixpkgs;
  119. home-manager = inputs.home-manager;
  120. };
  121. };
  122. }