1
0

flake.nix 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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 host; };
  40. modules = [
  41. ./hosts/${host.dir}/home.nix
  42. ] ++ modules;
  43. };
  44. mkNixOSConfigurations =
  45. {
  46. host,
  47. nixpkgs,
  48. home-manager,
  49. modules ? [ ],
  50. overlays ? [],
  51. }:
  52. nixpkgs.lib.nixosSystem {
  53. system = host.arch;
  54. specialArgs = {
  55. inherit inputs host;
  56. };
  57. modules = [
  58. nix-flatpak.nixosModules.nix-flatpak
  59. ./hosts/${host.dir}/nixos
  60. { nixpkgs.overlays = overlays; }
  61. home-manager.nixosModules.home-manager
  62. {
  63. home-manager.extraSpecialArgs = { inherit inputs host; };
  64. home-manager.useGlobalPkgs = true;
  65. home-manager.useUserPackages = true;
  66. home-manager.backupFileExtension = "backup";
  67. home-manager.users."${host.user}" = import ./hosts/${host.dir}/home;
  68. }
  69. ] ++ modules;
  70. };
  71. mkISOConfiguration = # Build with: nix build .#nixosConfigurations.<hostname>-iso.config.system.build.isoImage
  72. {
  73. host,
  74. nixpkgs,
  75. }:
  76. nixpkgs.lib.nixosSystem {
  77. system = host.arch;
  78. modules = [
  79. ./hosts/${host.dir}/iso.nix
  80. { networking.hostName = "${host.hostname}-iso"; }
  81. ];
  82. };
  83. in
  84. {
  85. nixosConfigurations."${hosts.nixstation.hostname}" = mkNixOSConfigurations {
  86. host = hosts.nixstation;
  87. nixpkgs = inputs.nixpkgs;
  88. home-manager = inputs.home-manager;
  89. };
  90. nixosConfigurations."${hosts.ideapad.hostname}" = mkNixOSConfigurations {
  91. host = hosts.ideapad;
  92. nixpkgs = inputs.nixpkgs;
  93. home-manager = inputs.home-manager;
  94. };
  95. nixosConfigurations."${hosts.nixstation.hostname}-iso" = mkISOConfiguration {
  96. host = hosts.nixstation;
  97. nixpkgs = inputs.nixpkgs;
  98. };
  99. nixosConfigurations."${hosts.ideapad.hostname}-iso" = mkISOConfiguration {
  100. host = hosts.ideapad;
  101. nixpkgs = inputs.nixpkgs;
  102. };
  103. homeConfigurations."${hosts.nixstation.user}@${hosts.nixstation.hostname}" = mkHomeConfigurations {
  104. host = hosts.nixstation;
  105. nixpkgs = inputs.nixpkgs;
  106. home-manager = inputs.home-manager;
  107. };
  108. homeConfigurations."${hosts.ideapad.user}@${hosts.ideapad.hostname}" = mkHomeConfigurations {
  109. host = hosts.ideapad;
  110. nixpkgs = inputs.nixpkgs;
  111. home-manager = inputs.home-manager;
  112. };
  113. };
  114. }