commit 0df1237eb27f6d1350b8e05a5fab8057a27ccb7d Author: Lucy von Overheidt Date: Tue Sep 9 18:03:42 2025 +0200 init diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..9912fbf --- /dev/null +++ b/configuration.nix @@ -0,0 +1,137 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page, on +# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). + +{ config +, lib +, pkgs +, ... +}: + +{ + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "twinkpad"; # Define your hostname. + # Pick only one of the below networking options. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + + # Set your time zone. + time.timeZone = "Europe/Berlin"; + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Select internationalisation properties. + # i18n.defaultLocale = "en_US.UTF-8"; + # console = { + # font = "Lat2-Terminus16"; + # keyMap = "us"; + # useXkbConfig = true; # use xkb.options in tty. + # }; + + # Enable the X11 windowing system. + services.xserver.enable = true; + + # Enable the GNOME Desktop Environment. + services.xserver.displayManager.gdm.enable = true; + programs.niri.enable = true; + + # Configure keymap in X11 + # services.xserver.xkb.layout = "us"; + # services.xserver.xkb.options = "eurosign:e,caps:escape"; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable sound. + # services.pulseaudio.enable = true; + # OR + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + + }; + + # make pipewire realtime-capable + security.rtkit.enable = true; + + # Enable touchpad support (enabled default in most desktopManager). + # services.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.mutableUsers = false; + users.users.lucy = { + initialHashedPassword = "$6$QX95LTUGi55mFQOZ$j19/LuGvMeWOBCp/oEOLWDU5rcrEfD9/2AQ3sW1OVMROMJEFpg/hTrWKnOgIUfzWtF32wUxNlThXIJm8YWJwZ."; + isNormalUser = true; + extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. + packages = with pkgs; [ + tree + ]; + }; + + programs.firefox.enable = true; + + # List packages installed in system profile. + # You can use https://search.nixos.org/ to find more packages (and options). + environment.systemPackages = with pkgs; [ + vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + wget + ]; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + programs.mtr.enable = true; + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + # services.openssh.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # Copy the NixOS configuration file and link it from the resulting system + # (/run/current-system/configuration.nix). This is useful in case you + # accidentally delete configuration.nix. + # system.copySystemConfiguration = true; + + # This option defines the first version of NixOS you have installed on this particular machine, + # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions. + # + # Most users should NEVER change this value after the initial install, for any reason, + # even if you've upgraded your system to a new NixOS release. + # + # This value does NOT affect the Nixpkgs version your packages and OS are pulled from, + # so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how + # to actually do that. + # + # This value being lower than the current NixOS release does NOT mean your system is + # out of date, out of support, or vulnerable. + # + # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration, + # and migrated your data accordingly. + # + # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . + system.stateVersion = "25.05"; # Did you read the comment? + + nixpkgs.config.allowUnfree = true; + +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..b568bd3 --- /dev/null +++ b/flake.lock @@ -0,0 +1,547 @@ +{ + "nodes": { + "c3d2-user-module": { + "inputs": { + "nixos-modules": "nixos-modules", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1754772133, + "narHash": "sha256-bGKm5L9ZzPzqKAK0Sp4l/nz/XOQnTkDhZWemHYytwvg=", + "ref": "refs/heads/master", + "rev": "cc347c4545cd8b8add0f3fc43d593f2ffcecfdef", + "revCount": 143, + "type": "git", + "url": "https://gitea.c3d2.de/C3D2/nix-user-module.git" + }, + "original": { + "type": "git", + "url": "https://gitea.c3d2.de/C3D2/nix-user-module.git" + } + }, + "determinate": { + "inputs": { + "determinate-nixd-aarch64-darwin": "determinate-nixd-aarch64-darwin", + "determinate-nixd-aarch64-linux": "determinate-nixd-aarch64-linux", + "determinate-nixd-x86_64-darwin": [ + "determinate", + "determinate-nixd-aarch64-darwin" + ], + "determinate-nixd-x86_64-linux": "determinate-nixd-x86_64-linux", + "nix": "nix", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1757033802, + "narHash": "sha256-BLUHtWWoHFR6UJJJwkmivSv7RTjo92wlT0Y7kbCd2MY=", + "rev": "e154f8433851f8f2509490f33680e3285d553df4", + "revCount": 301, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/determinate/3.11.1/01991762-b4e5-7a3b-8bfc-5d0f1ed4965e/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/DeterminateSystems/determinate/%2A" + } + }, + "determinate-nixd-aarch64-darwin": { + "flake": false, + "locked": { + "narHash": "sha256-Dym4kTLMTxAxNyZcrHRKRVMBINQPA7qgr+7dHozNrps=", + "type": "file", + "url": "https://install.determinate.systems/determinate-nixd/tag/v3.11.1/macOS" + }, + "original": { + "type": "file", + "url": "https://install.determinate.systems/determinate-nixd/tag/v3.11.1/macOS" + } + }, + "determinate-nixd-aarch64-linux": { + "flake": false, + "locked": { + "narHash": "sha256-eYVSpk+ly2YRSYvgT47ABmFRwG0DliNO/8ntBkoRmjI=", + "type": "file", + "url": "https://install.determinate.systems/determinate-nixd/tag/v3.11.1/aarch64-linux" + }, + "original": { + "type": "file", + "url": "https://install.determinate.systems/determinate-nixd/tag/v3.11.1/aarch64-linux" + } + }, + "determinate-nixd-x86_64-linux": { + "flake": false, + "locked": { + "narHash": "sha256-ZvRoKG/v0WS2XrDgkV+/hq3ARGokGisyelncKwlefvk=", + "type": "file", + "url": "https://install.determinate.systems/determinate-nixd/tag/v3.11.1/x86_64-linux" + }, + "original": { + "type": "file", + "url": "https://install.determinate.systems/determinate-nixd/tag/v3.11.1/x86_64-linux" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "determinate", + "nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1748821116, + "narHash": "sha256-F82+gS044J1APL0n4hH50GYdPRv/5JWm34oCJYmVKdE=", + "rev": "49f0870db23e8c1ca0b5259734a02cd9e1e371a1", + "revCount": 377, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/hercules-ci/flake-parts/0.1.377%2Brev-49f0870db23e8c1ca0b5259734a02cd9e1e371a1/01972f28-554a-73f8-91f4-d488cc502f08/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/hercules-ci/flake-parts/0.1" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "git-hooks-nix": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": [ + "determinate", + "nix" + ], + "nixpkgs": [ + "determinate", + "nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1747372754, + "narHash": "sha256-2Y53NGIX2vxfie1rOW0Qb86vjRZ7ngizoo+bnXU9D9k=", + "rev": "80479b6ec16fefd9c1db3ea13aeb038c60530f46", + "revCount": 1026, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/cachix/git-hooks.nix/0.1.1026%2Brev-80479b6ec16fefd9c1db3ea13aeb038c60530f46/0196d79a-1b35-7b8e-a021-c894fb62163d/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/cachix/git-hooks.nix/0.1.941" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1757385184, + "narHash": "sha256-LCxtQn9ajvOgGRbQIRUJgfP7clMGGvV1SDW1HcSb0zk=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "26993d87fd0d3b14f7667b74ad82235f120d986e", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "niri": { + "inputs": { + "niri-stable": "niri-stable", + "niri-unstable": "niri-unstable", + "nixpkgs": "nixpkgs_4", + "nixpkgs-stable": "nixpkgs-stable", + "xwayland-satellite-stable": "xwayland-satellite-stable", + "xwayland-satellite-unstable": "xwayland-satellite-unstable" + }, + "locked": { + "lastModified": 1757423134, + "narHash": "sha256-CZpxYEwjxLDdF1xGtrPJU2DX8k7Q5ajDBjBrjlEswik=", + "owner": "sodiboo", + "repo": "niri-flake", + "rev": "11d325391d1bbb4bb8f49010959f54bb1f6038b4", + "type": "github" + }, + "original": { + "owner": "sodiboo", + "repo": "niri-flake", + "type": "github" + } + }, + "niri-stable": { + "flake": false, + "locked": { + "lastModified": 1756556321, + "narHash": "sha256-RLD89dfjN0RVO86C/Mot0T7aduCygPGaYbog566F0Qo=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "01be0e65f4eb91a9cd624ac0b76aaeab765c7294", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "ref": "v25.08", + "repo": "niri", + "type": "github" + } + }, + "niri-unstable": { + "flake": false, + "locked": { + "lastModified": 1757358784, + "narHash": "sha256-UNeUJW3c10z0aMJ87QKS85C/JgK9ng6pdRS0EwY6OLg=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "bdee1a657699a77bc4cdb050f7355f37f64c45a6", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "repo": "niri", + "type": "github" + } + }, + "nix": { + "inputs": { + "flake-parts": "flake-parts", + "git-hooks-nix": "git-hooks-nix", + "nixpkgs": "nixpkgs_2", + "nixpkgs-23-11": "nixpkgs-23-11", + "nixpkgs-regression": "nixpkgs-regression" + }, + "locked": { + "lastModified": 1757029043, + "narHash": "sha256-/XtKs/hpYXJPeT3WppFVFZH1WvPDmeTt11hMWt/Bwas=", + "rev": "7143558a0989008c8e08cc27c3cb6a031f30b356", + "revCount": 22309, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/nix-src/3.11.1/01991737-661d-7932-b7c9-d3a0499b4c3f/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/DeterminateSystems/nix-src/%2A" + } + }, + "nix-index-db": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1757218147, + "narHash": "sha256-IwOwN70HvoBNB2ckaROxcaCvj5NudNc52taPsv5wtLk=", + "owner": "Mic92", + "repo": "nix-index-database", + "rev": "9b144dc3ef6e42b888c4190e02746aab13b0e97f", + "type": "github" + }, + "original": { + "owner": "Mic92", + "repo": "nix-index-database", + "type": "github" + } + }, + "nixos-hardware": { + "locked": { + "lastModified": 1757103352, + "narHash": "sha256-PtT7ix43ss8PONJ1VJw3f6t2yAoGH+q462Sn8lrmWmk=", + "owner": "NixOS", + "repo": "nixos-hardware", + "rev": "11b2a10c7be726321bb854403fdeec391e798bf0", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "master", + "repo": "nixos-hardware", + "type": "github" + } + }, + "nixos-modules": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "c3d2-user-module", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1748287559, + "narHash": "sha256-dvUE9HGwzEXyv6G7LuZFQCmRYFuXLJBO4+crCTxe5zs=", + "owner": "NuschtOS", + "repo": "nixos-modules", + "rev": "9ae063877f8c5d42c39b739ae1d00f9657ad17f4", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "repo": "nixos-modules", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1749143949, + "narHash": "sha256-QuUtALJpVrPnPeozlUG/y+oIMSLdptHxb3GK6cpSVhA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d3d2d80a2191a73d1e86456a751b83aa13085d7d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-23-11": { + "locked": { + "lastModified": 1717159533, + "narHash": "sha256-oamiKNfr2MS6yH64rUn99mIZjc45nGJlj9eGth/3Xuw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a62e6edd6d5e1fa0329b8653c801147986f8d446", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a62e6edd6d5e1fa0329b8653c801147986f8d446", + "type": "github" + } + }, + "nixpkgs-regression": { + "locked": { + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1757341549, + "narHash": "sha256-fRnT+bwP1sB6ne7BLw4aXkVYjr+QCZZ+e4MhbokHyd4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9d1fa9fa266631335618373f8faad570df6f9ede", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1755922037, + "narHash": "sha256-wY1+2JPH0ZZC4BQefoZw/k+3+DowFyfOxv17CN/idKs=", + "rev": "b1b3291469652d5a2edb0becc4ef0246fff97a7c", + "revCount": 808723, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2505.808723%2Brev-b1b3291469652d5a2edb0becc4ef0246fff97a7c/0198daf7-011a-7703-95d7-57146e794342/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/NixOS/nixpkgs/0.2505" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1756696532, + "narHash": "sha256-6FWagzm0b7I/IGigOv9pr6LL7NQ86mextfE8g8Q6HBg=", + "rev": "58dcbf1ec551914c3756c267b8b9c8c86baa1b2f", + "revCount": 854745, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.854745%2Brev-58dcbf1ec551914c3756c267b8b9c8c86baa1b2f/019908ed-e731-796e-b7c5-ea173f5d3b8d/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/DeterminateSystems/nixpkgs-weekly/0.1" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1757347588, + "narHash": "sha256-tLdkkC6XnsY9EOZW9TlpesTclELy8W7lL2ClL+nma8o=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b599843bad24621dcaa5ab60dac98f9b0eb1cabe", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_5": { + "locked": { + "lastModified": 1757347588, + "narHash": "sha256-tLdkkC6XnsY9EOZW9TlpesTclELy8W7lL2ClL+nma8o=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "b599843bad24621dcaa5ab60dac98f9b0eb1cabe", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "quickshell": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1756981260, + "narHash": "sha256-GhuD9QVimjynHI0OOyZsqJsnlXr2orowh9H+HYz4YMs=", + "ref": "refs/heads/master", + "rev": "6eb12551baf924f8fdecdd04113863a754259c34", + "revCount": 672, + "type": "git", + "url": "https://git.outfoxxed.me/quickshell/quickshell" + }, + "original": { + "type": "git", + "url": "https://git.outfoxxed.me/quickshell/quickshell" + } + }, + "root": { + "inputs": { + "c3d2-user-module": "c3d2-user-module", + "determinate": "determinate", + "home-manager": "home-manager", + "niri": "niri", + "nix-index-db": "nix-index-db", + "nixos-hardware": "nixos-hardware", + "nixpkgs": "nixpkgs_5", + "quickshell": "quickshell", + "treefmt-nix": "treefmt-nix" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1756662192, + "narHash": "sha256-F1oFfV51AE259I85av+MAia221XwMHCOtZCMcZLK2Jk=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "1aabc6c05ccbcbf4a635fb7a90400e44282f61c4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "xwayland-satellite-stable": { + "flake": false, + "locked": { + "lastModified": 1755491097, + "narHash": "sha256-m+9tUfsmBeF2Gn4HWa6vSITZ4Gz1eA1F5Kh62B0N4oE=", + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "rev": "388d291e82ffbc73be18169d39470f340707edaa", + "type": "github" + }, + "original": { + "owner": "Supreeeme", + "ref": "v0.7", + "repo": "xwayland-satellite", + "type": "github" + } + }, + "xwayland-satellite-unstable": { + "flake": false, + "locked": { + "lastModified": 1757179758, + "narHash": "sha256-TIvyWzRt1miQj6Cf5Wy8Qz43XIZX7c4vTVwRLAT5S4Y=", + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "rev": "970728d0d9d1eada342bb8860af214b601139e58", + "type": "github" + }, + "original": { + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..9cd4078 --- /dev/null +++ b/flake.nix @@ -0,0 +1,135 @@ +{ + description = "A very basic flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + c3d2-user-module.url = "git+https://gitea.c3d2.de/C3D2/nix-user-module.git"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + niri.url = "github:sodiboo/niri-flake"; + nixos-hardware.url = "github:NixOS/nixos-hardware/master"; + treefmt-nix = { + url = "github:numtide/treefmt-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + determinate.url = "https://flakehub.com/f/DeterminateSystems/determinate/*"; + nix-index-db = { + url = "github:Mic92/nix-index-database"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + quickshell = { + url = "git+https://git.outfoxxed.me/quickshell/quickshell"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = + inputs@{ self + , nixpkgs + , c3d2-user-module + , home-manager + , niri + , nixos-hardware + , treefmt-nix + , determinate + , nix-index-db + , quickshell + , + }: + let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + + # Configure treefmt + treefmtEval = treefmt-nix.lib.evalModule pkgs { + projectRootFile = "flake.nix"; + programs = { + nixpkgs-fmt.enable = true; + prettier = { + enable = true; + includes = [ + "*.json" + "*.yaml" + "*.yml" + ]; + }; + taplo.enable = true; + }; + + settings = { + global.excludes = [ + "*.lock" + "result" + ".git/" + "*.md" + "*.sh" + "*.py" + "*.js" + "*.ts" + ]; + }; + }; + in + { + nixosConfigurations.p50 = nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs; }; + system = "x86_64-linux"; + modules = [ + niri.nixosModules.niri + nixos-hardware.nixosModules.lenovo-thinkpad-p50 + ./configuration.nix + determinate.nixosModules.default + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.lucy = + { config + , pkgs + , lib + , inputs + , ... + }: + { + imports = [ + ./modules/home.nix + ]; + + # Configure dconf settings here or inside home.nix + # Example: + # home.sessionVariables = { + # XDG_CURRENT_DESKTOP = "GNOME"; + # }; + }; + } + c3d2-user-module.nixosModule + ./modules/nix.nix + ./modules/fonts.nix + ]; + }; + + # Add treefmt formatter + formatter.${system} = treefmtEval.config.build.wrapper; + + # Optional: Add a dev shell with treefmt + devShells.${system}.default = pkgs.mkShell { + buildInputs = with pkgs; [ + git + treefmtEval.config.build.wrapper + ]; + + shellHook = '' + echo "Development shell loaded!" + echo "Run 'nix fmt' to format all files" + echo "Run 'treefmt' to format with treefmt directly" + ''; + }; + + # Optional: Add formatting check + checks.${system} = { + formatting = treefmtEval.config.build.check self; + }; + }; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..7733ebc --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,65 @@ +# 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" "uas" "usbhid" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { + device = "none"; + fsType = "tmpfs"; + options = [ "defaults" "size=8G" "mode=755" ]; + }; + + fileSystems."/boot" = + { + device = "/dev/disk/by-uuid/0777-71C3"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + fileSystems."/nix" = + { + device = "/dev/disk/by-uuid/3a8c6986-3105-4f1f-a75b-f72e4ec5ecdc"; + fsType = "ext4"; + }; + + boot.initrd.luks.devices."nix".device = "/dev/disk/by-uuid/439beee9-6797-41bc-bc4f-01bfe1a75166"; + + fileSystems."/etc/nixos" = + { + device = "/nix/persist/etc/nixos"; + fsType = "none"; + options = [ "bind" ]; + }; + + fileSystems."/var/log" = + { + device = "/nix/persist/var/log"; + fsType = "none"; + options = [ "bind" ]; + }; + + 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.enp0s31f6.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/modules/alacritty.nix b/modules/alacritty.nix new file mode 100644 index 0000000..2f4c0a6 --- /dev/null +++ b/modules/alacritty.nix @@ -0,0 +1,49 @@ +{ ... }: { + programs.alacritty.enable = true; + programs.alacritty.settings = { + window.opacity = 0.8; + colors.bright = { + black = "#444b6a"; + blue = "#7da6ff"; + cyan = "#0db9d7"; + green = "#b9f27c"; + magenta = "#bb9af7"; + red = "#ff7a93"; + white = "#acb0d0"; + yellow = "#ff9e64"; + }; + colors.normal = { + black = "#32344a"; + blue = "#7aa2f7"; + cyan = "#449dab"; + green = "#9ece6a"; + magenta = "#ad8ee6"; + red = "#f7768e"; + white = "#787c99"; + yellow = "#e0af68"; + }; + colors.primary = { + background = "#1a1b26"; + foreground = "#a9b1d6"; + }; + font = { + normal = { + family = "Iosevka"; + style = "Regular"; + }; + bold = { + family = "Iosevka"; + style = "Bold"; + }; + italic = { + family = "Iosevka"; + style = "Italic"; + }; + bold_italic = { + family = "Iosevka"; + style = "Bold Italic"; + }; + size = 18.0; # Adjust the font size as needed + }; + }; +} diff --git a/modules/fonts.nix b/modules/fonts.nix new file mode 100644 index 0000000..870bb4c --- /dev/null +++ b/modules/fonts.nix @@ -0,0 +1,7 @@ +{ pkgs, ... }: +{ + fonts.packages = with pkgs; [ + iosevka + comic-mono + ]; +} diff --git a/modules/gammastep.nix b/modules/gammastep.nix new file mode 100644 index 0000000..6cf1c86 --- /dev/null +++ b/modules/gammastep.nix @@ -0,0 +1,27 @@ +{ pkgs, ... }: +{ + services.gammastep = { + enable = true; + package = pkgs.gammastep.override { + withRandr = false; + withDrm = false; + withVidmode = false; + withAppIndicator = false; + }; + + latitude = "-34.58"; + longitude = "-58.64"; + provider = "manual"; + temperature = { + day = 5500; + night = 3500; + }; + settings = { + general = { + brightness-day = 1.0; + brightness-night = 0.5; + adjustment-method = "wayland"; + }; + }; + }; +} diff --git a/modules/helix.nix b/modules/helix.nix new file mode 100644 index 0000000..239c194 --- /dev/null +++ b/modules/helix.nix @@ -0,0 +1,30 @@ +{ lib, pkgs, ... }: { + programs.helix = { + enable = true; + settings = { + theme = "autumn_night_transparent"; + editor.cursor-shape = { + normal = "block"; + insert = "bar"; + select = "underline"; + }; + }; + languages = { + language = [{ + name = "nix"; + auto-format = true; + formatter.command = "${pkgs.nixfmt}/bin/nixfmt"; + language-servers = [ "nixd" ]; + }]; + language-server.nixd = { command = lib.getExe pkgs.nixd; }; + }; + themes = { + autumn_night_transparent = { + "inherits" = "autumn_night"; + "ui.background" = { }; + }; + }; + extraPackages = with pkgs; [ nil rust-analyzer gopls ]; + }; + +} diff --git a/modules/home.nix b/modules/home.nix new file mode 100644 index 0000000..6175dde --- /dev/null +++ b/modules/home.nix @@ -0,0 +1,164 @@ +{ + config, + pkgs, + inputs, + ... +}: +{ + imports = [ + ./helix.nix + ./alacritty.nix + ./nushell.nix + ./waybar.nix + ./niri + ./quickshell.nix + ./gammastep.nix + ./hypridle.nix + ]; + + # TODO please change the username & home directory to your own + home.username = "lucy"; + home.homeDirectory = "/home/${config.home.username}"; + # link the configuration file in current directory to the specified location in home directory + # home.file.".config/i3/wallpaper.jpg".source = ./wallpaper.jpg; + + # link all files in `./scripts` to `~/.config/i3/scripts` + # home.file.".config/i3/scripts" = { + # source = ./scripts; + # recursive = true; # link recursively + # executable = true; # make all files executable + # }; + + # encode the file content in nix configuration file directly + # home.file.".xxx".text = '' + # xxx + # ''; + + manual = { + html.enable = false; + json.enable = false; + manpages.enable = false; + }; + + programs.nix-index = { + enable = true; + }; + /* + stylix = { + enable = true; + polarity = "dark"; + opacity = { + popups = 1.0; + terminal = 1.0; + }; + + fonts = { + serif = config.stylix.fonts.sansSerif; + sansSerif = { + package = pkgs.adwaita-fonts; + name = "Adwaita Sans"; + }; + + monospace = { + package = pkgs.nerd-fonts.geist-mono; + name = "Geist Nerd Font Mono"; + }; + + emoji = { + package = pkgs.noto-fonts-emoji; + name = "Noto Color Emoji"; + }; + }; + }; + */ + # set cursor size and dpi for 4k monitor + + # Packages that should be installed to the user profile. + home.packages = with pkgs; [ + # here is some command line tools I use frequently + # feel free to add your own or remove some of them + + aerc + + hyfetch + nnn # terminal file manager + + prismlauncher + + # archives + zip + xz + unzip + p7zip + + # utils + ripgrep # recursively searches directories for a regex pattern + jq # A lightweight and flexible command-line JSON processor + yq-go # yaml processor https://github.com/mikefarah/yq + eza # A modern replacement for ‘ls’ + fzf # A command-line fuzzy finder + + # networking tools + mtr # A network diagnostic tool + iperf3 + dnsutils # `dig` + `nslookup` + ldns # replacement of `dig`, it provide the command `drill` + aria2 # A lightweight multi-protocol & multi-source command-line download utility + socat # replacement of openbsd-netcat + nmap # A utility for network discovery and security auditing + ipcalc # it is a calculator for the IPv4/v6 addresses + + # misc + cowsay + file + which + tree + gnused + gnutar + gawk + zstd + gnupg + + # nix related + # + # it provides the command `nom` works just like `nix` + # with more details log output + nix-output-monitor + + # productivity + hugo # static site generator + glow # markdown previewer in terminal + + btop # replacement of htop/nmon + iotop # io monitoring + iftop # network monitoring + + # system call monitoring + strace # system call monitoring + ltrace # library call monitoring + lsof # list open files + + # system tools + sysstat + lm_sensors # for `sensors` command + ethtool + pciutils # lspci + usbutils # lsusb + + tcsh + fuzzel + seatd + jaq + ]; + # basic configuration of git, please change to your own + programs.git = { + enable = true; + userName = "Lucy von Overheidt"; + userEmail = "git@lucy.giving"; + }; + + home.stateVersion = "24.11"; + + programs.home-manager.enable = true; + +} diff --git a/modules/hypridle.nix b/modules/hypridle.nix new file mode 100644 index 0000000..706aa59 --- /dev/null +++ b/modules/hypridle.nix @@ -0,0 +1,44 @@ +{ + pkgs, + lib, + config, + ... +}: +let + lock = "${pkgs.systemd}/bin/loginctl lock-session"; + + brillo = lib.getExe pkgs.brillo; + + # timeout after which DPMS kicks in + timeout = 300; +in +{ + # screen idle + services.hypridle = { + enable = true; + + settings = { + general.lock_cmd = lib.getExe config.programs.hyprlock.package; + + listener = [ + { + timeout = timeout - 10; + # save the current brightness and dim the screen over a period of + # 500 ms + on-timeout = "${brillo} -O; ${brillo} -u 500000 -S 10"; + # brighten the screen over a period of 250ms to the saved value + on-resume = "${brillo} -I -u 250000"; + } + { + inherit timeout; + } + { + timeout = timeout + 10; + on-timeout = lock; + } + ]; + }; + }; + + systemd.user.services.hypridle.Unit.After = lib.mkForce "graphical-session.target"; +} diff --git a/modules/niri/binds.nix b/modules/niri/binds.nix new file mode 100644 index 0000000..2fa6aa9 --- /dev/null +++ b/modules/niri/binds.nix @@ -0,0 +1,144 @@ +{ config, pkgs, ... }: + +let + lib = pkgs.lib; + qs = "${pkgs.quickshell}/bin/qs"; + + # Niri built-in actions + inherit (config.lib.niri.actions) + spawn + close-window + maximize-column + screenshot-window + screenshot + focus-column-left + focus-column-right + focus-workspace-up + focus-workspace-down + ; + + # Helper to call QuickShell + qsCall = + args: + spawn ( + [ + qs + "-c" + "DankMaterialShell" + "ipc" + "call" + ] + ++ args + ); + + # Generate workspace focus binds (Mod+1 to Mod+9) + wsBinds = builtins.listToAttrs ( + builtins.genList (i: { + name = "Mod+${toString (i + 1)}"; + value.action.focus-workspace = i + 1; + }) 9 + ); + +in +{ + programs.niri.settings.binds = lib.mkMerge [ + # --- Static Keybindings --- + { + # --- Media Keys --- + + # --- Audio / Brightness --- + "XF86AudioMute" = { + allow-when-locked = true; + action = qsCall [ + "audio" + "mute" + ]; + }; + "XF86AudioMicMute" = { + allow-when-locked = true; + action = qsCall [ + "audio" + "micmute" + ]; + }; + "XF86AudioRaiseVolume" = { + allow-when-locked = true; + action = qsCall [ + "audio" + "increment" + "5" + ]; + }; + "XF86AudioLowerVolume" = { + allow-when-locked = true; + action = qsCall [ + "audio" + "decrement" + "5" + ]; + }; + "XF86MonBrightnessUp" = { + allow-when-locked = true; + action = qsCall [ + "brightness" + "increment" + "5" + "amdgpu_bl1" + ]; + }; + "XF86MonBrightnessDown" = { + allow-when-locked = true; + action = qsCall [ + "brightness" + "decrement" + "5" + "amdgpu_bl1" + ]; + }; + + # --- System Actions --- + "Ctrl+Alt+L".action = qsCall [ + "lock" + "lock" + ]; + "Mod+V".action = qsCall [ + "clipboard" + "toggle" + ]; + "Mod+U".action = qsCall [ + "settings" + "toggle" + ]; + "Mod+M".action = qsCall [ + "processlist" + "toggle" + ]; + + # --- Screenshots --- + "Print".action.screenshot-screen = { + write-to-disk = true; + }; + "Mod+Shift+Alt+S".action = screenshot-window; + "Mod+Shift+S".action.screenshot = { + show-pointer = false; + }; + + # --- Launchers --- + "Mod+D".action = spawn (lib.getExe pkgs.fuzzel); + "Mod+Return".action = spawn (lib.getExe pkgs.alacritty); + + # --- Window / Layout --- + "Mod+W".action = close-window; + "Mod+F".action = maximize-column; + + # --- Navigation --- + "Mod+Left".action = focus-column-left; + "Mod+Right".action = focus-column-right; + "Mod+Down".action = focus-workspace-down; + "Mod+Up".action = focus-workspace-up; + } + + # --- Dynamic Workspace Binds --- + wsBinds + ]; +} diff --git a/modules/niri/default.nix b/modules/niri/default.nix new file mode 100644 index 0000000..9687634 --- /dev/null +++ b/modules/niri/default.nix @@ -0,0 +1,8 @@ +{ inputs, pkgs, ... }: +{ + imports = [ + ./settings.nix + ./binds.nix + ./rules.nix + ]; +} diff --git a/modules/niri/rules.nix b/modules/niri/rules.nix new file mode 100644 index 0000000..1781146 --- /dev/null +++ b/modules/niri/rules.nix @@ -0,0 +1,249 @@ +_: +let + windowRules = [ + { + geometry-corner-radius = + let + radius = 12.0; + in + { + bottom-left = radius; + bottom-right = radius; + top-left = radius; + top-right = radius; + }; + clip-to-geometry = true; + draw-border-with-background = false; + } + { + matches = [ + { is-floating = true; } + ]; + shadow.enable = true; + } + { + matches = [ + { + is-window-cast-target = true; + } + ]; + focus-ring = { + active.color = "#f38ba8"; + inactive.color = "#7d0d2d"; + }; + border = { + inactive.color = "#7d0d2d"; + }; + shadow = { + color = "#7d0d2d70"; + }; + tab-indicator = { + active.color = "#f38ba8"; + inactive.color = "#7d0d2d"; + }; + } + { + matches = [{ app-id = "org.telegram.desktop"; }]; + block-out-from = "screencast"; + } + { + matches = [{ app-id = "app.drey.PaperPlane"; }]; + block-out-from = "screencast"; + } + { + matches = [ + { app-id = "zen"; } + { app-id = "firefox"; } + { app-id = "chromium-browser"; } + { app-id = "xdg-desktop-portal-gtk"; } + ]; + scroll-factor = 0.5; + } + { + matches = [ + { app-id = "zen"; } + { app-id = "firefox"; } + { app-id = "chromium-browser"; } + { app-id = "edge"; } + ]; + open-maximized = true; + } + { + matches = [ + { + app-id = "firefox"; + title = "Picture-in-Picture"; + } + ]; + open-floating = true; + default-floating-position = { + x = 32; + y = 32; + relative-to = "bottom-right"; + }; + default-column-width = { + fixed = 480; + }; + default-window-height = { + fixed = 270; + }; + } + { + matches = [ + { + app-id = "zen"; + title = "Picture-in-Picture"; + } + ]; + open-floating = true; + default-floating-position = { + x = 32; + y = 32; + relative-to = "bottom-right"; + }; + default-column-width = { + fixed = 480; + }; + default-window-height = { + fixed = 270; + }; + } + { + matches = [{ title = "Picture in picture"; }]; + open-floating = true; + default-floating-position = { + x = 32; + y = 32; + relative-to = "bottom-right"; + }; + } + { + matches = [{ title = "Discord Popout"; }]; + open-floating = true; + default-floating-position = { + x = 32; + y = 32; + relative-to = "bottom-right"; + }; + } + { + matches = [{ app-id = "pavucontrol"; }]; + open-floating = true; + } + { + matches = [{ app-id = "pavucontrol-qt"; }]; + open-floating = true; + } + { + matches = [{ app-id = "com.saivert.pwvucontrol"; }]; + open-floating = true; + } + { + matches = [{ app-id = "io.github.fsobolev.Cavalier"; }]; + open-floating = true; + } + { + matches = [{ app-id = "dialog"; }]; + open-floating = true; + } + { + matches = [{ app-id = "popup"; }]; + open-floating = true; + } + { + matches = [{ app-id = "task_dialog"; }]; + open-floating = true; + } + { + matches = [{ app-id = "gcr-prompter"; }]; + open-floating = true; + } + { + matches = [{ app-id = "file-roller"; }]; + open-floating = true; + } + { + matches = [{ app-id = "org.gnome.FileRoller"; }]; + open-floating = true; + } + { + matches = [{ app-id = "nm-connection-editor"; }]; + open-floating = true; + } + { + matches = [{ app-id = "blueman-manager"; }]; + open-floating = true; + } + { + matches = [{ app-id = "xdg-desktop-portal-gtk"; }]; + open-floating = true; + } + { + matches = [{ app-id = "org.kde.polkit-kde-authentication-agent-1"; }]; + open-floating = true; + } + { + matches = [{ app-id = "pinentry"; }]; + open-floating = true; + } + { + matches = [{ title = "Progress"; }]; + open-floating = true; + } + { + matches = [{ title = "File Operations"; }]; + open-floating = true; + } + { + matches = [{ title = "Copying"; }]; + open-floating = true; + } + { + matches = [{ title = "Moving"; }]; + open-floating = true; + } + { + matches = [{ title = "Properties"; }]; + open-floating = true; + } + { + matches = [{ title = "Downloads"; }]; + open-floating = true; + } + { + matches = [{ title = "file progress"; }]; + open-floating = true; + } + { + matches = [{ title = "Confirm"; }]; + open-floating = true; + } + { + matches = [{ title = "Authentication Required"; }]; + open-floating = true; + } + { + matches = [{ title = "Notice"; }]; + open-floating = true; + } + { + matches = [{ title = "Warning"; }]; + open-floating = true; + } + { + matches = [{ title = "Error"; }]; + open-floating = true; + } + ]; +in +{ + programs.niri.settings = { + window-rules = windowRules; + layer-rules = [ + { + matches = [{ namespace = "^swww$"; }]; + place-within-backdrop = true; + } + ]; + }; +} diff --git a/modules/niri/settings.nix b/modules/niri/settings.nix new file mode 100644 index 0000000..3f12c6e --- /dev/null +++ b/modules/niri/settings.nix @@ -0,0 +1,135 @@ +{ config +, lib +, pkgs +, ... +}: +let + makeCommand = command: { + command = [ command ]; + }; + qs = "${pkgs.quickshell}/bin/qs"; + wl-paste = "${pkgs.wl-clipboard}/bin/wl-paste"; +in +{ + programs.niri.settings = { + environment = { + CLUTTER_BACKEND = "wayland"; + DISPLAY = ":0"; + GDK_BACKEND = "wayland,x11"; + MOZ_ENABLE_WAYLAND = "1"; + NIXOS_OZONE_WL = "1"; + QT_QPA_PLATFORM = "wayland;xcb"; + QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; + SDL_VIDEODRIVER = "wayland"; + }; + spawn-at-startup = [ + (makeCommand "${lib.getExe pkgs.hyprlock}") + (makeCommand "${pkgs.swww}/bin/swww-daemon") + { + command = [ + "${wl-paste}" + "--watch" + "cliphist" + "store" + ]; + } + { + command = [ + "${wl-paste}" + "--type text" + "--watch" + "cliphist" + "store" + ]; + } + { + command = [ + "${qs}" + "-c" + "DankMaterialShell" + ]; + } + ]; + + input = { + touchpad = { + click-method = "button-areas"; + dwt = true; + dwtp = true; + natural-scroll = true; + scroll-method = "two-finger"; + tap = true; + tap-button-map = "left-right-middle"; + middle-emulation = true; + accel-profile = "adaptive"; + }; + focus-follows-mouse = { + enable = true; + max-scroll-amount = "90%"; + }; + warp-mouse-to-focus.enable = true; + workspace-auto-back-and-forth = true; + }; + + outputs = { + "eDP-1" = { + scale = 1.0; + position = { + x = 0; + y = 0; + }; + }; + }; + + overview = { + workspace-shadow.enable = false; + backdrop-color = "transparent"; + }; + gestures = { + hot-corners.enable = true; + }; + layout = { + focus-ring.enable = false; + border = { + enable = true; + width = 2; + #active.color = "#${base0D}"; + #inactive.color = "#${base07}"; + }; + shadow = { + enable = false; + }; + preset-column-widths = [ + { proportion = 0.25; } + { proportion = 0.5; } + { proportion = 0.75; } + { proportion = 1.0; } + ]; + default-column-width = { + proportion = 0.5; + }; + + gaps = 6; + struts = { + left = 0; + right = 0; + top = 0; + bottom = 0; + }; + + tab-indicator = { + hide-when-single-tab = true; + place-within-column = true; + position = "left"; + corner-radius = 20.0; + gap = -12.0; + gaps-between-tabs = 10.0; + width = 4.0; + length.total-proportion = 0.1; + }; + }; + + prefer-no-csd = true; + hotkey-overlay.skip-at-startup = true; + }; +} diff --git a/modules/nix.nix b/modules/nix.nix new file mode 100644 index 0000000..05abfad --- /dev/null +++ b/modules/nix.nix @@ -0,0 +1,8 @@ +{ ... }: { + nix.settings = { + experimental-features = [ "nix-command" "flakes" ]; + + substituters = [ "https://nix-gaming.cachix.org" ]; + trusted-public-keys = [ "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" ]; + }; +} diff --git a/modules/nushell.nix b/modules/nushell.nix new file mode 100644 index 0000000..9385c31 --- /dev/null +++ b/modules/nushell.nix @@ -0,0 +1,113 @@ +{ lib, pkgs, ... }: { + programs = { + nushell = { + enable = true; + # The config.nu can be anywhere you want if you like to edit your Nushell with Nu + #configFile.source = ./.../config.nu; + # for editing directly to config.nu + extraConfig = '' + # Common ls aliases and sort them by type and then name + # Inspired by https://github.com/nushell/nushell/issues/7190 + def lla [...args] { ls -la ...(if $args == [] {["."]} else {$args}) | sort-by type name -i } + def la [...args] { ls -a ...(if $args == [] {["."]} else {$args}) | sort-by type name -i } + def ll [...args] { ls -l ...(if $args == [] {["."]} else {$args}) | sort-by type name -i } + def l [...args] { ls ...(if $args == [] {["."]} else {$args}) | sort-by type name -i } + + # Completions + # mainly pieced together from https://www.nushell.sh/cookbook/external_completers.html + + # carapce completions https://www.nushell.sh/cookbook/external_completers.html#carapace-completer + # + fix https://www.nushell.sh/cookbook/external_completers.html#err-unknown-shorthand-flag-using-carapace + # enable the package and integration bellow + let carapace_completer = {|spans: list| + carapace $spans.0 nushell ...$spans + | from json + | if ($in | default [] | where value == $"($spans | last)ERR" | is-empty) { $in } else { null } + } + # some completions are only available through a bridge + # eg. tailscale + # https://carapace-sh.github.io/carapace-bin/setup.html#nushell + $env.CARAPACE_BRIDGES = 'zsh,fish,bash,inshellisense' + + # fish completions https://www.nushell.sh/cookbook/external_completers.html#fish-completer + let fish_completer = {|spans| + ${ + lib.getExe pkgs.fish + } --command $'complete "--do-complete=($spans | str join " ")"' + | $"value(char tab)description(char newline)" + $in + | from tsv --flexible --no-infer + } + + # zoxide completions https://www.nushell.sh/cookbook/external_completers.html#zoxide-completer + let zoxide_completer = {|spans| + $spans | skip 1 | zoxide query -l ...$in | lines | where {|x| $x != $env.PWD} + } + + # multiple completions + # the default will be carapace, but you can also switch to fish + # https://www.nushell.sh/cookbook/external_completers.html#alias-completions + let multiple_completers = {|spans| + ## alias fixer start https://www.nushell.sh/cookbook/external_completers.html#alias-completions + let expanded_alias = scope aliases + | where name == $spans.0 + | get -i 0.expansion + + let spans = if $expanded_alias != null { + $spans + | skip 1 + | prepend ($expanded_alias | split row ' ' | take 1) + } else { + $spans + } + ## alias fixer end + + match $spans.0 { + __zoxide_z | __zoxide_zi => $zoxide_completer + _ => $carapace_completer + } | do $in $spans + } + + $env.config = { + show_banner: false, + completions: { + case_sensitive: false # case-sensitive completions + quick: true # set to false to prevent auto-selecting completions + partial: true # set to false to prevent partial filling of the prompt + algorithm: "fuzzy" # prefix or fuzzy + external: { + # set to false to prevent nushell looking into $env.PATH to find more suggestions + enable: true + # set to lower can improve completion performance at the cost of omitting some options + max_results: 100 + completer: $multiple_completers + } + } + } + $env.PATH = ($env.PATH | + split row (char esep) | + prepend /home/myuser/.apps | + append /usr/bin/env + ) + ''; + + shellAliases = { + fg = "job unfreeze"; + nano = "hx"; + vi = "hx"; + nvim = "hx"; + vim = "hx"; + devenv-init = "nix flake init --template github:cachix/devenv"; + devenv-enter = "nix develop --impure"; + rust-init = "nix flake init --template templates#rust"; + c-init = "nix flake init --template templates#c-hello"; + go-hello = "nix flake init --template templates#go-hello"; + haskell-hello = "nix flake init --template templates#haskell-hello"; + neofetch = "hyfetch"; + }; + }; + carapace.enable = true; + carapace.enableNushellIntegration = true; + + starship = { enable = true; }; + }; +} diff --git a/modules/quickshell.nix b/modules/quickshell.nix new file mode 100644 index 0000000..46d9d4b --- /dev/null +++ b/modules/quickshell.nix @@ -0,0 +1,37 @@ +{ + pkgs, + inputs, + lib, + ... +}: +let + quickshell = inputs.quickshell.packages.${pkgs.system}.default; +in +{ + home.packages = + with pkgs; + [ + quickshell + ] + ++ [ + inputs.mynixpkgs.packages.${pkgs.system}.dgop + accountsservice + brightnessctl + cava + cliphist + ddcutil + kdePackages.qt6ct + khal + material-symbols + matugen + swww + wl-clipboard + glib + ]; + + home.sessionVariables.QML2_IMPORT_PATH = lib.concatStringsSep ":" [ + "${quickshell}/lib/qt-6/qml" + "${pkgs.kdePackages.qtdeclarative}/lib/qt-6/qml" + "${pkgs.kdePackages.kirigami.unwrapped}/lib/qt-6/qml" + ]; +} diff --git a/modules/waybar.nix b/modules/waybar.nix new file mode 100644 index 0000000..27b779c --- /dev/null +++ b/modules/waybar.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + programs.waybar.enable = true; +} diff --git a/persist.nix b/persist.nix new file mode 100644 index 0000000..b242fd4 --- /dev/null +++ b/persist.nix @@ -0,0 +1,18 @@ +{ ... }: { + # machine-id is used by systemd for the journal, if you don't + # persist this file you won't be able to easily use journalctl to + # look at journals for previous boots. + environment.etc."machine-id".source = "/nix/persist/etc/machine-id"; + + + # if you want to run an openssh daemon, you may want to store the + # host keys across reboots. + # + # For this to work you will need to create the directory yourself: + # $ mkdir /nix/persist/etc/ssh + environment.etc."ssh/ssh_host_rsa_key".source = "/nix/persist/etc/ssh/ssh_host_rsa_key"; + environment.etc."ssh/ssh_host_rsa_key.pub".source = "/nix/persist/etc/ssh/ssh_host_rsa_key.pub"; + environment.etc."ssh/ssh_host_ed25519_key".source = "/nix/persist/etc/ssh/ssh_host_ed25519_key"; + environment.etc."ssh/ssh_host_ed25519_key.pub".source = "/nix/persist/etc/ssh/ssh_host_ed25519_key.pub"; + +}