flake.nix 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. {
  2. description = "A very basic flake";
  3. inputs = {
  4. # Nixpkgs branches
  5. master.url = "github:nixos/nixpkgs/master";
  6. stable.url = "github:nixos/nixpkgs/nixos-21.11";
  7. unstable.url = "github:nixos/nixpkgs/nixos-unstable";
  8. # Default nixpkgs for packages and modules
  9. nixpkgs.follows = "master";
  10. # Flake inputs
  11. aagl.url = "github:ezKEa/aagl-gtk-on-nix"; # Anime Game Launcher
  12. emacs-overlay.url = "github:nix-community/emacs-overlay";
  13. firefox-gnome-theme = {
  14. url = "github:rafaelmardojai/firefox-gnome-theme";
  15. flake = false;
  16. };
  17. home.url = "github:nix-community/home-manager";
  18. hyprland.url = "github:hyprwm/hyprland";
  19. hyprland-contrib.url = "github:hyprwm/contrib";
  20. impermanence.url = "github:nix-community/impermanence";
  21. neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
  22. nil.url = "github:oxalica/nil?rev=18de045d7788df2343aec58df7b85c10d1f5d5dd";
  23. nix.url = "github:nixos/nix";
  24. nur.url = "github:nix-community/NUR";
  25. nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland";
  26. nix-colors.url = "github:Misterio77/nix-colors";
  27. sops-nix.url = "github:Mic92/sops-nix";
  28. spicetify.url = "github:the-argus/spicetify-nix";
  29. statix.url = "github:nerdypepper/statix";
  30. swayfx.url = "github:WillPower3309/swayfx";
  31. xdph.url = "github:hyprwm/xdg-desktop-portal-hyprland";
  32. # Minimize duplicate instances of inputs
  33. aagl.inputs.nixpkgs.follows = "nixpkgs";
  34. emacs-overlay.inputs.nixpkgs.follows = "nixpkgs";
  35. emacs-overlay.inputs.nixpkgs-stable.follows = "stable";
  36. home.inputs.nixpkgs.follows = "nixpkgs";
  37. hyprland.inputs.nixpkgs.follows = "nixpkgs";
  38. hyprland-contrib.inputs.nixpkgs.follows = "nixpkgs";
  39. neovim-nightly-overlay.inputs.nixpkgs.follows = "nixpkgs";
  40. nil.inputs.nixpkgs.follows = "nixpkgs";
  41. nix.inputs.nixpkgs.follows = "nixpkgs";
  42. nixpkgs-wayland.inputs.nixpkgs.follows = "nixpkgs";
  43. sops-nix.inputs.nixpkgs.follows = "nixpkgs";
  44. sops-nix.inputs.nixpkgs-stable.follows = "stable";
  45. spicetify.inputs.nixpkgs.follows = "nixpkgs";
  46. statix.inputs.nixpkgs.follows = "nixpkgs";
  47. swayfx.inputs.nixpkgs.follows = "nixpkgs";
  48. xdph.inputs.nixpkgs.follows = "nixpkgs";
  49. };
  50. outputs = {
  51. self,
  52. home,
  53. nixpkgs,
  54. ...
  55. } @ inputs: let
  56. config = {
  57. allowBroken = true;
  58. allowUnfree = true;
  59. allowUnfreePredicate = _: true;
  60. };
  61. pkgs = nixpkgs.legacyPackages.x86_64-linux;
  62. filterNixFiles = k: v: v == "regular" && nixpkgs.lib.hasSuffix ".nix" k;
  63. importNixFiles = path:
  64. with nixpkgs.lib;
  65. (lists.forEach (mapAttrsToList (name: _: path + ("/" + name))
  66. (filterAttrs filterNixFiles (builtins.readDir path))))
  67. import;
  68. overlays = with inputs;
  69. [
  70. (final: prev: let
  71. inherit (final) system;
  72. in {
  73. /*
  74. Nixpkgs branches, replace when https://github.com/NixOS/nixpkgs/pull/160061 is live.
  75. One can access these branches like so:
  76. `pkgs.stable.mpd'
  77. `pkgs.master.linuxPackages_xanmod'
  78. */
  79. master = import master {inherit config system;};
  80. unstable = import unstable {inherit config system;};
  81. stable = import stable {inherit config system;};
  82. })
  83. # neovim-nightly-overlay.overlay #TODO: remove comment if the lspconfig bug is fixed
  84. ]
  85. # Overlays from ./overlays directory
  86. ++ (importNixFiles ./overlays);
  87. forAllSystems = nixpkgs.lib.genAttrs [
  88. "x86_64-linux"
  89. #"aarch64-linux"
  90. #"i686-linux"
  91. #"aarch64-darwin"
  92. #"x86_64-darwin"
  93. ];
  94. in {
  95. nixosConfigurations = {
  96. sforza = import ./hosts/sforza {
  97. inherit config nixpkgs overlays inputs;
  98. };
  99. nostra = import ./hosts/nostra {
  100. inherit config nixpkgs overlays inputs;
  101. };
  102. };
  103. homeConfigurations = {
  104. ludovico = import ./users/ludovico {
  105. inherit config nixpkgs home overlays inputs;
  106. };
  107. };
  108. # Acessible through 'nix build', 'nix shell', etc
  109. packages = forAllSystems (
  110. system: let
  111. pkgs = nixpkgs.legacyPackages.${system};
  112. in
  113. import ./pkgs {inherit pkgs;}
  114. );
  115. # Devshell for bootstrapping
  116. # Acessible through 'nix develop' or 'nix-shell' (legacy)
  117. devShells = forAllSystems (
  118. system: let
  119. pkgs = nixpkgs.legacyPackages.${system};
  120. in
  121. import ./shell.nix {inherit pkgs;}
  122. );
  123. # Default formatter for the entire repo
  124. formatter = nixpkgs.lib.genAttrs ["x86_64-linux"] (_system: pkgs.alejandra);
  125. };
  126. }