setup flake.nix with derivation and devShell
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,3 +4,4 @@ dwl
|
||||
*-protocol.h
|
||||
.ccls-cache
|
||||
config.h
|
||||
result
|
||||
|
||||
27
flake.lock
generated
Normal file
27
flake.lock
generated
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1772963539,
|
||||
"narHash": "sha256-9jVDGZnvCckTGdYT53d/EfznygLskyLQXYwJLKMPsZs=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "9dcb002ca1690658be4a04645215baea8b95f31d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
60
flake.nix
Normal file
60
flake.nix
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
description = "A flake for dwl";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
}:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
nativeBuildInputs = with pkgs; [
|
||||
tinycc
|
||||
gnumake
|
||||
pkg-config
|
||||
wayland-protocols
|
||||
];
|
||||
buildInputs = with pkgs; [
|
||||
wayland-scanner
|
||||
wlroots
|
||||
libinput
|
||||
wayland
|
||||
libxkbcommon
|
||||
pixman
|
||||
];
|
||||
inherit (pkgs) lib;
|
||||
in
|
||||
{
|
||||
devShell.${system} =
|
||||
with pkgs;
|
||||
mkShell {
|
||||
inherit buildInputs nativeBuildInputs;
|
||||
};
|
||||
packages.${system} =
|
||||
let
|
||||
src = lib.fileset.toSource {
|
||||
root = ./.;
|
||||
fileset = lib.fileset.unions [
|
||||
./Makefile
|
||||
./client.h
|
||||
./config.def.h
|
||||
./config.mk
|
||||
./dwl.c
|
||||
./dwl.1
|
||||
./dwl.desktop
|
||||
./protocols
|
||||
./util.c
|
||||
./util.h
|
||||
];
|
||||
};
|
||||
in
|
||||
{
|
||||
default = pkgs.callPackage ./package.nix { inherit src buildInputs nativeBuildInputs; };
|
||||
};
|
||||
};
|
||||
}
|
||||
27
package.nix
Normal file
27
package.nix
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
lib,
|
||||
src,
|
||||
stdenv,
|
||||
buildInputs,
|
||||
nativeBuildInputs,
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
pname = "dwl";
|
||||
version = "0.1.0";
|
||||
inherit src buildInputs nativeBuildInputs;
|
||||
|
||||
makeFlags = [
|
||||
];
|
||||
|
||||
meta = {
|
||||
description = "dwm for Wayland";
|
||||
homepage = "https://codeberg.org/dwl/dwl";
|
||||
platforms = lib.platforms.linux;
|
||||
mainProgram = "dwl";
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/
|
||||
cp dwl $out/
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user