Nix: init

This commit is contained in:
Mihai Fufezan 2024-02-17 23:06:07 +02:00
parent 35626ddd66
commit 2d370eff32
No known key found for this signature in database
4 changed files with 139 additions and 0 deletions

48
flake.lock Normal file
View file

@ -0,0 +1,48 @@
{
"nodes": {
"hyprlang": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1708197082,
"narHash": "sha256-6jMgmGkZLXUHVSkUQi9NLhFD3KYrG8merm0T9qiUdyA=",
"owner": "hyprwm",
"repo": "hyprlang",
"rev": "65a7f870a682bd313ae978d76e61ebc72fbd64cd",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprlang",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1702645756,
"narHash": "sha256-qKI6OR3TYJYQB3Q8mAZ+DG4o/BR9ptcv9UnRV2hzljc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "40c3c94c241286dd2243ea34d3aef8a488f9e4d0",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"hyprlang": "hyprlang",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

37
flake.nix Normal file
View file

@ -0,0 +1,37 @@
{
description = "Hyprland's idle daemon";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
hyprlang = {
url = "github:hyprwm/hyprlang";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs: let
inherit (inputs.nixpkgs) lib;
genSystems = lib.genAttrs [
# Add more systems if they are supported
"x86_64-linux"
"aarch64-linux"
];
pkgsFor = genSystems (system:
import inputs.nixpkgs {
overlays = [inputs.self.overlays.default];
inherit system;
});
in {
overlays = import ./nix/overlays.nix {inherit inputs lib;};
packages = genSystems (system: {
inherit (pkgsFor.${system}) hypridle;
default = inputs.self.packages.${system}.hypridle;
});
checks = genSystems (system: inputs.self.packages.${system});
formatter = genSystems (system: pkgsFor.${system}.alejandra);
};
}

33
nix/default.nix Normal file
View file

@ -0,0 +1,33 @@
{
lib,
stdenv,
cmake,
pkg-config,
hyprlang,
wayland,
wayland-protocols,
version ? "git",
}:
stdenv.mkDerivation {
pname = "hypridle";
inherit version;
src = ../.;
nativeBuildInputs = [
cmake
pkg-config
];
buildInputs = [
hyprlang
wayland
wayland-protocols
];
meta = {
homepage = "https://github.com/hyprwm/hypridle";
description = "An idle management daemon for Hyprland";
license = lib.licenses.bsd3;
platforms = lib.platforms.linux;
};
}

21
nix/overlays.nix Normal file
View file

@ -0,0 +1,21 @@
{
lib,
inputs,
}: let
mkDate = longDate: (lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
]);
in {
default = lib.composeManyExtensions [
inputs.hyprlang.overlays.default
(final: prev: {
hypridle = prev.callPackage ./default.nix {
stdenv = prev.gcc13Stdenv;
version = "0.pre" + "+date=" + (mkDate (inputs.self.lastModifiedDate or "19700101")) + "_" + (inputs.self.shortRev or "dirty");
inherit (final) hyprlang;
};
})
];
}