1
0

flake.nix 3.4 KB

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