From b261562377ba5a9520eb63271750da0b3d719585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20K=C3=A4nner?= Date: Thu, 7 Mar 2024 00:07:23 +0100 Subject: [PATCH] 90 current 1970-01-01 01:00:00 24.05.20240303.b8697e5 6.6.19 * --- flake.lock | 15 +++++----- flake.nix | 11 ++++++-- hosts/MaxNixosLaptop/configuration.nix | 14 ++------- modules/home-manager/sway.nix | 1 - modules/nixos/greetd.nix | 39 ++++++++++++++++++++++++++ modules/nixos/sway.nix | 1 + 6 files changed, 58 insertions(+), 23 deletions(-) create mode 100644 modules/nixos/greetd.nix diff --git a/flake.lock b/flake.lock index 2d84be4..ed3d0e7 100644 --- a/flake.lock +++ b/flake.lock @@ -7,32 +7,31 @@ ] }, "locked": { - "lastModified": 1706981411, - "narHash": "sha256-cLbLPTL1CDmETVh4p0nQtvoF+FSEjsnJTFpTxhXywhQ=", + "lastModified": 1709756385, + "narHash": "sha256-EwAsCWfjLnq6Rzh9c95ThPhTTOQkY/R9ZROPUfhtHmE=", "owner": "nix-community", "repo": "home-manager", - "rev": "652fda4ca6dafeb090943422c34ae9145787af37", + "rev": "ad9254cd9af9165000ecd6ef9c23c2b8ceda01c7", "type": "github" }, "original": { "owner": "nix-community", - "ref": "release-23.11", "repo": "home-manager", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1709218635, - "narHash": "sha256-nytX/MkfqeTD4z7bMq4QRXcHxO9B3vRo9tM6fMtPFA8=", + "lastModified": 1709479366, + "narHash": "sha256-n6F0n8UV6lnTZbYPl1A9q1BS0p4hduAv1mGAP17CVd0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "068d4db604958d05d0b46c47f79b507d84dbc069", + "rev": "b8697e57f10292a6165a20f03d2f42920dfaf973", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-23.11", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index b4cea4f..a0ff672 100644 --- a/flake.nix +++ b/flake.nix @@ -2,10 +2,10 @@ description = "Nixos config flake"; inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; home-manager = { - url = "github:nix-community/home-manager/release-23.11"; + url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; }; @@ -13,6 +13,7 @@ outputs = { self, nixpkgs, + home-manager, ... } @ inputs: let system = "x86_64-linux"; @@ -22,7 +23,11 @@ specialArgs = {inherit inputs;}; modules = [ ./hosts/MaxNixosLaptop/configuration.nix - inputs.home-manager.nixosModules.default + home-manager.nixosModules.default + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + } ]; }; }; diff --git a/hosts/MaxNixosLaptop/configuration.nix b/hosts/MaxNixosLaptop/configuration.nix index 6705571..fe7dc70 100644 --- a/hosts/MaxNixosLaptop/configuration.nix +++ b/hosts/MaxNixosLaptop/configuration.nix @@ -10,6 +10,8 @@ imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix + # greetd login manager + ../../modules/nixos/greetd.nix # sway as window manager ../../modules/nixos/sway.nix inputs.home-manager.nixosModules.default @@ -116,7 +118,7 @@ ffmpeg ]; - fonts.fonts = with pkgs; [ + fonts.packages = with pkgs; [ nerdfonts ]; @@ -161,16 +163,6 @@ # fingerprint unlock services.fprintd.enable = true; - services.greetd = { - enable = true; - settings = rec { - default_session = { - command = "${pkgs.sway}/bin/sway"; - user = "max"; - }; - }; - }; - # Enable the OpenSSH daemon. # services.openssh.enable = true; diff --git a/modules/home-manager/sway.nix b/modules/home-manager/sway.nix index 6cd9186..cc468bf 100644 --- a/modules/home-manager/sway.nix +++ b/modules/home-manager/sway.nix @@ -5,7 +5,6 @@ ... }: { home.packages = with pkgs; [ - sway waybar # status bar swaylock # screen locking swayidle # automatic screen locking after system idle time diff --git a/modules/nixos/greetd.nix b/modules/nixos/greetd.nix new file mode 100644 index 0000000..d7dad27 --- /dev/null +++ b/modules/nixos/greetd.nix @@ -0,0 +1,39 @@ +{ + config, + lib, + pkgs, + ... +}: let + swayConfig = pkgs.writeText "greetd-sway-config" '' + input * { + xkb_layout "de" + xkb_options "caps:ctrl_modifier" + xkb_numlock "enable" + } + input "type:touchpad" { + tap "enable" + natural_scroll "enable" + } + + # `-l` activates layer-shell mode. Notice that `swaymsg exit` will run after gtkgreet. + exec "${pkgs.greetd.gtkgreet}/bin/gtkgreet -l; swaymsg exit" + bindsym Mod4+shift+e exec swaynag \ + -t warning \ + -m 'What do you want to do?' \ + -b 'Poweroff' 'systemctl poweroff' \ + -b 'Reboot' 'systemctl reboot' + ''; +in { + services.greetd = { + enable = true; + settings = { + default_session = { + command = "${pkgs.sway}/bin/sway --config ${swayConfig}"; + }; + }; + }; + + environment.etc."greetd/environments".text = '' + sway + ''; +} diff --git a/modules/nixos/sway.nix b/modules/nixos/sway.nix index a9f69e9..1b50b28 100644 --- a/modules/nixos/sway.nix +++ b/modules/nixos/sway.nix @@ -67,6 +67,7 @@ in { xdg.portal = { enable = true; wlr.enable = true; + config.common.default = ["wlr" "gtk"]; # gtk portal needed to make gtk apps happy extraPortals = [pkgs.xdg-desktop-portal-gtk]; };