From 95bb8156a6a01d2c63b3e7a515cb2bb938513204 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 30 May 2024 21:20:39 +0100 Subject: [PATCH] hyprland monitors --- flake.lock | 50 +++++++------- flake.nix | 9 +++ .../optional/desktop/hyprland/default.nix | 68 +++++++++---------- home/common/optional/syncthing.nix | 16 ----- home/semita.nix | 39 +++++++++++ home/users/sam/default.nix | 3 - hosts/semita/default.nix | 51 ++++++++++++++ hosts/semita/hardware-configuration.nix | 24 +++++++ modules/home-manager/monitors.nix | 4 ++ scripts/bootstrap.sh | 2 +- 10 files changed, 187 insertions(+), 79 deletions(-) create mode 100644 home/semita.nix create mode 100644 hosts/semita/default.nix create mode 100644 hosts/semita/hardware-configuration.nix diff --git a/flake.lock b/flake.lock index d3c1577..0aa38c0 100644 --- a/flake.lock +++ b/flake.lock @@ -29,11 +29,11 @@ ] }, "locked": { - "lastModified": 1716773194, - "narHash": "sha256-rskkGmWlvYFb+CXedBiL8eWEuED0Es0XR4CkJ11RQKY=", + "lastModified": 1717032306, + "narHash": "sha256-s3Sis+M1qTSVIehHrEKBzHBpqprIFJli5V6WojkJnYE=", "owner": "nix-community", "repo": "disko", - "rev": "10986091e47fb1180620b78438512b294b7e8f67", + "rev": "8ea5bcccc03111bdedaeaae9380dfab61e9deb33", "type": "github" }, "original": { @@ -182,11 +182,11 @@ ] }, "locked": { - "lastModified": 1716908526, - "narHash": "sha256-Zl6e/sEVDh07K47XxDGPsXTYT4nI6llUDbQ4xMIwp7k=", + "lastModified": 1717052710, + "narHash": "sha256-LRhOxzXmOza5SymhOgnEzA8EAQp+94kkeUYWKKpLJ/U=", "owner": "nix-community", "repo": "home-manager", - "rev": "373ead20606efa9181cd15ba19a5deac7ead1492", + "rev": "29c69d9a466e41d46fd3a7a9d0591ef9c113c2ae", "type": "github" }, "original": { @@ -203,11 +203,11 @@ ] }, "locked": { - "lastModified": 1716457508, - "narHash": "sha256-ZxzffLuWRyuMrkVVq7wastNUqeO0HJL9xqfY1QsYaqo=", + "lastModified": 1717052710, + "narHash": "sha256-LRhOxzXmOza5SymhOgnEzA8EAQp+94kkeUYWKKpLJ/U=", "owner": "nix-community", "repo": "home-manager", - "rev": "850cb322046ef1a268449cf1ceda5fd24d930b05", + "rev": "29c69d9a466e41d46fd3a7a9d0591ef9c113c2ae", "type": "github" }, "original": { @@ -239,11 +239,11 @@ ] }, "locked": { - "lastModified": 1716511055, - "narHash": "sha256-5Fe/DGgvMhPEMl9VdVxv3zvwRcwNDmW5eRJ0gk72w7U=", + "lastModified": 1716993688, + "narHash": "sha256-vo5k2wQekfeoq/2aleQkBN41dQiQHNTniZeVONWiWLs=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "0bea8222f6e83247dd13b055d83e64bce02ee532", + "rev": "c0d5b8c54d6828516c97f6be9f2d00c63a363df4", "type": "github" }, "original": { @@ -255,11 +255,11 @@ "nix-secrets": { "flake": false, "locked": { - "lastModified": 1716917146, - "narHash": "sha256-YopICr9b8EqsysVABoJAIDBPtk5PiJjqz+eRWjYHLP0=", + "lastModified": 1717081517, + "narHash": "sha256-Pvennf20SmdaJ7mZK4I3jjQX8jQy9Hd/KeE64e2uqHU=", "ref": "refs/heads/master", - "rev": "1669319dcc94896a4591dc1118f90818f2591433", - "revCount": 73, + "rev": "c9a84172f898001d8e1732e7b6872be9d9352cef", + "revCount": 80, "type": "git", "url": "ssh://git@git.bitlab21.com/sam/nix-secrets.git" }, @@ -270,11 +270,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1716715802, - "narHash": "sha256-usk0vE7VlxPX8jOavrtpOqphdfqEQpf9lgedlY/r66c=", + "lastModified": 1716977081, + "narHash": "sha256-pFe5jLeIPlKEln5n2h998d7cpzXFdbrBMRe3suz4K1o=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e2dd4e18cc1c7314e24154331bae07df76eb582f", + "rev": "ac82a513e55582291805d6f09d35b6d8b60637a1", "type": "github" }, "original": { @@ -300,11 +300,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1716509168, - "narHash": "sha256-4zSIhSRRIoEBwjbPm3YiGtbd8HDWzFxJjw5DYSDy1n8=", + "lastModified": 1716948383, + "narHash": "sha256-SzDKxseEcHR5KzPXLwsemyTR/kaM9whxeiJohbL04rs=", "owner": "nixos", "repo": "nixpkgs", - "rev": "bfb7a882678e518398ce9a31a881538679f6f092", + "rev": "ad57eef4ef0659193044870c731987a6df5cf56b", "type": "github" }, "original": { @@ -329,11 +329,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1716833970, - "narHash": "sha256-K3tVrTna4EN86GW9IeOQJkbj57zT2xNGJg1hh26xy5c=", + "lastModified": 1717081007, + "narHash": "sha256-GNr1i6itjFKGXSco3lcdKe8GxEwrmSYFDUpZyXsXWp4=", "owner": "nix-community", "repo": "nixvim", - "rev": "a2afa5634495ee739e682e5ccb743c5c6dd90ec1", + "rev": "da9bd1f2e8fc8cd8553a76a9e22afd386c18f205", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 7d38e83..dc26e45 100644 --- a/flake.nix +++ b/flake.nix @@ -99,6 +99,15 @@ } ]; }; + semita = nixpkgs.lib.nixosSystem { + inherit specialArgs; + modules = [ + ./hosts/semita + home-manager.nixosModules.home-manager{ + home-manager.extraSpecialArgs = specialArgs; + } + ]; + }; }; # # Standalone home-manager configuration entrypoint diff --git a/home/common/optional/desktop/hyprland/default.nix b/home/common/optional/desktop/hyprland/default.nix index 44d4742..3417242 100644 --- a/home/common/optional/desktop/hyprland/default.nix +++ b/home/common/optional/desktop/hyprland/default.nix @@ -20,66 +20,66 @@ ]; }; extraConfig = let - monitor = "${toString (builtins.map (m: "monitor=${ m.name },${ toString(m.width) }x${ toString(m.height) }@60,auto,1") config.monitors)}"; + monitor = "${toString (builtins.map (m: "monitor=${ m.name },${ toString( m.width ) }x${ toString( m.height ) }@${ toString( m.refreshRate ) },${ toString( m.x ) }x${ toString( m.y ) },${ toString( m.scale ) }\n") config.monitors)}"; in '' ${monitor} $terminal = kitty $fileManager = dolphin $menu = wofi --show drun - + env = XCURSOR_SIZE,24 - + input { kb_layout = gb kb_variant = kb_model = kb_options = caps:swapescape kb_rules = - + follow_mouse = 1 - + touchpad { natural_scroll = no } - + } - + general { - + gaps_in = 5 gaps_out = 20 border_size = 2 col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg col.inactive_border = rgba(595959aa) - + layout = dwindle - + allow_tearing = false } - + decoration { - + rounding = 10 - + blur { enabled = true size = 3 passes = 1 } - + drop_shadow = yes shadow_range = 4 shadow_render_power = 3 col.shadow = rgba(1a1a1aee) } - + animations { enabled = yes - - + + bezier = myBezier, 0.05, 0.9, 0.1, 1.05 - + animation = windows, 1, 7, myBezier animation = windowsOut, 1, 7, default, popin 80% animation = border, 1, 10, default @@ -87,30 +87,30 @@ animation = fade, 1, 7, default animation = workspaces, 1, 6, default } - + dwindle { } - + master { new_is_master = true } - + gestures { workspace_swipe = off } - + misc { } - + device { name = epic-mouse-v1 sensitivity = -0.5 } - - - + + + $mainMod = SUPER - + bind = $mainMod, Q, exec, $terminal bind = $mainMod, C, killactive, bind = $mainMod, M, exit, @@ -118,12 +118,12 @@ bind = $mainMod, V, togglefloating, bind = $mainMod, R, exec, $menu bind = $mainMod, S, exec, rofi -show drun -show-icons - + bind = $mainMod, left, movefocus, l bind = $mainMod, right, movefocus, r bind = $mainMod, up, movefocus, u bind = $mainMod, down, movefocus, d - + bind = $mainMod, 1, workspace, 1 bind = $mainMod, 2, workspace, 2 bind = $mainMod, 3, workspace, 3 @@ -134,7 +134,7 @@ bind = $mainMod, 8, workspace, 8 bind = $mainMod, 9, workspace, 9 bind = $mainMod, 0, workspace, 10 - + bind = $mainMod SHIFT, 1, movetoworkspace, 1 bind = $mainMod SHIFT, 2, movetoworkspace, 2 bind = $mainMod SHIFT, 3, movetoworkspace, 3 @@ -145,16 +145,16 @@ bind = $mainMod SHIFT, 8, movetoworkspace, 8 bind = $mainMod SHIFT, 9, movetoworkspace, 9 bind = $mainMod SHIFT, 0, movetoworkspace, 10 - + bind = $mainMod, S, togglespecialworkspace, magic bind = $mainMod SHIFT, S, movetoworkspace, special:magic - + bind = $mainMod, mouse_down, workspace, e+1 bind = $mainMod, mouse_up, workspace, e-1 - + bindm = $mainMod, mouse:272, movewindow bindm = $mainMod, mouse:273, resizewindow - + exec-once=bash ~/.config/hypr/start.sh ''; }; diff --git a/home/common/optional/syncthing.nix b/home/common/optional/syncthing.nix index 948c27b..215ab69 100644 --- a/home/common/optional/syncthing.nix +++ b/home/common/optional/syncthing.nix @@ -6,22 +6,6 @@ in services = { syncthing = { enable = true; -# user = "${user}"; -# dataDir = "/home/${user}/sync"; -# configDir = "/home/${user}/.config/syncthing"; -# overrideDevices = true; # overrides any devices added or deleted through the WebUI -# overrideFolders = true; # overrides any folders added or deleted through the WebUI -# settings = { -# devices = { -# "device1" = { id = "UT6263Y-V3GJXNO-6KIGAKZ-KY6UQMD-ER6BT4R-4LPKT2P-V4PCJYZ-ROJZIQQ"; }; -# }; -# folders = { -# "sync" = { # Name of folder in Syncthing, also the folder ID -# path = "/home/${user}/sync"; # Which folder to add to Syncthing -# devices = [ "device1" ]; # Which devices to share the folder with -# }; -# }; -# }; }; }; } diff --git a/home/semita.nix b/home/semita.nix new file mode 100644 index 0000000..682d7d0 --- /dev/null +++ b/home/semita.nix @@ -0,0 +1,39 @@ +{ + pkgs, + config, + lib, + ... +}: { + imports = [ + # Import users + ./users/sam + + ./common/core + ./common/optional/sops.nix + ./common/optional/firefox.nix + + # Import optional + ./common/optional/git.nix + ./common/optional/syncthing.nix + ./common/optional/desktop/hyprland + ./common/optional/desktop/waybar.nix + + ]; +monitors = [ + { + name = "Virtual-1"; + width = 2048; + height = 1152; + refreshRate = 60; + x = 0; + primary = true; + } + { + name = "Virtual-2"; + width = 2048; + height = 1152; + refreshRate = 60; + x = 2048; + } + ]; +} diff --git a/home/users/sam/default.nix b/home/users/sam/default.nix index 5e770b5..ac76ea7 100644 --- a/home/users/sam/default.nix +++ b/home/users/sam/default.nix @@ -9,11 +9,9 @@ ] ++ (builtins.attrValues outputs.homeManagerModules); # import all homeManagerModules? home.packages = [ - pkgs.firefox pkgs.kitty pkgs.zathura pkgs.xfce.thunar - #pkgs.age ]; home.file = { @@ -51,7 +49,6 @@ home.sessionVariables = { EDITOR="nvim"; - MUSIC="$HOME/mus/music_data/"; TERMINAL="kitty"; READER="zathura"; IMAGE_VIEWER=""; diff --git a/hosts/semita/default.nix b/hosts/semita/default.nix new file mode 100644 index 0000000..5c27f35 --- /dev/null +++ b/hosts/semita/default.nix @@ -0,0 +1,51 @@ +{ inputs, config, lib, pkgs, outputs,... }: +let + # Disko setup + fsType = "btrfs"; # one of ext4 or btrfs. Use btrfs if using impermanence + dev = "/dev/vda"; # depends on target hardware + encrypted = true; # currrently only applies to btrfs + btrfsMountDevice = if encrypted then "/dev/mapper/crypted" else "/dev/root_vg/root"; +in +{ + imports = + [ + # Create users for this host + ../common/users/sam + + # Disk configuration + inputs.disko.nixosModules.disko + (import ../common/disks { device = dev; fsType = fsType; encrypted = encrypted; }) + + # Impermanence + inputs.impermanence.nixosModules.impermanence + (import ../common/disks/btrfs-impermanence.nix { btrfsMountDevice = btrfsMountDevice; lib = lib; }) + + # Import core options + ./hardware-configuration.nix + ../common/core + + # Import optional options + ../common/optional/persistence.nix + ../common/optional/pipewire.nix + ../common/optional/hyprland.nix + ../common/optional/displayManager/sddm.nix + ../common/optional/openssh.nix + + ]; + + boot = { + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + timeout = 3; + }; + }; + + networking = { + hostName = "semita"; + networkmanager.enable = true; + enableIPv6 = false; + }; + + services.libinput.enable = true; +} diff --git a/hosts/semita/hardware-configuration.nix b/hosts/semita/hardware-configuration.nix new file mode 100644 index 0000000..0a2bb19 --- /dev/null +++ b/hosts/semita/hardware-configuration.nix @@ -0,0 +1,24 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ]; + boot.initrd.kernelModules = [ "dm-snapshot" ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp1s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/modules/home-manager/monitors.nix b/modules/home-manager/monitors.nix index 00a4c94..fb048b8 100644 --- a/modules/home-manager/monitors.nix +++ b/modules/home-manager/monitors.nix @@ -38,6 +38,10 @@ in { type = types.int; default = 0; }; + scale = mkOption { + type = types.int; + default = 1; + }; enabled = mkOption { type = types.bool; default = true; diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 963e93e..b09e550 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -70,7 +70,7 @@ just update-sops-secrets && just update-flake-secrets && just update-flake cp -prv . "$temp/persist/etc/nixos" # Install Nixos to target -SHELL=/bin/sh nix run github:nix-community/nixos-anywhere/242444d228636b1f0e89d3681f04a75254c29f66 -- --extra-files "$temp" --disk-encryption-keys /tmp/luks_secret.key /tmp/luks_secret.key --flake .#"$config" root@"$ip" -i "$HOME/.ssh/id_ed25519" +SHELL=/bin/sh nix run github:nix-community/nixos-anywhere -- --extra-files "$temp" --disk-encryption-keys /tmp/luks_secret.key /tmp/luks_secret.key --flake .#"$config" root@"$ip" -i "$HOME/.ssh/id_ed25519" [ $? != 0 ] && echo "Error installing Nixos" && exit 1 ## Delete keys from local known_hosts