diff --git a/flake.lock b/flake.lock index 95f76b3..51f04e7 100644 --- a/flake.lock +++ b/flake.lock @@ -1,10 +1,29 @@ { "nodes": { + "ags": { + "inputs": { + "nixpkgs": "nixpkgs", + "systems": "systems" + }, + "locked": { + "lastModified": 1727303518, + "narHash": "sha256-lO5JMynTxNZxg/+E4/Y9reeLGIz/M8cEue+Re4cP6qo=", + "owner": "Aylur", + "repo": "ags", + "rev": "cd543afec4d9ed708990e5ba52184716809bf248", + "type": "github" + }, + "original": { + "owner": "Aylur", + "repo": "ags", + "type": "github" + } + }, "basix": { "inputs": { "flake-compat": "flake-compat", "flake-parts": "flake-parts", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs_2" }, "locked": { "lastModified": 1727493962, @@ -78,6 +97,24 @@ "inputs": { "nixpkgs-lib": "nixpkgs-lib_2" }, + "locked": { + "lastModified": 1726153070, + "narHash": "sha256-HO4zgY0ekfwO5bX0QH/3kJ/h4KvUDFZg8YpkNwIbg1U=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "bcef6817a8b2aa20a5a6dbb19b43e63c5bf8619a", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_4": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_3" + }, "locked": { "lastModified": 1715865404, "narHash": "sha256-/GJvTdTpuDjNn84j82cU6bXztE0MSkdnTWClUCRub78=", @@ -114,7 +151,7 @@ }, "flake-utils_2": { "inputs": { - "systems": "systems" + "systems": "systems_2" }, "locked": { "lastModified": 1710146030, @@ -132,7 +169,7 @@ }, "flake-utils_3": { "inputs": { - "systems": "systems_4" + "systems": "systems_5" }, "locked": { "lastModified": 1710146030, @@ -282,6 +319,63 @@ "type": "github" } }, + "niri": { + "inputs": { + "flake-parts": "flake-parts_3", + "niri-stable": "niri-stable", + "niri-unstable": "niri-unstable", + "nixpkgs": "nixpkgs_3", + "nixpkgs-stable": "nixpkgs-stable", + "xwayland-satellite-stable": "xwayland-satellite-stable", + "xwayland-satellite-unstable": "xwayland-satellite-unstable" + }, + "locked": { + "lastModified": 1727780469, + "narHash": "sha256-ujDpvGKpYLLFP5qPA4eSV0AAYllWT/J7zqJRFGmZuSo=", + "owner": "sodiboo", + "repo": "niri-flake", + "rev": "72216d18036d31a22791af605b827a2dff64deb4", + "type": "github" + }, + "original": { + "owner": "sodiboo", + "repo": "niri-flake", + "type": "github" + } + }, + "niri-stable": { + "flake": false, + "locked": { + "lastModified": 1726304152, + "narHash": "sha256-4YDrKMwXGVOBkeaISbxqf24rLuHvO98TnqxWYfgiSeg=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "6a48728ffb1e638839b07f9ab2f06b2adb41dc61", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "ref": "v0.1.9", + "repo": "niri", + "type": "github" + } + }, + "niri-unstable": { + "flake": false, + "locked": { + "lastModified": 1727778508, + "narHash": "sha256-9oMBzXZZzEVZAqHA79aJSQmNJ75hQuCpq0POB0Lxt7Q=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "0cca7a21163f0d4c1e99c12844da027a23e76003", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "repo": "niri", + "type": "github" + } + }, "nixos-hardware": { "locked": { "lastModified": 1727665282, @@ -299,11 +393,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1715266358, - "narHash": "sha256-doPgfj+7FFe9rfzWo1siAV2mVCasW+Bh8I1cToAXEE4=", + "lastModified": 1725634671, + "narHash": "sha256-v3rIhsJBOMLR8e/RNWxr828tB+WywYIoajrZKFM+0Gg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "f1010e0469db743d14519a1efd37e23f8513d714", + "rev": "574d1eac1c200690e27b8eb4e24887f8df7ac27c", "type": "github" }, "original": { @@ -326,6 +420,18 @@ } }, "nixpkgs-lib_2": { + "locked": { + "lastModified": 1725233747, + "narHash": "sha256-Ss8QWLXdr2JCBPcYChJhz4xJm+h/xjl4G0c0XlP6a74=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" + } + }, + "nixpkgs-lib_3": { "locked": { "lastModified": 1714640452, "narHash": "sha256-QBx10+k6JWz6u7VsohfSw8g8hjdBZEf8CFzXH1/1Z94=", @@ -337,7 +443,39 @@ "url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1727672256, + "narHash": "sha256-9/79hjQc9+xyH+QxeMcRsA6hDyw6Z9Eo1/oxjvwirLk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1719f27dd95fd4206afb9cec9f415b539978827e", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { + "locked": { + "lastModified": 1715266358, + "narHash": "sha256-doPgfj+7FFe9rfzWo1siAV2mVCasW+Bh8I1cToAXEE4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f1010e0469db743d14519a1efd37e23f8513d714", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1727634051, "narHash": "sha256-S5kVU7U82LfpEukbn/ihcyNt2+EvG7Z5unsKW9H/yFA=", @@ -353,7 +491,23 @@ "type": "github" } }, - "nixpkgs_3": { + "nixpkgs_4": { + "locked": { + "lastModified": 1727634051, + "narHash": "sha256-S5kVU7U82LfpEukbn/ihcyNt2+EvG7Z5unsKW9H/yFA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "06cf0e1da4208d3766d898b7fdab6513366d45b9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_5": { "locked": { "lastModified": 1726871744, "narHash": "sha256-V5LpfdHyQkUF7RfOaDPrZDP+oqz88lTJrMT1+stXNwo=", @@ -369,7 +523,7 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_6": { "locked": { "lastModified": 1656753965, "narHash": "sha256-BCrB3l0qpJokOnIVc3g2lHiGhnjUi0MoXiw6t1o8H1E=", @@ -385,7 +539,7 @@ "type": "github" } }, - "nixpkgs_5": { + "nixpkgs_7": { "locked": { "lastModified": 1726871744, "narHash": "sha256-V5LpfdHyQkUF7RfOaDPrZDP+oqz88lTJrMT1+stXNwo=", @@ -419,11 +573,11 @@ }, "nvf": { "inputs": { - "flake-parts": "flake-parts_3", + "flake-parts": "flake-parts_4", "flake-utils": "flake-utils_2", "mnw": "mnw", "nil": "nil", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_5", "nmd": "nmd", "plugin-alpha-nvim": "plugin-alpha-nvim", "plugin-bufdelete-nvim": "plugin-bufdelete-nvim", @@ -527,7 +681,7 @@ "plugin-vim-vsnip": "plugin-vim-vsnip", "plugin-which-key": "plugin-which-key", "rnix-lsp": "rnix-lsp", - "systems": "systems_2" + "systems": "systems_3" }, "locked": { "lastModified": 1727647833, @@ -2186,7 +2340,7 @@ "rnix-lsp": { "inputs": { "naersk": "naersk", - "nixpkgs": "nixpkgs_4", + "nixpkgs": "nixpkgs_6", "utils": "utils" }, "locked": { @@ -2205,15 +2359,17 @@ }, "root": { "inputs": { + "ags": "ags", "basix": "basix", "flake-parts": "flake-parts_2", "flake-utils": "flake-utils", "home-manager": "home-manager", + "niri": "niri", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs_4", "nvf": "nvf", "plasma-manager": "plasma-manager", - "systems": "systems_3", + "systems": "systems_4", "treefmt-nix": "treefmt-nix", "wezterm": "wezterm" } @@ -2268,16 +2424,16 @@ }, "systems": { "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", "type": "github" }, "original": { "owner": "nix-systems", - "repo": "default", + "repo": "default-linux", "type": "github" } }, @@ -2297,6 +2453,21 @@ } }, "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_4": { "locked": { "lastModified": 1689347949, "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", @@ -2311,7 +2482,7 @@ "type": "github" } }, - "systems_4": { + "systems_5": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -2328,7 +2499,7 @@ }, "treefmt-nix": { "inputs": { - "nixpkgs": "nixpkgs_5" + "nixpkgs": "nixpkgs_7" }, "locked": { "lastModified": 1727431250, @@ -2388,6 +2559,39 @@ "type": "github" } }, + "xwayland-satellite-stable": { + "flake": false, + "locked": { + "lastModified": 1718165778, + "narHash": "sha256-dwF9nI54a6Fo9XU5s4qmvMXSgCid3YQVGxch00qEMvI=", + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "rev": "b6d281967cb0b7bf1dfdb8d0f597b517dc4aa5c5", + "type": "github" + }, + "original": { + "owner": "Supreeeme", + "ref": "v0.4", + "repo": "xwayland-satellite", + "type": "github" + } + }, + "xwayland-satellite-unstable": { + "flake": false, + "locked": { + "lastModified": 1726378112, + "narHash": "sha256-OANPb73V/RQDqtpIcbzeJ93KuOHKFQv+1xXC44Ut7tY=", + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "rev": "b962a0f33b503aa39c9cf6919f488b664e5b79b4", + "type": "github" + }, + "original": { + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "type": "github" + } + }, "zlib": { "flake": false, "locked": { diff --git a/flake.nix b/flake.nix index cd586ea..5297c58 100644 --- a/flake.nix +++ b/flake.nix @@ -59,6 +59,12 @@ inputs.home-manager.follows = "home-manager"; }; + ags.url = "github:Aylur/ags"; + + niri = { + url = "github:sodiboo/niri-flake"; + }; + treefmt-nix.url = "github:numtide/treefmt-nix"; nixos-hardware.url = "github:NixOS/nixos-hardware"; diff --git a/home/default.nix b/home/default.nix index 9f93a5d..0f073b4 100644 --- a/home/default.nix +++ b/home/default.nix @@ -5,7 +5,6 @@ }: { imports = [ ./terminal - self.nixosModules.theme ]; home = { username = "nezia"; @@ -14,7 +13,4 @@ }; programs.home-manager.enable = true; - - theme.wallpaper = lib.mkDefault ../wallpapers/nix-wallpaper-nineish-catppuccin-frappe-alt.svg; - theme.scheme = lib.mkDefault "catppuccin-frappe"; } diff --git a/home/profiles/vamos/default.nix b/home/profiles/vamos/default.nix index 95bb3a1..811c76f 100644 --- a/home/profiles/vamos/default.nix +++ b/home/profiles/vamos/default.nix @@ -1,18 +1,18 @@ -{ - self, - inputs, - ... -}: { +{self, ...}: { imports = [ "${self}/home/services/udiskie.nix" "${self}/home/programs" - "${self}/home/programs/plasma" - "${self}/home/terminal/emulators/konsole.nix" + "${self}/home/programs/niri" + "${self}/home/programs/ags" + "${self}/home/programs/fuzzel.nix" + "${self}/home/programs/swaybg.nix" + "${self}/home/programs/swaylock.nix" + "${self}/home/programs/swayidle.nix" + + "${self}/home/terminal/emulators/foot.nix" "${self}/home/programs/editors/neovim.nix" - - inputs.plasma-manager.homeManagerModules.plasma-manager ]; } diff --git a/home/programs/ags/default.nix b/home/programs/ags/default.nix new file mode 100644 index 0000000..bf4f2dd --- /dev/null +++ b/home/programs/ags/default.nix @@ -0,0 +1,21 @@ +{ + inputs, + pkgs, + ... +}: { + imports = [inputs.ags.homeManagerModules.default]; + + programs.ags = { + enable = true; + + # null or path, leave as null if you don't want hm to manage the config + configDir = ./src; + + # additional packages to add to gjs's runtime + extraPackages = with pkgs; [ + gtksourceview + webkitgtk + accountsservice + ]; + }; +} diff --git a/home/programs/ags/src/README.md b/home/programs/ags/src/README.md new file mode 100644 index 0000000..be94d6b --- /dev/null +++ b/home/programs/ags/src/README.md @@ -0,0 +1,15 @@ + +# Starter Config + +if suggestions don't work, first make sure +you have TypeScript LSP working in your editor + +if you do not want typechecking only suggestions + +```json +// tsconfig.json +"checkJs": false +``` + +types are symlinked to: +/home/nezia/.local/share/com.github.Aylur.ags/types diff --git a/home/programs/ags/src/config.js b/home/programs/ags/src/config.js new file mode 100644 index 0000000..246fbef --- /dev/null +++ b/home/programs/ags/src/config.js @@ -0,0 +1,214 @@ +// const hyprland = await Service.import("hyprland"); +const notifications = await Service.import("notifications"); +const mpris = await Service.import("mpris"); +const audio = await Service.import("audio"); +const battery = await Service.import("battery"); +const systemtray = await Service.import("systemtray"); + +const date = Variable("", { + poll: [1000, 'date "+%H:%M %b %e."'], +}); + +// widgets can be only assigned as a child in one container +// so to make a reuseable widget, make it a function +// then you can simply instantiate one by calling it + +//function Workspaces() { +// const activeId = hyprland.active.workspace.bind("id"); +// const workspaces = hyprland.bind("workspaces").as((ws) => +// ws.map(({ id }) => +// Widget.Button({ +// on_clicked: () => hyprland.messageAsync(`dispatch workspace ${id}`), +// child: Widget.Label(`${id}`), +// class_name: activeId.as((i) => `${i === id ? "focused" : ""}`), +// }), +// ), +// ); +// +// return Widget.Box({ +// class_name: "workspaces", +// children: workspaces, +// }); +//} + +function ClientTitle() { + return Widget.Label({ + class_name: "client-title", + label: "Label!", // hyprland.active.client.bind("title"), + }); +} + +function Clock() { + return Widget.Label({ + class_name: "clock", + label: date.bind(), + }); +} + +// we don't need dunst or any other notification daemon +// because the Notifications module is a notification daemon itself +function Notification() { + const popups = notifications.bind("popups"); + return Widget.Box({ + class_name: "notification", + visible: popups.as((p) => p.length > 0), + children: [ + Widget.Icon({ + icon: "preferences-system-notifications-symbolic", + }), + Widget.Label({ + label: popups.as((p) => p[0]?.summary || ""), + }), + ], + }); +} + +function Media() { + const label = Utils.watch("", mpris, "player-changed", () => { + if (mpris.players[0]) { + const { track_artists, track_title } = mpris.players[0]; + return `${track_artists.join(", ")} - ${track_title}`; + } else { + return "Nothing is playing"; + } + }); + + return Widget.Button({ + class_name: "media", + on_primary_click: () => mpris.getPlayer("")?.playPause(), + on_scroll_up: () => mpris.getPlayer("")?.next(), + on_scroll_down: () => mpris.getPlayer("")?.previous(), + child: Widget.Label({ label }), + }); +} + +function Volume() { + const icons = { + 101: "overamplified", + 67: "high", + 34: "medium", + 1: "low", + 0: "muted", + }; + + function getIcon() { + const icon = audio.speaker.is_muted + ? 0 + : [101, 67, 34, 1, 0].find( + (threshold) => threshold <= audio.speaker.volume * 100, + ); + + return `audio-volume-${icons[icon]}-symbolic`; + } + + const icon = Widget.Icon({ + icon: Utils.watch(getIcon(), audio.speaker, getIcon), + }); + + const slider = Widget.Slider({ + hexpand: true, + draw_value: false, + on_change: ({ value }) => (audio.speaker.volume = value), + setup: (self) => + self.hook(audio.speaker, () => { + self.value = audio.speaker.volume || 0; + }), + }); + + return Widget.Box({ + class_name: "volume", + css: "min-width: 180px", + children: [icon, slider], + }); +} + +function BatteryLabel() { + const value = battery.bind("percent").as((p) => (p > 0 ? p / 100 : 0)); + const icon = battery + .bind("percent") + .as((p) => `battery-level-${Math.floor(p / 10) * 10}-symbolic`); + + return Widget.Box({ + class_name: "battery", + visible: battery.bind("available"), + children: [ + Widget.Icon({ icon }), + Widget.LevelBar({ + widthRequest: 140, + vpack: "center", + value, + }), + ], + }); +} + +function SysTray() { + const items = systemtray.bind("items").as((items) => + items.map((item) => + Widget.Button({ + child: Widget.Icon({ icon: item.bind("icon") }), + on_primary_click: (_, event) => item.activate(event), + on_secondary_click: (_, event) => item.openMenu(event), + tooltip_markup: item.bind("tooltip_markup"), + }), + ), + ); + + return Widget.Box({ + children: items, + }); +} + +// layout of the bar +function Left() { + return Widget.Box({ + spacing: 8, + children: [ + // Workspaces(), + ClientTitle(), + ], + }); +} + +function Center() { + return Widget.Box({ + spacing: 8, + children: [Media(), Notification()], + }); +} + +function Right() { + return Widget.Box({ + hpack: "end", + spacing: 8, + children: [Volume(), BatteryLabel(), Clock(), SysTray()], + }); +} + +function Bar(monitor = 0) { + return Widget.Window({ + name: `bar-${monitor}`, // name has to be unique + class_name: "bar", + monitor, + anchor: ["top", "left", "right"], + exclusivity: "exclusive", + child: Widget.CenterBox({ + start_widget: Left(), + center_widget: Center(), + end_widget: Right(), + }), + }); +} + +App.config({ + style: "./style.css", + windows: [ + Bar(), + + // you can call it, for each monitor + // Bar(0), + // Bar(1) + ], +}); + +export {}; diff --git a/home/programs/ags/src/style.css b/home/programs/ags/src/style.css new file mode 100644 index 0000000..9ac7355 --- /dev/null +++ b/home/programs/ags/src/style.css @@ -0,0 +1,40 @@ +window.bar { + background-color: @theme_bg_color; + color: @theme_fg_color; +} + +button { + min-width: 0; + padding-top: 0; + padding-bottom: 0; + background-color: transparent; +} + +button:active { + background-color: @theme_selected_bg_color; +} + +button:hover { + border-bottom: 3px solid @theme_fg_color; +} + +label { + font-weight: bold; +} + +.workspaces button.focused { + border-bottom: 3px solid @theme_selected_bg_color; +} + +.client-title { + color: @theme_selected_bg_color; +} + +.notification { + color: yellow; +} + +levelbar block, +highlight { + min-height: 10px; +} diff --git a/home/programs/ags/src/tsconfig.json b/home/programs/ags/src/tsconfig.json new file mode 100644 index 0000000..f03f2d1 --- /dev/null +++ b/home/programs/ags/src/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "ES2022", + "lib": [ + "ES2022" + ], + "allowJs": true, + "checkJs": true, + "strict": true, + "noImplicitAny": false, + "baseUrl": ".", + "typeRoots": [ + "./types" + ], + "skipLibCheck": true + } +} \ No newline at end of file diff --git a/home/programs/ags/src/types b/home/programs/ags/src/types new file mode 120000 index 0000000..bef2e43 --- /dev/null +++ b/home/programs/ags/src/types @@ -0,0 +1 @@ +/home/nezia/.local/share/com.github.Aylur.ags/types \ No newline at end of file diff --git a/home/programs/browsers.nix b/home/programs/browsers.nix index b25d9a6..aa89d3d 100644 --- a/home/programs/browsers.nix +++ b/home/programs/browsers.nix @@ -1,4 +1,51 @@ {pkgs, ...}: { programs.chromium.enable = true; - home.packages = [pkgs.floorp]; + programs.firefox = { + enable = true; + profiles = { + nezia = { + search = { + engines = { + "Nix Packages" = { + urls = [ + { + template = "https://search.nixos.org/packages"; + params = [ + { + name = "type"; + value = "packages"; + } + { + name = "query"; + value = "{searchTerms}"; + } + ]; + } + ]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = ["@np"]; + }; + "NixOS Wiki" = { + urls = [{template = "https://wiki.nixos.org/w/index.php?search={searchTerms}";}]; + iconUpdateURL = "https://wiki.nixos.org/favicon.ico"; + updateInterval = 24 * 60 * 60 * 1000; # every day + definedAliases = ["@nw"]; + }; + "Home Manager Option Search" = { + urls = [{template = "https://home-manager-options.extranix.com/?release=master&query={searchTerms}";}]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = ["@hm"]; + }; + "Arch Wiki" = { + urls = [{template = "https://wiki.archlinux.org/index.php?search={searchTerms}";}]; + icon = "https://archlinux.org/favicon.ico"; + definedAliases = ["@aw"]; + }; + "Google".metaData.alias = "@g"; # builtin engines only support specifying one additional alias + }; + }; + isDefault = true; + }; + }; + }; } diff --git a/home/programs/default.nix b/home/programs/default.nix index baf9f3d..7670469 100644 --- a/home/programs/default.nix +++ b/home/programs/default.nix @@ -1,17 +1,22 @@ {pkgs, ...}: { imports = [ ./browsers.nix + ./gtk.nix + ./media + ./xdg.nix ]; - programs.fzf.enable = true; - programs.fastfetch.enable = true; + programs = { + fzf.enable = true; + fastfetch.enable = true; + yazi.enable = true; + }; home.packages = with pkgs; [ imhex obsidian proton-pass - spotify vesktop wl-clipboard - stremio + cinny-desktop ]; } diff --git a/home/programs/editors/neovim.nix b/home/programs/editors/neovim.nix index fadf0af..90437ff 100644 --- a/home/programs/editors/neovim.nix +++ b/home/programs/editors/neovim.nix @@ -98,6 +98,7 @@ nix.enable = true; clang.enable = true; python.enable = true; + ts.enable = true; }; treesitter = { diff --git a/home/programs/fuzzel.nix b/home/programs/fuzzel.nix new file mode 100644 index 0000000..0c02750 --- /dev/null +++ b/home/programs/fuzzel.nix @@ -0,0 +1,31 @@ +{ + inputs, + nixosConfig, + lib, + pkgs, + ... +}: { + programs.fuzzel = { + enable = true; + settings = { + main = { + terminal = lib.getExe pkgs.foot; + use-bold = true; + dpi-aware = "auto"; + font = "monospace:size=14"; + }; + colors = let + inherit (inputs.basix.schemeData.base16.${nixosConfig.style.scheme}) palette; + in { + background = "${palette.base00}ff"; + text = "${palette.base05}ff"; + input = "${palette.base05}ff"; + selection = "${palette.base02}ff"; + selection-text = "${palette.base07}ff"; + selection-match = "${palette.base0D}ff"; + border = "${palette.base0E}ff"; + }; + border.width = 5; + }; + }; +} diff --git a/home/programs/gtk.nix b/home/programs/gtk.nix new file mode 100644 index 0000000..ac4ad27 --- /dev/null +++ b/home/programs/gtk.nix @@ -0,0 +1,42 @@ +{ + inputs, + pkgs, + config, + nixosConfig, + ... +}: { + home.pointerCursor = { + inherit (nixosConfig.style.cursorTheme) name package size; + gtk.enable = true; + x11.enable = true; + }; + + gtk = let + isDark = inputs.basix.schemeData.base16.${nixosConfig.style.scheme}.variant == "dark"; + commonGtkConfig = { + gtk-decoration-layout = ":menu"; + gtk-application-prefer-dark-theme = isDark; + }; + in { + enable = true; + + font = { + name = "Inter"; + package = pkgs.inter; + size = 11; + }; + + gtk3.extraConfig = commonGtkConfig; + gtk4.extraConfig = commonGtkConfig; + + gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; + + iconTheme = { + inherit (nixosConfig.style.gtk.iconTheme) name package; + }; + + theme = { + inherit (nixosConfig.style.gtk.theme) name package; + }; + }; +} diff --git a/home/programs/media/default.nix b/home/programs/media/default.nix new file mode 100644 index 0000000..91564ab --- /dev/null +++ b/home/programs/media/default.nix @@ -0,0 +1,11 @@ +{pkgs, ...}: { + imports = [./zathura.nix]; + programs.mpv.enable = true; + home.packages = [ + pkgs.gnome-calculator + pkgs.loupe + pkgs.spotify + pkgs.stremio + pkgs.celluloid + ]; +} diff --git a/home/programs/media/zathura.nix b/home/programs/media/zathura.nix new file mode 100644 index 0000000..b7853c7 --- /dev/null +++ b/home/programs/media/zathura.nix @@ -0,0 +1,25 @@ +{pkgs, ...}: { + programs.zathura = { + enable = true; + options = { + font = "Inter 12"; + selection-notification = true; + + selection-clipboard = "clipboard"; + adjust-open = "best-fit"; + pages-per-row = "1"; + scroll-page-aware = "true"; + scroll-full-overlap = "0.01"; + scroll-step = "100"; + zoom-min = "10"; + }; + + extraConfig = "include catppuccin-frappe"; + }; + xdg.configFile = { + "zathura/catppuccin-frappe".source = pkgs.fetchurl { + url = "https://raw.githubusercontent.com/catppuccin/zathura/main/src/catppuccin-frappe"; + hash = "sha256-xdWI/Ai3iE0zRF/9DCxILKmVaNWbfqHm7Xeh6eKM3MY="; + }; + }; +} diff --git a/home/programs/niri/binds.nix b/home/programs/niri/binds.nix new file mode 100644 index 0000000..6e33da7 --- /dev/null +++ b/home/programs/niri/binds.nix @@ -0,0 +1,152 @@ +{ + config, + pkgs, + lib, + ... +}: let + appLauncher = "fuzzel"; + terminal = "foot"; +in { + programs.niri.settings.binds = { + "Mod+D".action.spawn = appLauncher; + "Mod+Return".action.spawn = terminal; + "Mod+Shift+E".action.quit.skip-confirmation = true; + "Mod+Shift+Slash".action = config.lib.niri.actions.show-hotkey-overlay; + "Mod+Q".action = config.lib.niri.actions.close-window; + "Mod+F".action = config.lib.niri.actions.maximize-column; + "Mod+Shift+F".action = config.lib.niri.actions.fullscreen-window; + "Mod+C".action = config.lib.niri.actions.center-column; + + # Focus + "Mod+Left".action = config.lib.niri.actions.focus-column-left; + "Mod+Down".action = config.lib.niri.actions.focus-window-down; + "Mod+Up".action = config.lib.niri.actions.focus-window-up; + "Mod+Right".action = config.lib.niri.actions.focus-column-right; + "Mod+H".action = config.lib.niri.actions.focus-column-left; + "Mod+J".action = config.lib.niri.actions.focus-window-down; + "Mod+K".action = config.lib.niri.actions.focus-window-up; + "Mod+L".action = config.lib.niri.actions.focus-column-right; + "Mod+Home".action = config.lib.niri.actions.focus-column-first; + "Mod+End".action = config.lib.niri.actions.focus-column-last; + + # Move + "Mod+Ctrl+Left".action = config.lib.niri.actions.move-column-left; + "Mod+Ctrl+Down".action = config.lib.niri.actions.move-window-down; + "Mod+Ctrl+Up".action = config.lib.niri.actions.move-window-up; + "Mod+Ctrl+Right".action = config.lib.niri.actions.move-column-right; + "Mod+Ctrl+H".action = config.lib.niri.actions.move-column-left; + "Mod+Ctrl+J".action = config.lib.niri.actions.move-window-down; + "Mod+Ctrl+K".action = config.lib.niri.actions.move-window-up; + "Mod+Ctrl+L".action = config.lib.niri.actions.move-column-right; + "Mod+Ctrl+Home".action = config.lib.niri.actions.move-column-to-first; + "Mod+Ctrl+End".action = config.lib.niri.actions.move-column-to-last; + + # Monitor focus + "Mod+Shift+Left".action = config.lib.niri.actions.focus-monitor-left; + "Mod+Shift+Down".action = config.lib.niri.actions.focus-monitor-down; + "Mod+Shift+Up".action = config.lib.niri.actions.focus-monitor-up; + "Mod+Shift+Right".action = config.lib.niri.actions.focus-monitor-right; + "Mod+Shift+H".action = config.lib.niri.actions.focus-monitor-left; + "Mod+Shift+J".action = config.lib.niri.actions.focus-monitor-down; + "Mod+Shift+K".action = config.lib.niri.actions.focus-monitor-up; + "Mod+Shift+L".action = config.lib.niri.actions.focus-monitor-right; + + # Move to monitor + "Mod+Shift+Ctrl+Left".action = config.lib.niri.actions.move-column-to-monitor-left; + "Mod+Shift+Ctrl+Down".action = config.lib.niri.actions.move-column-to-monitor-down; + "Mod+Shift+Ctrl+Up".action = config.lib.niri.actions.move-column-to-monitor-up; + "Mod+Shift+Ctrl+Right".action = config.lib.niri.actions.move-column-to-monitor-right; + "Mod+Shift+Ctrl+H".action = config.lib.niri.actions.move-column-to-monitor-left; + "Mod+Shift+Ctrl+J".action = config.lib.niri.actions.move-column-to-monitor-down; + "Mod+Shift+Ctrl+K".action = config.lib.niri.actions.move-column-to-monitor-up; + "Mod+Shift+Ctrl+L".action = config.lib.niri.actions.move-column-to-monitor-right; + + # Workspace navigation + "Mod+Page_Down".action = config.lib.niri.actions.focus-workspace-down; + "Mod+Page_Up".action = config.lib.niri.actions.focus-workspace-up; + "Mod+U".action = config.lib.niri.actions.focus-workspace-down; + "Mod+I".action = config.lib.niri.actions.focus-workspace-up; + "Mod+Ctrl+Page_Down".action = config.lib.niri.actions.move-column-to-workspace-down; + "Mod+Ctrl+Page_Up".action = config.lib.niri.actions.move-column-to-workspace-up; + "Mod+Ctrl+U".action = config.lib.niri.actions.move-column-to-workspace-down; + "Mod+Ctrl+I".action = config.lib.niri.actions.move-column-to-workspace-up; + "Mod+Shift+Page_Down".action = config.lib.niri.actions.move-workspace-down; + "Mod+Shift+Page_Up".action = config.lib.niri.actions.move-workspace-up; + "Mod+Shift+U".action = config.lib.niri.actions.move-workspace-down; + + # Workspace focus + "Mod+1".action.focus-workspace = 1; + "Mod+2".action.focus-workspace = 2; + "Mod+3".action.focus-workspace = 3; + "Mod+4".action.focus-workspace = 4; + "Mod+5".action.focus-workspace = 5; + "Mod+6".action.focus-workspace = 6; + "Mod+7".action.focus-workspace = 7; + "Mod+8".action.focus-workspace = 8; + "Mod+9".action.focus-workspace = 9; + + # Move to workspace + "Mod+Ctrl+1".action.move-column-to-workspace = 1; + "Mod+Ctrl+2".action.move-column-to-workspace = 2; + "Mod+Ctrl+3".action.move-column-to-workspace = 3; + "Mod+Ctrl+4".action.move-column-to-workspace = 4; + "Mod+Ctrl+5".action.move-column-to-workspace = 5; + "Mod+Ctrl+6".action.move-column-to-workspace = 6; + "Mod+Ctrl+7".action.move-column-to-workspace = 7; + "Mod+Ctrl+8".action.move-column-to-workspace = 8; + "Mod+Ctrl+9".action.move-column-to-workspace = 9; + "Mod+Shift+I".action = config.lib.niri.actions.move-workspace-up; + + # Window management + "Mod+Comma".action = config.lib.niri.actions.consume-window-into-column; + "Mod+Period".action = config.lib.niri.actions.expel-window-from-column; + "Mod+BracketLeft".action = config.lib.niri.actions.consume-or-expel-window-left; + "Mod+BracketRight".action = config.lib.niri.actions.consume-or-expel-window-right; + + # Column management + "Mod+R".action = config.lib.niri.actions.switch-preset-column-width; + "Mod+Shift+R".action = config.lib.niri.actions.switch-preset-window-height; + "Mod+Ctrl+R".action = config.lib.niri.actions.reset-window-height; + "Mod+Minus".action = config.lib.niri.actions.set-column-width "-10%"; + "Mod+Equal".action = config.lib.niri.actions.set-column-width "+10%"; + "Mod+Shift+Minus".action = config.lib.niri.actions.set-window-height "-10%"; + "Mod+Shift+Equal".action = config.lib.niri.actions.set-window-height "+10%"; + + # Screenshots + "Print".action = config.lib.niri.actions.screenshot; + "Ctrl+Print".action = config.lib.niri.actions.screenshot-screen; + "Alt+Print".action = config.lib.niri.actions.screenshot-window; + + # System + "Mod+Alt+L".action.spawn = [ + "${lib.getExe' pkgs.systemd "loginctl"}" + "lock-session" + ]; + + # Media keys + "XF86AudioRaiseVolume" = { + action.spawn = ["wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1+"]; + allow-when-locked = true; + }; + "XF86AudioLowerVolume" = { + action.spawn = ["wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1-"]; + allow-when-locked = true; + }; + "XF86AudioMute" = { + action.spawn = ["wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle"]; + allow-when-locked = true; + }; + "XF86AudioMicMute" = { + action.spawn = ["wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle"]; + allow-when-locked = true; + }; + "XF86MonBrightnessUp" = { + action.spawn = ["brillo" "-q" "-u 300000" "-A 5"]; + allow-when-locked = true; + }; + "XF86MonBrightnessDown" = { + action.spawn = ["brillo" "-q" "-u 300000" "-U 5"]; + allow-when-locked = true; + }; + }; +} diff --git a/home/programs/niri/default.nix b/home/programs/niri/default.nix new file mode 100644 index 0000000..ece5afd --- /dev/null +++ b/home/programs/niri/default.nix @@ -0,0 +1,33 @@ +{ + inputs, + config, + pkgs, + ... +}: let + schemeData = inputs.basix.schemeData.base16.${config.theme.scheme}; +in { + imports = [./binds.nix]; + programs.niri = { + settings = { + environment."NIXOS_OZONE_WL" = "1"; + prefer-no-csd = true; + + window-rules = [ + { + matches = [ + {app-id = "foot";} + ]; + default-column-width = {proportion = 0.5;}; + } + ]; + + layout = { + border.active = pkgs.lib.rgba schemeData.palette.base0E; + }; + input.keyboard.xkb = { + layout = "us"; + options = "compose:ralt"; + }; + }; + }; +} diff --git a/home/programs/plasma/default.nix b/home/programs/plasma/default.nix index 538e750..4da779b 100644 --- a/home/programs/plasma/default.nix +++ b/home/programs/plasma/default.nix @@ -1,9 +1,13 @@ { + inputs, config, pkgs, ... }: { - programs.plasma = { + imports = [ + inputs.plasma-manager.homeManagerModules.plasma-manager + ]; + rograms.plasma = { enable = true; workspace = { lookAndFeel = "org.kde.breezedark.desktop"; diff --git a/home/programs/swaybg.nix b/home/programs/swaybg.nix new file mode 100644 index 0000000..8ac4d07 --- /dev/null +++ b/home/programs/swaybg.nix @@ -0,0 +1,19 @@ +# stolen from https://raw.githubusercontent.com/carlsvelz/dotfiles/a7a109b2e19f73062b4961e7be75836e6d13408c/home/wayland/swaybg.nix +{ + pkgs, + lib, + nixosConfig, + ... +}: { + systemd.user.services.swaybg = { + Unit = { + Description = "Wayland wallpaper daemon"; + PartOf = ["graphical-session.target"]; + }; + Service = { + ExecStart = "${lib.getExe pkgs.swaybg} -i ${nixosConfig.style.wallpaper} -m fill"; + Restart = "on-failure"; + }; + Install.WantedBy = ["graphical-session.target"]; + }; +} diff --git a/home/programs/swayidle.nix b/home/programs/swayidle.nix new file mode 100644 index 0000000..a3d3423 --- /dev/null +++ b/home/programs/swayidle.nix @@ -0,0 +1,20 @@ +{ + lib, + config, + ... +}: { + services.swayidle = { + enable = true; + events = [ + { + event = "lock"; + command = "${lib.getExe config.programs.swaylock.package}"; + } + { + event = "before-sleep"; + command = "${lib.getExe config.programs.swaylock.package}"; + } + ]; + }; + systemd.user.services.swayidle.Unit.After = lib.mkForce ["graphical-session.target"]; +} diff --git a/home/programs/swaylock.nix b/home/programs/swaylock.nix new file mode 100644 index 0000000..665699e --- /dev/null +++ b/home/programs/swaylock.nix @@ -0,0 +1,53 @@ +{ + inputs, + pkgs, + nixosConfig, + ... +}: let + inherit (inputs.basix.schemeData.base16.${nixosConfig.style.scheme}) palette; +in { + # requires `security.pam.services.swaylock = { };` at the system level or else + # unlock will not work. + programs.swaylock = { + enable = true; + package = pkgs.swaylock-effects; + + settings = { + indicator-radius = 111; + indicator-thickness = 9; + + screenshots = true; + effect-blur = "7x5"; + effect-vignette = "0.75:0.75"; + effect-pixelate = 5; + + ignore-empty-password = false; # needed for PAM to work with fprintd / password + + inside-color = palette.base01; + inside-clear-color = palette.base0C; + inside-caps-lock-color = palette.base09; + inside-ver-color = palette.base0D; + inside-wrong-color = palette.base08; + key-hl-color = palette.base0B; + layout-bg-color = palette.base00; + layout-border-color = palette.base05; + layout-text-color = palette.base07; + line-color = palette.base00; + line-clear-color = palette.base0C; + line-caps-lock-color = palette.base09; + line-ver-color = palette.base0D; + line-wrong-color = palette.base08; + ring-color = palette.base02; + ring-clear-color = palette.base0C; + ring-caps-lock-color = palette.base09; + ring-ver-color = palette.base0D; + ring-wrong-color = palette.base08; + separator-color = palette.base02; + text-color = palette.base07; + text-clear-color = palette.base04; + text-caps-lock-color = palette.base04; + text-ver-color = palette.base04; + text-wrong-color = palette.base04; + }; + }; +} diff --git a/home/programs/xdg.nix b/home/programs/xdg.nix new file mode 100644 index 0000000..8886ad5 --- /dev/null +++ b/home/programs/xdg.nix @@ -0,0 +1,35 @@ +{config, ...}: { + xdg = { + enable = true; + cacheHome = config.home.homeDirectory + "/.local/cache"; + + mimeApps = { + enable = true; + defaultApplications = { + "default-web-browser" = ["firefox.desktop"]; + "text/html" = ["firefox.desktop"]; + "x-scheme-handler/http" = ["firefox.desktop"]; + "x-scheme-handler/https" = ["firefox.desktop"]; + "x-scheme-handler/about" = ["firefox.desktop"]; + "x-scheme-handler/unknown" = ["firefox.desktop"]; + "x-scheme-handler/chrome" = ["chromium-browser.desktop"]; + "inode/directory" = ["yazi.desktop"]; + "application/pdf" = ["org.pwmt.zathura-pdf-mupdf.desktop"]; + "image/png" = ["org.gnome.Loupe.desktop"]; + "image/svg" = [" org.gnome.Loupe.desktop"]; + "image/jpeg" = ["org.gnome.Loupe.desktop"]; + "image/gif" = [" org.gnome.Loupe.desktop"]; + "video/mp4" = ["io.github.celluloid_player.Celluloid.desktop"]; + "video/avi" = ["io.github.celluloid_player.Celluloid.desktop"]; + "video/mkv" = ["io.github.celluloid_player.Celluloid.desktop"]; + }; + }; + userDirs = { + enable = true; + createDirectories = true; + extraConfig = { + XDG_SCREENSHOTS_DIR = "${config.xdg.userDirs.pictures}/Screenshots"; + }; + }; + }; +} diff --git a/home/terminal/default.nix b/home/terminal/default.nix index 14a96a4..c328315 100644 --- a/home/terminal/default.nix +++ b/home/terminal/default.nix @@ -3,4 +3,8 @@ ./programs ./shell ]; + + home.sessionVariables = { + EDITOR = "nvim"; + }; } diff --git a/home/terminal/emulators/foot.nix b/home/terminal/emulators/foot.nix index cec4b0d..57e0bd0 100644 --- a/home/terminal/emulators/foot.nix +++ b/home/terminal/emulators/foot.nix @@ -1,6 +1,8 @@ { inputs, + nixosConfig, config, + lib, ... }: { programs.foot = { @@ -9,10 +11,10 @@ main = { term = "xterm-256color"; font = "monospace:size=14"; + shell = "${lib.getExe config.programs.fish.package}"; }; colors = let - inherit (config.theme) scheme; - schemeData = inputs.basix.schemeData.base16.${scheme}; + schemeData = inputs.basix.schemeData.base16.${nixosConfig.style.scheme}; in { background = schemeData.palette.base00; foreground = schemeData.palette.base05; diff --git a/home/terminal/shell/default.nix b/home/terminal/shell/default.nix index 3910822..53f04c4 100644 --- a/home/terminal/shell/default.nix +++ b/home/terminal/shell/default.nix @@ -1,7 +1,8 @@ { imports = [ - ./fish.nix ./starship.nix ./zoxide.nix + ./nushell.nix + ./fish.nix ]; } diff --git a/home/terminal/shell/nushell.nix b/home/terminal/shell/nushell.nix new file mode 100644 index 0000000..9cd0c78 --- /dev/null +++ b/home/terminal/shell/nushell.nix @@ -0,0 +1,30 @@ +{ + programs.nushell = { + enable = true; + extraConfig = '' + let carapace_completer = {|spans| + carapace $spans.0 nushell ...$spans | from json + } + $env.config = { + show_banner: false, + completions: { + case_sensitive: false # case-sensitive completions + quick: true # set to false to prevent auto-selecting completions + partial: true # set to false to prevent partial filling of the prompt + algorithm: "fuzzy" # prefix or fuzzy + external: { + # set to false to prevent nushell looking into $env.PATH to find more suggestions + enable: true + # set to lower can improve completion performance at the cost of omitting some options + max_results: 100 + completer: $carapace_completer # check 'carapace_completer' + } + } + } + ''; + }; + + programs.carapace = { + enable = true; + }; +} diff --git a/hosts/default.nix b/hosts/default.nix index 3e0b6f8..023ac37 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,6 +1,7 @@ { self, inputs, + lib, ... }: { flake.nixosConfigurations = let @@ -19,8 +20,18 @@ ++ [ ./vamos - "${mod}/programs/kde.nix" + ../system/services/regreet.nix + "${mod}/programs/niri" + self.nixosModules.style + + { + style = { + gtk.enable = true; + wallpaper = lib.mkDefault ../wallpapers/lucy-edgerunners-wallpaper.jpg; + scheme = lib.mkDefault "catppuccin-frappe"; + }; + } { home-manager = { users.nezia.imports = homeImports.vamos; @@ -42,6 +53,7 @@ "${mod}/programs/kde.nix" "${mod}/hardware/nvidia.nix" + self.nixosModules.theme { home-manager = { users.nezia.imports = homeImports.solaire; diff --git a/hosts/vamos/default.nix b/hosts/vamos/default.nix index aaeae31..c81507f 100644 --- a/hosts/vamos/default.nix +++ b/hosts/vamos/default.nix @@ -1,4 +1,4 @@ -{...}: { +{lib, ...}: { imports = [ ./hardware-configuration.nix ]; diff --git a/lib/default.nix b/lib/default.nix index cd61e0f..c9f30a3 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -3,6 +3,13 @@ lib, ... }: let + # convert rrggbb hex to rgba(r, g, b, a) CSS format + rgba = c: let + r = toString (hexToDec (builtins.substring 0 2 c)); + g = toString (hexToDec (builtins.substring 2 2 c)); + b = toString (hexToDec (builtins.substring 4 2 c)); + in "rgba(${r}, ${g}, ${b}, .5)"; + # Helper function to convert hex color to decimal RGB values hexToDec = v: let hexToInt = { @@ -30,21 +37,12 @@ "F" = 15; }; chars = lib.strings.stringToCharacters v; - charsLen = builtins.length chars; in - lib.lists.foldl (a: v: a + v) 0 - (lib.lists.imap0 (k: v: hexToInt."${v}" * (pow 16 (charsLen - k - 1))) chars); + lib.foldl' (a: v: a + v) 0 + (lib.imap (k: v: hexToInt."${v}" * (pow 16 (builtins.length chars - k - 1))) chars); # Power function for exponentiation - pow = let - pow' = base: exponent: value: - if exponent == 0 - then 1 - else if exponent <= 1 - then value - else pow' base (exponent - 1) (value * base); - in - base: exponent: pow' base exponent base; + pow = base: exponent: lib.foldl' (acc: _: acc * base) 1 (lib.range 1 exponent); # Converts hex color to KDE color format colorToKde = name: hexColor: let @@ -74,25 +72,22 @@ base0E = ["Color5" "Color5Intense"]; }; - # Generate KDE color sections using the mapped colors colorSections = lib.concatStringsSep "\n" (lib.attrsets.mapAttrsToList - ( - name: value: - lib.concatMapStrings (slot: colorToKde slot value) (colorMap.${name} or []) - ) + (name: value: + lib.concatMapStrings (slot: colorToKde slot value) (colorMap.${name} or [])) palette); in - lib.strings.concatStringsSep "\n" ( - [ - "[General]" - "\nDescription=${scheme.name}" - "\nOpacity=1" - "\nWallpaper=" - ] - ++ [colorSections] - ); + lib.concatStringsSep "\n" [ + "[General]" + "Description=${scheme.name}" + "Opacity=1" + "Wallpaper=" + colorSections + ]; - # Main function to create the KDE colorscheme file + # Create a KDE konsole color scheme from base16 colors mkKonsoleColorScheme = scheme: pkgs.writeText "${scheme.name}.colorscheme" (schemeToKonsole scheme); -in {inherit mkKonsoleColorScheme;} +in { + inherit mkKonsoleColorScheme rgba; +} diff --git a/modules/default.nix b/modules/default.nix index 47af602..4d8324f 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,5 +1,5 @@ { flake.nixosModules = { - theme = import ./theme; + style = import ./style; }; } diff --git a/modules/style/default.nix b/modules/style/default.nix new file mode 100644 index 0000000..a97420e --- /dev/null +++ b/modules/style/default.nix @@ -0,0 +1,48 @@ +{ + lib, + pkgs, + ... +}: let + inherit (lib) mkOption; + inherit (lib.types) string path package; +in { + imports = [./gtk.nix]; + options.style = { + scheme = mkOption { + description = '' + Name of the tinted-scheming color scheme to use. + ''; + type = string; + example = lib.literalExpression "catppuccin-frappe"; + }; + wallpaper = mkOption { + description = '' + Location of the wallpaper that will be used throughout the system. + ''; + type = path; + example = lib.literalExpression "./wallpaper.png"; + }; + + cursorTheme = { + name = mkOption { + description = '' + Name of the cursor theme. + ''; + default = "Bibata-Modern-Classic"; + }; + package = mkOption { + type = package; + description = '' + Package providing the cursor theme. + ''; + default = pkgs.bibata-cursors; + }; + size = mkOption { + description = '' + Size of the cursor. + ''; + default = 24; + }; + }; + }; +} diff --git a/modules/style/gtk.nix b/modules/style/gtk.nix new file mode 100644 index 0000000..db02ff9 --- /dev/null +++ b/modules/style/gtk.nix @@ -0,0 +1,66 @@ +{ + config, + lib, + pkgs, + ... +}: let + inherit (builtins) pathExists; + inherit (lib) mkOption mkEnableOption; + inherit (lib.types) package str; + + cfg = config.style.gtk; +in { + options.style.gtk = { + enable = mkEnableOption "enable GTK theming options"; + theme = { + name = mkOption { + type = str; + description = "Name for the GTK theme"; + default = "catppuccin-frappe-lavender-standard"; + }; + package = mkOption { + type = package; + description = "Package providing the GTK theme"; + + default = pkgs.catppuccin-gtk.override { + # https://github.com/NixOS/nixpkgs/blob/nixos-23.05/pkgs/data/themes/catppuccin-gtk/default.nix + variant = "frappe"; + accents = ["lavender"]; + size = "standard"; + }; + }; + }; + iconTheme = { + name = mkOption { + type = str; + description = "The name for the icon theme that will be used for GTK programs"; + default = "Papirus-Dark"; + }; + + package = mkOption { + type = package; + description = "The GTK icon theme to be used"; + default = pkgs.catppuccin-papirus-folders.override { + accent = "lavender"; + flavor = "frappe"; + }; + }; + }; + }; + config = { + assertions = [ + (let + themePath = cfg.theme.package + /share/themes + "/${cfg.theme.name}"; + in { + assertion = cfg.enable -> pathExists themePath; + message = '' + ${toString themePath} set by the GTK module does not exist! + + To suppress this message, make sure that + `config.modules.style.gtk.theme.package` contains + the path `${cfg.theme.name}` + ''; + }) + ]; + }; +} diff --git a/modules/theme/default.nix b/modules/theme/default.nix deleted file mode 100644 index fbef65f..0000000 --- a/modules/theme/default.nix +++ /dev/null @@ -1,18 +0,0 @@ -{lib, ...}: { - options.theme = { - scheme = lib.mkOption { - description = '' - Name of the tinted-scheming color scheme to use. - ''; - type = lib.types.string; - example = lib.literalExpression "catppuccin-frappe"; - }; - wallpaper = lib.mkOption { - description = '' - Location of the wallpaper that will be used throughout the system. - ''; - type = lib.types.path; - example = lib.literalExpression "./wallpaper.png"; - }; - }; -} diff --git a/system/core/default.nix b/system/core/default.nix index a5e2c10..75b3b6d 100644 --- a/system/core/default.nix +++ b/system/core/default.nix @@ -2,6 +2,7 @@ imports = [ ./boot.nix ./users.nix + ./security.nix ../nix ]; i18n = { diff --git a/system/core/security.nix b/system/core/security.nix new file mode 100644 index 0000000..af947a8 --- /dev/null +++ b/system/core/security.nix @@ -0,0 +1,3 @@ +{ + security.sudo.wheelNeedsPassword = false; +} diff --git a/system/core/users.nix b/system/core/users.nix index 24bb86b..7da1ca7 100644 --- a/system/core/users.nix +++ b/system/core/users.nix @@ -1,9 +1,10 @@ -{...}: { +{ users.users.nezia = { isNormalUser = true; description = "Anthony Rodriguez"; extraGroups = [ "networkmanager" + "video" "wheel" ]; }; diff --git a/system/default.nix b/system/default.nix index f33efbe..0d5096b 100644 --- a/system/default.nix +++ b/system/default.nix @@ -19,9 +19,11 @@ let laptop = common ++ [ - ./hardware/power.nix ./hardware/fprintd.nix + ./services/power.nix + ./services/brightness.nix ./services/keyd.nix + ./services/logind.nix ]; in { inherit desktop laptop; diff --git a/system/hardware/power.nix b/system/hardware/power.nix deleted file mode 100644 index dd79035..0000000 --- a/system/hardware/power.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - services.power-profiles-daemon.enable = true; -} diff --git a/system/nix/nixpkgs.nix b/system/nix/nixpkgs.nix index c1f61f3..e4c570e 100644 --- a/system/nix/nixpkgs.nix +++ b/system/nix/nixpkgs.nix @@ -1,4 +1,4 @@ -_: { +{pkgs, ...}: { nixpkgs = { config.allowUnfree = true; overlays = [ @@ -10,5 +10,6 @@ _: { }; }) ]; + config.permittedInsecurePackages = ["cinny-4.2.1" "cinny-unwrapped-4.2.1"]; }; } diff --git a/system/programs/home-manager.nix b/system/programs/home-manager.nix index 216ffe2..ace5c17 100644 --- a/system/programs/home-manager.nix +++ b/system/programs/home-manager.nix @@ -4,6 +4,7 @@ ]; home-manager = { + backupFileExtension = "backup"; useGlobalPkgs = true; useUserPackages = true; }; diff --git a/system/programs/niri/default.nix b/system/programs/niri/default.nix new file mode 100644 index 0000000..9dee14e --- /dev/null +++ b/system/programs/niri/default.nix @@ -0,0 +1,30 @@ +{ + inputs, + lib, + pkgs, + config, + ... +}: { + imports = [ + inputs.niri.nixosModules.niri + ]; + + programs.niri = { + enable = true; + }; + + # copied from https://github.com/linyinfeng/dotfiles/blob/91b0363b093303f57885cbae9da7f8a99bbb4432/nixos/profiles/graphical/niri/default.nix#L17-L29 + security.pam.services.swaylock.text = lib.mkIf config.services.fprintd.enable '' + account required pam_unix.so + + # check passwork before fprintd + auth sufficient pam_unix.so try_first_pass likeauth + auth sufficient ${pkgs.fprintd}/lib/security/pam_fprintd.so + auth required pam_deny.so + + password sufficient pam_unix.so nullok yescrypt + + session required pam_env.so conffile=/etc/pam/environment readenv=0 + session required pam_unix.so + ''; +} diff --git a/system/services/brightness.nix b/system/services/brightness.nix new file mode 100644 index 0000000..4cbef77 --- /dev/null +++ b/system/services/brightness.nix @@ -0,0 +1,3 @@ +{ + hardware.brillo.enable = true; +} diff --git a/system/services/logind.nix b/system/services/logind.nix new file mode 100644 index 0000000..d7b9b86 --- /dev/null +++ b/system/services/logind.nix @@ -0,0 +1,5 @@ +{ + services.logind = { + lidSwitch = "suspend"; + }; +} diff --git a/system/services/power.nix b/system/services/power.nix new file mode 100644 index 0000000..299522b --- /dev/null +++ b/system/services/power.nix @@ -0,0 +1,12 @@ +{ + services = { + logind.extraConfig = '' + HandlePowerKey=suspend + ''; + + power-profiles-daemon.enable = true; + + # battery info + upower.enable = true; + }; +} diff --git a/system/services/regreet.nix b/system/services/regreet.nix new file mode 100644 index 0000000..252aa2b --- /dev/null +++ b/system/services/regreet.nix @@ -0,0 +1,34 @@ +{ + lib, + pkgs, + config, + ... +}: let + inherit (lib) mkForce; +in { + environment.systemPackages = [ + config.style.gtk.theme.package + config.style.gtk.iconTheme.package + config.style.cursorTheme.package + ]; + + programs.regreet = { + enable = true; + package = pkgs.greetd.regreet; + cageArgs = [ + "-s" + "-d" + ]; + settings = { + GTK = { + cursor_theme_name = mkForce config.style.cursorTheme.name; + icon_theme_name = mkForce config.style.gtk.iconTheme.name; + theme_name = mkForce config.style.gtk.theme.name; + }; + }; + }; + security.pam.services.greetd = { + enableGnomeKeyring = true; + fprintAuth = false; + }; +}