1
0

flake.nix 3.8 KB

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