commit ac1ef6d73764a2ab842f9a0f1e94059ee3c62eb9
parent 626c02453ada87dbf7ec49a715d6b07c4f551ef1
Author: Milutin Popovic <milutin@popovic.xyz>
Date: Sun, 4 Jan 2026 15:49:51 +0000
slock flaking
Diffstat:
6 files changed, 76 insertions(+), 87 deletions(-)
diff --git a/.envrc b/.envrc
@@ -0,0 +1 @@
+use flake
diff --git a/.gitignore b/.gitignore
@@ -0,0 +1,14 @@
+# Build artifacts (suckless)
+slock
+*.o
+*.d
+*.a
+*.so
+
+# Nix build results
+result
+result-*
+
+# direnv
+.direnv/
+.envrc.local
diff --git a/config.h b/config.h
@@ -1,86 +0,0 @@
-/* user and group to drop privileges to */
-static const char *user = "mika";
-static const char *group = "wheel";
-
-static const char *colorname[NUMCOLS] = {
- [BACKGROUND] = "black", /* after initialization */
- [INIT] = "#A96C8A", /* after initialization */
- [INPUT] = "#A96C8A", /* during input */
- [FAILED] = "#2d2d2d", /* wrong password */
- [CAPS] = "#6CA98A", /* CapsLock on */
-};
-
-/* treat a cleared input like a wrong password (color) */
-static int failonclear = 1;
-
-static int logosize = 50;
-static int logow = 9; /* Grid width and height for right center alignment*/
-static int logoh = 6;
-
-/* Setup specific draw on two monitors should be 0 false or 1 true */
-static int draw_on_two= 1;
-
-static XRectangle rectangles_double[18] = {
- /* x y w h */
- { 0, 4, 1, 2 },
- { 1, 2, 1, 2 },
- { 2, 0, 1, 2 },
- { 4, 0, 1, 6 },
- { 4, 0, 3, 1 },
- { 4, 5, 3, 1 },
- { 6, 0, 1, 6 },
- //
- { -40, 4, 1, 2 },
- { -39, 2, 1, 2 },
- { -38, 0, 1, 2 },
- { -36, 0, 1, 6 },
- { -36, 0, 3, 1 },
- { -36, 5, 3, 1 },
- { -34, 0, 1, 6 },
-};
-
-static XRectangle rectangles[18] = {
- /* x y w h */
- { 0, 4, 1, 2 },
- { 1, 2, 1, 2 },
- { 2, 0, 1, 2 },
- { 4, 0, 1, 6 },
- { 4, 0, 3, 1 },
- { 4, 5, 3, 1 },
- { 6, 0, 1, 6 },
- { 0, 4, 1, 2 },
- { 1, 2, 1, 2 },
- { 2, 0, 1, 2 },
- { 4, 0, 1, 6 },
- { 4, 0, 3, 1 },
- { 4, 5, 3, 1 },
- { 6, 0, 1, 6 },
-};
-
-/*Enable blur*/
-#define BLUR
-/*Set blur radius*/
-static int blurRadius=10;
-/*Enable Pixelation*/
-#define PIXELATION
-/*Set pixelation radius*/
-static int pixelSize=10;
-
-/*
- * Xresources preferences to load at startup
- */
-ResourcePref resources[] = {
- { "color_background", STRING, &colorname[BACKGROUND] },
- { "color_init", STRING, &colorname[INIT] },
- { "color_input", STRING, &colorname[INPUT] },
- { "color_failed", STRING, &colorname[FAILED] },
- { "color_caps", STRING, &colorname[CAPS] },
- { "failonclear", INTEGER, &failonclear },
- { "logosize", INTEGER, &logosize },
- { "logow", INTEGER, &logow },
- { "logoh", INTEGER, &logoh },
- { "draw_on_two", INTEGER, &draw_on_two },
- { "blurRadius", INTEGER, &blurRadius },
- { "pixelSize", INTEGER, &pixelSize },
-};
-
diff --git a/config.mk b/config.mk
@@ -4,7 +4,7 @@ VERSION = 1.6
# Customize below to fit your system
# paths
-PREFIX = /usr/local
+PREFIX = $(out)
MANPREFIX = ${PREFIX}/share/man
X11INC = /usr/X11R6/include
diff --git a/flake.lock b/flake.lock
@@ -0,0 +1,27 @@
+{
+ "nodes": {
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1767364772,
+ "narHash": "sha256-fFUnEYMla8b7UKjijLnMe+oVFOz6HjijGGNS1l7dYaQ=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "16c7794d0a28b5a37904d55bcca36003b9109aaa",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixpkgs-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "nixpkgs": "nixpkgs"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
@@ -0,0 +1,33 @@
+{
+ description = "slock development shell";
+
+ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+
+ outputs = { self, nixpkgs }:
+ let
+ system = "x86_64-linux";
+ pkgs = import nixpkgs { inherit system; };
+ in {
+ shell = pkgs.zsh;
+
+ devShells.${system}.default = pkgs.mkShell {
+ # Compilers + build tools
+ nativeBuildInputs = with pkgs; [
+ gcc
+ gnumake
+ pkg-config
+ ];
+
+ # Libraries + headers
+ buildInputs = with pkgs; [
+ libx11
+ libxinerama
+ libxrandr
+ libxft
+ imlib2
+ libxcrypt
+ libxext
+ ];
+ };
+ };
+}