1
0

flake.nix 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. {
  2. description = "Nix Dotfiles with flake";
  3. inputs = {
  4. nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
  5. home-manager = {
  6. url = "github:nix-community/home-manager/release-25.11";
  7. inputs.nixpkgs.follows = "nixpkgs";
  8. };
  9. nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=v0.7.0";
  10. };
  11. outputs =
  12. {
  13. self,
  14. nix-flatpak,
  15. ...
  16. }@inputs:
  17. let
  18. hosts = import ./config/hosts.nix;
  19. mkHomeConfigurations =
  20. {
  21. host,
  22. nixpkgs,
  23. home-manager,
  24. modules ? [ ],
  25. }:
  26. home-manager.lib.homeManagerConfiguration {
  27. pkgs = import nixpkgs {
  28. system = host.arch;
  29. config = {
  30. allowUnfree = true;
  31. };
  32. };
  33. modules = [
  34. ./hosts/${host.dir}/home.nix
  35. ] ++ modules;
  36. };
  37. mkNixOSConfigurations =
  38. {
  39. host,
  40. nixpkgs,
  41. home-manager,
  42. modules ? [ ],
  43. overlays ? [ ],
  44. }:
  45. nixpkgs.lib.nixosSystem {
  46. system = host.arch;
  47. modules = [
  48. nix-flatpak.nixosModules.nix-flatpak
  49. ./hosts/${host.dir}/configuration.nix
  50. { nixpkgs.overlays = overlays; }
  51. home-manager.nixosModules.home-manager
  52. {
  53. home-manager.useGlobalPkgs = true;
  54. home-manager.users."${host.user}" = import ./hosts/${host.dir}/home.nix;
  55. }
  56. ] ++ modules;
  57. };
  58. mkISOConfiguration =
  59. {
  60. host,
  61. nixpkgs,
  62. }:
  63. nixpkgs.lib.nixosSystem {
  64. system = host.arch;
  65. modules = [
  66. nix-flatpak.nixosModules.nix-flatpak
  67. "${inputs.nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-graphical-calamares-plasma6.nix"
  68. ./hosts/${host.dir}/iso-configuration.nix
  69. {
  70. # ISO-specific configuration
  71. image.fileName = "${host.hostname}-installer.iso";
  72. isoImage.volumeID = "${builtins.substring 0 11 host.hostname}";
  73. }
  74. ];
  75. };
  76. in
  77. {
  78. nixosConfigurations."${hosts.nixstation.hostname}" = mkNixOSConfigurations {
  79. host = hosts.nixstation;
  80. nixpkgs = inputs.nixpkgs;
  81. home-manager = inputs.home-manager;
  82. };
  83. nixosConfigurations."${hosts.nixtop.hostname}" = mkNixOSConfigurations {
  84. host = hosts.nixtop;
  85. nixpkgs = inputs.nixpkgs;
  86. home-manager = inputs.home-manager;
  87. };
  88. isos.nixstation = (mkISOConfiguration {
  89. host = hosts.nixstation;
  90. nixpkgs = inputs.nixpkgs;
  91. }).config.system.build.isoImage;
  92. isos.nixtop = (mkISOConfiguration {
  93. host = hosts.nixtop;
  94. nixpkgs = inputs.nixpkgs;
  95. }).config.system.build.isoImage;
  96. #homeConfigurations."${hosts.workstation.user}@${hosts.workstation.hostname}" = mkHomeConfigurations {
  97. # host = hosts.workstation;
  98. # nixpkgs = inputs.nixpkgs;
  99. # home-manager = inputs.home-manager;
  100. #};
  101. #homeConfigurations."${hosts.wsl.hostname}" = mkHomeConfigurations {
  102. # host = hosts.wsl;
  103. # nixpkgs = inputs.nixpkgs-stable;
  104. # home-manager = inputs.home-manager-stable;
  105. #};
  106. };
  107. }