From c2e1d5b4e48ca5166a668f9471b6c5508a8404a8 Mon Sep 17 00:00:00 2001 From: twoneis Date: Sat, 25 May 2024 01:41:30 +0200 Subject: [PATCH] disko + some stuff ported from arch --- devices/akarso/default.nix | 2 + devices/akarso/disko.nix | 60 +++++++++++++++++++++++++++++ devices/akarso/hardware-config.nix | 17 -------- flake.nix | 5 +++ modules/default.nix | 14 +------ modules/home/niri-setup/default.nix | 52 +++++++++++++++++++++++-- modules/home/niri-setup/waybar.css | 45 ++++++++++++++++++++++ modules/home/utils/default.nix | 12 +----- modules/niri/default.nix | 24 ++++++------ outputs.nix | 3 +- 10 files changed, 178 insertions(+), 56 deletions(-) create mode 100644 devices/akarso/disko.nix create mode 100644 modules/home/niri-setup/waybar.css diff --git a/devices/akarso/default.nix b/devices/akarso/default.nix index c259c24..9fab4c7 100644 --- a/devices/akarso/default.nix +++ b/devices/akarso/default.nix @@ -2,6 +2,7 @@ imports = [ ./hardware-config.nix ./options.nix + ./disko.nix ]; networking.hostName = "akarso"; @@ -12,6 +13,7 @@ systemd-boot = { enable = true; }; + efi.canTouchEfiVariables = true; }; hardware.opengl = { diff --git a/devices/akarso/disko.nix b/devices/akarso/disko.nix new file mode 100644 index 0000000..b0df28d --- /dev/null +++ b/devices/akarso/disko.nix @@ -0,0 +1,60 @@ +{ ... }: { + disko.devices = { + disk = { + vdb = { + type = "disk"; + device = "/dev/nvme0n1"; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "512M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ + "defaults" + ]; + }; + }; + luks = { + size = "100%"; + content = { + type = "luks"; + name = "crypted"; + settings = { + allowDiscards = true; + }; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; + subvolumes = { + "/root" = { + mountpoint = "/"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; + "/nix" = { + mountpoint = "/nix"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; + "/persist" = { + mountpoint = "/persist"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; + }; + swap = { + swapfile = { + size = "8G"; + }; + }; + }; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/devices/akarso/hardware-config.nix b/devices/akarso/hardware-config.nix index 82148b7..8842b65 100644 --- a/devices/akarso/hardware-config.nix +++ b/devices/akarso/hardware-config.nix @@ -8,23 +8,6 @@ extraModulePackages = [ ]; }; - fileSystems = { - "/" = { - device = "/dev/disk/by-uuid/4ecc3b27-016f-4416-a819-bd0998fc993f"; - fsType = "ext4"; - }; - "/boot" = { - device = "/dev/disk/by-uuid/0721-3632"; - fsType = "vfat"; - }; - "/ext" = { - device = "/dev/disk/by-uuid/b3faf000-8792-4fca-916a-5965c0cb8186"; - fsType = "ext4"; - }; - }; - - swapDevices = [ { device = "/dev/disk/by-uuid/b35abec3-ff20-4b3b-b953-e36f2df719cb"; } ]; - networking.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; diff --git a/flake.nix b/flake.nix index cbc14ef..bdd6463 100644 --- a/flake.nix +++ b/flake.nix @@ -4,6 +4,11 @@ url = "github:nixos/nixpkgs/nixos-unstable"; }; + disko = { + url = "github:nix-community/disko"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/modules/default.nix b/modules/default.nix index ae8c202..695829a 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -87,16 +87,6 @@ }; }; - services.xserver = { - enable = true; - excludePackages = [ pkgs.xterm ]; - displayManager.gdm.enable = true; - xkb = { - layout = "us"; - variant = ""; - }; - }; - # Needed for some features in nautilus such as auto-mounting and trash services.gvfs.enable = true; @@ -110,8 +100,8 @@ extraGroups = [ "networkmanager" "wheel" ]; }; - programs.zsh.enable = true; - users.defaultUserShell = pkgs.zsh; + programs.fish.enable = true; + users.defaultUserShell = pkgs.fish; security.pam.services.swaylock = {}; } diff --git a/modules/home/niri-setup/default.nix b/modules/home/niri-setup/default.nix index 29ac02e..7af4fa3 100644 --- a/modules/home/niri-setup/default.nix +++ b/modules/home/niri-setup/default.nix @@ -23,26 +23,72 @@ in lib.mkIf (osConfig.withNiri) { layer = "top"; position = "top"; modules-left = [ - "network" + "memory" + "cpu" ]; modules-center = [ "clock" ]; modules-right = [ + "network" "wireplumber" "battery" ]; + "cpu" = { + interval = 10; + format = "{usage}% "; + }; + "memory" = { + interval = 30; + format = "{percentage}% "; + }; + "clock" = { + format = "{:%H:%M}"; + format-alt = "{:%a, %Y-%m-%d}"; + }; + "battery" = { + states = { + good = 80; + warning = 50; + critical = 20; + }; + format = "{icon}"; + format-alt = "{capacity}%"; + format-icons = ["" "" "" "" ""]; + tooltip = false; + }; + "network" = { + format-wifi = "{icon}"; + format-alt = "{essid}"; + format-ethernet = "󰈁"; + format-disconnected = "󰤭"; + format-icons = ["󰤯" "󰤟" "󰤢" "󰤥" "󰤨"]; + tooltip = false; + }; + "wireplumber" = { + format = "{icon}"; + format-alt = "{volume}%"; + format-muted = ""; + format-icons = ["" "" ""]; + tooltip = false; + }; }; }; - # style = import ./waybar-style.nix; + style = builtins.readFile(./waybar.css); }; services.mako = { enable = true; - defaultTimeout = 5; + defaultTimeout = 5000; + maxHistory = 20; + maxVisible = 3; + font = "AlegreyaSans"; backgroundColor = theme.base.hex; borderColor = theme.muted.hex; textColor = theme.text.hex; + borderSize = 1; + borderRadius = 8; + icons = false; }; programs.swaylock = { diff --git a/modules/home/niri-setup/waybar.css b/modules/home/niri-setup/waybar.css new file mode 100644 index 0000000..02afc62 --- /dev/null +++ b/modules/home/niri-setup/waybar.css @@ -0,0 +1,45 @@ +* { + border: none; + font-family: FiraCodeNerdFont; + font-size: 13px; + color: #191724; + border-radius: 20px; +} + +window#waybar { + background: rgba(0, 0, 0, 0); +} + +/*-----module groups----*/ +.modules-right { + background-color: #c4a7e7; + margin: 2px 10px 0 0; +} +.modules-center { + background-color: #c4a7e7; + margin: 2px 0 0 0; +} +.modules-left { + margin: 2px 0 0 10px; + background-color: #c4a7e7; +} + +#clock, +#battery, +#cpu, +#memory, +#network, +#wireplumber { + padding: 0 15px; +} + +/*-----Indicators----*/ +#battery.charging { + color: #31748f; +} +#battery.warning:not(.charging) { + color: #eb6f92; +} +#battery.critical:not(.charging) { + color: #eb6f92; +} diff --git a/modules/home/utils/default.nix b/modules/home/utils/default.nix index f463e93..57d0b39 100644 --- a/modules/home/utils/default.nix +++ b/modules/home/utils/default.nix @@ -108,16 +108,8 @@ # For direnv and shell aliases the shell needs to be managed by hm programs.bash.enable = true; - programs.zsh = { + programs.fish = { enable = true; - autosuggestion.enable = true; - enableVteIntegration = true; - history.ignoreAllDups = true; - historySubstringSearch.enable = true; - oh-my-zsh = { - enable = true; - plugins = [ "git" "thefuck" ]; - theme = "bira"; - }; + plugins = with pkgs.fishPlugins; [ pure ]; }; } diff --git a/modules/niri/default.nix b/modules/niri/default.nix index b31ed62..699e42a 100644 --- a/modules/niri/default.nix +++ b/modules/niri/default.nix @@ -2,12 +2,8 @@ programs.niri.enable = true; environment.systemPackages = with pkgs; [ brightnessctl - swaybg - pamixer - xwayland - i3 - rofi ]; + home-manager.users.twoneis = { programs.niri = { settings = { @@ -36,7 +32,7 @@ }; position = { x=0; - y=1200; + y=0; }; }; @@ -48,7 +44,7 @@ refresh = 59.940; }; position = { - x=0; + x=2736; y=0; }; }; @@ -74,6 +70,11 @@ gaps = 4; }; + window-rule = { + geometry-corner-radius = 8; + clip-to-geometry = true; + }; + prefer-no-csd = true; screenshot-path = "~/Pictures/Screenshots/%Y-%m-%d-%H-%M-%S.png"; @@ -82,20 +83,17 @@ spawn-at-startup = [ { command = ["waybar"]; } - { command = ["swaybg" "-i" "${../../wallpaper/wallpaper.png}" "-m" "fill"]; } - { command = ["pamixer" "--set-volume" "0"]; } + { command = ["wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0"]; } { command = ["brightnessctl" "s" "50%"]; } - { command = ["systemctl" "--user" "restart" "spotifyd.service"]; } ]; binds = { "Mod+T".action.spawn = "alacritty"; "Mod+B".action.spawn = "firefox"; "Mod+S".action.spawn = ["fuzzel" "-I" "-T" "alacritty" "-p" ""]; - "Mod+X".action.spawn = ["sh" "-c" "Xwayland & env DISPLAY=:0 i3"]; - "XF86AudioRaiseVolume".action.spawn = ["pamixer" "-i" "5"]; - "XF86AudioLowerVolume".action.spawn = ["pamixer" "-d" "5"]; + "XF86AudioRaiseVolume".action.spawn = ["wpctl" "set-volume" "-l" "1" "@DEFAULT_AUDIO_SINK@" "5%+"]; + "XF86AudioLowerVolume".action.spawn = ["wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "5%-"]; "XF86MonBrightnessDown".action.spawn = ["brightnessctl" "-n=10%" "s" "5%-"]; "XF86MonBrightnessUp".action.spawn = ["brightnessctl" "s" "5%+"]; diff --git a/outputs.nix b/outputs.nix index 821e4d5..0801f96 100644 --- a/outputs.nix +++ b/outputs.nix @@ -1,4 +1,4 @@ -{ nixpkgs, home-manager, nixos-hardware, niri, ... }@inputs: { +{ nixpkgs, disko, home-manager, nixos-hardware, niri, ... }@inputs: { nixosConfigurations = { # AMD Ryzen 5600X # nvidia GeForce GTX 1060 (6GB) @@ -26,6 +26,7 @@ ./devices/akarso ./modules ./options.nix + disko.nixosModules.disko nixos-hardware.nixosModules.microsoft-surface-pro-intel niri.nixosModules.niri home-manager.nixosModules.home-manager