Overhaul nix flake (#279)
This commit is contained in:
parent
2bd366f337
commit
8afe66ab31
23
flake.lock
23
flake.lock
|
@ -1,28 +1,12 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"flake-compat": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1673956053,
|
|
||||||
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
|
||||||
"owner": "edolstra",
|
|
||||||
"repo": "flake-compat",
|
|
||||||
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "edolstra",
|
|
||||||
"repo": "flake-compat",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1684585791,
|
"lastModified": 1712192574,
|
||||||
"narHash": "sha256-lYPboblKrchmbkGMoAcAivomiOscZCjtGxxTSCY51SM=",
|
"narHash": "sha256-LbbVOliJKTF4Zl2b9salumvdMXuQBr2kuKP5+ZwbYq4=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "eea79d584eff53bf7a76aeb63f8845da6d386129",
|
"rev": "f480f9d09e4b4cf87ee6151eba068197125714de",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -34,7 +18,6 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": "flake-compat",
|
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
92
flake.nix
92
flake.nix
|
@ -1,73 +1,67 @@
|
||||||
{
|
{
|
||||||
description = "swaywm development environment";
|
description = "Swayfx development environment";
|
||||||
|
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||||
inputs = {
|
outputs =
|
||||||
flake-compat = {
|
{ self, nixpkgs, ... }:
|
||||||
url = "github:edolstra/flake-compat";
|
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
|
||||||
};
|
|
||||||
|
|
||||||
outputs = { self, nixpkgs, flake-compat, ... }:
|
|
||||||
let
|
let
|
||||||
pkgsFor = system:
|
pkgsFor = system: import nixpkgs { inherit system; };
|
||||||
import nixpkgs {
|
targetSystems = [
|
||||||
inherit system;
|
"aarch64-linux"
|
||||||
overlays = [ ];
|
"x86_64-linux"
|
||||||
|
];
|
||||||
|
mkPackage = pkgs: {
|
||||||
|
swayfx-unwrapped =
|
||||||
|
(pkgs.swayfx-unwrapped.override {
|
||||||
|
# When the sway 1.9 rebase is finished, this will need to be overridden.
|
||||||
|
# wlroots_0_16 = pkgs.wlroots_0_16;
|
||||||
|
}).overrideAttrs
|
||||||
|
(old: {
|
||||||
|
version = "0.3.2-git";
|
||||||
|
src = pkgs.lib.cleanSource ./.;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
targetSystems = [ "aarch64-linux" "x86_64-linux" ];
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
overlays.default = final: prev: {
|
overlays = rec {
|
||||||
swayfx-unwrapped = prev.sway-unwrapped.overrideAttrs (old: {
|
default = override;
|
||||||
src = builtins.path { path = prev.lib.cleanSource ./.; };
|
# Override onto the input nixpkgs
|
||||||
patches =
|
override = _: prev: mkPackage prev;
|
||||||
let
|
# Insert using the locked nixpkgs
|
||||||
removePatches = [
|
insert = _: prev: mkPackage (pkgsFor prev.system);
|
||||||
"LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM.patch"
|
|
||||||
];
|
|
||||||
in
|
|
||||||
builtins.filter
|
|
||||||
(patch: !builtins.elem (patch.name or null) removePatches)
|
|
||||||
(old.patches or [ ]);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
packages = nixpkgs.lib.genAttrs targetSystems (system:
|
packages = nixpkgs.lib.genAttrs targetSystems (
|
||||||
let pkgs = pkgsFor system;
|
system: (mkPackage (pkgsFor system) // { default = self.packages.${system}.swayfx-unwrapped; })
|
||||||
in (self.overlays.default pkgs pkgs) // {
|
);
|
||||||
default = self.packages.${system}.swayfx-unwrapped;
|
|
||||||
});
|
|
||||||
|
|
||||||
devShells = nixpkgs.lib.genAttrs targetSystems (system:
|
devShells = nixpkgs.lib.genAttrs targetSystems (
|
||||||
|
system:
|
||||||
let
|
let
|
||||||
pkgs = pkgsFor system;
|
pkgs = pkgsFor system;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell {
|
||||||
name = "swayfx-shell";
|
name = "swayfx-shell";
|
||||||
depsBuildBuild = with pkgs; [ pkg-config ];
|
inputsFrom = [
|
||||||
inputsFrom = [ self.packages.${system}.swayfx-unwrapped pkgs.wlroots_0_16 ];
|
self.packages.${system}.swayfx-unwrapped
|
||||||
|
pkgs.wlroots_0_16
|
||||||
|
];
|
||||||
nativeBuildInputs = with pkgs; [
|
nativeBuildInputs = with pkgs; [
|
||||||
cmake
|
cmake
|
||||||
meson
|
|
||||||
ninja
|
|
||||||
pkg-config
|
|
||||||
wayland-scanner
|
wayland-scanner
|
||||||
scdoc
|
|
||||||
hwdata # for wlroots
|
|
||||||
];
|
];
|
||||||
|
# Copy the nix version of wlroots into the project
|
||||||
shellHook = with pkgs; ''(
|
shellHook = with pkgs; ''
|
||||||
mkdir -p "$PWD/subprojects"
|
(
|
||||||
cd "$PWD/subprojects"
|
mkdir -p "$PWD/subprojects" && cd "$PWD/subprojects"
|
||||||
cp -R --no-preserve=mode,ownership ${wlroots_0_16.src} wlroots
|
cp -R --no-preserve=mode,ownership ${wlroots_0_16.src} wlroots
|
||||||
)'';
|
)'';
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
formatter = nixpkgs.lib.genAttrs targetSystems (system: {
|
||||||
|
default = (pkgsFor system).nixfmt-rfc-style;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue