From 83cacc4a057bd307f9e6d28ac5650b236b2320b4 Mon Sep 17 00:00:00 2001 From: Tristan Date: Mon, 16 Jun 2025 21:20:02 +0100 Subject: [PATCH 1/5] alpine: add gpu drivers --- hardware/alpine.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/hardware/alpine.nix b/hardware/alpine.nix index 17e78eb..611eb01 100644 --- a/hardware/alpine.nix +++ b/hardware/alpine.nix @@ -86,6 +86,7 @@ in { nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + hardware.graphics.enable = true; system.stateVersion = "24.05"; # don't change. home-manager.users.${user}.imports = [ From cbe883dcc6a9bc6607ad0fe1c1fddefcd1eff1c7 Mon Sep 17 00:00:00 2001 From: tristan Date: Sat, 21 Jun 2025 10:37:18 +0100 Subject: [PATCH 2/5] zenix: remove hyprland --- flake.nix | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/flake.nix b/flake.nix index 26369b5..ad9ab1b 100644 --- a/flake.nix +++ b/flake.nix @@ -43,7 +43,6 @@ ./nixos/programs/personal.nix ./nixos/services/musnix.nix ./nixos/workstation.nix - ./nixos/programs/hyprland.nix ]; home-modules = [ ./home/programs/graphical.nix @@ -135,24 +134,6 @@ ]; }; - vm-hyprland = - builtins.trace '' - use super+enter to start a terminal. - use super+d to launch applications - - Hyprland is VERY SLOW in the VM. - - start with '-vga virtio' - '' - mkConf - { - nixos-modules = [ - ./hardware/vm.nix - (auto-login "Hyprland") - ./nixos/programs/hyprland.nix - ]; - }; - vm-tty = mkConf { From 96c92c78381e87855ae0e4ae23a556c908d18777 Mon Sep 17 00:00:00 2001 From: tristan Date: Sat, 21 Jun 2025 12:01:48 +0100 Subject: [PATCH 3/5] zenix: remove usbkey, add cosmic-manager --- flake.lock | 106 +++++++++++++++------ flake.nix | 8 ++ hardware/zenix.nix | 13 +-- home/desktop/cosmic/default.nix | 163 +++++++++++++++----------------- home/modules/terminal.nix | 9 -- nixos/programs/cosmic.nix | 12 --- 6 files changed, 165 insertions(+), 146 deletions(-) diff --git a/flake.lock b/flake.lock index 7285e99..b0cd59e 100644 --- a/flake.lock +++ b/flake.lock @@ -67,6 +67,30 @@ "type": "github" } }, + "cosmic-manager": { + "inputs": { + "flake-parts": "flake-parts", + "home-manager": [ + "home-manager" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1744387566, + "narHash": "sha256-O39zTv7LdRgr4Hw38d+eQG2LYpP75rw2XKqTGV5qzgs=", + "owner": "HeitorAugustoLN", + "repo": "cosmic-manager", + "rev": "52d3fdd080a9dd4639948687682a68282fbf0314", + "type": "github" + }, + "original": { + "owner": "HeitorAugustoLN", + "repo": "cosmic-manager", + "type": "github" + } + }, "firefox-gnome-theme": { "flake": false, "locked": { @@ -101,16 +125,16 @@ "flake-parts": { "inputs": { "nixpkgs-lib": [ - "nixvim", + "cosmic-manager", "nixpkgs" ] }, "locked": { - "lastModified": 1743550720, - "narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=", + "lastModified": 1738453229, + "narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "c621e8422220273271f52058f618c94e405bb0f5", + "rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd", "type": "github" }, "original": { @@ -120,6 +144,27 @@ } }, "flake-parts_2": { + "inputs": { + "nixpkgs-lib": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1749398372, + "narHash": "sha256-tYBdgS56eXYaWVW3fsnPQ/nFlgWi/Z2Ymhyu21zVM98=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9305fe4e5c2a6fcf5ba6a3ff155720fbe4076569", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_3": { "inputs": { "nixpkgs-lib": [ "stylix", @@ -246,11 +291,11 @@ ] }, "locked": { - "lastModified": 1748665073, - "narHash": "sha256-RMhjnPKWtCoIIHiuR9QKD7xfsKb3agxzMfJY8V9MOew=", + "lastModified": 1749154018, + "narHash": "sha256-gjN3j7joRvT3a8Zgcylnd4NFsnXeDBumqiu4HmY1RIg=", "owner": "nix-community", "repo": "home-manager", - "rev": "282e1e029cb6ab4811114fc85110613d72771dea", + "rev": "7aae0ee71a17b19708b93b3ed448a1a0952bf111", "type": "github" }, "original": { @@ -346,11 +391,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1749024892, - "narHash": "sha256-OGcDEz60TXQC+gVz5sdtgGJdKVYr6rwdzQKuZAJQpCA=", + "lastModified": 1750400657, + "narHash": "sha256-3vkjFnxCOP6vm5Pm13wC/Zy6/VYgei/I/2DWgW4RFeA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "8f1b52b04f2cb6e5ead50bd28d76528a2f0380ef", + "rev": "b2485d56967598da068b5a6946dadda8bfcbcd37", "type": "github" }, "original": { @@ -361,11 +406,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1748693115, - "narHash": "sha256-StSrWhklmDuXT93yc3GrTlb0cKSS0agTAxMGjLKAsY8=", + "lastModified": 1750134718, + "narHash": "sha256-v263g4GbxXv87hMXMCpjkIxd/viIF7p3JpJrwgKdNiI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "910796cabe436259a29a72e8d3f5e180fc6dfacc", + "rev": "9e83b64f727c88a7711a2c463a7b16eedb69a84c", "type": "github" }, "original": { @@ -377,7 +422,7 @@ }, "nixvim": { "inputs": { - "flake-parts": "flake-parts", + "flake-parts": "flake-parts_2", "nixpkgs": [ "nixpkgs" ], @@ -385,11 +430,11 @@ "systems": "systems_2" }, "locked": { - "lastModified": 1748975233, - "narHash": "sha256-eLz/5C3qQN8w7dyLnY8zKdwLuHuS03s8csuLjTis2No=", + "lastModified": 1750149910, + "narHash": "sha256-M0WNjAy2FCHJAb1hEp+J2gnMk707K5/iTA24amEu/s8=", "owner": "nix-community", "repo": "nixvim", - "rev": "8917e2e8ecc957037c712145ddcfce08d00c1cad", + "rev": "1252966779a5632a3cd5238e442d55a1d2f56660", "type": "github" }, "original": { @@ -435,11 +480,11 @@ ] }, "locked": { - "lastModified": 1748298102, - "narHash": "sha256-PP11GVwUt7F4ZZi5A5+99isuq39C59CKc5u5yVisU/U=", + "lastModified": 1749730855, + "narHash": "sha256-L3x2nSlFkXkM6tQPLJP3oCBMIsRifhIDPMQQdHO5xWo=", "owner": "NuschtOS", "repo": "search", - "rev": "f8a1c221afb8b4c642ed11ac5ee6746b0fe1d32f", + "rev": "8dfe5879dd009ff4742b668d9c699bc4b9761742", "type": "github" }, "original": { @@ -450,6 +495,7 @@ }, "root": { "inputs": { + "cosmic-manager": "cosmic-manager", "home-manager": "home-manager", "musnix": "musnix", "nixpkgs": "nixpkgs_2", @@ -466,11 +512,11 @@ ] }, "locked": { - "lastModified": 1747603214, - "narHash": "sha256-lAblXm0VwifYCJ/ILPXJwlz0qNY07DDYdLD+9H+Wc8o=", + "lastModified": 1750119275, + "narHash": "sha256-Rr7Pooz9zQbhdVxux16h7URa6mA80Pb/G07T4lHvh0M=", "owner": "Mic92", "repo": "sops-nix", - "rev": "8d215e1c981be3aa37e47aeabd4e61bb069548fd", + "rev": "77c423a03b9b2b79709ea2cb63336312e78b72e2", "type": "github" }, "original": { @@ -487,7 +533,7 @@ "base16-vim": "base16-vim", "firefox-gnome-theme": "firefox-gnome-theme", "flake-compat": "flake-compat", - "flake-parts": "flake-parts_2", + "flake-parts": "flake-parts_3", "git-hooks": "git-hooks", "gnome-shell": "gnome-shell", "home-manager": "home-manager_2", @@ -503,11 +549,11 @@ "tinted-zed": "tinted-zed" }, "locked": { - "lastModified": 1749058304, - "narHash": "sha256-8fUXBczmQ7/Y8nrc988oaN4M7YZz/RbzZa0n1d8i3GM=", + "lastModified": 1750370365, + "narHash": "sha256-Yblt2LusglzBXlg+ekckztIUgvl1WQwJ7gLRJEt/IHE=", "owner": "danth", "repo": "stylix", - "rev": "689d4db89d3be6fd82b7dcb41a1cea5c4743b1ef", + "rev": "cc82dae884f45ffeb996d2b5116afa70933e507f", "type": "github" }, "original": { @@ -670,11 +716,11 @@ "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1748971473, - "narHash": "sha256-0Xh6sZI86Ops6u7wyDQlVvV+MvRRXIDb1r3sMnLNk9M=", + "lastModified": 1750219862, + "narHash": "sha256-wce+erYDBm6wpLJm6IJh85KYqy/NtdKp6DZQCn4YP1Q=", "owner": "youwen5", "repo": "zen-browser-flake", - "rev": "5cc269976ca876674d8ccc7f40debb61e05583ab", + "rev": "18d6cd2f5a9cd1527d478d4f716e9b9ee6fb6cbb", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index ad9ab1b..60ac238 100644 --- a/flake.nix +++ b/flake.nix @@ -22,6 +22,13 @@ zen-browser = { url = "github:youwen5/zen-browser-flake"; }; + cosmic-manager = { + url = "github:HeitorAugustoLN/cosmic-manager"; + inputs = { + nixpkgs.follows = "nixpkgs"; + home-manager.follows = "home-manager"; + }; + }; }; outputs = {nixvim, ...} @ inputs: let @@ -48,6 +55,7 @@ ./home/programs/graphical.nix ./home/programs/gamer.nix ./home/programs/personal/. + ./home/desktop/cosmic/. ]; }; diff --git a/hardware/zenix.nix b/hardware/zenix.nix index 1076e79..715f396 100644 --- a/hardware/zenix.nix +++ b/hardware/zenix.nix @@ -31,19 +31,12 @@ in { options = ["noatime"]; }; - boot.initrd.luks.devices."usbkey" = { - device = "/dev/disk/by-label/usbkey1"; - }; + # boot.initrd.luks.devices."usbkey" = { + # device = "/dev/disk/by-label/usbkey1"; + # }; boot.initrd.luks.devices."cryptroot" = { device = "/dev/disk/by-uuid/cc0617df-8cbf-4618-abbc-df64c96de151"; - keyFileSize = 4096; - preOpenCommands = '' - mkdir -m 0755 -p /key - mount -n -o ro /dev/mapper/usbkey /key - ''; - keyFile = "/key/keyfile"; - preLVM = false; }; fileSystems."/home" = { diff --git a/home/desktop/cosmic/default.nix b/home/desktop/cosmic/default.nix index 0dab645..04c1672 100644 --- a/home/desktop/cosmic/default.nix +++ b/home/desktop/cosmic/default.nix @@ -2,101 +2,94 @@ pkgs, config, lib, + inputs, ... }: let - inherit (config.lib.cosmic) Actions mapBinds; - SpawnTerminal = name: pkg: - Actions.Spawn (pkgs.writeShellScriptBin name "${lib.getExe config.programs.terminal} -e ${lib.getExe pkg}"); + inherit (config.lib.cosmic) mkRON; + mkAction = variant: action: mkRON "enum" { + inherit variant; + value = [ + (mkRON "enum" action) + ]; + }; in { - programs.cosmic = { + imports = [inputs.cosmic-manager.homeManagerModules.cosmic-manager]; + wayland.desktopManager.cosmic = { enable = true; - input.asDefaults = true; - input.binds = mapBinds { - # Navigation - Super. "h" = Actions.Focus "Left"; - Super. "l" = Actions.Focus "Right"; - Super. "j" = Actions.Focus "Down"; - Super. "k" = Actions.Focus "Up"; - Super. "u" = Actions.Focus "Out"; - Super. "i" = Actions.Focus "In"; - Super.Shift. "h" = Actions.Move "Left"; - Super.Shift. "l" = Actions.Move "Right"; - Super.Shift. "j" = Actions.Move "Down"; - Super.Shift. "k" = Actions.Move "Up"; - Super.Shift. "Right" = Actions.MoveToNextWorkspace; - Super.Shift. "Left" = Actions.MoveToPreviousWorkspace; - Super. "1" = Actions.Workspace 1; - Super. "2" = Actions.Workspace 2; - Super. "3" = Actions.Workspace 3; - Super. "4" = Actions.Workspace 4; - Super. "5" = Actions.Workspace 5; - Super.Shift. "1" = Actions.MoveToWorkspace 1; - Super.Shift. "2" = Actions.MoveToWorkspace 2; - Super.Shift. "3" = Actions.MoveToWorkspace 3; - Super.Shift. "4" = Actions.MoveToWorkspace 4; - Super.Shift. "5" = Actions.MoveToWorkspace 5; - Super. "Space" = Actions.ToggleWindowFloating; - Super. "f" = Actions.Maximize; - Super. "m" = Actions.Minimize; - Super.Shift. "x" = Actions.Close; - Super.Shift. "v" = Actions.ToggleStacking; - Super.Shift. "y" = Actions.ToggleSticky; - # System - Super. "d" = Actions.Spawn config.programs.menu.drunCommand; - Super. "Return" = Actions.Spawn config.programs.terminal; - Super. "e" = SpawnTerminal "aerc" config.programs.aerc.package; - Super. "o" = Actions.System "HomeFolder"; - Super.Shift. "s" = Actions.System "Screenshot"; - "XF86AudioRaiseVolume" = Actions.System "VolumeRaise"; - "XF86AudioLowerVolume" = Actions.System "VolumeLower"; - "XF86AudioPlay" = Actions.System "PlayPause"; - "XF86AudioNext" = Actions.System "PlayNext"; - "XF86AudioPrev" = Actions.System "PlayPrev"; - "XF86MonBrightnessUp" = Actions.System "BrightnessUp"; - "XF86MonBrightnessDown" = Actions.System "BrightnessDown"; - }; - background = { - displays = { - all = { - source = lib.mkDefault config.stylix.image; + + systemActions = mkRON "map" [ + { + key = mkRON "enum" "Terminal"; + value = lib.getExe config.programs.terminal; + } + ]; + + shortcuts = [ + { + action = mkAction "System" "Terminal"; + key = "Super+Return"; + } + ]; + + wallpapers = [ + { + filter_by_theme = true; + filter_method = mkRON "enum" "Lanczos"; + output = "all"; + rotation_frequency = 600; + sampling_method = mkRON "enum" "Alphanumeric"; + scaling_mode = mkRON "enum" { + value = [ + (mkRON "tuple" [ + 0.5 + 1.0 + (mkRON "raw" "0.345354352") + ]) + ]; + variant = "Fit"; }; - }; - }; - panels = { - "Bar" = { - applets = { - start = [ + source = mkRON "enum" { + value = [ (toString config.stylix.image) ]; + variant = "Path"; + }; + } + ]; + + panels = [ + { + anchor = mkRON "enum" "Top"; + anchor_gap = false; + autohide = mkRON "optional" null; + background = mkRON "enum" "Dark"; + expand_to_edges = true; + name = "Panel"; + opacity = 1.0; + output = mkRON "enum" "All"; + plugins_center = mkRON "optional" [ + "com.system76.CosmicAppletTime" + ]; + plugins_wings = mkRON "optional" (mkRON "tuple" [ + [ + "com.system76.CosmicPanelWorkspacesButton" + "com.system76.CosmicPanelAppButton" "com.system76.CosmicAppletWorkspaces" - ]; - center = [ - "com.system76.CosmicAppletMinimize" - ]; - end = [ - "com.system76.CosmicAppletTime" + ] + [ + "com.system76.CosmicAppletInputSources" + "com.system76.CosmicAppletStatusArea" "com.system76.CosmicAppletTiling" "com.system76.CosmicAppletAudio" "com.system76.CosmicAppletNetwork" + "com.system76.CosmicAppletBattery" "com.system76.CosmicAppletNotifications" - "com.system76.CosmicAppletStatusArea" + "com.system76.CosmicAppletBluetooth" "com.system76.CosmicAppletPower" - ]; - }; - options = { - size = "XS"; - border_radius = 0; - }; - }; - }; - comp.settings = { - autotile = true; - active_hint = true; - focus_follows_cursor = true; - focus_follows_cursor_delay = 0; - cursor_follows_focus = true; - descale_xwayland = true; - workspaces = { - workspace_layout = "Horizontal"; - }; - }; + ] + ]); + size = mkRON "enum" "XS"; + } + ]; + }; + } diff --git a/home/modules/terminal.nix b/home/modules/terminal.nix index 903e1c2..e12e37a 100644 --- a/home/modules/terminal.nix +++ b/home/modules/terminal.nix @@ -8,15 +8,6 @@ }; config = { - programs.alacritty = { - enable = true; - settings = { - window = { - dynamic_title = true; - }; - }; - }; - programs.foot = { enable = true; }; diff --git a/nixos/programs/cosmic.nix b/nixos/programs/cosmic.nix index 6d3749e..21f0e54 100644 --- a/nixos/programs/cosmic.nix +++ b/nixos/programs/cosmic.nix @@ -3,18 +3,6 @@ config, ... }: { - # imports = [ - # inputs.nixos-cosmic.nixosModules.default - # ]; - # nix.settings = { - # substituters = ["https://cosmic.cachix.org/"]; - # trusted-public-keys = ["cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE="]; - # }; services.desktopManager.cosmic.enable = true; services.displayManager.cosmic-greeter.enable = true; - # services.system76-scheduler.enable = true; - # home-manager.users.${config.user}.imports = [ - # (inputs.hm-cosmic.homeManagerModules.cosmic) - # ../../home/desktop/cosmic/. - # ]; } From b6a4db245017f76c8e0667fcaac4bbb98a3721b6 Mon Sep 17 00:00:00 2001 From: tristan Date: Sat, 21 Jun 2025 15:04:27 +0100 Subject: [PATCH 4/5] zenix: cosmic autotile, mouse accel --- home/desktop/cosmic/default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/home/desktop/cosmic/default.nix b/home/desktop/cosmic/default.nix index 04c1672..7d4bd00 100644 --- a/home/desktop/cosmic/default.nix +++ b/home/desktop/cosmic/default.nix @@ -31,6 +31,15 @@ in { } ]; + compositor = { + autotile = true; + focus_follows_cursor = true; + input_default = mkRON "optional" { + profile = (mkRON "optional" (mkRON "enum" "Flat")); + speed = 0.0; + }; + }; + wallpapers = [ { filter_by_theme = true; From eb3094369e1a2bb437ffb6fe19949ee945286382 Mon Sep 17 00:00:00 2001 From: Tristan Date: Sun, 22 Jun 2025 16:36:33 +0100 Subject: [PATCH 5/5] alpine: fix node exporter dashboard --- nixos/services/grafana.nix | 6 ++++-- nixos/services/prometheus.nix | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/nixos/services/grafana.nix b/nixos/services/grafana.nix index 353bbc8..9bfb549 100644 --- a/nixos/services/grafana.nix +++ b/nixos/services/grafana.nix @@ -5,9 +5,9 @@ name = "dashboards"; paths = map mkDashboard dashboards; }; - mkDashboard = {name, url, sha256}: pkgs.writeTextFile { + mkDashboard = {name, url, sha256, patch ? lib.id}: pkgs.writeTextFile { inherit name; - text = builtins.readFile ( builtins.fetchurl {inherit url sha256;} ); + text = patch (builtins.readFile ( builtins.fetchurl {inherit url sha256;} )); destination = "/dash/${name}.json"; }; in { @@ -42,6 +42,8 @@ in { name = "node-exporter"; url = "https://grafana.com/api/dashboards/1860/revisions/37/download"; sha256 = "sha256:0qza4j8lywrj08bqbww52dgh2p2b9rkhq5p313g72i57lrlkacfl"; + # https://github.com/rfmoz/grafana-dashboards/issues/169 + patch = builtins.replaceStrings ["$__rate_interval"] ["$__range"]; } { name = "synapse"; diff --git a/nixos/services/prometheus.nix b/nixos/services/prometheus.nix index 9e18f22..8581e70 100644 --- a/nixos/services/prometheus.nix +++ b/nixos/services/prometheus.nix @@ -2,8 +2,8 @@ inherit (config.services) prometheus; nodes = [ "alpine" - "100.106.49.128" - "zenix" + "100.106.49.128" # laptop + "100.65.29.110" # gaming pc ]; addPort = ip: "${ip}:${toString prometheus.exporters.node.port}"; in {