flake.nix 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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.useUserPackages = true;
  67. home-manager.backupFileExtension = "backup";
  68. home-manager.users."${host.user}" = import ./hosts/${host.dir}/home.nix;
  69. }
  70. ] ++ modules;
  71. };
  72. mkISOConfiguration = # Build with: nix build .#nixosConfigurations.<hostname>-iso.config.system.build.isoImage
  73. {
  74. host,
  75. nixpkgs,
  76. }:
  77. nixpkgs.lib.nixosSystem {
  78. system = host.arch;
  79. modules = [
  80. ./hosts/${host.dir}/iso.nix
  81. { networking.hostName = "${host.hostname}-iso"; }
  82. ];
  83. };
  84. in
  85. {
  86. nixosConfigurations."${hosts.nixstation.hostname}" = mkNixOSConfigurations {
  87. host = hosts.nixstation;
  88. nixpkgs = inputs.nixpkgs;
  89. home-manager = inputs.home-manager;
  90. };
  91. nixosConfigurations."${hosts.dellaptop.hostname}" = mkNixOSConfigurations {
  92. host = hosts.dellaptop;
  93. nixpkgs = inputs.nixpkgs;
  94. home-manager = inputs.home-manager;
  95. };
  96. nixosConfigurations."${hosts.ideapad.hostname}" = mkNixOSConfigurations {
  97. host = hosts.ideapad;
  98. nixpkgs = inputs.nixpkgs;
  99. home-manager = inputs.home-manager;
  100. };
  101. nixosConfigurations."${hosts.nixstation.hostname}-iso" = mkISOConfiguration {
  102. host = hosts.nixstation;
  103. nixpkgs = inputs.nixpkgs;
  104. };
  105. nixosConfigurations."${hosts.dellaptop.hostname}-iso" = mkISOConfiguration {
  106. host = hosts.dellaptop;
  107. nixpkgs = inputs.nixpkgs;
  108. };
  109. nixosConfigurations."${hosts.ideapad.hostname}-iso" = mkISOConfiguration {
  110. host = hosts.ideapad;
  111. nixpkgs = inputs.nixpkgs;
  112. };
  113. homeConfigurations."${hosts.nixstation.user}@${hosts.nixstation.hostname}" = mkHomeConfigurations {
  114. host = hosts.nixstation;
  115. nixpkgs = inputs.nixpkgs;
  116. home-manager = inputs.home-manager;
  117. };
  118. homeConfigurations."${hosts.dellaptop.user}@${hosts.dellaptop.hostname}" = mkHomeConfigurations {
  119. host = hosts.dellaptop;
  120. nixpkgs = inputs.nixpkgs;
  121. home-manager = inputs.home-manager;
  122. };
  123. };
  124. }