diff --git a/flake.nix b/flake.nix index c7aaca4..83b2b68 100644 --- a/flake.nix +++ b/flake.nix @@ -52,7 +52,43 @@ ]; }; - personal-laptop = nixpkgs.lib.nixosSystem { + personal-pc = nixpkgs.lib.nixosSystem rec { + system = "x86_64-linux"; + modules = [ + { + networking.hostName = "kp2pml30-personal-pc"; + networking.hostId = "e31a5cc2"; + + time.timeZone = "Asia/Yerevan"; + } + + ./nix/hardware/mini.nix + + ./nix/common.nix + + ./nix/personal + + { + kp2pml30 = { + xserver = true; + vscode = true; + kitty = true; + opera = true; + steam = true; + + boot.efiGrub = true; + + hardware.wireless = true; + hardware.audio = true; + + messengers.personal = true; + messengers.work = true; + }; + } + ]; + specialArgs = additionalArgs // { inherit system; }; + }; + personal-laptop = nixpkgs.lib.nixosSystem rec { system = "x86_64-linux"; modules = [ { @@ -85,7 +121,7 @@ }; } ]; - specialArgs = additionalArgs; + specialArgs = additionalArgs // { inherit system; }; }; personal-wsl = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; @@ -103,9 +139,3 @@ }; }; } - -# example -# + nix --extra-experimental-features 'nix-command flakes' build --out-link /tmp/nixos-rebuild.ydOEVb/nixos-rebuild '.#nixosConfigurations."wsl-amd64".config.system.build.nixos-rebuild' --show-trace -# ++ readlink -e /tmp/nixos-rebuild.ydOEVb/nixos-rebuild -# + p=/nix/store/rd18dwsifrcyghim695q18nhvyfykxxg-nixos-rebuild -# exec /nix/store/rd18dwsifrcyghim695q18nhvyfykxxg-nixos-rebuild/bin/nixos-rebuild switch --flake .#wsl-amd64 diff --git a/home/.config/awesome/rc.lua b/home/.config/awesome/rc.lua index 424e30d..31bb3aa 100644 --- a/home/.config/awesome/rc.lua +++ b/home/.config/awesome/rc.lua @@ -174,13 +174,41 @@ end -- Re-set wallpaper when a screen's geometry changes (e.g. different resolution) screen.connect_signal("property::geometry", set_wallpaper) +local all_tags = {} + +for i = 1,9 do + all_tags[i - 1] = awful.tag.add(tostring(i), { + screen = awful.screen.primary, + layout = awful.layout.layouts[1], + } + ) +end + +local function screen_delta(delta) + local cur_screen = awful.screen.focused() + local tag = cur_screen.selected_tag + + local all_screens = {} + local i = 0 + local idx = 0 + + for s in screen do + all_screens[i] = s + if s == cur_screen then + idx = i + end + i = i + 1 + end + + local next_screen = all_screens[(idx + delta + i) % i] + + tag.screen = next_screen +end + awful.screen.connect_for_each_screen(function(s) -- Wallpaper set_wallpaper(s) - -- Each screen has its own tag table. - awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1]) - -- Create a promptbox for each screen s.mypromptbox = awful.widget.prompt() -- Create an imagebox widget which will contain an icon indicating which layout we're using. @@ -348,6 +376,16 @@ globalkeys = gears.table.join( awful.key({}, "XF86MonBrightnessDown", function() my_brightness:down() end), awful.key({}, "XF86MonBrightnessUp", function() my_brightness:up() end), + -- switch screen + awful.key({ modkey }, "[", function () awful.screen.focus_relative(-1) end), + awful.key({ modkey }, "]", function () awful.screen.focus_relative(1) end), + awful.key({ modkey, "Shift" }, "[", function () + screen_delta(-1) + end), + awful.key({ modkey, "Shift" }, "]", function () + screen_delta(1) + end), + -- screenshot awful.key({}, "Print", function () awful.spawn.with_shell("xfce4-screenshooter -r --save /dev/stdout | xclip -i -selection clipboard -t image/png") end) ) @@ -403,46 +441,28 @@ for i = 1, 9 do globalkeys = gears.table.join(globalkeys, -- View tag only. awful.key({ modkey }, "#" .. i + 9, - function () - local screen = awful.screen.focused() - local tag = screen.tags[i] + function () + -- local screen = awful.screen.focused() + -- local tag = screen.tags[i] + local tag = all_tags[i - 1] if tag then - tag:view_only() + tag:view_only() + awful.screen.focus(tag.screen) end - end, - {description = "view tag #"..i, group = "tag"}), - -- Toggle tag display. - awful.key({ modkey, "Control" }, "#" .. i + 9, - function () - local screen = awful.screen.focused() - local tag = screen.tags[i] - if tag then - awful.tag.viewtoggle(tag) - end - end, - {description = "toggle tag #" .. i, group = "tag"}), + end, + {description = "view tag #"..i, group = "tag"}), -- Move client to tag. awful.key({ modkey, "Shift" }, "#" .. i + 9, - function () - if client.focus then - local tag = client.focus.screen.tags[i] - if tag then - client.focus:move_to_tag(tag) - end - end - end, - {description = "move focused client to tag #"..i, group = "tag"}), - -- Toggle tag on focused client. - awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9, - function () - if client.focus then - local tag = client.focus.screen.tags[i] - if tag then - client.focus:toggle_tag(tag) - end - end - end, - {description = "toggle focused client on tag #" .. i, group = "tag"}) + function () + if client.focus then + --local tag = client.focus.screen.tags[i] + local tag = all_tags[i - 1] + if tag then + client.focus:move_to_tag(tag) + end + end + end, + {description = "move focused client to tag #"..i, group = "tag"}) ) end diff --git a/nix/hardware/mini.nix b/nix/hardware/mini.nix new file mode 100644 index 0000000..02c1d0c --- /dev/null +++ b/nix/hardware/mini.nix @@ -0,0 +1,67 @@ + +{ pkgs +, inputs +, lib +, config +, ... +}: +{ + imports = [ ./common.nix ]; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/1ec7bbd6-cb83-427a-a901-d5fb7a4ef3ba"; + fsType = "ext4"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/B19C-E7B1"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + fileSystems."/mnt/d" = { + device = "/dev/sda1"; + fsType = "exfat"; + options = [ + "users" + "exec" + "nofail" + ]; + }; + + swapDevices = [ { device = "/dev/disk/by-uuid/c68daa9f-f165-4e23-8710-2aab0ad8d282"; } ]; + + boot.kernelModules = [ "kvm-amd" ]; + + environment.systemPackages = with pkgs; [ + exfat + ]; + + hardware.cpu.amd.updateMicrocode = true; + + programs.nix-ld.enable = true; + + hardware = { + graphics = { + enable = true; + enable32Bit = true; + }; + + amdgpu.amdvlk = { + enable = true; + support32Bit.enable = true; + }; + + opengl.extraPackages = with pkgs; [ + amdvlk + ]; + + opengl.extraPackages32 = with pkgs; [ + driversi686Linux.amdvlk + ]; + }; + + networking = { + useDHCP = lib.mkDefault true; + }; +} diff --git a/nix/personal/default.nix b/nix/personal/default.nix index 56ea9db..2393644 100644 --- a/nix/personal/default.nix +++ b/nix/personal/default.nix @@ -73,6 +73,7 @@ in { "nvidia-persistenced" "opera" "discord-ptb" + "slack" ]; }; } diff --git a/nix/personal/graphical/messengers-work.nix b/nix/personal/graphical/messengers-work.nix index f17b4b2..1ee55fe 100644 --- a/nix/personal/graphical/messengers-work.nix +++ b/nix/personal/graphical/messengers-work.nix @@ -6,5 +6,8 @@ }: let cfg = config.kp2pml30; -in lib.mkIf cfg.messengers.personal { +in lib.mkIf cfg.messengers.work { + users.users.${cfg.username}.packages = with pkgs; [ + slack + ]; } diff --git a/nix/personal/graphical/messengers.nix b/nix/personal/graphical/messengers.nix index baabaf0..9b91cd1 100644 --- a/nix/personal/graphical/messengers.nix +++ b/nix/personal/graphical/messengers.nix @@ -2,14 +2,22 @@ , lib , rootPath , config +, system , ... }: let cfg = config.kp2pml30; + signalSuffix = if system == "x86_64-linux" then "amd64" else "arm64"; in lib.mkIf cfg.messengers.personal { users.users.${cfg.username}.packages = with pkgs; [ discord-ptb telegram-desktop - signal-desktop + (pkgs.callPackage "${toString pkgs.path}/pkgs/by-name/si/signal-desktop/generic.nix" {} rec { + pname = "signal-desktop"; + dir = "Signal"; + version = "7.46.0"; + url = "https://updates.signal.org/desktop/apt/pool/s/signal-desktop/signal-desktop_${version}_${signalSuffix}.deb"; + hash = "sha256-HbmyivfhvZfXdtcL/Cjzl4v0Ck/fJCD517iTjIeidgc="; + }) ]; } diff --git a/nix/personal/graphical/x.nix b/nix/personal/graphical/x.nix index aaf7ff2..c06f15d 100644 --- a/nix/personal/graphical/x.nix +++ b/nix/personal/graphical/x.nix @@ -32,9 +32,13 @@ in lib.mkIf cfg.xserver { environment.systemPackages = with pkgs; [ xclip brightnessctl + arandr + libnotify xfce.xfce4-screenshooter ]; + programs.dconf.enable = true; + home-manager.users.${cfg.username} = { programs.rofi = { enable = true; diff --git a/nix/personal/home.nix b/nix/personal/home.nix index f6d894d..60f7413 100644 --- a/nix/personal/home.nix +++ b/nix/personal/home.nix @@ -16,7 +16,7 @@ in { home-manager.useUserPackages = true; home-manager.backupFileExtension = "bak"; - home-manager.users.${cfg.username} = { + home-manager.users.${cfg.username} = { lib, ... }: { home = { stateVersion = "24.05"; username = cfg.username; @@ -28,6 +28,13 @@ in { sessionVariables = { TERMINAL = "kitty"; }; + + activation = { + makeWorkDir = lib.hm.dag.entryAfter [ "writeBoundary" ] '' + run mkdir -p ~/work/personal + run mkdir -p ~/work/experiments + ''; + }; }; nix.gc = { @@ -62,6 +69,21 @@ in { }; home-manager.enable = true; + + direnv = { + enable = true; + enableBashIntegration = true; + #enableFishIntegration = lib.mkDefault true; + nix-direnv.enable = true; + }; }; + + dconf.settings = { + "org/gnome/desktop/interface" = { + color-scheme = "prefer-dark"; + }; + }; + + systemd.user.sessionVariables = config.home-manager.users.${cfg.username}.home.sessionVariables; }; }