flake.nix 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. {
  2. inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
  3. outputs = { self, nixpkgs }@inputs:
  4. let
  5. versionSuffix = if (self ? "shortRev") then "" else "-dirty";
  6. version = builtins.readFile ./VERSION + versionSuffix;
  7. # taken from github:NixOS/nix/flake.nix
  8. systems = [ "x86_64-linux" "x86_64-darwin" ];
  9. forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
  10. nixpkgsFor = forAllSystems (system:
  11. import nixpkgs {
  12. inherit system;
  13. overlays = [ self.overlays.default ];
  14. }
  15. );
  16. in
  17. {
  18. overlays.default = final: prev: {
  19. stefano-m.emacsen = self.packages.${final.system};
  20. };
  21. packages = forAllSystems (system:
  22. let
  23. flakePkgs = nixpkgsFor.${system};
  24. in
  25. rec {
  26. default = flakePkgs.callPackage ./default.nix {
  27. inherit version;
  28. pkgs = flakePkgs;
  29. };
  30. full = default.override {
  31. extraConfigs = "all";
  32. };
  33. python-ide = default.override {
  34. extraConfigs = [ "python" ];
  35. };
  36. clojure-ide = default.override {
  37. extraConfigs = [ "clojure" ];
  38. };
  39. lua-ide = default.override {
  40. extraConfigs = [ "lua" ];
  41. };
  42. devops-ide = default.override {
  43. extraConfigs = [ "javascript" "yaml" "terraform" "docker" ];
  44. };
  45. golang-ide = default.override {
  46. extraConfigs = [ "golang" ];
  47. };
  48. });
  49. apps = forAllSystems (system:
  50. let
  51. flakePkgs = nixpkgsFor.${system};
  52. in
  53. with flakePkgs.lib.attrsets;
  54. mapAttrs (name: value: { type = "app"; program = "${value}/bin/emacs"; }) self.packages.${system}
  55. );
  56. devShells = forAllSystems (system:
  57. let
  58. flakePkgs = nixpkgsFor.${system};
  59. in
  60. {
  61. default = flakePkgs.mkShell {
  62. buildInputs = with flakePkgs; [
  63. nixpkgs-fmt
  64. ];
  65. };
  66. });
  67. };
  68. }