-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
294 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Build | ||
|
||
on: [push, pull_request, workflow_dispatch] | ||
jobs: | ||
nix: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: DeterminateSystems/nix-installer-action@main | ||
- uses: DeterminateSystems/magic-nix-cache-action@main | ||
|
||
# not needed (yet) | ||
# - uses: cachix/cachix-action@v12 | ||
# with: | ||
# name: hyprland | ||
# authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | ||
|
||
- name: Build | ||
run: nix flake check --print-build-logs --keep-going | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
description = "Hyprland's GPU-accelerated screen locking utility"; | ||
|
||
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}) hyprlock; | ||
default = inputs.self.packages.${system}.hyprlock; | ||
}); | ||
|
||
homeManagerModules = { | ||
hyprlock = import ./nix/hm-module.nix inputs.self; | ||
default = inputs.self.homeManagerModules.hyprlock; | ||
}; | ||
|
||
checks = genSystems (system: inputs.self.packages.${system}); | ||
|
||
formatter = genSystems (system: pkgsFor.${system}.alejandra); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
lib, | ||
stdenv, | ||
cmake, | ||
pkg-config, | ||
cairo, | ||
libGL, | ||
libxkbcommon, | ||
hyprlang, | ||
pam, | ||
pango, | ||
wayland, | ||
wayland-protocols, | ||
version ? "git", | ||
}: | ||
stdenv.mkDerivation { | ||
pname = "hyprlock"; | ||
inherit version; | ||
src = ../.; | ||
|
||
nativeBuildInputs = [ | ||
cmake | ||
pkg-config | ||
]; | ||
|
||
buildInputs = [ | ||
cairo | ||
libGL | ||
libxkbcommon | ||
hyprlang | ||
pam | ||
pango | ||
wayland | ||
wayland-protocols | ||
]; | ||
|
||
meta = { | ||
homepage = "https://github.com/hyprwm/hyprlock"; | ||
description = "A gpu-accelerated screen lock for Hyprland"; | ||
license = lib.licenses.bsd3; | ||
platforms = lib.platforms.linux; | ||
mainProgram = "hyprlock"; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
self: { | ||
config, | ||
pkgs, | ||
lib, | ||
... | ||
}: let | ||
inherit (builtins) toString; | ||
inherit (lib.types) int listOf package str submodule; | ||
inherit (lib.modules) mkIf; | ||
inherit (lib.options) mkOption mkEnableOption; | ||
|
||
cfg = config.services.hyprlock; | ||
in { | ||
options.services.hyprlock = { | ||
enable = mkEnableOption "Hyprlock, Hyprland's GPU-accelerated lock screen utility"; | ||
|
||
package = mkOption { | ||
description = "The hyprlock package"; | ||
type = package; | ||
default = self.packages.${pkgs.stdenv.hostPlatform.system}.hyprlock; | ||
}; | ||
|
||
backgrounds = mkOption { | ||
description = "Monitor configurations"; | ||
type = listOf (submodule { | ||
options = { | ||
monitor = mkOption { | ||
description = "The monitor to apply the given wallpaper to"; | ||
type = str; | ||
default = ""; | ||
}; | ||
|
||
path = mkOption { | ||
description = "The path to the wallpaper"; | ||
type = str; | ||
default = "echo 'timeout reached'"; | ||
}; | ||
}; | ||
}); | ||
}; | ||
|
||
general.disable_loading_bar = | ||
mkEnableOption "" | ||
// { | ||
description = "Whether to disable loading bar"; | ||
}; | ||
|
||
input_field = submodule { | ||
options = { | ||
monitor = mkOption { | ||
description = "The monitor to place the input field on"; | ||
type = str; | ||
default = ""; | ||
}; | ||
|
||
size = mkOption { | ||
description = "The size of the input field"; | ||
type = submodule { | ||
options = { | ||
width = mkOption { | ||
description = "Width of the input field"; | ||
type = int; | ||
default = 200; | ||
}; | ||
height = mkOption { | ||
description = "Height of the input field"; | ||
type = int; | ||
default = 50; | ||
}; | ||
}; | ||
}; | ||
}; | ||
|
||
outline_thickness = mkOption { | ||
description = "The outline thickness of the input field"; | ||
type = int; | ||
default = 3; | ||
}; | ||
|
||
outer_color = mkOption { | ||
description = "The outer color of the input field"; | ||
type = str; | ||
default = "rgb(151515)"; | ||
}; | ||
|
||
inner_color = mkOption { | ||
description = "The inner color of the input field"; | ||
type = str; | ||
default = "rgb(200, 200, 200)"; | ||
}; | ||
}; | ||
}; | ||
}; | ||
|
||
config = mkIf cfg.enable { | ||
xdg.configFile."hypr/hyprlock.conf".text = '' | ||
general { | ||
disable_loading_bar = ${cfg.general.disable_loading_bar} | ||
} | ||
input_field { | ||
monitor = ${cfg.input_field.monitor} | ||
size = ${toString cfg.input_field.size.width} ${toString cfg.input_field.size.height} | ||
outline_thickness = ${toString cfg.input_field.outline_thickness} | ||
outer_color = ${cfg.input_field.outer_color} | ||
inner_color = ${cfg.input_field.inner_color} | ||
} | ||
${builtins.concatStringsSep "\n" (map (background: '' | ||
background { | ||
monitor = ${background.monitor} | ||
path = ${background.path} | ||
} | ||
'') | ||
cfg.backgrounds)} | ||
''; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: { | ||
hyprlock = 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; | ||
}; | ||
}) | ||
]; | ||
} |