1
0

flake.nix 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. #mango = {
  11. # url = "github:mangowm/mango";
  12. # inputs.nixpkgs.follows = "nixpkgs";
  13. #};
  14. #moose = {
  15. # url = "github:johron/moose";
  16. # inputs.nixpkgs.follows = "nixpkgs";
  17. #};
  18. caelestia-shell = {
  19. #url = "github:anarion80/caelestia-shell/topbar";
  20. url = "github:caelestia-dots/shell";
  21. inputs.nixpkgs.follows = "nixpkgs";
  22. };
  23. caelestia-cli = {
  24. url = "github:caelestia-dots/cli";
  25. inputs.nixpkgs.follows = "nixpkgs";
  26. };
  27. dms = {
  28. url = "github:AvengeMedia/DankMaterialShell/stable";
  29. inputs.nixpkgs.follows = "nixpkgs";
  30. };
  31. };
  32. outputs =
  33. {
  34. self,
  35. nix-flatpak,
  36. #mango,
  37. ...
  38. }@inputs:
  39. let
  40. hosts = import ./config/hosts.nix;
  41. mkHomeConfigurations =
  42. {
  43. host,
  44. nixpkgs,
  45. home-manager,
  46. modules ? [ ],
  47. }:
  48. home-manager.lib.homeManagerConfiguration {
  49. pkgs = import nixpkgs {
  50. system = host.arch;
  51. config = {
  52. allowUnfree = true;
  53. };
  54. };
  55. extraSpecialArgs = { inherit inputs; };
  56. modules = [
  57. ./hosts/${host.dir}/home.nix
  58. #mango.homeManagerModules.mango
  59. ] ++ modules;
  60. };
  61. mkNixOSConfigurations =
  62. {
  63. host,
  64. nixpkgs,
  65. home-manager,
  66. modules ? [ ],
  67. overlays ? [],
  68. }:
  69. nixpkgs.lib.nixosSystem {
  70. system = host.arch;
  71. specialArgs = {
  72. inherit inputs;
  73. };
  74. modules = [
  75. nix-flatpak.nixosModules.nix-flatpak
  76. ./hosts/${host.dir}/configuration.nix
  77. { nixpkgs.overlays = overlays; }
  78. home-manager.nixosModules.home-manager
  79. {
  80. home-manager.extraSpecialArgs = { inherit inputs; };
  81. home-manager.useGlobalPkgs = true;
  82. home-manager.users."${host.user}" = import ./hosts/${host.dir}/home.nix;
  83. }
  84. ] ++ modules;
  85. };
  86. mkISOConfiguration = # Build with: nix build .#nixosConfigurations.<hostname>-iso.config.system.build.isoImage
  87. {
  88. host,
  89. nixpkgs,
  90. }:
  91. nixpkgs.lib.nixosSystem {
  92. system = host.arch;
  93. modules = [
  94. ./hosts/${host.dir}/iso.nix
  95. { networking.hostName = "${host.hostname}-iso"; }
  96. ];
  97. };
  98. in
  99. {
  100. nixosConfigurations."${hosts.nixstation.hostname}" = mkNixOSConfigurations {
  101. host = hosts.nixstation;
  102. nixpkgs = inputs.nixpkgs;
  103. home-manager = inputs.home-manager;
  104. };
  105. nixosConfigurations."${hosts.dellaptop.hostname}" = mkNixOSConfigurations {
  106. host = hosts.dellaptop;
  107. nixpkgs = inputs.nixpkgs;
  108. home-manager = inputs.home-manager;
  109. };
  110. nixosConfigurations."${hosts.nixstation.hostname}-iso" = mkISOConfiguration {
  111. host = hosts.nixstation;
  112. nixpkgs = inputs.nixpkgs;
  113. };
  114. nixosConfigurations."${hosts.dellaptop.hostname}-iso" = mkISOConfiguration {
  115. host = hosts.dellaptop;
  116. nixpkgs = inputs.nixpkgs;
  117. };
  118. homeConfigurations."${hosts.nixstation.user}@${hosts.nixstation.hostname}" = mkHomeConfigurations {
  119. host = hosts.nixstation;
  120. nixpkgs = inputs.nixpkgs;
  121. home-manager = inputs.home-manager;
  122. };
  123. homeConfigurations."${hosts.dellaptop.user}@${hosts.dellaptop.hostname}" = mkHomeConfigurations {
  124. host = hosts.dellaptop;
  125. nixpkgs = inputs.nixpkgs;
  126. home-manager = inputs.home-manager;
  127. };
  128. };
  129. }