nix: flake cleanup

- Removed all outputs except for "packages"
- Track nixos-unstable instead of stable
- Cleanup installPhase
This commit is contained in:
Fernando Ayats 2022-05-17 13:11:24 +02:00
parent 48b8ab3f65
commit 0728326d6e
3 changed files with 84 additions and 207 deletions

View File

@ -1,30 +1,55 @@
{ lib, stdenv, fetchFromGitHub, src, pkg-config, cmake, ninja, libdrm, libinput
, libxcb, libxkbcommon, mesa, mount, pango, wayland, wayland-protocols
, wayland-scanner, wlroots, xcbutilwm, xwayland, enableXWayland ? true }:
stdenv.mkDerivation rec {
{
lib,
stdenv,
fetchFromGitHub,
pkg-config,
cmake,
ninja,
libdrm,
libinput,
libxcb,
libxkbcommon,
mesa,
mount,
pango,
wayland,
wayland-protocols,
wayland-scanner,
wlroots,
xcbutilwm,
xwayland,
enableXWayland ? true,
version ? "git",
}:
stdenv.mkDerivation {
pname = "hyprland";
version = "git";
inherit src;
inherit version;
src = ./.;
nativeBuildInputs = [ cmake ninja pkg-config wayland ]
++ lib.optional enableXWayland xwayland;
buildInputs = [
libdrm
libinput
libxcb
libxkbcommon
mesa
pango
wayland-protocols
wayland-scanner
wlroots
(wlroots.override { inherit enableXWayland; })
xcbutilwm
nativeBuildInputs = [
cmake
ninja
pkg-config
];
cmakeFlags = [ "-DCMAKE_BUILD_TYPE=Release" ]
buildInputs =
[
libdrm
libinput
libxcb
libxkbcommon
mesa
pango
wayland
wayland-protocols
wayland-scanner
(wlroots.override {inherit enableXWayland;})
xcbutilwm
]
++ lib.optional enableXWayland xwayland;
cmakeFlags =
["-DCMAKE_BUILD_TYPE=Release"]
++ lib.optional (!enableXWayland) "-DNO_XWAYLAND=true";
prePatch = ''
@ -38,25 +63,21 @@ stdenv.mkDerivation rec {
'';
installPhase = ''
cd ../
mkdir -p $out/share/wayland-sessions
cp ./example/hyprland.desktop $out/share/wayland-sessions
mkdir -p $out/bin
cp ./build/Hyprland $out/bin
cp ./hyprctl/hyprctl $out/bin
mkdir -p $out/share/hyprland
cp ./assets/wall_2K.png $out/share/hyprland
cp ./assets/wall_4K.png $out/share/hyprland
cp ./assets/wall_8K.png $out/share/hyprland
pushd ..
install -Dm644 ./example/hyprland.desktop -t $out/share/wayland-sessions
install -Dm755 ./build/Hyprland -t $out/bin
install -Dm755 ./hyprctl/hyprctl -t $out/bin
install -Dm644 ./assets/* -t $out/share/hyprland
popd
'';
passthru.providedSessions = [ "hyprland" ];
passthru.providedSessions = ["hyprland"];
meta = with lib; {
homepage = "https://github.com/vaxerski/Hyprland";
description =
"A dynamic tiling Wayland compositor that doesn't sacrifice on its looks";
description = "A dynamic tiling Wayland compositor that doesn't sacrifice on its looks";
license = licenses.bsd3;
platforms = platforms.linux;
mainProgram = "Hyprland";
};
}

View File

@ -1,71 +1,5 @@
{
"nodes": {
"cachix": {
"locked": {
"lastModified": 1652530570,
"narHash": "sha256-GWRrbUv9l1GSyBkj39s9AqNLX1l3rzVOwvnuG4WYM+E=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "4c560cc7ee57e1fb28e6fd7bdacdf01f948f8a91",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-21.11",
"repo": "nixpkgs",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1650374568,
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1652557277,
"narHash": "sha256-jSes9DaIVMdmwBB78KkFUVrlDzawmD62vrUg0GS2500=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "12806d31a381e7cd169a6bac35590e7b36dc5fe5",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"lib-aggregate": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1652616584,
"narHash": "sha256-9Uc/k/t08QsJ8rl1n/cbT8L/JrCoDuE7TmsE+F1OiS8=",
"owner": "nix-community",
"repo": "lib-aggregate",
"rev": "81165c2e94b56afcb9486b82dc91d92dfb503a6b",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "lib-aggregate",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1652659998,
@ -77,58 +11,6 @@
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1652576347,
"narHash": "sha256-52Wu7hkcIRcS4UenSSrt01J2sAbbQ6YqxZIDpuEPL/c=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "bdf553800c9c34ed00641785b02038f67f44d671",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixpkgs-wayland": {
"inputs": {
"cachix": "cachix",
"flake-compat": "flake-compat",
"lib-aggregate": "lib-aggregate",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1652618007,
"narHash": "sha256-eOH21ElHKORg1kd8Z/qX9naZElAOpCt5fPq26AxMQSw=",
"owner": "nix-community",
"repo": "nixpkgs-wayland",
"rev": "4588213f577661d37a42c7b6bba04c138c02d78f",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs-wayland",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1652467128,
"narHash": "sha256-1wuQ7QgPQ3tugYcoVMJ3pUzl4wVdBzKZr9qtJAgA4VI=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "fb222e008681fce4608e94f2d1dfdf3d03a364c4",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
@ -137,27 +19,10 @@
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"nixpkgs-wayland": "nixpkgs-wayland",
"utils": "utils",
"wlroots-git": "wlroots-git"
"wlroots": "wlroots"
}
},
"utils": {
"locked": {
"lastModified": 1652557277,
"narHash": "sha256-jSes9DaIVMdmwBB78KkFUVrlDzawmD62vrUg0GS2500=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "12806d31a381e7cd169a6bac35590e7b36dc5fe5",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"wlroots-git": {
"wlroots": {
"flake": false,
"locked": {
"host": "gitlab.freedesktop.org",

View File

@ -1,43 +1,34 @@
# Based on fortuneteller2k's (https://github.com/fortuneteller2k/nixpkgs-f2k) package repo
{
description =
"Hyprland is a dynamic tiling Wayland compositor that doesn't sacrifice on its looks.";
description = "Hyprland is a dynamic tiling Wayland compositor that doesn't sacrifice on its looks";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.11";
utils.url = "github:numtide/flake-utils";
nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland";
wlroots-git = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
wlroots = {
url = "gitlab:wlroots/wlroots?host=gitlab.freedesktop.org";
flake = false;
};
};
outputs = { self, nixpkgs, utils, nixpkgs-wayland, wlroots-git }:
{
overlay = final: prev: {
hyprland = prev.callPackage self {
src = self;
wlroots = (nixpkgs-wayland.overlays.default final prev).wlroots.overrideAttrs (prev: rec {
src = wlroots-git;
});
};
};
overlays.default = self.overlay;
} // utils.lib.eachSystem [ "aarch64-linux" "x86_64-linux" ] (system:
let pkgs = nixpkgs.legacyPackages.${system};
in rec {
packages = {
hyprland = pkgs.callPackage self {
src = self;
wlroots = nixpkgs-wayland.packages.${system}.wlroots.overrideAttrs (prev: rec {
src = wlroots-git;
});
};
};
defaultPackage = packages.hyprland;
apps.hyprland = utils.lib.mkApp { drv = packages.hyprland; };
defaultApp = apps.hyprland;
apps.default =
utils.lib.mkApp { drv = self.packages.${system}.hyprland; };
outputs = inputs @ {
self,
nixpkgs,
...
}: let
supportedSystems = [
"aarch64-linux"
"x86_64-linux"
];
genSystems = nixpkgs.lib.genAttrs supportedSystems;
pkgsFor = nixpkgs.legacyPackages;
in {
packages = genSystems (system: {
wlroots = pkgsFor.${system}.wlroots.overrideAttrs (prev: {
src = inputs.wlroots;
});
default = pkgsFor.${system}.callPackage ./default.nix {
version = self.lastModifiedDate;
inherit (self.packages.${system}) wlroots;
};
});
};
}