From 4992e9f3bb62bcc564d5a4b7c201f9358535447a Mon Sep 17 00:00:00 2001 From: Jonni Liljamo Date: Wed, 13 Nov 2024 23:14:22 +0200 Subject: [PATCH] feat: arwen as first ws --- systems/hosts/arwen/default.nix | 55 -- systems/hosts/default.nix | 5 - ws/.gitignore | 1 + ws/flake.lock | 866 ++++++++++++++++++ ws/flake.nix | 41 + ws/hosts/arwen/core/default.nix | 21 + .../arwen/core}/hardware-configuration.nix | 2 - ws/hosts/arwen/core/impermanence.nix | 11 + {hosts => ws/hosts}/arwen/default.nix | 27 +- {hosts => ws/hosts}/arwen/hyprland.nix | 0 ws/hosts/default.nix | 17 + ws/profiles/common/editor.nix | 3 + ws/profiles/common/fonts.nix | 14 + ws/profiles/common/nix.nix | 14 + ws/profiles/default.nix | 4 + ws/profiles/desktop.nix | 15 + ws/profiles/laptop.nix | 19 + ws/roles/audio.nix | 28 + ws/roles/base.nix | 65 ++ ws/roles/bluetooth.nix | 28 + ws/roles/default.nix | 9 + ws/roles/docker.nix | 22 + ws/roles/gaming/default.nix | 59 ++ ws/roles/gaming/lutris.nix | 16 + ws/roles/gaming/steam.nix | 45 + ws/roles/git.nix | 42 + ws/roles/graphics/amd.nix | 13 + ws/roles/graphics/default.nix | 26 + ws/roles/graphics/nvidia.nix | 21 + ws/roles/hyprland.nix | 163 ++++ ws/roles/imv.nix | 15 + ws/roles/kitty.nix | 80 ++ ws/roles/obs.nix | 25 + ws/roles/podman.nix | 17 + ws/roles/qutebrowser.nix | 50 + ws/roles/shell/default.nix | 88 ++ ws/roles/shell/direnv.elv | 18 + ws/roles/tailscale.nix | 34 + ws/roles/unfree.nix | 19 + ws/roles/zellij.nix | 113 +++ ws/systems.nix | 27 + 41 files changed, 2075 insertions(+), 63 deletions(-) delete mode 100644 systems/hosts/arwen/default.nix create mode 100644 ws/.gitignore create mode 100644 ws/flake.lock create mode 100644 ws/flake.nix create mode 100644 ws/hosts/arwen/core/default.nix rename {systems/hosts/arwen => ws/hosts/arwen/core}/hardware-configuration.nix (97%) create mode 100644 ws/hosts/arwen/core/impermanence.nix rename {hosts => ws/hosts}/arwen/default.nix (74%) rename {hosts => ws/hosts}/arwen/hyprland.nix (100%) create mode 100644 ws/hosts/default.nix create mode 100644 ws/profiles/common/editor.nix create mode 100644 ws/profiles/common/fonts.nix create mode 100644 ws/profiles/common/nix.nix create mode 100644 ws/profiles/default.nix create mode 100644 ws/profiles/desktop.nix create mode 100644 ws/profiles/laptop.nix create mode 100644 ws/roles/audio.nix create mode 100644 ws/roles/base.nix create mode 100644 ws/roles/bluetooth.nix create mode 100644 ws/roles/default.nix create mode 100644 ws/roles/docker.nix create mode 100644 ws/roles/gaming/default.nix create mode 100644 ws/roles/gaming/lutris.nix create mode 100644 ws/roles/gaming/steam.nix create mode 100644 ws/roles/git.nix create mode 100644 ws/roles/graphics/amd.nix create mode 100644 ws/roles/graphics/default.nix create mode 100644 ws/roles/graphics/nvidia.nix create mode 100644 ws/roles/hyprland.nix create mode 100644 ws/roles/imv.nix create mode 100644 ws/roles/kitty.nix create mode 100644 ws/roles/obs.nix create mode 100644 ws/roles/podman.nix create mode 100644 ws/roles/qutebrowser.nix create mode 100644 ws/roles/shell/default.nix create mode 100644 ws/roles/shell/direnv.elv create mode 100644 ws/roles/tailscale.nix create mode 100644 ws/roles/unfree.nix create mode 100644 ws/roles/zellij.nix create mode 100644 ws/systems.nix diff --git a/systems/hosts/arwen/default.nix b/systems/hosts/arwen/default.nix deleted file mode 100644 index dcfca9d..0000000 --- a/systems/hosts/arwen/default.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ - inputs, - lib, - pkgs, - ... -}: { - imports = [ - ./hardware-configuration.nix - - inputs.nixos-hardware.nixosModules.lenovo-thinkpad-e495 - ]; - - boot.initrd.postDeviceCommands = lib.mkAfter '' - zfs rollback -r zpool/root@blank - ''; - - sops.defaultSopsFile = ../../../secrets/arwen/secrets.yaml; - sops.gnupg.sshKeyPaths = ["/persist/etc/ssh/ssh_host_rsa_key"]; - sops.age.sshKeyPaths = ["/persist/etc/ssh/ssh_host_ed25519_key"]; - - networking.hostId = "d2a2e2cb"; - networking.networkmanager.enable = true; - - time.timeZone = "Europe/Helsinki"; - - services.xserver.xkb.layout = "us"; - - services.libinput.enable = true; - - environment.systemPackages = with pkgs; [ - inputs.nvim-flake.packages.x86_64-linux.nvim - wget - - keepassxc - jellyfin-mpv-shim - libreoffice-qt6-fresh - ]; - - environment.persistence."/persist" = { - hideMounts = true; - directories = [ - "/etc/nixos" - "/etc/ssh" - "/var/lib/nixos" - "/var/lib/tailscale" - ]; - }; - - services.pcscd.enable = true; - programs.gnupg.agent.enable = true; - - services.openssh.enable = true; - - system.stateVersion = "24.05"; -} diff --git a/systems/hosts/default.nix b/systems/hosts/default.nix index 3290732..5ee00c8 100644 --- a/systems/hosts/default.nix +++ b/systems/hosts/default.nix @@ -10,9 +10,4 @@ profile = desktop; modules = []; }; - arwen = { - system = "x86_64-linux"; - profile = laptop; - modules = []; - }; } diff --git a/ws/.gitignore b/ws/.gitignore new file mode 100644 index 0000000..c4a847d --- /dev/null +++ b/ws/.gitignore @@ -0,0 +1 @@ +/result diff --git a/ws/flake.lock b/ws/flake.lock new file mode 100644 index 0000000..77d1804 --- /dev/null +++ b/ws/flake.lock @@ -0,0 +1,866 @@ +{ + "nodes": { + "crane": { + "locked": { + "lastModified": 1730652660, + "narHash": "sha256-+XVYfmVXAiYA0FZT7ijHf555dxCe+AoAT5A6RU+6vSo=", + "owner": "ipetkov", + "repo": "crane", + "rev": "a4ca93905455c07cb7e3aca95d4faf7601cba458", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "devshell": { + "inputs": { + "nixpkgs": [ + "nvim-flake", + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1728330715, + "narHash": "sha256-xRJ2nPOXb//u1jaBnDP56M7v5ldavjbtR6lfGqSvcKg=", + "owner": "numtide", + "repo": "devshell", + "rev": "dd6b80932022cea34a019e2bb32f6fa9e494dfef", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "flake-compat": { + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "revCount": 57, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1727826117, + "narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": [ + "nvim-flake", + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1727826117, + "narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "git-hooks": { + "inputs": { + "flake-compat": [ + "nvim-flake", + "nixvim", + "flake-compat" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "nvim-flake", + "nixvim", + "nixpkgs" + ], + "nixpkgs-stable": [ + "nvim-flake", + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1730302582, + "narHash": "sha256-W1MIJpADXQCgosJZT8qBYLRuZls2KSiKdpnTVdKBuvU=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "af8a16fe5c264f5e9e18bcee2859b40a656876cf", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "nvim-flake", + "nixvim", + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1726989464, + "narHash": "sha256-Vl+WVTJwutXkimwGprnEtXc/s/s8sMuXzqXaspIGlwM=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "2f23fa308a7c067e52dfcc30a0758f47043ec176", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-24.05", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "nvim-flake", + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1730016908, + "narHash": "sha256-bFCxJco7d8IgmjfNExNz9knP8wvwbXU4s/d53KOK6U0=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "e83414058edd339148dc142a8437edb9450574c8", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "hy3": { + "inputs": { + "hyprland": "hyprland" + }, + "locked": { + "lastModified": 1719341859, + "narHash": "sha256-aZuNKBwTwj8EXkDBMWNdRKbHPx647wJLWm55h6jOKbo=", + "owner": "outfoxxed", + "repo": "hy3", + "rev": "d200873687ea1f10958adb6c08cfcfa44b13267f", + "type": "github" + }, + "original": { + "owner": "outfoxxed", + "ref": "hl0.41.2", + "repo": "hy3", + "type": "github" + } + }, + "hyprcursor": { + "inputs": { + "hyprlang": [ + "hy3", + "hyprland", + "hyprlang" + ], + "nixpkgs": [ + "hy3", + "hyprland", + "nixpkgs" + ], + "systems": [ + "hy3", + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1718450675, + "narHash": "sha256-jpsns6buS4bK+1sF8sL8AaixAiCRjA+nldTKvcwmvUs=", + "owner": "hyprwm", + "repo": "hyprcursor", + "rev": "66d5b46ff94efbfa6fa3d1d1b66735f1779c34a6", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprcursor", + "type": "github" + } + }, + "hyprland": { + "inputs": { + "hyprcursor": "hyprcursor", + "hyprlang": "hyprlang", + "hyprutils": "hyprutils", + "hyprwayland-scanner": "hyprwayland-scanner", + "nixpkgs": "nixpkgs", + "systems": "systems", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1719317162, + "narHash": "sha256-JmfnYz+9a4TjNl3mAus1VpoWtTI9d1xkW9MHbkcV0Po=", + "rev": "918d8340afd652b011b937d29d5eea0be08467f5", + "revCount": 4886, + "submodules": true, + "type": "git", + "url": "https://github.com/hyprwm/Hyprland" + }, + "original": { + "rev": "918d8340afd652b011b937d29d5eea0be08467f5", + "submodules": true, + "type": "git", + "url": "https://github.com/hyprwm/Hyprland" + } + }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "hy3", + "hyprland", + "xdph", + "nixpkgs" + ], + "systems": [ + "hy3", + "hyprland", + "xdph", + "systems" + ] + }, + "locked": { + "lastModified": 1714869498, + "narHash": "sha256-vbLVOWvQqo4n1yvkg/Q70VTlPbMmTiCQfNTgcWDCfJM=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "e06482e0e611130cd1929f75e8c1cf679e57d161", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, + "hyprlang": { + "inputs": { + "hyprutils": [ + "hy3", + "hyprland", + "hyprutils" + ], + "nixpkgs": [ + "hy3", + "hyprland", + "nixpkgs" + ], + "systems": [ + "hy3", + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1717881852, + "narHash": "sha256-XeeVoKHQgfKuXoP6q90sUqKyl7EYy3ol2dVZGM+Jj94=", + "owner": "hyprwm", + "repo": "hyprlang", + "rev": "ec6938c66253429192274d612912649a0cfe4d28", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprlang", + "type": "github" + } + }, + "hyprutils": { + "inputs": { + "nixpkgs": [ + "hy3", + "hyprland", + "nixpkgs" + ], + "systems": [ + "hy3", + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1719316102, + "narHash": "sha256-dmRz128j/lJmMuTYeCYPfSBRHHQO3VeH4PbmoyAhHzw=", + "owner": "hyprwm", + "repo": "hyprutils", + "rev": "1f6bbec5954f623ff8d68e567bddcce97cd2f085", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprutils", + "type": "github" + } + }, + "hyprwayland-scanner": { + "inputs": { + "nixpkgs": [ + "hy3", + "hyprland", + "nixpkgs" + ], + "systems": [ + "hy3", + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1719067853, + "narHash": "sha256-mAnZG/eQy72Fp1ImGtqCgUrDumnR1rMZv2E/zgP4U74=", + "owner": "hyprwm", + "repo": "hyprwayland-scanner", + "rev": "914f083741e694092ee60a39d31f693d0a6dc734", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprwayland-scanner", + "type": "github" + } + }, + "impermanence": { + "locked": { + "lastModified": 1731242966, + "narHash": "sha256-B3C3JLbGw0FtLSWCjBxU961gLNv+BOOBC6WvstKLYMw=", + "owner": "nix-community", + "repo": "impermanence", + "rev": "3ed3f0eaae9fcc0a8331e77e9319c8a4abd8a71a", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "impermanence", + "type": "github" + } + }, + "ixx": { + "inputs": { + "flake-utils": [ + "nvim-flake", + "nixvim", + "nuschtosSearch", + "flake-utils" + ], + "nixpkgs": [ + "nvim-flake", + "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" + } + }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nvim-flake", + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1730184279, + "narHash": "sha256-6OB+WWR6gnaWiqSS28aMJypKeK7Pjc2Wm6L0MtOrTuA=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "b379bd4d872d159e5189053ce9a4adf86d56db4b", + "type": "github" + }, + "original": { + "owner": "lnl7", + "repo": "nix-darwin", + "type": "github" + } + }, + "nixos-hardware": { + "locked": { + "lastModified": 1731403644, + "narHash": "sha256-T9V7CTucjRZ4Qc6pUEV/kpgNGzQbHWfGcfK6JJLfUeI=", + "owner": "nixos", + "repo": "nixos-hardware", + "rev": "f6581f1c3b137086e42a08a906bdada63045f991", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixos-hardware", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1719075281, + "narHash": "sha256-CyyxvOwFf12I91PBWz43iGT1kjsf5oi6ax7CrvaMyAo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a71e967ef3694799d0c418c98332f7ff4cc5f6af", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1731497087, + "narHash": "sha256-0xHYkMkeLVQAMa7gvkddbPqpxph+hDzdu1XdGPJR+Os=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1731489818, + "narHash": "sha256-VpMvK9x/CWykzWEENEpukNNIE3oW6M5NGNv3tdKB9OY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1252394ddb5900089300b8e602302c0fa85da4d2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "release-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1731139594, + "narHash": "sha256-IigrKK3vYRpUu+HEjPL/phrfh7Ox881er1UEsZvw9Q4=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "76612b17c0ce71689921ca12d9ffdc9c23ce40b2", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1730327045, + "narHash": "sha256-xKel5kd1AbExymxoIfQ7pgcX6hjw9jCgbiBjiUfSVJ8=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "080166c15633801df010977d9d7474b4a6c549d7", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1730200266, + "narHash": "sha256-l253w0XMT8nWHGXuXqyiIC/bMvh1VRszGXgdpQlfhvU=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "807e9154dcb16384b1b765ebe9cd2bba2ac287fd", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1731245184, + "narHash": "sha256-vmLS8+x+gHRv1yzj3n+GTAEObwmhxmkkukB2DwtJRdU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "aebe249544837ce42588aa4b2e7972222ba12e8f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixvim": { + "inputs": { + "devshell": "devshell", + "flake-compat": "flake-compat", + "flake-parts": "flake-parts_2", + "git-hooks": "git-hooks", + "home-manager": "home-manager_2", + "nix-darwin": "nix-darwin", + "nixpkgs": [ + "nvim-flake", + "nixpkgs" + ], + "nuschtosSearch": "nuschtosSearch", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1730499477, + "narHash": "sha256-olt0Sx4alDxv3ko9BgbV3SsE2KQ/Tf0/Az1Fr9s2Y6U=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "356896f58dde22ee16481b7c954e340dceec340d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixvim", + "type": "github" + } + }, + "nuschtosSearch": { + "inputs": { + "flake-utils": "flake-utils", + "ixx": "ixx", + "nixpkgs": [ + "nvim-flake", + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1730337772, + "narHash": "sha256-uTxvqDohfG85+zldO5Tf1B+fuAF8ZhMouNwG5S6OAnA=", + "owner": "NuschtOS", + "repo": "search", + "rev": "4e0a7a95a3df3333771abc4df6a656e7baf67106", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "repo": "search", + "type": "github" + } + }, + "nvim-flake": { + "inputs": { + "flake-parts": [ + "flake-parts" + ], + "nixpkgs": "nixpkgs_3", + "nixvim": "nixvim" + }, + "locked": { + "lastModified": 1731245970, + "narHash": "sha256-im4BKDAYg417Q5Enb9i8ZXQXAxLEJyA8egK1s/mUw80=", + "ref": "refs/heads/master", + "rev": "f68996e4ee50e58f580e564f60465c975a482334", + "revCount": 41, + "type": "git", + "url": "https://git.src.quest/~liljamo/nvim-flake" + }, + "original": { + "type": "git", + "url": "https://git.src.quest/~liljamo/nvim-flake" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "home-manager": "home-manager", + "hy3": "hy3", + "impermanence": "impermanence", + "nixos-hardware": "nixos-hardware", + "nixpkgs": "nixpkgs_2", + "nixpkgs-unstable": "nixpkgs-unstable", + "nvim-flake": "nvim-flake", + "sops-nix": "sops-nix", + "zjstatus": "zjstatus" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "zjstatus", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1730687492, + "narHash": "sha256-xQVadjquBA/tFxDt5A55LJ1D1AvkVWsnrKC2o+pr8F4=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "41814763a2c597755b0755dbe3e721367a5e420f", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "sops-nix": { + "inputs": { + "nixpkgs": "nixpkgs_4", + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1729999681, + "narHash": "sha256-qm0uCtM9bg97LeJTKQ8dqV/FvqRN+ompyW4GIJruLuw=", + "owner": "Mic92", + "repo": "sops-nix", + "rev": "1666d16426abe79af5c47b7c0efa82fd31bf4c56", + "type": "github" + }, + "original": { + "owner": "Mic92", + "repo": "sops-nix", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { + "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": [ + "nvim-flake", + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1730321837, + "narHash": "sha256-vK+a09qq19QNu2MlLcvN4qcRctJbqWkX7ahgPZ/+maI=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "746901bb8dba96d154b66492a29f5db0693dbfcc", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "xdph": { + "inputs": { + "hyprland-protocols": "hyprland-protocols", + "hyprlang": [ + "hy3", + "hyprland", + "hyprlang" + ], + "nixpkgs": [ + "hy3", + "hyprland", + "nixpkgs" + ], + "systems": [ + "hy3", + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1718619174, + "narHash": "sha256-FWW68AVYmB91ZDQnhLMBNCUUTCjb1ZpO2k2KIytHtkA=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "c7894aa54f9a7dbd16df5cd24d420c8af22d5623", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" + } + }, + "zjstatus": { + "inputs": { + "crane": "crane", + "flake-utils": "flake-utils_2", + "nixpkgs": [ + "nixpkgs-unstable" + ], + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1730748983, + "narHash": "sha256-72uoWm/34SU5aHgvUJgKqYMhvt4Y9X39bFhcDwVS+P0=", + "owner": "dj95", + "repo": "zjstatus", + "rev": "d5794fbec93860ead015b0beee70489f50cd87b1", + "type": "github" + }, + "original": { + "owner": "dj95", + "repo": "zjstatus", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/ws/flake.nix b/ws/flake.nix new file mode 100644 index 0000000..3b4539c --- /dev/null +++ b/ws/flake.nix @@ -0,0 +1,41 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; + nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + + nixos-hardware.url = "github:nixos/nixos-hardware"; + + home-manager = { + url = "github:nix-community/home-manager/release-24.05"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + flake-parts.url = "github:hercules-ci/flake-parts"; + sops-nix.url = "github:Mic92/sops-nix"; + impermanence.url = "github:nix-community/impermanence"; + + # Packages + zjstatus = { + url = "github:dj95/zjstatus"; + inputs.nixpkgs.follows = "nixpkgs-unstable"; + }; + + # This has to match what is currently in NixOS stable. + hy3.url = "github:outfoxxed/hy3?ref=hl0.41.2"; + + # Own flakes + nvim-flake = { + url = "git+https://git.src.quest/~liljamo/nvim-flake"; + inputs.flake-parts.follows = "flake-parts"; + }; + }; + + outputs = inputs @ {self, ...}: + inputs.flake-parts.lib.mkFlake {inherit inputs;} { + imports = [ + ./systems.nix + ]; + + systems = []; + }; +} diff --git a/ws/hosts/arwen/core/default.nix b/ws/hosts/arwen/core/default.nix new file mode 100644 index 0000000..bd513ed --- /dev/null +++ b/ws/hosts/arwen/core/default.nix @@ -0,0 +1,21 @@ +{lib, ...}: { + imports = [ + ./hardware-configuration.nix + ./impermanence.nix + ]; + + boot.initrd.postDeviceCommands = lib.mkAfter '' + zfs rollback -r zpool/root@blank + ''; + + sops.defaultSopsFile = ../../../../secrets/arwen/secrets.yaml; + sops.gnupg.sshKeyPaths = ["/persist/etc/ssh/ssh_host_rsa_key"]; + sops.age.sshKeyPaths = ["/persist/etc/ssh/ssh_host_ed25519_key"]; + + networking.hostId = "d2a2e2cb"; + networking.networkmanager.enable = true; + + time.timeZone = "Europe/Helsinki"; + + system.stateVersion = "24.05"; +} diff --git a/systems/hosts/arwen/hardware-configuration.nix b/ws/hosts/arwen/core/hardware-configuration.nix similarity index 97% rename from systems/hosts/arwen/hardware-configuration.nix rename to ws/hosts/arwen/core/hardware-configuration.nix index 7a72753..59361dc 100644 --- a/systems/hosts/arwen/hardware-configuration.nix +++ b/ws/hosts/arwen/core/hardware-configuration.nix @@ -1,7 +1,6 @@ { config, lib, - pkgs, modulesPath, ... }: { @@ -16,7 +15,6 @@ boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "usb_storage" "sd_mod" "sdhci_pci"]; boot.initrd.kernelModules = ["zfs"]; boot.kernelModules = ["kvm-amd"]; - boot.extraModulePackages = []; boot.supportedFilesystems = ["zfs"]; fileSystems."/" = { diff --git a/ws/hosts/arwen/core/impermanence.nix b/ws/hosts/arwen/core/impermanence.nix new file mode 100644 index 0000000..2417d8d --- /dev/null +++ b/ws/hosts/arwen/core/impermanence.nix @@ -0,0 +1,11 @@ +{ + environment.persistence."/persist" = { + hideMounts = true; + directories = [ + "/etc/nixos" + "/etc/ssh" + "/var/lib/nixos" + "/var/lib/tailscale" + ]; + }; +} diff --git a/hosts/arwen/default.nix b/ws/hosts/arwen/default.nix similarity index 74% rename from hosts/arwen/default.nix rename to ws/hosts/arwen/default.nix index db5cd00..edd1475 100644 --- a/hosts/arwen/default.nix +++ b/ws/hosts/arwen/default.nix @@ -1,8 +1,33 @@ -{config, ...}: { +{ + config, + inputs, + pkgs, + ... +}: { imports = [ + ./core + ./hyprland.nix ]; + services.xserver.xkb.layout = "us"; + + services.libinput.enable = true; + + environment.systemPackages = with pkgs; [ + inputs.nvim-flake.packages.x86_64-linux.nvim + wget + + keepassxc + jellyfin-mpv-shim + libreoffice-qt6-fresh + ]; + + services.pcscd.enable = true; + programs.gnupg.agent.enable = true; + + services.openssh.enable = true; + sops.secrets.rootPwd.neededForUsers = true; sops.secrets.skyePwd.neededForUsers = true; diff --git a/hosts/arwen/hyprland.nix b/ws/hosts/arwen/hyprland.nix similarity index 100% rename from hosts/arwen/hyprland.nix rename to ws/hosts/arwen/hyprland.nix diff --git a/ws/hosts/default.nix b/ws/hosts/default.nix new file mode 100644 index 0000000..7078b49 --- /dev/null +++ b/ws/hosts/default.nix @@ -0,0 +1,17 @@ +inputs: profiles: { + alice = { + system = "x86_64-linux"; + profile = profiles.desktop; + modules = [ + inputs.impermanence.nixosModules.impermanence + ]; + }; + arwen = { + system = "x86_64-linux"; + profile = profiles.laptop; + modules = [ + inputs.impermanence.nixosModules.impermanence + inputs.nixos-hardware.nixosModules.lenovo-thinkpad-e495 + ]; + }; +} diff --git a/ws/profiles/common/editor.nix b/ws/profiles/common/editor.nix new file mode 100644 index 0000000..f31288e --- /dev/null +++ b/ws/profiles/common/editor.nix @@ -0,0 +1,3 @@ +{ + environment.variables.EDITOR = "nvim"; +} diff --git a/ws/profiles/common/fonts.nix b/ws/profiles/common/fonts.nix new file mode 100644 index 0000000..d3621a6 --- /dev/null +++ b/ws/profiles/common/fonts.nix @@ -0,0 +1,14 @@ +{pkgs, ...}: let + fonts = with pkgs; [ + font-awesome + + liberation_ttf + + (nerdfonts.override { + fonts = ["FiraCode" "VictorMono"]; + }) + ]; +in { + environment.systemPackages = fonts; + fonts.packages = fonts; +} diff --git a/ws/profiles/common/nix.nix b/ws/profiles/common/nix.nix new file mode 100644 index 0000000..b8ed0ed --- /dev/null +++ b/ws/profiles/common/nix.nix @@ -0,0 +1,14 @@ +{ + nix = { + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; + settings = { + auto-optimise-store = true; + experimental-features = ["nix-command" "flakes"]; + trusted-users = ["@wheel"]; + }; + }; +} diff --git a/ws/profiles/default.nix b/ws/profiles/default.nix new file mode 100644 index 0000000..b420dfc --- /dev/null +++ b/ws/profiles/default.nix @@ -0,0 +1,4 @@ +inputs: { + desktop = import ./desktop.nix inputs; + laptop = import ./laptop.nix inputs; +} diff --git a/ws/profiles/desktop.nix b/ws/profiles/desktop.nix new file mode 100644 index 0000000..1930317 --- /dev/null +++ b/ws/profiles/desktop.nix @@ -0,0 +1,15 @@ +inputs: { + modules = [ + inputs.sops-nix.nixosModules.sops + inputs.home-manager.nixosModules.home-manager + + ../roles + + ./common/fonts.nix + ./common/nix.nix + ./common/editor.nix + ]; + specialArgs = { + inherit inputs; + }; +} diff --git a/ws/profiles/laptop.nix b/ws/profiles/laptop.nix new file mode 100644 index 0000000..e50d330 --- /dev/null +++ b/ws/profiles/laptop.nix @@ -0,0 +1,19 @@ +inputs: { + modules = [ + inputs.sops-nix.nixosModules.sops + inputs.home-manager.nixosModules.home-manager + + ../roles + + ./common/fonts.nix + ./common/nix.nix + ./common/editor.nix + + { + programs.light.enable = true; + } + ]; + specialArgs = { + inherit inputs; + }; +} diff --git a/ws/roles/audio.nix b/ws/roles/audio.nix new file mode 100644 index 0000000..44bf22a --- /dev/null +++ b/ws/roles/audio.nix @@ -0,0 +1,28 @@ +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.roles.audio; +in { + options.roles.audio = { + enable = lib.mkEnableOption "enable audio"; + }; + + config = lib.mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + pavucontrol + ]; + + services.pipewire = { + enable = true; + alsa = { + enable = true; + support32Bit = true; + }; + jack.enable = true; + pulse.enable = true; + }; + }; +} diff --git a/ws/roles/base.nix b/ws/roles/base.nix new file mode 100644 index 0000000..ba5fb8f --- /dev/null +++ b/ws/roles/base.nix @@ -0,0 +1,65 @@ +{ + config, + lib, + ... +}: let + cfg = config.roles.base; +in { + options.roles.base = { + root = lib.mkOption { + type = lib.types.submodule { + options = { + hashedPasswordFile = lib.mkOption { + type = lib.types.path; + }; + }; + }; + }; + primaryUser = lib.mkOption { + type = lib.types.submodule { + options = { + username = lib.mkOption { + type = lib.types.str; + }; + isWheel = lib.mkEnableOption "admin permissions"; + extraGroups = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = []; + }; + hashedPasswordFile = lib.mkOption { + type = lib.types.path; + }; + }; + }; + }; + }; + + imports = [ + (lib.mkAliasOptionModule ["hm"] [ + "home-manager" + "users" + cfg.primaryUser.username + ]) + ]; + + config = let + homeDirectory = "/home/${cfg.primaryUser.username}"; + in { + users.users.root.hashedPasswordFile = cfg.root.hashedPasswordFile; + users.users.${cfg.primaryUser.username} = { + isNormalUser = true; + extraGroups = cfg.primaryUser.extraGroups ++ lib.optional cfg.primaryUser.isWheel "wheel"; + home = homeDirectory; + hashedPasswordFile = cfg.primaryUser.hashedPasswordFile; + }; + home-manager = { + useUserPackages = true; + useGlobalPkgs = true; + }; + hm.home = { + inherit (cfg.primaryUser) username; + inherit homeDirectory; + stateVersion = config.system.stateVersion; + }; + }; +} diff --git a/ws/roles/bluetooth.nix b/ws/roles/bluetooth.nix new file mode 100644 index 0000000..8e8e55f --- /dev/null +++ b/ws/roles/bluetooth.nix @@ -0,0 +1,28 @@ +{ + config, + lib, + ... +}: let + cfg = config.roles.bluetooth; +in { + options.roles.bluetooth = { + enable = lib.mkEnableOption "enable bluetooth"; + enableHDAudio = lib.mkEnableOption "enable HD audio for bluetooth"; + }; + + config = lib.mkIf cfg.enable { + hardware.bluetooth.enable = true; + services.blueman.enable = true; + + services.pipewire.wireplumber.extraConfig = lib.mkIf cfg.enableHDAudio { + bluetoothEnhancements = { + "monitor.bluez.properties" = { + "bluez5.enable-sbc-xq" = true; + "bluez5.enable-msbc" = true; + "bluez5.enable-hw-volume" = true; + "bluez5.roles" = ["hsp_hs" "hsp_ag" "hfp_hf" "hfp_ag"]; + }; + }; + }; + }; +} diff --git a/ws/roles/default.nix b/ws/roles/default.nix new file mode 100644 index 0000000..a786736 --- /dev/null +++ b/ws/roles/default.nix @@ -0,0 +1,9 @@ +{lib, ...}: { + imports = + [ + ./gaming + ./graphics + ./shell + ] + ++ lib.pipe ./. [builtins.readDir (lib.filterAttrs (n: ty: ty != "directory" && n != "default.nix" && lib.hasSuffix ".nix" n)) (lib.mapAttrsToList (n: _: ./${n}))]; +} diff --git a/ws/roles/docker.nix b/ws/roles/docker.nix new file mode 100644 index 0000000..45b05fe --- /dev/null +++ b/ws/roles/docker.nix @@ -0,0 +1,22 @@ +{ + config, + lib, + ... +}: let + cfg = config.roles.docker; +in { + options.roles.docker = { + enable = lib.mkEnableOption "Docker"; + enableNvidia = lib.mkEnableOption "Docker NVIDIA GPU support"; + }; + + config = lib.mkIf cfg.enable { + virtualisation.docker = { + enable = true; + enableNvidia = cfg.enableNvidia; + }; + + # FIXME: Make configurable. + roles.base.primaryUser.extraGroups = ["docker"]; + }; +} diff --git a/ws/roles/gaming/default.nix b/ws/roles/gaming/default.nix new file mode 100644 index 0000000..1eaea1f --- /dev/null +++ b/ws/roles/gaming/default.nix @@ -0,0 +1,59 @@ +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.roles.gaming; +in { + imports = [ + ./lutris.nix + ./steam.nix + ]; + + options.roles.gaming = { + enable = lib.mkEnableOption "gaming utilities"; + lutris.enable = lib.mkEnableOption "Lutris"; + steam.enable = lib.mkEnableOption "Steam"; + }; + + config = lib.mkIf cfg.enable { + programs.gamemode = { + enable = true; + }; + + environment.systemPackages = with pkgs; [ + gamescope + protontricks + gnome.zenity + r2modman + ]; + + hm = { + programs.mangohud = { + enable = true; + enableSessionWide = false; + settings = { + fps_limit = "60,90,120,200"; + time = true; + + gpu_stats = true; + gpu_temp = true; + gpu_text = "GPU"; + + cpu_stats = true; + cpu_temp = true; + cpu_text = "CPU"; + + vram = true; + ram = true; + + fps = true; + frametime = true; + frame_timing = true; + show_fps_limit = true; + }; + }; + }; + }; +} diff --git a/ws/roles/gaming/lutris.nix b/ws/roles/gaming/lutris.nix new file mode 100644 index 0000000..7fa9e41 --- /dev/null +++ b/ws/roles/gaming/lutris.nix @@ -0,0 +1,16 @@ +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.roles.gaming; +in { + config = lib.mkIf cfg.lutris.enable { + environment.systemPackages = with pkgs; [ + lutris + + wineWowPackages.stable + ]; + }; +} diff --git a/ws/roles/gaming/steam.nix b/ws/roles/gaming/steam.nix new file mode 100644 index 0000000..3fce431 --- /dev/null +++ b/ws/roles/gaming/steam.nix @@ -0,0 +1,45 @@ +{ + config, + lib, + ... +}: let + cfg = config.roles.gaming; +in { + config = lib.mkIf cfg.steam.enable { + roles.unfree.allow = [ + "steam-run" + "steam-original" + "steam" + ]; + + nixpkgs.config.packageOverrides = pkgs: { + steam = pkgs.steam.override { + extraPkgs = pkgs: + with pkgs; [ + # For gamescope to work properly: + # https://github.com/NixOS/nixpkgs/issues/162562#issuecomment-1523177264 + xorg.libXcursor + xorg.libXi + xorg.libXinerama + xorg.libXScrnSaver + libpng + libpulseaudio + libvorbis + stdenv.cc.cc.lib + libkrb5 + keyutils + + # Fallback fonts (e.g. for Don't Get Lost). + liberation_ttf + ]; + }; + }; + + programs.steam = { + enable = true; + remotePlay.openFirewall = false; + dedicatedServer.openFirewall = false; + }; + hardware.steam-hardware.enable = true; + }; +} diff --git a/ws/roles/git.nix b/ws/roles/git.nix new file mode 100644 index 0000000..3a715a4 --- /dev/null +++ b/ws/roles/git.nix @@ -0,0 +1,42 @@ +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.roles.git; +in { + options.roles.git = { + enable = lib.mkEnableOption "enable git"; + email = lib.mkOption { + type = lib.types.str; + }; + name = lib.mkOption { + type = lib.types.str; + }; + gitExtraConfig = lib.mkOption { + type = lib.types.lines; + default = {}; + }; + enableLazygit = lib.mkEnableOption "enable lazygit"; + }; + + config = { + programs.lazygit = lib.mkIf cfg.enableLazygit { + enable = true; + settings = { + disableStartupPopups = true; + }; + }; + + hm = { + programs.git = lib.mkIf cfg.enable { + enable = true; + package = pkgs.gitAndTools.gitFull; + userEmail = cfg.email; + userName = cfg.name; + extraConfig = cfg.gitExtraConfig; + }; + }; + }; +} diff --git a/ws/roles/graphics/amd.nix b/ws/roles/graphics/amd.nix new file mode 100644 index 0000000..2824236 --- /dev/null +++ b/ws/roles/graphics/amd.nix @@ -0,0 +1,13 @@ +{ + config, + lib, + ... +}: let + cfg = config.roles.graphics; +in { + config = lib.mkIf cfg.amd.enable { + boot.initrd.kernelModules = ["amdgpu"]; + + services.xserver.videoDrivers = ["amdgpu"]; + }; +} diff --git a/ws/roles/graphics/default.nix b/ws/roles/graphics/default.nix new file mode 100644 index 0000000..e0cd07b --- /dev/null +++ b/ws/roles/graphics/default.nix @@ -0,0 +1,26 @@ +{ + config, + lib, + ... +}: let + cfg = config.roles.graphics; +in { + imports = [ + ./amd.nix + ./nvidia.nix + ]; + + options.roles.graphics = { + enable = lib.mkEnableOption "graphics drivers"; + amd.enable = lib.mkEnableOption "AMDGPU drivers"; + nvidia.enable = lib.mkEnableOption "NVIDIA drivers"; + }; + + config = lib.mkIf cfg.enable { + hardware.opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + }; + }; +} diff --git a/ws/roles/graphics/nvidia.nix b/ws/roles/graphics/nvidia.nix new file mode 100644 index 0000000..1374e98 --- /dev/null +++ b/ws/roles/graphics/nvidia.nix @@ -0,0 +1,21 @@ +{ + config, + lib, + ... +}: let + cfg = config.roles.graphics; +in { + config = lib.mkIf cfg.nvidia.enable { + roles.unfree.allow = ["nvidia-x11"]; + + services.xserver.videoDrivers = ["nvidia"]; + + hardware.nvidia = { + modesetting.enable = true; + powerManagement.enable = true; + open = true; + nvidiaSettings = false; + }; + boot.kernelParams = ["nvidia-drm.fbdev=1"]; + }; +} diff --git a/ws/roles/hyprland.nix b/ws/roles/hyprland.nix new file mode 100644 index 0000000..cd047b2 --- /dev/null +++ b/ws/roles/hyprland.nix @@ -0,0 +1,163 @@ +{ + config, + inputs, + lib, + pkgs, + ... +}: let + cfg = config.roles.hyprland; +in { + options.roles.hyprland = { + enable = lib.mkEnableOption "enable hyprland"; + }; + + config = lib.mkIf cfg.enable { + environment.systemPackages = [ + pkgs.bemenu + + pkgs.playerctl + ]; + + programs.hyprland.enable = true; + + security.pam.services.hyprlock = {}; + + hm = { + wayland.windowManager.hyprland = { + enable = true; + plugins = [inputs.hy3.packages.${pkgs.stdenv.hostPlatform.system}.hy3]; + # NOTE: These are just the default settings. + settings = { + exec-once = [ + "wpaperd -d" + ]; + + input = { + kb_layout = "us,fi,no"; + kb_options = "grp:win_space_toggle,ctrl:nocaps"; + touchpad = { + disable_while_typing = false; + }; + }; + + misc = { + disable_hyprland_logo = true; + disable_splash_rendering = true; + }; + + "$mod" = "SUPER"; + bind = [ + "$mod, Return, exec, kitty" + "$mod SHIFT, return, exec, bemenu-run" + "$mod SHIFT, x, exec, hyprlock" + + "$mod, w, exec, wpaperctl next" + + "$mod SHIFT, c, killactive" + "$mod SHIFT, q, exit" + + "$mod, f, fullscreen, 0" + "$mod SHIFT, space, togglefloating" + + "$mod, Tab, cyclenext," + "$mod, Tab, bringactivetotop," + + "$mod, v, hy3:makegroup, v, ephemeral" + "$mod, b, hy3:makegroup, h, ephemeral" + + "$mod, h, hy3:movefocus, l" + "$mod, j, hy3:movefocus, d" + "$mod, k, hy3:movefocus, u" + "$mod, l, hy3:movefocus, r" + "$mod SHIFT, h, hy3:movewindow, l" + "$mod SHIFT, j, hy3:movewindow, d" + "$mod SHIFT, k, hy3:movewindow, u" + "$mod SHIFT, l, hy3:movewindow, r" + + "$mod, 1, workspace, 1" + "$mod, 2, workspace, 2" + "$mod, 3, workspace, 3" + "$mod, 4, workspace, 4" + "$mod, 5, workspace, 5" + "$mod, 6, workspace, 6" + "$mod, 7, workspace, 7" + "$mod, 8, workspace, 8" + "$mod, 9, workspace, 9" + "$mod SHIFT, 1, hy3:movetoworkspace, 1" + "$mod SHIFT, 2, hy3:movetoworkspace, 2" + "$mod SHIFT, 3, hy3:movetoworkspace, 3" + "$mod SHIFT, 4, hy3:movetoworkspace, 4" + "$mod SHIFT, 5, hy3:movetoworkspace, 5" + "$mod SHIFT, 6, hy3:movetoworkspace, 6" + "$mod SHIFT, 7, hy3:movetoworkspace, 7" + "$mod SHIFT, 8, hy3:movetoworkspace, 8" + "$mod SHIFT, 9, hy3:movetoworkspace, 9" + ]; + binde = [ + "$mod CTRL, h, resizeactive, -10 0" + "$mod CTRL, j, resizeactive, 0 -10" + "$mod CTRL, k, resizeactive, 0 10" + "$mod CTRL, l, resizeactive, 10 0" + ]; + + bindm = [ + "$mod, mouse:272, movewindow" + "$mod, mouse:273, resizewindow" + ]; + }; + }; + + services.hypridle = { + enable = true; + settings = { + listener = [ + { + timeout = 500; + } + ]; + general.lock_cmd = "hyprlock"; + }; + }; + + programs.hyprlock = { + enable = true; + settings = { + general = { + no_fade_in = true; + no_fade_out = true; + }; + background = [ + { + #path = "/home/skye/dev/femboys.png"; + color = "rgba(0, 0, 0, 1.0)"; + } + ]; + input-field = [ + { + monitor = ""; + size = "200, 50"; + position = "0, 0"; + } + ]; + }; + }; + + programs.wpaperd.enable = true; + + services.mako = { + enable = true; + maxVisible = 5; + defaultTimeout = 5000; + backgroundColor = "#7298bf"; + textColor = "#e0c296"; + borderColor = "#ffffff"; + borderSize = 2; + }; + + programs.waybar = { + enable = true; + systemd.enable = false; + }; + }; + }; +} diff --git a/ws/roles/imv.nix b/ws/roles/imv.nix new file mode 100644 index 0000000..42ad6c3 --- /dev/null +++ b/ws/roles/imv.nix @@ -0,0 +1,15 @@ +{ + config, + lib, + ... +}: let + cfg = config.roles.imv; +in { + options.roles.imv = { + enable = lib.mkEnableOption "imv, a command line image viewer"; + }; + + config = lib.mkIf cfg.enable { + hm.programs.imv.enable = true; + }; +} diff --git a/ws/roles/kitty.nix b/ws/roles/kitty.nix new file mode 100644 index 0000000..f8c3aea --- /dev/null +++ b/ws/roles/kitty.nix @@ -0,0 +1,80 @@ +{ + config, + lib, + ... +}: let + cfg = config.roles.kitty; +in { + options.roles.kitty = { + enable = lib.mkEnableOption "enable kitty"; + }; + + config.hm = lib.mkIf cfg.enable { + programs.kitty = { + enable = true; + settings = { + shell = "elvish"; + + font_family = "FiraCode Nerd Font Mono"; + bold_font = "auto"; + italic_font = "auto"; + bold_italic_font = "auto"; + + font_size = "12.0"; + + enable_audio_bell = false; + + window_padding_width = 10; + + background_opacity = "0.9"; + + foreground = "#5c6a72"; + background = "#fffbef"; + + selection_foreground = "#829181"; + selection_background = "#f0f2d4"; + + cursor = "#5c6a72"; + cursor_text_color = "#f8f5e4"; + + url_color = "#3a94c5"; + + active_border_color = "#8da101"; + inactive_border_color = "#bec5b2"; + bell_border_color = "#f57d26"; + visual_bell_color = "none"; + + active_tab_background = "#fffbef"; + active_tab_foreground = "#5c6a72"; + inactive_tab_background = "#f2efdf"; + inactive_tab_foreground = "#939f91"; + tab_bar_background = "#f8f5e4"; + tab_bar_margin_color = "none"; + + mark1_foreground = "#fffbef"; + mark1_background = "#3a94c5"; + mark2_foreground = "#fffbef"; + mark2_background = "#d3c6aa"; + mark3_foreground = "#fffbef"; + mark3_background = "#df69ba"; + + color0 = "#708089"; + color8 = "#829181"; + color1 = "#f85552"; + color9 = "#e66868"; + color2 = "#8da101"; + color10 = "#93b259"; + color3 = "#dfa000"; + color11 = "#dfa000"; + color4 = "#3a94c5"; + color12 = "#3a94c5"; + color5 = "#df69ba"; + color13 = "#df69ba"; + color6 = "#35a77c"; + color14 = "#35a77c"; + color7 = "#939f91"; + color15 = "#a6b0a0"; + }; + }; + }; +} diff --git a/ws/roles/obs.nix b/ws/roles/obs.nix new file mode 100644 index 0000000..dc1a5e2 --- /dev/null +++ b/ws/roles/obs.nix @@ -0,0 +1,25 @@ +{ + config, + lib, + ... +}: let + cfg = config.roles.obs; +in { + options.roles.obs = { + enable = lib.mkEnableOption "OBS Studio"; + enableVirtualCamera = lib.mkEnableOption "OBS virtual camera"; # TODO: implement lol + }; + + config = lib.mkIf cfg.enable { + hm.programs.obs-studio = { + enable = true; + }; + + boot.extraModulePackages = [ + config.boot.kernelPackages.v4l2loopback + ]; + boot.extraModprobeConfig = '' + options v4l2loopback devices=1 video_nr=1 card_label="OBS virtual camera" exclusive_caps=1 + ''; + }; +} diff --git a/ws/roles/podman.nix b/ws/roles/podman.nix new file mode 100644 index 0000000..48e9b84 --- /dev/null +++ b/ws/roles/podman.nix @@ -0,0 +1,17 @@ +{ + config, + lib, + ... +}: let + cfg = config.roles.podman; +in { + options.roles.podman = { + enable = lib.mkEnableOption "Podman"; + }; + + config = lib.mkIf cfg.enable { + virtualisation.podman = { + enable = true; + }; + }; +} diff --git a/ws/roles/qutebrowser.nix b/ws/roles/qutebrowser.nix new file mode 100644 index 0000000..3c6fa8c --- /dev/null +++ b/ws/roles/qutebrowser.nix @@ -0,0 +1,50 @@ +{ + config, + lib, + ... +}: let + cfg = config.roles.qutebrowser; +in { + options.roles.qutebrowser = { + enable = lib.mkEnableOption ""; + }; + + config = lib.mkIf cfg.enable { + hm.programs.qutebrowser = { + enable = true; + quickmarks = { + nixpkgs = "https://github.com/nixos/nixpkgs"; + home-manager-options = "https://nix-community.github.io/home-manager/options.xhtml"; + }; + searchEngines = { + DEFAULT = "https://www.startpage.com/sp/search?query={}"; + }; + # https://qutebrowser.org/doc/help/settings.html + settings = { + auto_save.session = true; + colors.webpage.preferred_color_scheme = "light"; + content = { + blocking = { + enabled = true; + method = "auto"; + }; + cookies = { + accept = "no-3rdparty"; + store = false; + }; + dns_prefetch = false; + geolocation = false; + headers = { + do_not_track = true; + referer = "never"; + }; + }; + downloads.remove_finished = 60000; + url = { + default_page = "about:blank"; + start_pages = "about:blank"; + }; + }; + }; + }; +} diff --git a/ws/roles/shell/default.nix b/ws/roles/shell/default.nix new file mode 100644 index 0000000..853c223 --- /dev/null +++ b/ws/roles/shell/default.nix @@ -0,0 +1,88 @@ +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.roles.shell; +in { + options.roles.shell = { + enable = lib.mkEnableOption "an opnionated shell environment"; + }; + + config = lib.mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + elvish + + ripgrep + fd + + btop + + sl + + silicon + ]; + programs.direnv = { + enable = true; + nix-direnv.enable = true; + silent = true; + }; + hm = { + home.file = { + ".config/elvish/lib/direnv.elv" = { + executable = true; + source = ./direnv.elv; + }; + ".config/elvish/rc.elv" = { + executable = true; + text = '' + #!/usr/bin/env elvish + use direnv + eval (starship init elvish) + ''; + }; + }; + programs.bash = { + enable = true; + bashrcExtra = '' + eval "$(direnv hook bash)" + eval "$(starship init bash)" + ''; + }; + programs.starship = { + enable = true; + settings = { + add_newline = false; + scan_timeout = 10; + /* + format = lib.concatStrings [ + "$line_break" + "$shell" + "$nix_shell" + "$directory" + "$character" + ]; + #format_right = lib.concatStrings [ + # + #]; + character = { + success_symbol = " >"; + error_symbol = " >"; + }; + directory = { + truncation_length = 3; + truncate_to_repo = true; + format = "[$path](bold cyan)"; + }; + */ + shell = { + disabled = false; + bash_indicator = "bsh"; + elvish_indicator = "elv"; + }; + }; + }; + }; + }; +} diff --git a/ws/roles/shell/direnv.elv b/ws/roles/shell/direnv.elv new file mode 100644 index 0000000..7331db5 --- /dev/null +++ b/ws/roles/shell/direnv.elv @@ -0,0 +1,18 @@ +## Hook for direnv as of direnv 2.34.0 +set @edit:before-readline = $@edit:before-readline { + try { + var m = [("direnv" export elvish | from-json)] + if (> (count $m) 0) { + set m = (all $m) + keys $m | each { |k| + if $m[$k] { + set-env $k $m[$k] + } else { + unset-env $k + } + } + } + } catch e { + echo $e + } +} diff --git a/ws/roles/tailscale.nix b/ws/roles/tailscale.nix new file mode 100644 index 0000000..2cd9878 --- /dev/null +++ b/ws/roles/tailscale.nix @@ -0,0 +1,34 @@ +{ + config, + lib, + ... +}: let + cfg = config.roles.tailscale; +in { + options.roles.tailscale = { + enable = lib.mkEnableOption "Tailscale"; + authKeyFile = lib.mkOption { + type = lib.types.nullOr lib.types.path; + default = null; + }; + interfaceName = lib.mkOption { + type = lib.types.str; + default = "tailscale0"; + }; + enableSSH = lib.mkOption { + type = lib.types.bool; + default = false; + }; + }; + + config = lib.mkIf cfg.enable { + services.tailscale = { + enable = true; + authKeyFile = lib.mkIf (cfg.authKeyFile != null) cfg.authKeyFile; + extraUpFlags = lib.mkIf (cfg.enableSSH) ["--ssh"]; # TODO: Make modular for multiple possible flags. + interfaceName = cfg.interfaceName; + openFirewall = false; + useRoutingFeatures = "none"; + }; + }; +} diff --git a/ws/roles/unfree.nix b/ws/roles/unfree.nix new file mode 100644 index 0000000..f5112a3 --- /dev/null +++ b/ws/roles/unfree.nix @@ -0,0 +1,19 @@ +{ + config, + lib, + ... +}: let + cfg = config.roles.unfree; +in { + options.roles.unfree = { + allow = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = []; + }; + }; + + config = { + nixpkgs.config.allowUnfreePredicate = pkg: + builtins.elem (lib.getName pkg) cfg.allow; + }; +} diff --git a/ws/roles/zellij.nix b/ws/roles/zellij.nix new file mode 100644 index 0000000..625c6cb --- /dev/null +++ b/ws/roles/zellij.nix @@ -0,0 +1,113 @@ +{ + config, + inputs, + lib, + pkgs, + ... +}: let + cfg = config.roles.zellij; + + # Hard light: + # https://github.com/sainnhe/everforest/blob/master/palette.md#light + # https://github.com/sainnhe/everforest/blob/e5b9e2fb676a9ded3e86ae51924f7962fa4fb0ac/autoload/everforest.vim#L51 + everforest = { + bg0 = "#FFF9E8"; + bg1 = "#F8F5E4"; + bg2 = "#F2EFDF"; + bg3 = "#EDEADA"; + bg4 = "#E8E5D5"; + bg5 = "#BEC5B2"; + fg = { + default = "#5C6A72"; + accent = { + cyan = "#35A77C"; + green = "#8DA101"; + }; + grey0 = "#7A8478"; + grey1 = "#859289"; + grey2 = "#9DA9A0"; + statusline = { + green = "#93B259"; + grey = "#708089"; + red = "#E66868"; + }; + }; + }; + + zjstatus = '' + plugin location="file:${inputs.zjstatus.packages.${pkgs.system}.default}/bin/zjstatus.wasm" { + format_left "{mode}" + format_center "{tabs}" + + mode_locked "#[fg=${everforest.bg0},bg=${everforest.fg.statusline.red},bold] {name} " + mode_normal "#[fg=${everforest.bg0},bg=${everforest.fg.statusline.green},bold] {name} " + mode_tab "#[fg=${everforest.bg0},bg=${everforest.fg.accent.cyan},bold] {name} " + + tab_active "#[fg=${everforest.bg0},bg=${everforest.fg.statusline.green}] {name} " + tab_normal "#[fg=${everforest.fg.default},bg=${everforest.bg3}] {name} " + } + ''; +in { + options.roles.zellij = { + enable = lib.mkEnableOption "enable zellij"; + }; + + config = lib.mkIf cfg.enable { + hm = { + programs.zellij = { + enable = true; + settings = { + default_shell = "elvish"; + simplified_ui = true; + pane_frames = false; + default_layout = "default"; + ui.pane_frames.hide_session_name = true; + }; + }; + + home.file.".config/zellij/layouts/default.kdl".text = '' + layout { + default_tab_template { + children + pane size=1 { + ${zjstatus} + } + } + + tab { + pane + } + } + ''; + + home.file.".config/zellij/layouts/dev.kdl".text = '' + layout { + default_tab_template { + children + pane size=1 { + ${zjstatus} + } + } + + tab name="nvim" focus=true { + pane + } + + tab name="shell" { + pane + } + } + + keybinds { + locked { + bind "Insert" { GoToTab 2; SwitchToMode "Normal"; } + } + + shared_except "locked" { + bind "Insert" { GoToTab 1; SwitchToMode "Locked"; } + } + } + ''; + }; + }; +} diff --git a/ws/systems.nix b/ws/systems.nix new file mode 100644 index 0000000..951f41b --- /dev/null +++ b/ws/systems.nix @@ -0,0 +1,27 @@ +{ + lib, + inputs, + ... +}: { + flake = let + mkHost = name: cfg: + inputs.nixpkgs.lib.nixosSystem { + system = cfg.system; + specialArgs = cfg.profile.specialArgs; + modules = + cfg.profile.modules + ++ cfg.modules + ++ [ + ./hosts/${name} + { + networking.hostName = name; + } + ]; + }; + + profiles = import ./profiles inputs; + hosts = import ./hosts inputs profiles; + in { + nixosConfigurations = lib.mapAttrs mkHost hosts; + }; +} -- 2.44.1