diff --git a/configuration.nix b/configuration.nix index eb111ee..b08d472 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,21 +1,15 @@ { pkgs, ... }: -{ system.userActivationScripts = { - stdio = { - text = '' - rm -f ~/Android/Sdk/platform-tools/adb - ln -s /run/current-system/sw/bin/adb ~/Android/Sdk/platform-tools/adb - ''; - deps = [ ]; - }; - }; - +{ # Importing necessary setup for Steam & Printing & Flutter. imports = [ ./builds/steam/default.nix ./home/extras/printer.nix ./builds/flutter.nix ]; # Use the systemd-boot EFI boot loader. boot.loader = { - systemd-boot.enable = true; + systemd-boot = { + enable = true; + configurationLimit = 120; + }; efi.canTouchEfiVariables = true; }; @@ -25,7 +19,6 @@ i18n.defaultLocale = "en_US.UTF-8"; console = { font = "Lat2-Terminus16"; - # Use xkb.options in tty. useXkbConfig = true; }; # Enable Asterisks for Password prompt. @@ -36,6 +29,9 @@ ''; }; + # Activate Flakes. + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + # Configuration of the Garbage collect. nix.gc = { automatic = true; # Enable the automatic garbage collector @@ -43,37 +39,30 @@ options = "--delete-older-than 7d"; }; - # Activate Flakes. - nix.settings.experimental-features = [ "nix-command" "flakes" ]; services = { - # Set XServer Options. displayManager = { sddm = { enable = true; theme = "catppuccin-mocha"; + wayland.enable = true; }; - defaultSession = "none+xmonad"; + #autoLogin = { + # enable = true; + # user = "elias"; + #}; + defaultSession = "river"; }; libinput.enable = true; # Enable touchpad. - xserver = { - enable = true; - windowManager.xmonad = { - enable = true; - flake = { - enable = true; - compiler = "ghc982"; - }; - enableContribAndExtras = true; - }; - xkb = { - layout = "de"; - options = "caps:deadgraveacute"; - }; - }; - # Enable CUPS to print. printing.enable = true; }; + programs = { + river.enable = true; + ssh.startAgent = true; + zsh.enable = true; + }; + + # Define a user account. users = { mutableUsers = false; @@ -90,24 +79,6 @@ # Setting the Basic Packages. environment.systemPackages = with pkgs; [ (libsForQt5.callPackage ./home/themes/catppuccin-sddm.nix { }) - # Betterlockscreen - xss-lock - xorg.xset - # flutter - android-studio - clang - cmake - flutter - ninja - pkg-config - curl - unzip - xz - sqlite - sqlite-utils - zip - mesa - dart git wget @@ -119,8 +90,6 @@ acpilight # For setting Backlight. dbus - # pulseaudioFull - # pulseaudio-ctl libnotify @@ -150,12 +119,6 @@ virtualisation.virtualbox.host.enableKvm = true; virtualisation.virtualbox.host.addNetworkInterface = false; - programs = { - # Flutter - adb.enable = true; - ssh.startAgent = true; - zsh.enable = true; - }; # Betterlockscreen security.pam.services.i3lock.enable = true; diff --git a/flake.lock b/flake.lock index ab08123..8d01b62 100644 --- a/flake.lock +++ b/flake.lock @@ -95,42 +95,6 @@ "type": "github" } }, - "flake-utils": { - "inputs": { - "systems": "systems_2" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_2": { - "inputs": { - "systems": "systems_3" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "git-hooks": { "inputs": { "flake-compat": "flake-compat_2", @@ -154,44 +118,6 @@ "type": "github" } }, - "git-ignore-nix": { - "inputs": { - "nixpkgs": "nixpkgs_3" - }, - "locked": { - "lastModified": 1709087332, - "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "ref": "master", - "repo": "gitignore.nix", - "type": "github" - } - }, - "git-ignore-nix_2": { - "inputs": { - "nixpkgs": "nixpkgs_4" - }, - "locked": { - "lastModified": 1709087332, - "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "ref": "master", - "repo": "gitignore.nix", - "type": "github" - } - }, "gitignore": { "inputs": { "nixpkgs": [ @@ -330,48 +256,6 @@ "type": "github" } }, - "nixpkgs_3": { - "locked": { - "lastModified": 1666603677, - "narHash": "sha256-apAEIj+z1iwMaMJ4tB21r/VTetfGDLDzuhXRHJknIAU=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "074da18a72269cc5a6cf444dce42daea5649b2fe", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "nixpkgs_4": { - "locked": { - "lastModified": 1666603677, - "narHash": "sha256-apAEIj+z1iwMaMJ4tB21r/VTetfGDLDzuhXRHJknIAU=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "074da18a72269cc5a6cf444dce42daea5649b2fe", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "nixpkgs_5": { - "locked": { - "lastModified": 1746206129, - "narHash": "sha256-JA4DynBKhY7t4DdJZTuomRLAiXFDUgCGGwxgt+XGiik=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "9a7caecf30a0494c88b7daeeed29244cd9a52e7d", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, "nur": { "inputs": { "flake-parts": "flake-parts_3", @@ -397,75 +281,7 @@ "home-manager": "home-manager", "neovim-nightly-overlay": "neovim-nightly-overlay", "nixpkgs": "nixpkgs", - "nur": "nur", - "wpaperd": "wpaperd", - "xmonad-contrib": "xmonad-contrib" - } - }, - "rust-overlay": { - "inputs": { - "nixpkgs": [ - "wpaperd", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1729391507, - "narHash": "sha256-as0I9xieJUHf7kiK2a9znDsVZQTFWhM1pLivII43Gi0=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "784981a9feeba406de38c1c9a3decf966d853cca", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "systems": { - "locked": { - "lastModified": 1689347949, - "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", - "owner": "nix-systems", - "repo": "default-linux", - "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default-linux", - "type": "github" - } - }, - "systems_2": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "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" + "nur": "nur" } }, "treefmt-nix": { @@ -509,88 +325,6 @@ "repo": "treefmt-nix", "type": "github" } - }, - "unstable": { - "locked": { - "lastModified": 1746141548, - "narHash": "sha256-IgBWhX7A2oJmZFIrpRuMnw5RAufVnfvOgHWgIdds+hc=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "f02fddb8acef29a8b32f10a335d44828d7825b78", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "wpaperd": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ], - "rust-overlay": "rust-overlay", - "systems": "systems" - }, - "locked": { - "lastModified": 1746003389, - "narHash": "sha256-UZzEVcFPFlSp/2ppzoTEn5n+iDgUGY2ACtk/2Crxyu0=", - "owner": "danyspin97", - "repo": "wpaperd", - "rev": "f891ed0d36d3b7a51897da59c3d6e213935afc93", - "type": "github" - }, - "original": { - "owner": "danyspin97", - "repo": "wpaperd", - "type": "github" - } - }, - "xmonad": { - "inputs": { - "flake-utils": "flake-utils_2", - "git-ignore-nix": "git-ignore-nix_2", - "nixpkgs": "nixpkgs_5", - "unstable": "unstable" - }, - "locked": { - "lastModified": 1744559834, - "narHash": "sha256-4AeqylaTW3B+iIab7/JobZruTOU1AgDZ8s+wYaZKQos=", - "owner": "xmonad", - "repo": "xmonad", - "rev": "ebf265a84c6295d4fe15c4a5cf88cb08746f2145", - "type": "github" - }, - "original": { - "owner": "xmonad", - "repo": "xmonad", - "type": "github" - } - }, - "xmonad-contrib": { - "inputs": { - "flake-utils": "flake-utils", - "git-ignore-nix": "git-ignore-nix", - "nixpkgs": [ - "nixpkgs" - ], - "xmonad": "xmonad" - }, - "locked": { - "lastModified": 1744559846, - "narHash": "sha256-Cq2N2Gokz+TLz+D1TFNtc34z5OxBAuY9qmz2m6hhKpg=", - "owner": "xmonad", - "repo": "xmonad-contrib", - "rev": "4b866210512b90bc532b4cd46dc5171542d0fac8", - "type": "github" - }, - "original": { - "owner": "xmonad", - "repo": "xmonad-contrib", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 5c83cba..785b238 100644 --- a/flake.nix +++ b/flake.nix @@ -3,31 +3,21 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; - xmonad-contrib = { - url = "github:xmonad/xmonad-contrib"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - nur = { url = "github:nix-community/NUR"; }; neovim-nightly-overlay = { url = "github:nix-community/neovim-nightly-overlay"; inputs.nixpkgs.follows = "nixpkgs"; }; - - wpaperd = { - url = "github:danyspin97/wpaperd"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - }; - outputs = { nixpkgs, xmonad-contrib, home-manager, nur, ... }@inputs: { + outputs = { nixpkgs, home-manager, nur, ... }@inputs: { formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style; nixosConfigurations = { @@ -40,20 +30,16 @@ home-manager.nixosModules.home-manager { home-manager = { - backupFileExtension = "backup"; + useGlobalPkgs = true; useUserPackages = true; extraSpecialArgs = { inherit inputs; }; users.elias = import ./home/default-laptop.nix; }; nixpkgs.overlays = [ - inputs.neovim-nightly-overlay.overlays.default - inputs.wpaperd.overlays.default inputs.nur.overlays.default - (import overlays/minlog.nix) - (import overlays/obsidian.nix) ]; } - ] ++ xmonad-contrib.nixosModules; + ]; }; eliasDesktop = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; @@ -64,20 +50,16 @@ home-manager.nixosModules.home-manager { home-manager = { - backupFileExtension = "backup"; + useGlobalPkgs = true; useUserPackages = true; extraSpecialArgs = { inherit inputs; }; users.elias = import ./home/default-desktop.nix; }; nixpkgs.overlays = [ - inputs.neovim-nightly-overlay.overlays.default - inputs.wpaperd.overlays.default inputs.nur.overlays.default - (import overlays/minlog.nix) - (import overlays/obsidian.nix) ]; } - ] ++ xmonad-contrib.nixosModules; + ]; }; }; }; diff --git a/home/programs/default.nix b/home/programs/default.nix index bbc8ee9..4836ec0 100644 --- a/home/programs/default.nix +++ b/home/programs/default.nix @@ -1,5 +1,6 @@ { imports = [ + ./river ./alacritty ./anki ./betterlockscreen diff --git a/home/programs/eww/src/scripts/logout.sh b/home/programs/eww/src/scripts/logout.sh index 8e443d2..00754e9 100755 --- a/home/programs/eww/src/scripts/logout.sh +++ b/home/programs/eww/src/scripts/logout.sh @@ -1 +1 @@ -pkill -KILL xmonad +pkill river diff --git a/home/programs/eww/src/scripts/powermenu.sh b/home/programs/eww/src/scripts/powermenu.sh index 23b552f..acb157b 100755 --- a/home/programs/eww/src/scripts/powermenu.sh +++ b/home/programs/eww/src/scripts/powermenu.sh @@ -6,5 +6,5 @@ echo "Power button pressed" >>/tmp/acpi_log.txt if eww active-windows | grep -q "$WINDOW_NAME"; then eww close "$WINDOW_NAME" else - eww open "$WINDOW_NAME" + eww open "$WINDOW_NAME" --screen "$(wlr-randr | grep -oP '^\S+' | head -n 1)" fi diff --git a/home/programs/river/default.nix b/home/programs/river/default.nix new file mode 100644 index 0000000..4293110 --- /dev/null +++ b/home/programs/river/default.nix @@ -0,0 +1,137 @@ +{ pkgs, lib, ... }: + +{ + + home.packages = with pkgs; [ + wlr-randr + yad slurp + grim + wl-clipboard + rivercarro + ]; + xdg.configFile."helperscripts" = { + recursive = true; + source = ./src; + }; + + wayland.windowManager.river = let + all_tags = "$(((1 << 32) - 1))"; + scratch_tag = "$((1 << 20 ))"; + all_but_scratch_tag = "$(( ((1 << 32) - 1) ^ ${scratch_tag} ))"; + tags = i: "$((1 << (${i} - 1)))"; + + genTagMappings = key: command: + lib.attrsets.mergeAttrsList + (map (i: { "${key (toString i)}" = "${command (toString i)}"; }) + (lib.lists.range 1 9)); + in { + enable = true; + extraSessionVariables = { + MOZ_ENABLE_WAYLAND = "1"; + GDK_BACKEND = "wayland"; + }; + systemd = { enable = true; }; + xwayland.enable = true; + extraConfig = '' + rivertile -view-padding 0 -outer-padding 25 & + ''; + settings = { + spawn = [ + "nextcloud --background" + "~/.config/helperscriptsstartEww.sh" + "trayer --edge top --align left --widthtype request --height 25 --transparent true --alpha 0 --expand true --SetDockType true --SetPartialStrut true" + ]; + spawn-tagmask = "${all_but_scratch_tag}"; + keyboard-layout = "de"; + #keyboard-layout = "-options caps:swapescape 'us(colemak_dh)'"; + default-layout = "rivertile"; + rule-add = { + "-app-id" = { + "'bar'" = "csd"; + "'float*'" = { "-title" = { "'foo'" = "float"; }; }; + }; + }; + map-pointer = { + normal = { + "Super BTN_LEFT" = "move-view"; + "Super BTN_RIGHT" = "resize-view"; + "Super BTN_MIDDLE" = "toggle-float"; + }; + }; + map = { + normal = { + "Super+Shift Return" = "spawn alacritty"; + # Messages + "Control+Super W" = "spawn 'yad --text=\"Hello from Wayland!\" --button=OK'"; + # System + "Super P" = "spawn 'rofi -show drun'"; + "Super+Shift C" = "close"; + # Screenshots + "None Print" = "spawn 'grim ~/Pictures/screenshot_$(date +%F_%H-%M-%S).png; yad --text=\"Screenshot - Whole Screen to File (/home/$USER/Pictures/screenshot-$(date -u +%Y-%m-%d-%H:%M:%S))\"'"; # Whole Screen to File + "Super Print" = "spawn 'grim -g \"$(slurp)\" ~/Pictures/screenshot_$(date +%F_%H-%M-%S).png; yad --text=\"Screenshot - Selection to File (/home/$USER/Pictures/screenshot-$(date -u +%Y-%m-%d-%H:%M:%S))\"'"; # Selection to File + "Shift Print" = "spawn 'grim -g \"$(riverctl windows --focused | awk '{print $3,$4,$5,$6}')\" ~/Pictures/active_window_$(date +%F_%H-%M-%S).png; yad --text=\"Screenshot - Active Window to File (/home/$USER/Pictures/screenshot-$(date -u +%Y-%m-%d-%H:%M:%S))\"'"; # Active Window to File + "Control Print" = "spawn 'grim -g \"$(slurp)\" - | wl-copy --type image/png; yad --text=\"Screenshot - Whole Screen to Clipboard\"'"; # Whole Screen to Clipboard + "Control+Super Print" = "spawn 'grim -g \"$(slurp)\" - | wl-copy --type image/png; yad --text=\"Screenshot - Selection to Clipboard\"'"; # Selection to Clipboard + "Control+Shift Print" = "spawn 'grim -g \"$(riverctl windows --focused | awk '{print $3,$4,$5,$6}')\" - | wl-copy --type image/png; yad --text=\"Screenshot - Active Window to Clipboard\"'"; # Active Window to Clipboard + # Window Control + "Super J" = "focus-view next"; + "Super K" = "focus-view previous"; + "Super+Shift J" = "swap next"; + "Super+Shift K" = "swap previous"; + "Super Period" = "focus-output next"; + "Super Comma" = "focus-output previous"; + "Super+Shift Period" = "send-to-output next"; + "Super+Shift Comma" = "send-to-output previous"; + "Super H" = ''send-layout-cmd rivertile "main-ratio -0.05"''; + "Super L" = ''send-layout-cmd rivertile "main-ratio +0.05"''; + "Super+Shift H" = ''send-layout-cmd rivertile "main-count +1"''; + "Super+Shift L" = ''send-layout-cmd rivertile "main-count -1"''; + "Super+Alt H" = "move left 100"; + "Super+Alt J" = "move down 100"; + "Super+Alt K" = "move up 100"; + "Super+Alt L" = "move right 100"; + "Super+Alt+Control H" = "snap left"; + "Super+Alt+Control J" = "snap down"; + "Super+Alt+Control K" = "snap up"; + "Super+Alt+Control L" = "snap right"; + "Super+Alt+Shift H" = "resize horizontal -100"; + "Super+Alt+Shift J" = "resize vertical 100"; + "Super+Alt+Shift K" = "resize vertical -100"; + "Super+Alt+Shift L" = "resize horizontal 100"; + + "Super+Shift P" = "set-view-tags ${scratch_tag}"; + + "Super 0" = "set-focused-tags ${all_tags}"; + "Super+Shift 0" = "set-view-tags ${all_tags}"; + "Super Space" = "toggle-float"; + "Super F" = "toggle-fullscreen"; + "Super Up" = ''send-layout-cmd rivertile "main-location top"''; + "Super Right" = ''send-layout-cmd rivertile "main-location right"''; + "Super Down" = ''send-layout-cmd rivertile "main-location bottom"''; + "Super Left" = ''send-layout-cmd rivertile "main-location left"''; + # Audio + "None XF86AudioRaiseVolume" = "spawn 'pactl set-sink-volume @DEFAULT_SINK@ +10%'"; + "None XF86AudioLowerVolume" = "spawn 'pactl set-sink-volume @DEFAULT_SINK@ -10%'"; + "None XF86AudioMute" = "spawn 'pactl set-sink-mute @DEFAULT_SINK@ toggle'"; + "None XF86AudioMicMute" = "spawn 'pactl set-source-mute @DEFAULT_SOURCE@ toggle'"; + # Brightness + "None XF86MonBrightnessUp" = "spawn 'xbacklight -inc 10'"; + "None XF86MonBrightnessDown" = "spawn 'xbacklight -dec 10'"; + # Powerbutton + "None XF86PowerOff" = "spawn '/home/$USER/.config/eww/scripts/powermenu.sh'"; + # Program + "Super C" = "spawn 'firefox'"; + "Super Y" = "spawn 'signal-desktop'"; + "Super X" = "spawn 'telegram-desktop'"; + "Super V" = "spawn 'thunderbird'"; + } // genTagMappings (i: "Super ${i}") (i: "set-focused-tags ${tags i}") + // genTagMappings (i: "Super+Shift ${i}") + (i: "set-view-tags ${tags i}") + // genTagMappings (i: "Super+Control ${i}") + (i: "toggle-focused-tags ${tags i}") + // genTagMappings (i: "Super+Shift+Control ${i}") + (i: "toggle-view-tags ${tags i}"); + }; + }; + }; +} diff --git a/home/programs/river/src/startEww.sh b/home/programs/river/src/startEww.sh new file mode 100755 index 0000000..ee3c99a --- /dev/null +++ b/home/programs/river/src/startEww.sh @@ -0,0 +1,12 @@ +hostname=$(hostname) + +if [[ "$hostname" == "eliasLaptop" ]]; then + eww open bar --screen eDP-1 + # You can put other commands specific to this hostname +elif [[ "$hostname" == "eliasDesktop" ]]; then + echo "This is another PC!" + # Add commands for the second PC +else + echo "This is an unknown PC." + # Add commands for unknown hosts +fi diff --git a/home/themes/catppuccin-sddm.nix b/home/themes/catppuccin-sddm.nix index 0fb6b8c..52a3db4 100644 --- a/home/themes/catppuccin-sddm.nix +++ b/home/themes/catppuccin-sddm.nix @@ -29,4 +29,3 @@ stdenv.mkDerivation { platforms = lib.platforms.linux; }; } -