flake.nix 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. {
  2. description = "NixOS configuration";
  3. inputs = {
  4. nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-23.11";
  5. # nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
  6. nixpkgs.follows = "nixpkgs-stable";
  7. nixos-hardware.url = "github:NixOS/nixos-hardware/master";
  8. flake-programs-sqlite = {
  9. url = "github:wamserma/flake-programs-sqlite";
  10. inputs.nixpkgs.follows = "nixpkgs";
  11. };
  12. home-manager = {
  13. url = "github:nix-community/home-manager/release-23.11";
  14. inputs.nixpkgs.follows = "nixpkgs";
  15. };
  16. impermanence.url = "github:nix-community/impermanence";
  17. agenix = {
  18. url = "github:ryantm/agenix";
  19. inputs = {
  20. darwin.follows = "";
  21. home-manager.follows = "home-manager";
  22. nixpkgs.follows = "nixpkgs";
  23. };
  24. };
  25. };
  26. outputs = inputs @ { self, nixpkgs, nixos-hardware, ... }:
  27. let inherit (import ./lib.nix { inherit inputs; })
  28. forAllSystems isDir listDir asAttrs mkSystem;
  29. in {
  30. modules = builtins.listToAttrs (builtins.map (s: {
  31. name = builtins.baseNameOf s;
  32. value = asAttrs "\\.nix" s;
  33. }) (builtins.filter isDir (listDir ./modules))) // {
  34. secrets = asAttrs "\\.age" ./secrets;
  35. };
  36. overlays = builtins.mapAttrs (_: import) (asAttrs "\\.nix" ./overlays);
  37. devShells = forAllSystems (system:
  38. with import nixpkgs {
  39. inherit system;
  40. overlays = builtins.attrValues self.overlays;
  41. }; {
  42. default = mkShell {
  43. nativeBuildInputs = with pkgs; [
  44. inputs.agenix.packages.${system}.agenix
  45. inputs.home-manager.packages.${system}.home-manager
  46. deadnix
  47. statix
  48. vim-with-vimrc
  49. ];
  50. };
  51. });
  52. packages = nixpkgs.lib.recursiveUpdate (forAllSystems (system:
  53. with import nixpkgs { inherit system; }; {
  54. default = writeShellScriptBin "fmt-check" ''
  55. ${deadnix}/bin/deadnix ${self}
  56. ${statix}/bin/statix check -i hardware-configuration.nix -- ${self}
  57. '';
  58. })) (import ./packages.nix { inherit inputs; });
  59. nixosConfigurations = {
  60. makai = mkSystem "x86_64-linux" [
  61. nixos-hardware.nixosModules.common-cpu-intel-sandy-bridge
  62. nixos-hardware.nixosModules.common-pc-laptop-hdd
  63. ./hosts/makai
  64. ];
  65. shrine = mkSystem "x86_64-linux" [
  66. nixos-hardware.nixosModules.common-cpu-intel
  67. nixos-hardware.nixosModules.common-pc-laptop-ssd
  68. ./hosts/shrine
  69. ];
  70. yama = mkSystem "x86_64-linux" [
  71. nixos-hardware.nixosModules.common-cpu-amd
  72. nixos-hardware.nixosModules.common-pc-ssd
  73. ./hosts/yama
  74. ];
  75. };
  76. };
  77. }