From cde4da7e51ebf48a9b1a57faff4422d37424a73c Mon Sep 17 00:00:00 2001 From: oddlama Date: Sun, 27 Oct 2024 11:51:53 +0100 Subject: [PATCH] chore: update flake, add uwsm --- config/graphical/cosmic.nix | 172 ++++++++++++++++++++++++++++ config/graphical/default.nix | 18 +++ config/optional/laptop.nix | 2 +- config/system.nix | 3 +- flake.lock | 144 ++++++++++++++--------- flake.nix | 5 + hosts/nom/default.nix | 10 ++ nix/hosts.nix | 1 + nix/pkgs.nix | 1 + pkgs/ccid.nix | 84 ++++++++++++++ pkgs/default.nix | 1 + users/myuser/default.nix | 6 +- users/myuser/graphical/hyprland.nix | 12 +- users/myuser/graphical/swaync.nix | 3 - users/myuser/graphical/swww.nix | 1 + users/myuser/graphical/waybar.nix | 8 +- 16 files changed, 397 insertions(+), 74 deletions(-) create mode 100644 config/graphical/cosmic.nix create mode 100644 pkgs/ccid.nix diff --git a/config/graphical/cosmic.nix b/config/graphical/cosmic.nix new file mode 100644 index 0000000..6a4d46f --- /dev/null +++ b/config/graphical/cosmic.nix @@ -0,0 +1,172 @@ +{ + lib, + pkgs, + config, + utils, + ... +}: let + excludePackages = with pkgs; [fira]; +in { + environment.pathsToLink = [ + "/share/backgrounds" + "/share/cosmic" + ]; + environment.systemPackages = + utils.removePackagesByName ( + with pkgs; + [ + adwaita-icon-theme + alsa-utils + cosmic-applets + cosmic-applibrary + cosmic-bg + (cosmic-comp.override { + # avoid PATH pollution of system action keybinds (Xwayland handled below) + useXWayland = false; + }) + cosmic-edit + cosmic-files + cosmic-greeter + cosmic-icons + cosmic-launcher + cosmic-notifications + cosmic-osd + cosmic-panel + cosmic-randr + cosmic-screenshot + cosmic-session + cosmic-settings + cosmic-settings-daemon + cosmic-term + cosmic-wallpapers + cosmic-workspaces-epoch + hicolor-icon-theme + playerctl + pop-icon-theme + pop-launcher + xdg-user-dirs + xwayland + ] + ++ lib.optionals config.services.flatpak.enable [ + cosmic-store + ] + ) + excludePackages; + + # xdg portal packages and config + xdg.portal = { + enable = true; + extraPortals = with pkgs; [ + xdg-desktop-portal-cosmic + xdg-desktop-portal-gtk + ]; + configPackages = lib.mkDefault ( + with pkgs; [ + xdg-desktop-portal-cosmic + ] + ); + }; + + # fonts + fonts.packages = + utils.removePackagesByName (with pkgs; [ + fira + ]) + excludePackages; + + # required features + # hardware.${ + # if lib.versionAtLeast lib.version "24.11" + # then "graphics" + # else "opengl" + # }.enable = + # true; + # services.libinput.enable = true; + # xdg.mime.enable = true; + # xdg.icons.enable = true; + + # optional features + # hardware.bluetooth.enable = lib.mkDefault true; + services.acpid.enable = lib.mkDefault true; + # services.pipewire = { + # enable = lib.mkDefault true; + # alsa.enable = lib.mkDefault true; + # pulse.enable = lib.mkDefault true; + # }; + services.gvfs.enable = lib.mkDefault true; + # networking.networkmanager.enable = lib.mkDefault true; + services.gnome.gnome-keyring.enable = lib.mkDefault true; + + # general graphical session features + # programs.dconf.enable = lib.mkDefault true; + # + # required dbus services + services.accounts-daemon.enable = true; + services.upower.enable = true; + services.power-profiles-daemon.enable = lib.mkDefault (!config.hardware.system76.power-daemon.enable); + security.polkit.enable = true; + security.rtkit.enable = true; + + # session packages + services.displayManager.sessionPackages = with pkgs; [cosmic-session]; + systemd.packages = with pkgs; [cosmic-session]; + # TODO: remove when upstream has XDG autostart support + systemd.user.targets.cosmic-session = { + wants = ["xdg-desktop-autostart.target"]; + before = ["xdg-desktop-autostart.target"]; + }; + + # required for screen locker + security.pam.services.cosmic-greeter = {}; + + nix.settings.substituters = [ + "https://cosmic.cachix.org/" + ]; + nix.settings.trusted-public-keys = [ + "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE=" + ]; + + # module diagnostics + warnings = + lib.optional + ( + lib.elem pkgs.cosmic-files excludePackages + && !(lib.elem pkgs.cosmic-session excludePackages) + ) + '' + The COSMIC session may fail to initialise with the `cosmic-files` package excluded via + `excludePackages`. + + Please do one of the following: + 1. Remove `cosmic-files` from `excludePackages`. + 2. Add `cosmic-session` (in addition to `cosmic-files`) to + `excludePackages` and ensure whatever session starter/manager you are + using is appropriately set up. + ''; + assertions = [ + { + assertion = lib.elem "libcosmic-app-hook" ( + lib.map ( + drv: lib.optionalString (lib.isDerivation drv) (lib.getName drv) + ) + pkgs.cosmic-comp.nativeBuildInputs + ); + message = '' + It looks like the provided `pkgs` to the NixOS COSMIC module is not usable for a working COSMIC + desktop environment. + + If you are erroneously passing in `pkgs` to `specialArgs` somewhere in your system configuration, + this is is often unnecessary and has unintended consequences for all NixOS modules. Please either + remove that in favor of configuring the NixOS `pkgs` instance via `nixpkgs.config` and + `nixpkgs.overlays`. + + If you must instantiate your own `pkgs`, then please include the overlay from the NixOS COSMIC flake + when instantiating `pkgs` and be aware that the `nixpkgs.config` and `nixpkgs.overlays` options will + not function for any NixOS modules. + + Note that the COSMIC packages in Nixpkgs are still largely broken as of 2024-10-16 and will not be + usable for having a fully functional COSMIC desktop environment. The overlay is therefore necessary. + ''; + } + ]; +} diff --git a/config/graphical/default.nix b/config/graphical/default.nix index a1958ca..07fdb4d 100644 --- a/config/graphical/default.nix +++ b/config/graphical/default.nix @@ -4,6 +4,7 @@ lib, minimal, pkgs, + globals, ... }: let inherit @@ -29,6 +30,7 @@ in ./fonts.nix ./steam.nix ./xserver.nix + # ./cosmic.nix ]; config = { @@ -59,6 +61,22 @@ in ]; }; + services.displayManager.enable = true; + programs.uwsm = { + enable = true; + waylandCompositors.sway = { + prettyName = "Sway"; + comment = "Sway"; + binPath = lib.getExe config.home-manager.users.${globals.myuser.name}.wayland.windowManager.sway.package; + }; + + waylandCompositors.hyprland = { + prettyName = "Hyprland"; + comment = "Hyprland"; + binPath = lib.getExe config.home-manager.users.${globals.myuser.name}.wayland.windowManager.hyprland.package; + }; + }; + stylix = { enable = true; # I want to choose what to style myself. diff --git a/config/optional/laptop.nix b/config/optional/laptop.nix index 8ec703c..2e2f602 100644 --- a/config/optional/laptop.nix +++ b/config/optional/laptop.nix @@ -2,7 +2,7 @@ systemd.network.wait-online.anyInterface = true; services = { - tlp.enable = true; + # tlp.enable = true; physlock.enable = true; logind = { lidSwitch = "ignore"; diff --git a/config/system.nix b/config/system.nix index 7b70273..f264f69 100644 --- a/config/system.nix +++ b/config/system.nix @@ -1,8 +1,9 @@ {pkgs, ...}: { documentation.nixos.enable = false; - # Disable sudo which is entierly unnecessary. + # Disable sudo which is entirely unnecessary. security.sudo.enable = false; + services.dbus.implementation = "broker"; time.timeZone = "Europe/Berlin"; i18n.defaultLocale = "C.UTF-8"; diff --git a/flake.lock b/flake.lock index bb65f64..330cfff 100644 --- a/flake.lock +++ b/flake.lock @@ -51,11 +51,11 @@ "pre-commit-hooks": "pre-commit-hooks" }, "locked": { - "lastModified": 1727102360, - "narHash": "sha256-ZDqf33OAsr46TlP7TXbxmEf48xenYA3iSLs9441fYbQ=", + "lastModified": 1729172588, + "narHash": "sha256-BLAyMpW3onKZ0tOfXRY26baJL9fZ/OogccFWO0uNyuw=", "owner": "oddlama", "repo": "agenix-rekey", - "rev": "62da71e7eadf6b9b52e831d2e516937c30a5f712", + "rev": "0488a23f882df0de8107e46da88177bd038ab4d2", "type": "github" }, "original": { @@ -350,11 +350,11 @@ ] }, "locked": { - "lastModified": 1728334376, - "narHash": "sha256-CTKEKPzD/j8FK6H4DO3EjyixZd3HHvgAgfnCwpGFP5c=", + "lastModified": 1729712798, + "narHash": "sha256-a+Aakkb+amHw4biOZ0iMo8xYl37uUL48YEXIC5PYJ/8=", "owner": "nix-community", "repo": "disko", - "rev": "d39ee334984fcdae6244f5a8e6ab857479cbaefe", + "rev": "09a776702b004fdf9c41a024e1299d575ee18a7d", "type": "github" }, "original": { @@ -878,11 +878,11 @@ ] }, "locked": { - "lastModified": 1728092656, - "narHash": "sha256-eMeCTJZ5xBeQ0f9Os7K8DThNVSo9gy4umZLDfF5q6OM=", + "lastModified": 1729104314, + "narHash": "sha256-pZRZsq5oCdJt3upZIU4aslS9XwFJ+/nVtALHIciX/BI=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "1211305a5b237771e13fcca0c51e60ad47326a9a", + "rev": "3c3e88f0f544d6bb54329832616af7eb971b6be6", "type": "github" }, "original": { @@ -1090,11 +1090,11 @@ ] }, "locked": { - "lastModified": 1728337164, - "narHash": "sha256-VdRTjJFyq4Q9U7Z/UoC2Q5jK8vSo6E86lHc2OanXtvc=", + "lastModified": 1729844616, + "narHash": "sha256-LZdokf9Xave80URxsHAZehogjC16dDPBZb285hh5OAM=", "owner": "nix-community", "repo": "home-manager", - "rev": "038630363e7de57c36c417fd2f5d7c14773403e4", + "rev": "5feb9dba3cc095cd0d5d0d34a39dbee9cc469530", "type": "github" }, "original": { @@ -1111,11 +1111,11 @@ ] }, "locked": { - "lastModified": 1728337164, - "narHash": "sha256-VdRTjJFyq4Q9U7Z/UoC2Q5jK8vSo6E86lHc2OanXtvc=", + "lastModified": 1729716953, + "narHash": "sha256-FbRKGRRd0amsk/WS/UV9ukJ8jT1dZ2pJBISxkX+uq6A=", "owner": "nix-community", "repo": "home-manager", - "rev": "038630363e7de57c36c417fd2f5d7c14773403e4", + "rev": "a4353cc43d1b4dd6bdeacea90eb92a8b7b78a9d7", "type": "github" }, "original": { @@ -1149,11 +1149,11 @@ }, "impermanence": { "locked": { - "lastModified": 1727649413, - "narHash": "sha256-FA53of86DjFdeQzRDVtvgWF9o52rWK70VHGx0Y8fElQ=", + "lastModified": 1729068498, + "narHash": "sha256-C2sGRJl1EmBq0nO98TNd4cbUy20ABSgnHWXLIJQWRFA=", "owner": "nix-community", "repo": "impermanence", - "rev": "d0b38e550039a72aff896ee65b0918e975e6d48e", + "rev": "e337457502571b23e449bf42153d7faa10c0a562", "type": "github" }, "original": { @@ -1162,6 +1162,34 @@ "type": "github" } }, + "ixx": { + "inputs": { + "flake-utils": [ + "nixvim", + "nuschtosSearch", + "flake-utils" + ], + "nixpkgs": [ + "nixvim", + "nuschtosSearch", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1729544999, + "narHash": "sha256-YcyJLvTmN6uLEBGCvYoMLwsinblXMkoYkNLEO4WnKus=", + "owner": "NuschtOS", + "repo": "ixx", + "rev": "65c207c92befec93e22086da9456d3906a4e999c", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "ref": "v0.0.5", + "repo": "ixx", + "type": "github" + } + }, "lib-net": { "flake": false, "locked": { @@ -1184,11 +1212,11 @@ "spectrum": "spectrum" }, "locked": { - "lastModified": 1728349983, - "narHash": "sha256-VRQm46/W29z87IeITfvxIrS6LUEItgDtEDzqVX59q0E=", + "lastModified": 1729726792, + "narHash": "sha256-ndjFy5kfhn9MoOOSzGnZ7f2FwRUUY1EJYwXGxK8DzsQ=", "owner": "astro", "repo": "microvm.nix", - "rev": "470537e671d743f40812b9c071a4130eabdb3deb", + "rev": "ef42cfface9940b9ce9614307670b60cdbda33f6", "type": "github" }, "original": { @@ -1245,11 +1273,11 @@ ] }, "locked": { - "lastModified": 1728385805, - "narHash": "sha256-mUd38b0vhB7yzgAjNOaFz7VY9xIVzlbn3P2wjGBcVV0=", + "lastModified": 1729757100, + "narHash": "sha256-x+8uGaX66V5+fUBHY23Q/OQyibQ38nISzxgj7A7Jqds=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "48b50b3b137be5cfb9f4d006835ce7c3fe558ccc", + "rev": "04193f188e4144d7047f83ad1de81d6034d175cd", "type": "github" }, "original": { @@ -1265,11 +1293,11 @@ ] }, "locked": { - "lastModified": 1728263287, - "narHash": "sha256-GJDtsxz2/zw6g/Nrp4XVWBS5IaZ7ZUkuvxPOBEDe7pg=", + "lastModified": 1729394935, + "narHash": "sha256-2ntUG+NJKdfhlrh/tF+jOU0fOesO7lm5ZZVSYitsvH8=", "owner": "Mic92", "repo": "nix-index-database", - "rev": "5fce10c871bab6d7d5ac9e5e7efbb3a2783f5259", + "rev": "04f8a11f247ba00263b060fbcdc95484fd046104", "type": "github" }, "original": { @@ -1303,11 +1331,11 @@ }, "nixlib": { "locked": { - "lastModified": 1728176478, - "narHash": "sha256-px3Q0W//c+mZ4kPMXq4poztsjtXM1Ja1rN+825YMDUQ=", + "lastModified": 1729386149, + "narHash": "sha256-hUP9oxmnOmNnKcDOf5Y55HQ+NnoT0+bLWHLQWLLw9Ks=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "b61309c3c1b6013d36299bc8285612865b3b9e4c", + "rev": "cce4521b6df014e79a7b7afc58c703ed683c916e", "type": "github" }, "original": { @@ -1348,11 +1376,11 @@ ] }, "locked": { - "lastModified": 1728522165, - "narHash": "sha256-UQpsJ0Ev6JBGsCYRlS2oOVvb+eWcDD0xTV3RVlqbeVU=", + "lastModified": 1729472750, + "narHash": "sha256-s93LPHi5BN7I2xSGNAFWiYb8WRsPvT1LE9ZjZBrpFlg=", "owner": "nix-community", "repo": "nixos-generators", - "rev": "40c8d30c490414910fc63626ad1b67af7db40cd3", + "rev": "7c60ba4bc8d6aa2ba3e5b0f6ceb9fc07bc261565", "type": "github" }, "original": { @@ -1363,11 +1391,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1728269138, - "narHash": "sha256-oKxDImsOvgUZMY4NwXVyUc/c1HiU2qInX+b5BU0yXls=", + "lastModified": 1729742320, + "narHash": "sha256-u3Of8xRkN//me8PU+RucKA59/6RNy4B2jcGAF36P4jI=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "ecfcd787f373f43307d764762e139a7cdeb9c22b", + "rev": "e8a2f6d5513fe7b7d15701b2d05404ffdc3b6dda", "type": "github" }, "original": { @@ -1575,11 +1603,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1728492678, - "narHash": "sha256-9UTxR8eukdg+XZeHgxW5hQA9fIKHsKCdOIUycTryeVw=", + "lastModified": 1729665710, + "narHash": "sha256-AlcmCXJZPIlO5dmFzV3V2XF6x/OpNWUV8Y/FMPGd8Z4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5633bcff0c6162b9e4b5f1264264611e950c8ec7", + "rev": "2768c7d042a37de65bb1b5b3268fc987e534c49d", "type": "github" }, "original": { @@ -1620,11 +1648,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1728485062, - "narHash": "sha256-+2e9hAM2GVDF3gywdQI/OA7s4f0Z9rvFuiVxePI41QM=", + "lastModified": 1729791159, + "narHash": "sha256-i5TKYCs9tJ2qaYTsjQh3WwExmj4O0EU+L1jq6ZBVMfM=", "owner": "nix-community", "repo": "nixvim", - "rev": "61ec39764fbe1e4f21cf801ea7b9209d527c8135", + "rev": "4726334e4413ff55f1db3768c8d08722abbf09cf", "type": "github" }, "original": { @@ -1636,17 +1664,18 @@ "nuschtosSearch": { "inputs": { "flake-utils": "flake-utils_8", + "ixx": "ixx", "nixpkgs": [ "nixvim", "nixpkgs" ] }, "locked": { - "lastModified": 1728423244, - "narHash": "sha256-+YwNsyIFj3dXyLVQd1ry4pCNmtOpbceKUrkNS8wp9Ho=", + "lastModified": 1729763753, + "narHash": "sha256-M8WAUgKFBU5TvFt92g/dHBtGJmBP33LHird+solHt0g=", "owner": "NuschtOS", "repo": "search", - "rev": "f276cc3b391493ba3a8b30170776860f9520b7fa", + "rev": "bedc2f2ada220815a98a896e10f5e61bfc329bfc", "type": "github" }, "original": { @@ -1823,11 +1852,11 @@ "nixpkgs-stable": "nixpkgs-stable_6" }, "locked": { - "lastModified": 1728092656, - "narHash": "sha256-eMeCTJZ5xBeQ0f9Os7K8DThNVSo9gy4umZLDfF5q6OM=", + "lastModified": 1729104314, + "narHash": "sha256-pZRZsq5oCdJt3upZIU4aslS9XwFJ+/nVtALHIciX/BI=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "1211305a5b237771e13fcca0c51e60ad47326a9a", + "rev": "3c3e88f0f544d6bb54329832616af7eb971b6be6", "type": "github" }, "original": { @@ -2049,11 +2078,11 @@ "tinted-tmux": "tinted-tmux" }, "locked": { - "lastModified": 1728487226, - "narHash": "sha256-gTOUdO94Y24QgnPVnHTQ/Kch0eM6pHEk/c1WoIxg+qE=", + "lastModified": 1729380793, + "narHash": "sha256-TV6NYBUqTHI9t5fqNu4Qyr4BZUD2yGxAn3E+d5/mqaI=", "owner": "danth", "repo": "stylix", - "rev": "5699ba97c60455ebafde0fd4e78ca0a2e5a58282", + "rev": "fb9399b7e2c855f42dae76a363bab28d4f24aa8d", "type": "github" }, "original": { @@ -2276,16 +2305,17 @@ "tinted-kitty": { "flake": false, "locked": { - "lastModified": 1727867815, - "narHash": "sha256-cghdwzPyve13JFeW+Mpqy/sDswlJ4DTffY24R0R7r/U=", + "lastModified": 1716423189, + "narHash": "sha256-2xF3sH7UIwegn+2gKzMpFi3pk5DlIlM18+vj17Uf82U=", "owner": "tinted-theming", "repo": "tinted-kitty", - "rev": "81b15cb9eb696247af857808d37122188423f73b", + "rev": "eb39e141db14baef052893285df9f266df041ff8", "type": "github" }, "original": { "owner": "tinted-theming", "repo": "tinted-kitty", + "rev": "eb39e141db14baef052893285df9f266df041ff8", "type": "github" } }, @@ -2335,11 +2365,11 @@ ] }, "locked": { - "lastModified": 1727984844, - "narHash": "sha256-xpRqITAoD8rHlXQafYZOLvUXCF6cnZkPfoq67ThN0Hc=", + "lastModified": 1729613947, + "narHash": "sha256-XGOvuIPW1XRfPgHtGYXd5MAmJzZtOuwlfKDgxX5KT3s=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "4446c7a6fc0775df028c5a3f6727945ba8400e64", + "rev": "aac86347fb5063960eccb19493e0cadcdb4205ca", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 673dae7..220ee96 100644 --- a/flake.nix +++ b/flake.nix @@ -55,6 +55,11 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + # nixos-cosmic = { + # url = "github:lilyinstarlight/nixos-cosmic"; + # inputs.nixpkgs.follows = "nixpkgs"; + # }; + nixos-extra-modules = { url = "github:oddlama/nixos-extra-modules"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/hosts/nom/default.nix b/hosts/nom/default.nix index 632b1f1..11110ca 100644 --- a/hosts/nom/default.nix +++ b/hosts/nom/default.nix @@ -47,5 +47,15 @@ nvidiaBusId = "PCI:1:0:0"; }; + services.mullvad-vpn.enable = true; + environment.persistence."/persist".directories = [ + { + directory = "/etc/mullvad-vpn"; + user = "root"; + group = "root"; + mode = "0700"; + } + ]; + topology.self.icon = "devices.laptop"; } diff --git a/nix/hosts.nix b/nix/hosts.nix index e51ab3d..4362892 100644 --- a/nix/hosts.nix +++ b/nix/hosts.nix @@ -33,6 +33,7 @@ (import ../pkgs/default.nix inputs) ++ [ inputs.idmail.overlays.default + # inputs.nixos-cosmic.overlays.default inputs.nix-topology.overlays.default inputs.nixos-extra-modules.overlays.default inputs.nixvim.overlays.default diff --git a/nix/pkgs.nix b/nix/pkgs.nix index 2154651..ba1feb0 100644 --- a/nix/pkgs.nix +++ b/nix/pkgs.nix @@ -28,6 +28,7 @@ (import ../pkgs/default.nix inputs) ++ [ inputs.nix-topology.overlays.default + # inputs.nixos-cosmic.overlays.default inputs.nixos-extra-modules.overlays.default ]; }; diff --git a/pkgs/ccid.nix b/pkgs/ccid.nix new file mode 100644 index 0000000..1018d84 --- /dev/null +++ b/pkgs/ccid.nix @@ -0,0 +1,84 @@ +{ + lib, + stdenv, + fetchurl, + flex, + gitUpdater, + libusb1, + meson, + ninja, + pcsclite, + perl, + pkg-config, + zlib, +}: +stdenv.mkDerivation rec { + pname = "ccid"; + version = "1.6.1"; + + src = fetchurl { + url = "https://ccid.apdu.fr/files/${pname}-${version}.tar.xz"; + hash = "sha256-LsqPsH6P58DTna6sp7l81zxA7Ztyc4okrT3L38kY4eo="; + }; + + postPatch = '' + patchShebangs . + substituteInPlace meson.build --replace-fail \ + "pcsc_dep.get_variable('usbdropdir')" \ + "'$out/pcsc/drivers'" + ''; + + mesonFlags = [ + (lib.mesonBool "serial" true) + ]; + + # error: call to undeclared function 'InterruptRead'; + # ISO C99 and later do not support implicit function declarations + env = lib.optionalAttrs stdenv.cc.isClang { + NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration"; + }; + + nativeBuildInputs = [ + flex + perl + pkg-config + meson + ninja + ]; + + buildInputs = [ + libusb1 + pcsclite + zlib + ]; + + postInstall = '' + install -Dm 0444 -t $out/lib/udev/rules.d ../src/92_pcscd_ccid.rules + substituteInPlace $out/lib/udev/rules.d/92_pcscd_ccid.rules \ + --replace-fail "/usr/sbin/pcscd" "${pcsclite}/bin/pcscd" + ''; + + # The resulting shared object ends up outside of the default paths which are + # usually getting stripped. + stripDebugList = ["pcsc"]; + + passthru.updateScript = gitUpdater { + url = "https://salsa.debian.org/rousseau/CCID.git"; + }; + + installCheckPhase = '' + [ -f $out/etc/reader.conf.d/libccidtwin ] + [ -f $out/lib/udev/rules.d/92_pcscd_ccid.rules ] + [ -f $out/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist ] + [ -f $out/pcsc/drivers/ifd-ccid.bundle/Contents/Linux/libccid.so ] + [ -f $out/pcsc/drivers/serial/libccidtwin.so ] + ''; + + meta = with lib; { + description = "PC/SC driver for USB CCID smart card readers"; + homepage = "https://ccid.apdu.fr/"; + license = licenses.lgpl21Plus; + maintainers = [maintainers.anthonyroussel]; + platforms = platforms.unix; + }; +} diff --git a/pkgs/default.nix b/pkgs/default.nix index 44fc3e1..c99fb5b 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -8,6 +8,7 @@ _inputs: [ segoe-ui-ttf = prev.callPackage ./segoe-ui-ttf.nix {}; zsh-histdb-skim = prev.callPackage ./zsh-skim-histdb.nix {}; actual-server = prev.callPackage ./actual-server.nix {}; + ccid = prev.callPackage ./ccid.nix {}; neovim-clean = prev.neovim-unwrapped.overrideAttrs (old: { nativeBuildInputs = (old.nativeBuildInputs or []) ++ [prev.makeWrapper]; postInstall = diff --git a/users/myuser/default.nix b/users/myuser/default.nix index e48ea44..6304c5a 100644 --- a/users/myuser/default.nix +++ b/users/myuser/default.nix @@ -57,9 +57,9 @@ in # Autostart hyprland if on tty1 (once, don't restart after logout) programs.zsh.initExtra = lib.mkOrder 9999 '' - if [[ -t 0 && "$(tty || true)" == /dev/tty1 && -z "$DISPLAY" && -z "$WAYLAND_DISPLAY" ]]; then - echo "Login shell detected. Starting hyprland..." - dbus-run-session Hyprland + if [[ -t 0 && "$(tty || true)" == /dev/tty1 && -z "$DISPLAY" && -z "$WAYLAND_DISPLAY" ]] && uwsm check may-start; then + echo "Login shell detected. Starting Hyprland..." + uwsm start -S -F Hyprland fi ''; }; diff --git a/users/myuser/graphical/hyprland.nix b/users/myuser/graphical/hyprland.nix index 22347db..d1f3dae 100644 --- a/users/myuser/graphical/hyprland.nix +++ b/users/myuser/graphical/hyprland.nix @@ -49,7 +49,7 @@ in { bind = [ - "SUPER + CTRL + SHIFT,q,exit" + "SUPER + CTRL + SHIFT,q,exec,uwsm stop" # Applications "SUPER,code:49,exec,${rofi-drun}" # SUPER+^ @@ -123,12 +123,10 @@ in { decoration.rounding = 4; exec-once = [ - "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" - "systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" - "systemctl --user restart xdg-desktop-portal.service" - "${pkgs.waybar}/bin/waybar" - "${pkgs.swaynotificationcenter}/bin/swaync" - "${lib.getExe pkgs.whisper-overlay}" + "uwsm finalize" + # "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" + # "systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" + # "systemctl --user restart xdg-desktop-portal.service" ]; input = { diff --git a/users/myuser/graphical/swaync.nix b/users/myuser/graphical/swaync.nix index c95b907..2778fe0 100644 --- a/users/myuser/graphical/swaync.nix +++ b/users/myuser/graphical/swaync.nix @@ -86,7 +86,4 @@ ) + (builtins.readFile ./swaync-style.css); }; - - # Started via hyprland to ensure it restarts properly with hyprland - systemd.user.services.swaync.Install.WantedBy = lib.mkForce []; } diff --git a/users/myuser/graphical/swww.nix b/users/myuser/graphical/swww.nix index a41a42d..89de0fa 100644 --- a/users/myuser/graphical/swww.nix +++ b/users/myuser/graphical/swww.nix @@ -28,6 +28,7 @@ in { Unit = { Description = "Wayland wallpaper daemon"; PartOf = ["graphical-session.target"]; + After = ["graphical-session.target"]; }; Service = { ExecStart = "${pkgs.swww}/bin/swww-daemon"; diff --git a/users/myuser/graphical/waybar.nix b/users/myuser/graphical/waybar.nix index 576bfda..06d53d3 100644 --- a/users/myuser/graphical/waybar.nix +++ b/users/myuser/graphical/waybar.nix @@ -5,8 +5,7 @@ }: { programs.waybar = { enable = true; - # Started via hyprland to ensure it restarts properly with hyprland - systemd.enable = false; + systemd.enable = true; style = ./waybar-style.css; settings.main = { layer = "top"; @@ -246,4 +245,9 @@ }; }; }; + + systemd.user.services.waybar = { + Unit.After = ["graphical-session.target"]; + Service.Slice = ["app-graphical.slice"]; + }; }