Personal Nix setup

Add hyprland panel and update fonts

+69
flake.lock
···
"type": "github"
}
},
"android-sdk": {
"inputs": {
"devshell": "devshell",
···
"owner": "kitten",
"ref": "edge",
"repo": "nixos-apple-silicon",
"type": "github"
}
},
···
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs",
"nvim-plugins": "nvim-plugins",
"yeetmouse": "yeetmouse",
"zen-browser": "zen-browser"
}
···
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
···
"type": "github"
}
},
+
"ags": {
+
"inputs": {
+
"astal": "astal",
+
"nixpkgs": [
+
"system-shell",
+
"nixpkgs"
+
]
+
},
+
"locked": {
+
"lastModified": 1744557573,
+
"narHash": "sha256-XAyj0iDuI51BytJ1PwN53uLpzTDdznPDQFG4RwihlTQ=",
+
"owner": "aylur",
+
"repo": "ags",
+
"rev": "3ed9737bdbc8fc7a7c7ceef2165c9109f336bff6",
+
"type": "github"
+
},
+
"original": {
+
"owner": "aylur",
+
"repo": "ags",
+
"type": "github"
+
}
+
},
"android-sdk": {
"inputs": {
"devshell": "devshell",
···
"owner": "kitten",
"ref": "edge",
"repo": "nixos-apple-silicon",
+
"type": "github"
+
}
+
},
+
"astal": {
+
"inputs": {
+
"nixpkgs": [
+
"system-shell",
+
"ags",
+
"nixpkgs"
+
]
+
},
+
"locked": {
+
"lastModified": 1742571008,
+
"narHash": "sha256-5WgfJAeBpxiKbTR/gJvxrGYfqQRge5aUDcGKmU1YZ1Q=",
+
"owner": "aylur",
+
"repo": "astal",
+
"rev": "dc0e5d37abe9424c53dcbd2506a4886ffee6296e",
+
"type": "github"
+
},
+
"original": {
+
"owner": "aylur",
+
"repo": "astal",
"type": "github"
}
},
···
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs",
"nvim-plugins": "nvim-plugins",
+
"system-shell": "system-shell",
"yeetmouse": "yeetmouse",
"zen-browser": "zen-browser"
}
···
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
+
"type": "github"
+
}
+
},
+
"system-shell": {
+
"inputs": {
+
"ags": "ags",
+
"flake-utils": [
+
"flake-utils"
+
],
+
"nixpkgs": [
+
"nixpkgs"
+
]
+
},
+
"locked": {
+
"lastModified": 1746537812,
+
"narHash": "sha256-gr1DbuTbbEa53Hx0BlC+9a382hcUn/XZfdFiQhO8nNw=",
+
"owner": "kitten",
+
"repo": "system-shell",
+
"rev": "bccdaa60737f39c008a79c84fb7b5e36f14dc911",
+
"type": "github"
+
},
+
"original": {
+
"owner": "kitten",
+
"repo": "system-shell",
"type": "github"
}
},
+9
flake.nix
···
};
};
nvim-plugins = {
url = "github:kitten/system-nvim-plugins.nix";
inputs = {
···
inputs.language-servers.overlays.default
(self: super: {
zen-browser = inputs.zen-browser.packages.${self.system}.beta;
} // (import ./lib/pkgs self))
];
in {
···
};
};
+
system-shell = {
+
url = "github:kitten/system-shell";
+
inputs = {
+
nixpkgs.follows = "nixpkgs";
+
flake-utils.follows = "flake-utils";
+
};
+
};
+
nvim-plugins = {
url = "github:kitten/system-nvim-plugins.nix";
inputs = {
···
inputs.language-servers.overlays.default
(self: super: {
zen-browser = inputs.zen-browser.packages.${self.system}.beta;
+
system-shell = inputs.system-shell.packages.${self.system}.default;
} // (import ./lib/pkgs self))
];
in {
+23 -6
home/desktop/hyprland.nix
···
let
cfg = config.modules.desktop;
-
hyprpanel = pkgs.callPackage ./hyprpanel {};
-
wpctl = "${pkgs.wireplumber}/bin/wpctl";
brightnessctl = "${pkgs.brightnessctl}/bin/brightnessctl";
playerctl = "${pkgs.playerctl}/bin/playerctl";
···
brightness = 0.45;
vibrancy = 0.15;
vibrancy_darkness = 0.1;
-
ignore_opacity = true;
noise = 0.012;
};
···
monitor = [
"eDP-1, preferred, 0x0, 1.6"
-
"eDP-1, addreserved, 35, 0, 0, 0"
];
bindm = [
···
];
bindel = [
-
", XF86AudioRaiseVolume, exec, ${wpctl} set-volume @DEFAULT_AUDIO_SINK@ 3%+"
-
", XF86AudioLowerVolume, exec, ${wpctl} set-volume @DEFAULT_AUDIO_SINK@ 3%-"
", XF86MonBrightnessDown, exec, ${brightnessctl} s 10%-"
", XF86MonBrightnessUp, exec, ${brightnessctl} set +10%"
];
···
layerrule = [
"blur, hyprpanel"
];
};
};
···
shadow_passes = 2;
}
];
};
};
};
···
let
cfg = config.modules.desktop;
wpctl = "${pkgs.wireplumber}/bin/wpctl";
brightnessctl = "${pkgs.brightnessctl}/bin/brightnessctl";
playerctl = "${pkgs.playerctl}/bin/playerctl";
···
brightness = 0.45;
vibrancy = 0.15;
vibrancy_darkness = 0.1;
+
ignore_opacity = false;
+
popups_ignorealpha = 0.1;
+
input_methods_ignorealpha = 0.1;
noise = 0.012;
};
···
monitor = [
"eDP-1, preferred, 0x0, 1.6"
];
bindm = [
···
];
bindel = [
+
", XF86AudioRaiseVolume, exec, ${wpctl} set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 3%+"
+
", XF86AudioLowerVolume, exec, ${wpctl} set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 3%-"
", XF86MonBrightnessDown, exec, ${brightnessctl} s 10%-"
", XF86MonBrightnessUp, exec, ${brightnessctl} set +10%"
];
···
layerrule = [
"blur, hyprpanel"
+
"ignorezero, hyprpanel"
+
"xray, hyprpanel"
+
"animation slide, hyprpanel"
];
};
};
···
shadow_passes = 2;
}
];
+
};
+
};
+
+
systemd.user.services.hyprpanel = {
+
Install.WantedBy = ["graphical-session.target"];
+
Service = {
+
ExecStart = "${lib.getExe pkgs.system-shell}";
+
Restart = "on-failure";
+
RestartSec = 5;
+
Environment = [ "GSK_RENDERER=ngl" ];
+
};
+
Unit = {
+
After = [ "graphical-session.target" ];
+
ConditionEnvironment = "WAYLAND_DISPLAY";
+
PartOf = [ "graphical-session.target" ];
};
};
};
-56
home/desktop/hyprpanel/default.nix
···
-
{
-
stdenv,
-
astal,
-
meson,
-
ninja,
-
pkg-config,
-
gobject-introspection,
-
blueprint-compiler,
-
gtk4-layer-shell,
-
gtk4,
-
json-glib,
-
networkmanager,
-
dart-sass,
-
vala,
-
wrapGAppsHook4,
-
...
-
}: let
-
astalPackages = [
-
astal.astal4
-
astal.io
-
astal.gjs
-
astal.auth
-
astal.cava
-
astal.apps
-
astal.greet
-
astal.mpris
-
astal.notifd
-
astal.network
-
astal.battery
-
astal.hyprland
-
astal.bluetooth
-
astal.wireplumber
-
astal.powerprofiles
-
];
-
in stdenv.mkDerivation {
-
name = "hyprpanel";
-
src = ./.;
-
depsBuildBuild = [
-
pkg-config
-
];
-
nativeBuildInputs = [
-
meson
-
ninja
-
gobject-introspection
-
wrapGAppsHook4
-
blueprint-compiler
-
dart-sass
-
vala
-
];
-
buildInputs = [
-
gtk4
-
gtk4-layer-shell
-
networkmanager
-
json-glib
-
] ++ astalPackages;
-
}
···
-2
home/desktop/hyprpanel/meson.build
···
-
project('hyprpanel', 'vala')
-
subdir('src')
···
-7
home/desktop/hyprpanel/src/gresource.xml
···
-
<?xml version="1.0" encoding="UTF-8"?>
-
<gresources>
-
<gresource prefix="/">
-
<file>main.css</file>
-
<file>ui/Bar.ui</file>
-
</gresource>
-
</gresources>
···
-1
home/desktop/hyprpanel/src/main.scss
···
-
@use "./scss/Bar.scss";
···
-66
home/desktop/hyprpanel/src/meson.build
···
-
pkgdatadir = get_option('prefix') / get_option('datadir')
-
bindir = get_option('prefix') / get_option('bindir')
-
blp = find_program('blueprint-compiler', required: true)
-
sass = find_program('sass', required: true)
-
-
dependencies = [
-
dependency('glib-2.0'),
-
dependency('libnm'),
-
dependency('gtk4-layer-shell-0'),
-
dependency('astal-io-0.1'),
-
dependency('astal-4-4.0'),
-
dependency('astal-battery-0.1'),
-
dependency('astal-wireplumber-0.1'),
-
dependency('astal-network-0.1'),
-
dependency('astal-mpris-0.1'),
-
dependency('astal-power-profiles-0.1'),
-
dependency('astal-bluetooth-0.1'),
-
]
-
-
blueprint_sources = files(
-
'ui/Bar.blp',
-
)
-
-
vala_sources = files(
-
'vala/Bar.vala',
-
'vala/App.vala',
-
)
-
-
# transplie blueprints
-
ui = custom_target(
-
'blueprint',
-
input: blueprint_sources,
-
output: '.',
-
command: [
-
blp,
-
'batch-compile',
-
'@OUTPUT@',
-
'@CURRENT_SOURCE_DIR@',
-
'@INPUT@',
-
],
-
)
-
-
# bundle scss files
-
css = custom_target(
-
'scss',
-
input: files('main.scss'),
-
command: [sass, '@INPUT@', '@OUTPUT@'],
-
output: ['main.css'],
-
)
-
-
# compiling data files into a binary
-
resource = import('gnome').compile_resources(
-
'data',
-
files('gresource.xml'),
-
dependencies: [ui, css],
-
source_dir: meson.current_build_dir(),
-
)
-
-
executable(
-
meson.project_name(),
-
dependencies: dependencies,
-
sources: [vala_sources, resource],
-
link_args: ['-lm'], # Link math library
-
install: true,
-
install_dir: bindir,
-
)
···
-25
home/desktop/hyprpanel/src/scss/Bar.scss
···
-
// https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-4-16/gtk/theme/Default/_colors-public.scss
-
$fg-color: #{"@theme_fg_color"};
-
$bg-color: #{"@theme_bg_color"};
-
-
window.Bar {
-
background: transparent;
-
-
> box {
-
min-height: 36px;
-
padding: 2px 18px;
-
background: transparent;
-
color: $fg-color;
-
-
font-family: SF Pro Display;
-
font-weight: medium;
-
font-size: 13px;
-
}
-
-
.menubar-item {
-
> * + * {
-
margin-left: 6px;
-
}
-
}
-
}
-
···
-41
home/desktop/hyprpanel/src/ui/Bar.blp
···
-
using Gtk 4.0;
-
using Astal 4.0;
-
-
template $Bar: Astal.Window {
-
default-height: 40;
-
-
CenterBox centerbox {
-
start-widget: Box {
-
};
-
-
center-widget: Box {
-
};
-
-
end-widget: Box {
-
spacing: 14;
-
-
Image {
-
styles ["menubar-item"]
-
icon-name: bind template.network-icon;
-
}
-
-
Box {
-
styles ["menubar-item"]
-
Image {
-
icon-name: bind template.volume-icon;
-
}
-
}
-
-
Box {
-
styles ["menubar-item"]
-
Label {
-
label: bind template.battery-label;
-
}
-
Image {
-
icon-name: bind template.battery-icon;
-
}
-
}
-
};
-
}
-
}
-
···
-46
home/desktop/hyprpanel/src/vala/App.vala
···
-
class App : Astal.Application {
-
static App instance;
-
-
// this is where request handlers can be implemented
-
// that will be used to handle `astal` cli invocations
-
public override void request(string request, GLib.SocketConnection conn) {
-
print(@"incoming request: $request\n");
-
-
AstalIO.write_sock.begin(conn, "response", null);
-
}
-
-
// this is the method that will be invoked on `app.run()`
-
// this is where everything should be initialized and instantiated
-
public override void activate() {
-
this.apply_css("resource:///main.css", false);
-
this.add_window(new Bar());
-
}
-
-
// entry point of our app
-
static int main(string[] argv) {
-
App.instance = new App() { instance_name = "hyprpanel" };
-
-
try {
-
// `app.acquire_socket()` needed for the request API to work
-
App.instance.acquire_socket();
-
-
// if it succeeds we can run the app
-
return App.instance.run(null);
-
} catch (Error _) {
-
// if it throws an error it means there is already an instance
-
// with `instance_name` running, so we just send a request instead
-
try {
-
var response = AstalIO.send_request(
-
"hyprpanel",
-
string.joinv(" ", argv[1:])
-
);
-
print(@"$response\n");
-
return 0;
-
} catch (Error err) {
-
printerr(err.message);
-
return 1;
-
}
-
}
-
}
-
}
-
···
-73
home/desktop/hyprpanel/src/vala/Bar.vala
···
-
[GtkTemplate(ui="/ui/Bar.ui")]
-
class Bar : Astal.Window {
-
public string volume_icon { get; set; }
-
public string battery_visible { get; set; }
-
public string battery_label { get; set; }
-
public string battery_icon { get; set; }
-
public string network_icon { get; set; }
-
-
public Bar() {
-
namespace = "hyprpanel";
-
anchor = TOP | LEFT | RIGHT;
-
exclusivity = EXCLUSIVE;
-
add_css_class("Bar");
-
present();
-
-
// network
-
var nw = AstalNetwork.get_default();
-
Binding networkBinding = null;
-
-
nw.bind_property(
-
"primary",
-
this,
-
"network-icon",
-
BindingFlags.SYNC_CREATE,
-
(_, primary) => {
-
if (networkBinding != null) networkBinding.unbind();
-
-
switch (primary.get_enum()) {
-
case AstalNetwork.Primary.WIRED:
-
networkBinding = nw.wired.bind_property(
-
"icon-name",
-
this,
-
"network-icon",
-
BindingFlags.SYNC_CREATE
-
);
-
return false;
-
-
case AstalNetwork.Primary.WIFI:
-
networkBinding = nw.wifi.bind_property(
-
"icon-name",
-
this,
-
"network-icon",
-
BindingFlags.SYNC_CREATE
-
);
-
return false;
-
-
default:
-
network_icon = "network-idle-symbolic";
-
return false;
-
}
-
},
-
null
-
);
-
-
// battery
-
var bat = AstalBattery.get_default();
-
bat.bind_property("is-present", this, "battery-visible", BindingFlags.SYNC_CREATE);
-
bat.bind_property("icon-name", this, "battery-icon", BindingFlags.SYNC_CREATE);
-
bat.bind_property("percentage", this, "battery-label", BindingFlags.SYNC_CREATE, (_, src, ref target) => {
-
target.set_string(@"$(Math.floor(bat.percentage * 100))%");
-
return true;
-
}, null);
-
-
// volume
-
var speaker = AstalWp.get_default().get_default_speaker();
-
speaker.bind_property("volume-icon", this, "volume-icon", BindingFlags.SYNC_CREATE);
-
}
-
-
public override void dispose() {
-
base.dispose();
-
}
-
}
-
···
+2 -2
lib/pkgs/default.nix
···
pkgs: {
sf-pro = import ./sf-pro.nix pkgs;
-
sf-pro-mono = import ./sf-pro-mono.nix pkgs;
-
hyprpanel = import ../../home/desktop/hyprpanel pkgs;
}
···
pkgs: {
sf-pro = import ./sf-pro.nix pkgs;
+
sf-mono = import ./sf-mono.nix pkgs;
+
new-york = import ./new-york.nix pkgs;
}
+24
lib/pkgs/new-york.nix
···
···
+
{
+
stdenv,
+
lib,
+
fetchFromGitHub,
+
unzip,
+
...
+
}: stdenv.mkDerivation rec {
+
pname = "New-York";
+
version = "0";
+
+
src = fetchFromGitHub {
+
owner = "yell0wsuit";
+
repo = "New-York-fonts";
+
rev = "master";
+
sha256 = "sha256-0uuzr64KxDEMtkLizvGeHTXDBAMLe4j5iXGaJPfDdmg=";
+
};
+
+
nativeBuildInputs = [unzip];
+
+
installPhase = ''
+
mkdir -p $out/share/fonts/opentype
+
cp *.otf $out/share/fonts/opentype/
+
'';
+
}
+24
lib/pkgs/sf-mono.nix
···
···
+
{
+
stdenv,
+
lib,
+
fetchFromGitHub,
+
unzip,
+
...
+
}: stdenv.mkDerivation rec {
+
pname = "SF-Mono";
+
version = "0";
+
+
src = fetchFromGitHub {
+
owner = "supercomputra";
+
repo = "SF-Mono-Font";
+
rev = "master";
+
sha256 = "sha256-3wG3M4Qep7MYjktzX9u8d0iDWa17FSXYnObSoTG2I/o=";
+
};
+
+
nativeBuildInputs = [unzip];
+
+
installPhase = ''
+
mkdir -p $out/share/fonts/opentype
+
cp *.otf $out/share/fonts/opentype/
+
'';
+
}
-24
lib/pkgs/sf-pro-mono.nix
···
-
{
-
stdenv,
-
lib,
-
fetchFromGitHub,
-
unzip,
-
...
-
}: stdenv.mkDerivation rec {
-
pname = "SF-Pro-mono";
-
version = "v3.0.0";
-
-
src = fetchFromGitHub {
-
owner = "shaunsingh";
-
repo = "SFMono-Nerd-Font-Ligaturized";
-
rev = "main";
-
sha256 = "sha256-AYjKrVLISsJWXN6Cj74wXmbJtREkFDYOCRw1t2nVH2w=";
-
};
-
-
nativeBuildInputs = [unzip];
-
-
installPhase = ''
-
mkdir -p $out/share/fonts/opentype
-
cp *.otf $out/share/fonts/opentype/
-
'';
-
}
···
+1 -1
lib/pkgs/sf-pro.nix
···
...
}: stdenv.mkDerivation rec {
pname = "SF-Pro";
-
version = "v3.0.0";
src = fetchFromGitHub {
owner = "sahibjotsaggu";
···
...
}: stdenv.mkDerivation rec {
pname = "SF-Pro";
+
version = "0";
src = fetchFromGitHub {
owner = "sahibjotsaggu";
+5 -5
modules/desktop/fonts.nix
···
packages = with pkgs; [
sf-pro
-
sf-pro-mono
noto-fonts
noto-fonts-cjk-sans
noto-fonts-emoji
-
roboto-mono
inter
];
fontconfig.defaultFonts = {
-
serif = [ "Noto Serif" "Noto Color Emoji" ];
-
sansSerif = [ "SF Pro Display" "Noto Color Emoji" ];
-
monospace = [ "Dank Mono" "Roboto Mono" "Noto Color Emoji" ];
emoji = [ "Noto Color Emoji" ];
};
};
···
packages = with pkgs; [
sf-pro
+
sf-mono
+
new-york
noto-fonts
noto-fonts-cjk-sans
noto-fonts-emoji
inter
];
fontconfig.defaultFonts = {
+
serif = [ "New York" "Noto Serif" "Noto Color Emoji" ];
+
sansSerif = [ "SF Pro Display" "Inter" "Noto Color Emoji" ];
+
monospace = [ "Dank Mono" "SF Mono" "Noto Color Emoji" ];
emoji = [ "Noto Color Emoji" ];
};
};