From 55b1c4991391e0c506836a688e58970c5e885870 Mon Sep 17 00:00:00 2001 From: Gabriel <68819302+obsidianical@users.noreply.github.com> Date: Fri, 12 Aug 2022 12:14:32 +0200 Subject: [PATCH] aaaaaaaaaaaaaaaaaaaaaaaaa --- common.nix | 71 ++++++++++--------- modules/default.nix | 4 +- modules/desktop.nix | 87 ++++++++++++++++++++++++ monosodium-glutamate-g/configuration.nix | 31 ++------- monosodium-glutamate-g/flake.lock | 78 +++++++++++++++++++++ monosodium-glutamate-g/flake.nix | 11 +-- 6 files changed, 215 insertions(+), 67 deletions(-) create mode 100644 modules/desktop.nix create mode 100644 monosodium-glutamate-g/flake.lock diff --git a/common.nix b/common.nix index 513b323..836a15e 100644 --- a/common.nix +++ b/common.nix @@ -2,10 +2,13 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). -{ config, pkgs, ... }: +{ config, pkgs, lib, ... }: -let smol = import {config.allowUnfree = true;}; -in { +# let smol = import {config.allowUnfree = true;}; +with lib; +with builtins; +{ + imports = [ ./modules ]; nixpkgs.config.allowUnfree = true; nix = { @@ -17,8 +20,6 @@ in { ''; }; - imports = [ - ]; time.timeZone = "Europe/Berlin"; @@ -26,31 +27,36 @@ in { networking.networkmanager.wifi.backend = "iwd"; networking.extraHosts = "100.122.76.64 listenwithme.tailnet.ckie.dev"; - services.xserver = { - enable = true; - - desktopManager = { - xterm.enable = false; - }; - - displayManager = { - defaultSession = "none+i3"; - gdm.enable = true; - }; - - windowManager.i3 = { - enable = true; - package = pkgs.i3-gaps; - extraPackages = with pkgs; [ - gnome.gdm i3lock-fancy rofi rofimoji volumeicon feh xorg.xinput dunst - arandr lxappearance gruvbox-dark-gtk gruvbox-dark-icons-gtk - gruvterial-theme flameshot tesseract5 imagemagick xclip polybar kitty - xkeysnail gtk-engine-murrine playerctl xmacro - ]; - }; + home-manager.users.jade = { nixosConfig, pkgs, ... }: { + home.sessionVariables.TZ = nixosConfig.time.timeZone; }; + + #services.xserver = { + #enable = true; + + #desktopManager = { + #xterm.enable = false; + #}; + + #displayManager = { + #defaultSession = "none+i3"; + #gdm.enable = true; + #}; + + #windowManager.i3 = { + #enable = true; + #package = pkgs.i3-gaps; + #extraPackages = with pkgs; [ + ## gnome.gdm i3lock-fancy rofi rofimoji volumeicon feh xorg.xinput dunst + ## arandr lxappearance gruvbox-dark-gtk gruvbox-dark-icons-gtk + ## gruvterial-theme flameshot tesseract5 imagemagick xclip polybar kitty + ## xkeysnail gtk-engine-murrine playerctl xmacro + #]; + #}; + #}; programs.dconf.enable = true; - programs.qt5ct.enable = true; + + qt5.platformTheme = "qt5ct"; virtualisation.libvirtd.enable = true; @@ -61,7 +67,7 @@ in { hardware.uinput.enable = true; services.printing.enable = true; - services.tailscale.enable = true; + # services.tailscale.enable = true; security.rtkit.enable = true; services.pipewire = { @@ -94,11 +100,11 @@ in { librewolf polymc jdk8 jdk11 jdk vlc xfce.thunar xfce.tumbler xfce.thunar-archive-plugin gnome.file-roller uhk-agent spotify spotify-tray spotify-tui cool-retro-term lutris libsecret gh xorg.xhost helvum - xdg-desktop-portal-gtk nheko smol.discord obsidian jetbrains.clion + xdg-desktop-portal-gtk nheko obsidian jetbrains.clion jetbrains.webstorm jetbrains.datagrip jetbrains.idea-ultimate jetbrains.pycharm-professional nix-prefetch-scripts audacity rustup - easyeffects virt-manager manim evince direnv nix-direnv python3Full - python39Packages.pip python39Packages.setuptools python39Packages.ipykernel + easyeffects virt-manager evince direnv nix-direnv python3Full + # python39Packages.pip python39Packages.setuptools python39Packages.ipykernel fzf openrgb krita gimp inkscape blender virglrenderer ddccontrol-db glab firebird-emu ]; @@ -125,7 +131,6 @@ in { users.defaultUserShell = pkgs.zsh; services.openssh.enable = true; - services.blueman.enable = true; services.gnome.gnome-keyring.enable = true; programs.seahorse.enable = true; diff --git a/modules/default.nix b/modules/default.nix index fca5958..9de6814 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,6 +1,4 @@ { ... }: - { - imports = [ - ]; + imports = [ ./desktop.nix ]; } diff --git a/modules/desktop.nix b/modules/desktop.nix new file mode 100644 index 0000000..f006d03 --- /dev/null +++ b/modules/desktop.nix @@ -0,0 +1,87 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.jade.desktop; + window-screenshot = pkgs.writeShellScriptBin "window-screenshot.sh" '' + unset x y w h + eval $(xwininfo -id $(xdotool getactivewindow) | + sed -n -e "s/^ \+Absolute upper-left X: \+\([0-9]\+\).*/x=\1/p" \ + -e "s/^ \+Absolute upper-left Y: \+\([0-9]\+\).*/y=\1/p" \ + -e "s/^ \+Width: \+\([0-9]\+\).*/w=\1/p" \ + -e "s/^ \+Height: \+\([0-9]\+\).*/h=\1/p" ) + echo -n "''$x ''$y ''$w ''$h" + flameshot gui --region "''${w}x''${h}+''${x}+''${y}" -c -p ~/Pictures/screenshots/ + ''; +in with lib; { + options.jade.desktop = { + enable = mkEnableOption "Enable the i3 setup"; + }; + config = mkIf cfg.enable { + home-manager.users.jade = { pkgs, ... }: { + home.packages = with pkgs; [ + gnome.gdm i3lock-fancy rofi rofimoji volumeicon feh xorg.xinput dunst + arandr lxappearance gruvbox-dark-gtk gruvbox-dark-icons-gtk + gruvterial-theme flameshot tesseract5 imagemagick xclip polybar kitty + xkeysnail gtk-engine-murrine playerctl xmacro + window-screenshot + ]; + xsession = { + enable = true; + windowManager.i3 = { + enable = true; + package = pkgs.i3-gaps; + config = { + terminal = "kitty"; + modifier = "Mod4"; + gaps = { + inner = 15; + outer = 0; + smartGaps = true; + }; + modes = { + resize = with { + aaa = builtins.trace "foo" "bar"; + mod = builtins.trace config config.xsession.windowManager.i3.config.modifier; + }; { + "${mod}+h" = "resize shrink width 10 px or 10 ppt"; + "${mod}+j" = "resize grow height 10 px or 10 ppt"; + "${mod}+k" = "resize shrink height 10 px or 10 ppt"; + "${mod}+l" = "resize grow width 10 px or 10 ppt"; + + "Return" = "mode default"; + "Escape" = "mode default"; + "${mod}+r" = "mode default"; + }; + }; + keybindings = with { + mod = config.xsession.windowManager.i3.config.modifier; + }; { + # switch window focus + "${mod}+h" = "focus left"; + "${mod}+j" = "focus down"; + "${mod}+k" = "focus up"; + "${mod}+l" = "focus right"; + # move windows + "${mod}+Shift+h" = "move left"; + "${mod}+Shift+j" = "move down"; + "${mod}+Shift+k" = "move up"; + "${mod}+Shift+l" = "move right"; + # layout shit + "${mod}+shift+semicolon" = "split h"; + "${mod}+semicolon" = "split v"; + "${mod}+f" = "fullscreen toggle"; + "${mod}+Shift+w" = "layout tabbed"; + "${mod}+e" = "layout toggle split"; + "${mod}+Shift+space" = "floating toggle"; + # focus parents/children + "${mod}+Shift+a" = "focus parent"; + "${mod}+c" = "focus child"; + # custom script shit + "${mod}+w" = "exec window-screenshot.sh"; + }; + }; + }; + }; + }; + }; +} diff --git a/monosodium-glutamate-g/configuration.nix b/monosodium-glutamate-g/configuration.nix index 1c487bc..bd0d8b3 100644 --- a/monosodium-glutamate-g/configuration.nix +++ b/monosodium-glutamate-g/configuration.nix @@ -3,13 +3,16 @@ # and in the NixOS manual (accessible by running ‘nixos-help’). { config, pkgs, ... }: - { imports = [ ./hardware-configuration.nix ../common.nix ]; + jade = { + desktop.enable = true; + }; + # monitor control services.ddccontrol.enable = true; @@ -27,14 +30,6 @@ hardware.bluetooth.enable = true; hardware.keyboard.uhk.enable = true; - users.users.jade = { - isNormalUser = true; - extraGroups = [ "wheel" "input" "uinput" "libvirtd" ]; - packages = with pkgs; [ - ]; - }; - - # missing: menu-qalc picom-jonaburg environment.systemPackages = with pkgs; [ # TODO: clean up. @@ -44,24 +39,6 @@ "/share/nix-direnv" ]; - services.flatpak.enable = true; - xdg.portal.enable = true; - xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; - - fonts.fonts = with pkgs; [ - nerdfonts montserrat noto-fonts - ]; - - programs.mtr.enable = true; - programs.gnupg.agent = { - enable = true; - enableSSHSupport = true; - }; - - programs.zsh.enable = true; - users.defaultUserShell = pkgs.zsh; - - services.openssh.enable = true; services.blueman.enable = true; services.gnome.gnome-keyring.enable = true; diff --git a/monosodium-glutamate-g/flake.lock b/monosodium-glutamate-g/flake.lock new file mode 100644 index 0000000..504fd67 --- /dev/null +++ b/monosodium-glutamate-g/flake.lock @@ -0,0 +1,78 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": "nixpkgs", + "utils": "utils" + }, + "locked": { + "lastModified": 1659878744, + "narHash": "sha256-81a9Mx5pDMBGN4WnVhcQVkW5mXNTZOt8DZOSI8bVKpU=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "f5e9879e74e6202e2dbb3628fad2d20eac0d8be4", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1654953433, + "narHash": "sha256-TwEeh4r50NdWHFAHQSyjCk2cZxgwUfcCCAJOhPdXB28=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "90cd5459a1fd707819b9a3fb9c852beaaac3b79a", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1659327012, + "narHash": "sha256-zpdsLCH+cdx/K89QtzADNwwEzU/iJ9YT8UCVp3veLWQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a54fb7fc4ce8a2973097851eabfdb068a19d2211", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable-small", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs_2" + } + }, + "utils": { + "locked": { + "lastModified": 1653893745, + "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/monosodium-glutamate-g/flake.nix b/monosodium-glutamate-g/flake.nix index f6decfc..96079d5 100644 --- a/monosodium-glutamate-g/flake.nix +++ b/monosodium-glutamate-g/flake.nix @@ -6,10 +6,10 @@ home-manager = { url = "github:nix-community/home-manager"; inputs.nixpks.follows = "nixpkgs"; - } + }; }; - outputs = { self, nixpkgs, home-manager }: { + outputs = { self, nixpkgs, home-manager, ... }: { nixosConfigurations = { monosodium-glutamate-g = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; @@ -19,8 +19,11 @@ home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.users.jade = import ./home.nix; - } + home-manager.users.jade = { nixosConfig, pkgs, ... }: { + home.sessionVariables.TZ = nixosConfig.time.timeZone; + home.stateVersion = "${nixosConfig.system.stateVersion}"; + }; + } ]; }; };