Improve Nix Flake (#48)

* Improve nix flake

* Go back to unstable

* Update flake

* Update README.md
This commit is contained in:
Gokul Swaminathan 2022-11-15 19:47:04 -08:00 committed by GitHub
parent 546f56f873
commit fa6164f8fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 111 additions and 43 deletions

View file

@ -23,9 +23,21 @@ Sway is an incredible window manager, and certainly one of the most well establi
## Installation
### Compiling from Source
### Nix
This project contains a nix flake for those who have the nix package manager installed. This flake handles installing the below dependencies when `nix develop` is ran inside of the project root. Otherwise, the below dependencies must be installed prior to building and running this project.
If you have Nix installed, you can run SwayFX with a single command:
```
nix run github:WillPower3309/swayfx
```
You can also bring up a development shell and follow the build instructions below, without installing all of the dependencies manually:
```
nix develop
```
### Compiling from Source
Install dependencies:

View file

@ -1,38 +1,40 @@
{
"nodes": {
"flake-utils": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1649676176,
"narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678",
"lastModified": 1650374568,
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1651024496,
"narHash": "sha256-uKSrrw/neSkxX6TXPSaMyfu7iKzFrK7F6HOt6vQefGY=",
"owner": "NixOS",
"lastModified": 1668531822,
"narHash": "sha256-rNt2SphDCQTbAgWBX9ZCMIn5ISxeb0l6b6kRLvzbFVo=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "d9e593ed5889f3906dc72811c45bf684be8865cf",
"rev": "97b8d9459f7922ce0e666113a1e8e6071424ae16",
"type": "github"
},
"original": {
"id": "nixpkgs",
"owner": "nixos",
"ref": "nixpkgs-unstable",
"type": "indirect"
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"flake-compat": "flake-compat",
"nixpkgs": "nixpkgs"
}
}

106
flake.nix
View file

@ -2,33 +2,87 @@
description = "swaywm development environment";
inputs = {
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
flake-utils = { url = "github:numtide/flake-utils"; };
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
};
outputs = {self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in {
devShell = pkgs.mkShell {
depsBuildBuild = with pkgs; [
pkg-config
];
nativeBuildInputs = with pkgs; [
cmake meson ninja pkg-config wayland-scanner scdoc
];
buildInputs = with pkgs; [
wayland libxkbcommon pcre json_c libevdev pango cairo libinput libcap pam gdk-pixbuf librsvg
wayland-protocols libdrm wlroots dbus xwayland
# wlroots
libGL pixman xorg.xcbutilwm xorg.libX11 libcap xorg.xcbutilimage xorg.xcbutilerrors mesa
libpng ffmpeg xorg.xcbutilrenderutil seatd
];
outputs = { self, nixpkgs, flake-compat, ... }:
let
pkgsFor = system:
import nixpkgs {
inherit system;
overlays = [ ];
};
}
);
targetSystems = [ "aarch64-linux" "x86_64-linux" ];
in {
overlays.default = final: prev: {
swayfx = prev.sway.overrideAttrs (old: {
version = "999-master";
src = builtins.path {
name = "swayfx";
path = prev.lib.cleanSource ./.;
};
});
};
packages = nixpkgs.lib.genAttrs targetSystems (system:
let pkgs = pkgsFor system;
in (self.overlays.default pkgs pkgs) // {
default = self.packages.${system}.swayfx;
});
devShells = nixpkgs.lib.genAttrs targetSystems (system:
let pkgs = pkgsFor system;
in {
default = pkgs.mkShell {
depsBuildBuild = with pkgs; [ pkg-config ];
nativeBuildInputs = with pkgs; [
cmake
meson
ninja
pkg-config
wayland-scanner
scdoc
];
buildInputs = with pkgs; [
wayland
libxkbcommon
pcre
json_c
libevdev
pango
cairo
libinput
libcap
pam
gdk-pixbuf
librsvg
wayland-protocols
libdrm
wlroots
dbus
xwayland
libGL
pixman
xorg.xcbutilwm
xorg.libX11
libcap
xorg.xcbutilimage
xorg.xcbutilerrors
mesa
libpng
ffmpeg
xorg.xcbutilrenderutil
seatd
];
};
});
};
}