Skip to content

Added nix files#2580

Open
rXelelo wants to merge 11 commits intonoctalia-dev:v5from
rXelelo:v5
Open

Added nix files#2580
rXelelo wants to merge 11 commits intonoctalia-dev:v5from
rXelelo:v5

Conversation

@rXelelo
Copy link
Copy Markdown
Contributor

@rXelelo rXelelo commented Apr 28, 2026

Pull Request

If this PR is not ready for review yet, please mark it as Draft until it's good to be reviewed.

Motivation

Provide a clear and concise explanation of what this PR does and why it is needed.

Type of Change

Mark the relevant option with an "x".

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring

Related Issue

  • Closes #(issue number) (if any)

Testing

Describe how you tested your changes and mark the relevant items.

  • Tested on niri
  • Tested on Hyprland
  • Tested on sway
  • Tested with different bar positions and density settings
  • Tested at different interface scaling values
  • Tested with multiple monitors (if applicable)

Screenshots / Videos

If applicable, include screenshots or videos to help illustrate your changes.
image

Checklist

  • Code follows project style guidelines
  • Self-reviewed my code
  • No new warnings or errors
  • Documentation or comments updated (if relevant)

@pengolord
Copy link
Copy Markdown

pengolord commented Apr 28, 2026

Is flake utils really necessary for this? I feel like it's so simple that lib.genAttrsor something similar would work better (and not tack on an external dependency)

It would also make it so we manually specify each system. With the way you have it setup, it exports a package for MacOS, which afaik noctalia does not support

something like this:

outputs = { self, nixpkgs }: 
  let
    inherit (nixpkgs) lib;
    systems = [
      "x86_64-linux"
      "aarch64-linux"
      # any other systems/OSes noctalia supports go here
    ];
    forEachSystem = perSystem:
      lib.genAttrs systems (
        system: let
          pkgs = nixpkgs.legacyPackages.${system};
        in
          perSystem {inherit pkgs system;}
      );
  in {
    packages = forEachSystem (
      { pkgs, ... }: {
        default = pkgs.stdenv.mkDerivation {
          #...
        };
      }
    );

    devShells = forEachSystem (
      { pkgs, system }: {
        default = pkgs.mkShell {
          #...
        };
      }
    );
  
    apps = forEachSystem (
      { system, ... }: {
        default = {
          #...
        };
      }
    );
  };

@rXelelo
Copy link
Copy Markdown
Contributor Author

rXelelo commented Apr 28, 2026

Is flake utils really necessary for this? I feel like it's so simple that lib.genAttrsor something similar would work better (and not tack on an external dependency)

It would also make it so we manually specify each system. With the way you have it setup, it exports a package for MacOS, which afaik noctalia does not support

something like this:

outputs = { self, nixpkgs }: 
  let
    inherit (nixpkgs) lib;
    systems = [
      "x86_64-linux"
      "aarch64-linux"
      # any other systems/OSes noctalia supports go here
    ];
    forEachSystem = perSystem:
      lib.genAttrs systems (
        system: let
          pkgs = nixpkgs.legacyPackages.${system};
        in
          perSystem {inherit pkgs system;}
      );
  in {
    packages = forEachSystem (
      { pkgs, ... }: {
        default = pkgs.stdenv.mkDerivation {
          #...
        };
      }
    );

    devShells = forEachSystem (
      { pkgs, system }: {
        default = pkgs.mkShell {
          #...
        };
      }
    );
  
    apps = forEachSystem (
      { system, ... }: {
        default = {
          #...
        };
      }
    );
  };
{
  description = "Noctalia - A lightweight Wayland shell and bar";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
  };

  outputs = { self, nixpkgs }:
    let
      inherit (nixpkgs) lib;
      systems = [
        "x86_64-linux"
      ];
      forEachSystem = perSystem:
        lib.genAttrs systems (
          system: let
            pkgs = nixpkgs.legacyPackages.${system};
          in
            perSystem { inherit pkgs system; }
        );
    in
    {
      packages = forEachSystem (
        { pkgs, ... }: {
          default = pkgs.stdenv.mkDerivation {
            pname = "noctalia";
            version = "5.0.0";

            src = ./.;

            nativeBuildInputs = with pkgs; [
              meson
              ninja
              pkg-config
              wayland-scanner
            ];

            buildInputs = with pkgs; [
              wayland
              wayland-protocols
              libGL
              libglvnd
              freetype
              fontconfig
              cairo
              pango
              libxkbcommon
              sdbus-cpp_2
              systemd
              pipewire
              pam
              curl
              libwebp
            ];

            mesonBuildType = "release";
            
            dontUseMesonConfigure = true;
            
            configurePhase = ''
              runHook preConfigure
              meson setup build --prefix=$out --buildtype=release
              runHook postConfigure
            '';
            
            buildPhase = ''
              runHook preBuild
              meson compile -C build
              runHook postBuild
            '';
            
            installPhase = ''
              runHook preInstall
              meson install -C build
              runHook postInstall
            '';

            meta = with pkgs.lib; {
              description = "A lightweight Wayland shell and bar built directly on Wayland + OpenGL ES";
              homepage = "https://github.com/anomalyco/noctalia-shell";
              license = licenses.mit;
              platforms = platforms.linux;
              mainProgram = "noctalia";
            };
          };
        }
      );

      devShells = forEachSystem (
        { pkgs, system }: {
          default = pkgs.mkShell {
            inputsFrom = [ self.packages.${system}.default ];
            
            buildInputs = with pkgs; [
              just
              clang-tools
              gdb
            ];

            shellHook = ''
              echo "Noctalia development environment"
              echo ""
              echo "Available commands:"
              echo "  just configure       - Configure debug build"
              echo "  just build           - Build debug"
              echo "  just run             - Run debug build"
              echo "  just configure release - Configure release build"
              echo "  just build release   - Build release"
              echo "  just run release     - Run release build"
              echo ""
              echo "Note: Use 'just build' instead of 'nix build' due to sdbus-c++ API compatibility"
            '';
          };
        }
      );

      apps = forEachSystem (
        { system, ... }: {
          default = {
            type = "app";
            program = "${self.packages.${system}.default}/bin/noctalia";
          };
        }
      );
    };
}

this will be fine?

rXelelo and others added 9 commits April 29, 2026 13:43
style(nix): apply nixfmt formatting

chore(nix): switch nixpkgs input to channel url

chore(nix): fix homepage url

chore(nix): use lib.cleanSource for source filtering

chore(nix): port devshell from noctalia-dev#2584

chore(nix): derive version from lastModifiedDate and shortRev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants