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

View file

@ -1,71 +1,5 @@
{ {
"nodes": { "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": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1652659998, "lastModified": 1652659998,
@ -77,58 +11,6 @@
}, },
"original": { "original": {
"owner": "NixOS", "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", "ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
@ -137,27 +19,10 @@
"root": { "root": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixpkgs-wayland": "nixpkgs-wayland", "wlroots": "wlroots"
"utils": "utils",
"wlroots-git": "wlroots-git"
} }
}, },
"utils": { "wlroots": {
"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": {
"flake": false, "flake": false,
"locked": { "locked": {
"host": "gitlab.freedesktop.org", "host": "gitlab.freedesktop.org",

View file

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