flake.nix 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. };
  28. outputs =
  29. {
  30. self,
  31. nix-flatpak,
  32. ...
  33. }@inputs:
  34. let
  35. hosts = import ./config/hosts.nix;
  36. mkHomeConfigurations =
  37. {
  38. host,
  39. nixpkgs,
  40. home-manager,
  41. modules ? [ ],
  42. }:
  43. home-manager.lib.homeManagerConfiguration {
  44. pkgs = import nixpkgs {
  45. system = host.arch;
  46. config = {
  47. allowUnfree = true;
  48. };
  49. };
  50. extraSpecialArgs = { inherit inputs; };
  51. modules = [
  52. ./hosts/${host.dir}/home.nix
  53. ] ++ modules;
  54. };
  55. mkNixOSConfigurations =
  56. {
  57. host,
  58. nixpkgs,
  59. home-manager,
  60. modules ? [ ],
  61. overlays ? [],
  62. }:
  63. nixpkgs.lib.nixosSystem {
  64. system = host.arch;
  65. specialArgs = {
  66. inherit inputs;
  67. };
  68. modules = [
  69. nix-flatpak.nixosModules.nix-flatpak
  70. ./hosts/${host.dir}/configuration.nix
  71. { nixpkgs.overlays = overlays; }
  72. home-manager.nixosModules.home-manager
  73. {
  74. home-manager.extraSpecialArgs = { inherit inputs; };
  75. home-manager.useGlobalPkgs = true;
  76. home-manager.users."${host.user}" = import ./hosts/${host.dir}/home.nix;
  77. }
  78. ] ++ modules;
  79. };
  80. mkISOConfiguration = # Build with: nix build .#nixosConfigurations.<hostname>-iso.config.system.build.isoImage
  81. {
  82. host,
  83. nixpkgs,
  84. }:
  85. nixpkgs.lib.nixosSystem {
  86. system = host.arch;
  87. modules = [
  88. ./hosts/${host.dir}/iso.nix
  89. { networking.hostName = "${host.hostname}-iso"; }
  90. ];
  91. };
  92. in
  93. {
  94. nixosConfigurations."${hosts.nixstation.hostname}" = mkNixOSConfigurations {
  95. host = hosts.nixstation;
  96. nixpkgs = inputs.nixpkgs;
  97. home-manager = inputs.home-manager;
  98. };
  99. nixosConfigurations."${hosts.dellaptop.hostname}" = mkNixOSConfigurations {
  100. host = hosts.dellaptop;
  101. nixpkgs = inputs.nixpkgs;
  102. home-manager = inputs.home-manager;
  103. };
  104. nixosConfigurations."${hosts.nixstation.hostname}-iso" = mkISOConfiguration {
  105. host = hosts.nixstation;
  106. nixpkgs = inputs.nixpkgs;
  107. };
  108. nixosConfigurations."${hosts.dellaptop.hostname}-iso" = mkISOConfiguration {
  109. host = hosts.dellaptop;
  110. nixpkgs = inputs.nixpkgs;
  111. };
  112. homeConfigurations."${hosts.nixstation.user}@${hosts.nixstation.hostname}" = mkHomeConfigurations {
  113. host = hosts.nixstation;
  114. nixpkgs = inputs.nixpkgs;
  115. home-manager = inputs.home-manager;
  116. };
  117. homeConfigurations."${hosts.dellaptop.user}@${hosts.dellaptop.hostname}" = mkHomeConfigurations {
  118. host = hosts.dellaptop;
  119. nixpkgs = inputs.nixpkgs;
  120. home-manager = inputs.home-manager;
  121. };
  122. };
  123. }