diff --git a/flake.lock b/flake.lock index 2d17adf..211d185 100644 --- a/flake.lock +++ b/flake.lock @@ -42,11 +42,11 @@ "flake-compat_2": { "flake": false, "locked": { - "lastModified": 1696426674, - "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", "owner": "edolstra", "repo": "flake-compat", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", "type": "github" }, "original": { @@ -57,7 +57,7 @@ }, "flake-utils": { "inputs": { - "systems": "systems" + "systems": "systems_2" }, "locked": { "lastModified": 1705309234, @@ -75,14 +75,14 @@ }, "flake-utils_2": { "inputs": { - "systems": "systems_2" + "systems": "systems_3" }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", "owner": "numtide", "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", "type": "github" }, "original": { @@ -93,14 +93,14 @@ }, "flake-utils_3": { "inputs": { - "systems": "systems_3" + "systems": "systems_4" }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", "owner": "numtide", "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", "type": "github" }, "original": { @@ -111,7 +111,7 @@ }, "flake-utils_4": { "inputs": { - "systems": "systems_4" + "systems": "systems_5" }, "locked": { "lastModified": 1681202837, @@ -136,11 +136,11 @@ ] }, "locked": { - "lastModified": 1709087332, - "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", "owner": "hercules-ci", "repo": "gitignore.nix", - "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", "type": "github" }, "original": { @@ -170,6 +170,109 @@ "type": "github" } }, + "hyprcursor": { + "inputs": { + "hyprlang": [ + "hyprland", + "hyprlang" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1712434681, + "narHash": "sha256-qwmR2p1oc48Bj7gUDvb1oGL19Rjs2PmEmk4ChV01A5o=", + "owner": "hyprwm", + "repo": "hyprcursor", + "rev": "818d8c4b69e0997483d60b75f701fe14b561a7a3", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprcursor", + "type": "github" + } + }, + "hyprland": { + "inputs": { + "hyprcursor": "hyprcursor", + "hyprland-protocols": "hyprland-protocols", + "hyprlang": "hyprlang", + "nixpkgs": "nixpkgs", + "systems": "systems", + "wlroots": "wlroots", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1712766830, + "narHash": "sha256-WXD4j/hzoGQxakwFmvFrZD/yP4FxUrBc1kUhvmYh84k=", + "owner": "hyprwm", + "repo": "Hyprland", + "rev": "558d1be7e3c9242b39fe78efe74ada1298112892", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "Hyprland", + "type": "github" + } + }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1691753796, + "narHash": "sha256-zOEwiWoXk3j3+EoF3ySUJmberFewWlagvewDRuWYAso=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "0c2ce70625cb30aef199cb388f99e19a61a6ce03", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, + "hyprlang": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1711671891, + "narHash": "sha256-C/Wwsy/RLxHP1axFFl+AnwJRWfd8gxDKKoa8nt8Qk3c=", + "owner": "hyprwm", + "repo": "hyprlang", + "rev": "c1402612146ba06606ebf64963a02bc1efe11e74", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprlang", + "type": "github" + } + }, "nixos-wsl": { "inputs": { "flake-compat": "flake-compat", @@ -194,31 +297,47 @@ }, "nixpkgs": { "locked": { - "lastModified": 1712437997, - "narHash": "sha256-g0whLLwRvgO2FsyhY8fNk+TWenS3jg5UdlWL4uqgFeo=", - "owner": "nixos", + "lastModified": 1712439257, + "narHash": "sha256-aSpiNepFOMk9932HOax0XwNxbA38GOUVOiXfUVPOrck=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "e38d7cb66ea4f7a0eb6681920615dfcc30fc2920", + "rev": "ff0dbd94265ac470dda06a657d5fe49de93b4599", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixos-23.11", + "owner": "NixOS", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } }, "nixpkgs-stable": { "locked": { - "lastModified": 1712437997, - "narHash": "sha256-g0whLLwRvgO2FsyhY8fNk+TWenS3jg5UdlWL4uqgFeo=", + "lastModified": 1685801374, + "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e38d7cb66ea4f7a0eb6681920615dfcc30fc2920", + "rev": "c37ca420157f4abc31e26f436c1145f8951ff373", "type": "github" }, "original": { "owner": "NixOS", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1712588820, + "narHash": "sha256-y31s5idk3jMJMAVE4Ud9AdI7HT3CgTAeMTJ0StqKN7Y=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "d272ca50d1f7424fbfcd1e6f1c9e01d92f6da167", + "type": "github" + }, + "original": { + "owner": "nixos", "ref": "nixos-23.11", "repo": "nixpkgs", "type": "github" @@ -287,11 +406,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1711760932, - "narHash": "sha256-DqUTQ2iAAqSDwMhKBqvi24v0Oc7pD3LCK/0FCG//TdA=", + "lastModified": 1703939133, + "narHash": "sha256-Gxe+mfOT6bL7wLC/tuT2F+V+Sb44jNr8YsJ3cyIl4Mo=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "c11e43aed6f17336c25cd120eac886b96c455731", + "rev": "9d3d7e18c6bc4473d7520200d4ddab12f8402d38", "type": "github" }, "original": { @@ -303,24 +422,25 @@ "root": { "inputs": { "home-manager": "home-manager", + "hyprland": "hyprland", "nixos-wsl": "nixos-wsl", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "nixvim": "nixvim", "vscode-server": "vscode-server" } }, "systems": { "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", "type": "github" }, "original": { "owner": "nix-systems", - "repo": "default", + "repo": "default-linux", "type": "github" } }, @@ -369,6 +489,21 @@ "type": "github" } }, + "systems_5": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "utils": { "locked": { "lastModified": 1678901627, @@ -404,6 +539,58 @@ "repo": "nixos-vscode-server", "type": "github" } + }, + "wlroots": { + "flake": false, + "locked": { + "host": "gitlab.freedesktop.org", + "lastModified": 1709983277, + "narHash": "sha256-wXWIJLd4F2JZeMaihWVDW/yYXCLEC8OpeNJZg9a9ly8=", + "owner": "wlroots", + "repo": "wlroots", + "rev": "50eae512d9cecbf0b3b1898bb1f0b40fa05fe19b", + "type": "gitlab" + }, + "original": { + "host": "gitlab.freedesktop.org", + "owner": "wlroots", + "repo": "wlroots", + "rev": "50eae512d9cecbf0b3b1898bb1f0b40fa05fe19b", + "type": "gitlab" + } + }, + "xdph": { + "inputs": { + "hyprland-protocols": [ + "hyprland", + "hyprland-protocols" + ], + "hyprlang": [ + "hyprland", + "hyprlang" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1709299639, + "narHash": "sha256-jYqJM5khksLIbqSxCLUUcqEgI+O2LdlSlcMEBs39CAU=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "2d2fb547178ec025da643db57d40a971507b82fe", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 1f7a467..9ad88b5 100644 --- a/flake.nix +++ b/flake.nix @@ -23,6 +23,8 @@ url = "github:nix-community/nixvim/nixos-23.11"; inputs.nixpkgs.follows = "nixpkgs"; }; + + hyprland.url = "github:hyprwm/Hyprland"; }; outputs = { @@ -38,6 +40,19 @@ in { # Available through 'nixos-rebuild --flake .#wsl' nixosConfigurations = { + virtualbox = nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs outputs; + username = "nickolaj"; + hostname = "virtualbox"; + }; + modules = [ + nixos-wsl.nixosModules.wsl + vscode-server.nixosModules.default + ./nixos/configuration.nix + ./machines/virtualbox/configuration.nix + ]; + }; wsl = nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs outputs; @@ -48,7 +63,20 @@ nixos-wsl.nixosModules.wsl vscode-server.nixosModules.default ./nixos/configuration.nix - ./nixos/machines/wsl.nix + ./machines/wsl/configuration.nix + ]; + }; + legion = nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs outputs; + username = "nickolaj"; + hostname = "legion"; + }; + modules = [ + nixos-wsl.nixosModules.wsl + vscode-server.nixosModules.default + ./nixos/configuration.nix + ./machines/legion/configuration.nix ]; }; }; diff --git a/home-manager/wsl.nix b/home-manager/wsl.nix deleted file mode 100644 index 34fb5aa..0000000 --- a/home-manager/wsl.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ - pkgs, - ... -}: { - home.packages = with pkgs; [ - nodejs_20 - ]; -} diff --git a/machines/legion/configuration.nix b/machines/legion/configuration.nix new file mode 100644 index 0000000..bdc7724 --- /dev/null +++ b/machines/legion/configuration.nix @@ -0,0 +1,45 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, username, inputs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + # Bootloader. + boot.loader.grub.enable = true; + boot.loader.grub.device = "/dev/nvme0n1"; + boot.loader.grub.useOSProber = true; + + environment.sessionVariables = { + WLR_NO_HARDWARE_CURSORS = "1"; + }; + + programs.hyprland.enable = true; + programs.hyprland.package = inputs.hyprland.packages.${pkgs.system}.hyprland; + programs.hyprland.xwayland.enable = true; + + home-manager.users.${username}.imports = [ + ./home-manager.nix + ]; + + environment.systemPackages = [ + pkgs.gtk3 + ]; + + hardware.opengl = { + enable = true; + driSupport = true; + }; + + networking.wireless.enable = true; + networking.wireless.networks = { + Brother = { + psk = "fireproof"; + }; + }; +} diff --git a/machines/legion/hardware-configuration.nix b/machines/legion/hardware-configuration.nix new file mode 100644 index 0000000..665e071 --- /dev/null +++ b/machines/legion/hardware-configuration.nix @@ -0,0 +1,35 @@ +# 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 + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/ba0e4c19-b23f-4099-9107-167e4babe3f2"; + fsType = "ext4"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/61ff6a39-c765-43c4-ae64-09f94478e0aa"; } + ]; + + # 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.enp7s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/machines/legion/home-manager.nix b/machines/legion/home-manager.nix new file mode 100644 index 0000000..8099561 --- /dev/null +++ b/machines/legion/home-manager.nix @@ -0,0 +1,104 @@ +{ + pkgs, + ... +}: { + home.packages = with pkgs; [ + nodejs_20 + kitty + alacritty + wofi + vscode + xfce.thunar + xterm + foot + firefox + ]; + programs.kitty = { + enable = true; + }; + wayland.windowManager.hyprland = { + enable = true; + package = pkgs.hyprland; + systemd.enable = true; + settings = { + "monitor" = ",preferred,auto,1"; + + workspace = [ + "1, monitor:eDP-1, default:true" + "2, monitor:eDP-1" + "3, monitor:eDP-1" + "4, monitor:eDP-1" + "5, monitor:eDP-1" + ]; + + layerrule = "noanim, wofi"; + + input = { + kb_layout = "dk"; + kb_options = "caps:backspace"; + follow_mouse = "2"; # Cursor focus will be detached from keyboard focus. Clicking on a window will move keyboard focus to that window. + + touchpad = { + natural_scroll = "no"; + }; + + sensitivity = "0"; # -1.0 - 1.0, 0 means no modification. + accel_profile = "flat"; + }; + + general = { + gaps_in = 5; + gaps_out = 10; + border_size = 2; + #col.active_border = "rgb(cf6a4c)"; + no_cursor_warps = true; + layout = "dwindle"; + }; + + misc = { + focus_on_activate = true; + }; + + decoration = { + rounding = 5; + drop_shadow = true; + shadow_range = 4; + shadow_render_power = 3; + #col.shadow = "rgba(1a1a1aee)"; + }; + + "$mod" = "SUPER"; + bind = [ + "$mod, RETURN, exec, kitty" + "$mod, BACKSPACE, killactive" + "$mod, SPACE, exec, wofi" + + "$mod, q, workspace, 1" + "$mod, w, workspace, 2" + "$mod, e, workspace, 3" + "$mod, r, workspace, 4" + "$mod, t, workspace, 5" + + "$mod, left, movefocus, l" + "$mod, right, movefocus, r" + "$mod, up, movefocus, u" + "$mod, down, movefocus, d" + "$mod, h, movefocus, l" + "$mod, l, movefocus, r" + "$mod, k, movefocus, u" + "$mod, j, movefocus, d" + + "$mod, S, togglefloating," + "$mod, A, pseudo," # dwindle + "$mod, D, fullscreen," # dwindle + "$mod, BACKSLASH, togglesplit," # dwindle + "$mod, M, togglegroup," # dwindle + + ]; + bindm = [ + "$mod, mouse:272, movewindow" + "$mod, mouse:273, resizewindow" + ]; + }; + }; +} diff --git a/machines/virtualbox/configuration.nix b/machines/virtualbox/configuration.nix new file mode 100644 index 0000000..eabfc6a --- /dev/null +++ b/machines/virtualbox/configuration.nix @@ -0,0 +1,58 @@ +# 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, username, inputs, ... }: + +{ + imports = [ ]; + environment.sessionVariables = { + WLR_NO_HARDWARE_CURSORS = "1"; + }; + #services.xserver.enable = true; + #services.xserver.displayManager.gdm = { + # enable = true; + #}; + programs.hyprland.enable = true; + programs.hyprland.package = inputs.hyprland.packages.${pkgs.system}.hyprland; + programs.hyprland.xwayland.enable = true; +# programs.hyprland.enableNvidiaPatches = true; + home-manager.users.${username}.imports = [ + ./home-manager.nix + ]; + + environment.systemPackages = [ + pkgs.gtk3 + ]; + + hardware.opengl = { + enable = true; + driSupport = true; + #extraPackages = with pkgs; [ + # vaapiVdpau + # libvdpau-va-gl + #]; + }; + + boot.initrd.availableKernelModules = [ "ohci_pci" "ehci_pci" "ahci" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + boot.loader.grub.device = "nodev"; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/f222513b-ded1-49fa-b591-20ce86a2fe7f"; + fsType = "ext4"; + }; + + swapDevices = [ ]; + + # 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.enp0s3.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + virtualisation.virtualbox.guest.enable = true; +} diff --git a/machines/virtualbox/home-manager.nix b/machines/virtualbox/home-manager.nix new file mode 100644 index 0000000..62e49e8 --- /dev/null +++ b/machines/virtualbox/home-manager.nix @@ -0,0 +1,31 @@ +{ + pkgs, + ... +}: { + home.packages = with pkgs; [ + nodejs_20 + kitty + alacritty + wofi + vscode + xfce.thunar + xterm + foot + firefox + ]; + programs.kitty = { + enable = true; + }; + wayland.windowManager.hyprland = { + enable = true; + package = pkgs.hyprland; + systemd.enable = true; + settings = { + "$mod" = "SUPER"; + bind = [ + "$mod, RETURN, exec, kitty" + "$mod, SPACE, exec, wofi --show drun" + ]; + }; + }; +} diff --git a/nixos/machines/wsl.nix b/machines/wsl/configuration.nix similarity index 93% rename from nixos/machines/wsl.nix rename to machines/wsl/configuration.nix index c6525af..a6f639c 100644 --- a/nixos/machines/wsl.nix +++ b/machines/wsl/configuration.nix @@ -13,7 +13,7 @@ }; home-manager.users.${username}.imports = [ - ../../home-manager/wsl.nix + ./home-manager.nix ]; # Hacks to enable vscode diff --git a/machines/wsl/home-manager.nix b/machines/wsl/home-manager.nix new file mode 100644 index 0000000..e69de29 diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 6abeb19..ba940c5 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -21,6 +21,8 @@ nix.settings = { experimental-features = "nix-command flakes"; auto-optimise-store = true; + substituters = ["https://hyprland.cachix.org"]; + trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="]; }; home-manager = { @@ -47,5 +49,6 @@ }; }; + security.sudo.wheelNeedsPassword = false; system.stateVersion = "23.11"; }