{
    "version": "https://jsonfeed.org/version/1.1",
    "title": "Nix  dade",
    "description": "  Nix  dade",
    "home_page_url": "https://0xda.de/",
    "feed_url": "https://0xda.de/tags/nix/index.json",
    "language": "en",
    "authors": [
        {
            "name": "0xdade",
            "url": "https://0xda.de",
            "avatar": "https://0xda.de/img/dade-transparent-logo.png"
        }
    ],
    "items": [
        {
            "title": "Managing My Servers",
            "date_published": "2026-02-20T17:30:52-08:00",
            "date_modified": "2026-02-20T17:43:52-08:00",
            "id": "https://0xda.de/blog/2026/02/managing-my-servers/",
            "url": "https://0xda.de/blog/2026/02/managing-my-servers/",
            "content_html": "\u003cp\u003eI\u0026rsquo;ve been spending a fair amount of time building out documentation around my home network as well as my various services I\u0026rsquo;m running on the internet. Drawing architecture diagrams, mapping out what services are on which servers, documenting backup processes for each service, that sort of thing. But one thing that I keep coming back to is trying to understand the criteria for my perfect server. Sure I have TrueNAS running my storage server, and it\u0026rsquo;s great at what it does. But what about the compute?\u003c/p\u003e\n\u003cp\u003eProfessionally, I\u0026rsquo;ve long been an advocate of the \u0026ldquo;Servers are cattle, not pets\u0026rdquo; mentality \u0026ndash; though maybe I\u0026rsquo;d like to figure out a better way to express this. But the idea is that no server should be a snowflake, and that servers should be easily disposed of and replaced. This seems to be the underlying mentality powering the rise of Kubernetes, which does a great job at decoupling the workload from the underlying server.\u003c/p\u003e\n\u003ch2 id=\"kubernetes\"\u003eKubernetes\u003c/h2\u003e\n\u003cp\u003eKubernetes, though, is a matryoshka doll of complexity. Under every stone is another layer of complexity to manage. Plus, while there are various projects like Flux to enable gitops for kubernetes, a lot of the workflows seem to be heavily based on running commands to install software. \u003ccode\u003ehelm install \u0026lt;blahblahblah\u0026gt;\u003c/code\u003e. Everything is configured with yaml files everywhere, which makes me feel like it\u0026rsquo;s reasonably declarative. Yet still the seemingly standard process is \u0026ldquo;just helm install it, bro.\u0026rdquo; So it becomes easy for a cluster to quickly separate from a purely declarative abstract machine, and instead it accumulates a bunch of state. Which is okay because it\u0026rsquo;s made up of multiple nodes and the state has some consensus mechanism and redundancy so that any node failing is considered safe. But it just feels too imperative to me. Too much like managing an Ubuntu VM, but with way more moving parts.\u003c/p\u003e\n\u003cp\u003eFundamentally, Kubernetes solves a bunch of problems that I want to care about. A bunch of problems that I do care about, at work. Load balancing, horizontal scaling, security policies, everything is a container. Neat. But at home, it kind of sucks. There\u0026rsquo;s a bunch of complexity, a bunch of imperative configuration, and the gitops workflow feels pretty clunky and slow. This might be a user error, so if you love gitops for kubernetes, please write a rebuttal and send it to me. I would genuinely love to be better educated on it.\u003c/p\u003e\n\u003cp\u003eThat doesn\u0026rsquo;t even hit on one of my most important things \u0026ndash; managing a k8s cluster is an added layer of complexity on top of managing the underlying nodes. So you still need to make sure the underlying nodes are updating regularly, have access secured, offload the logs to centralized logging, etc. One promising candidate to relieve this overhead is \u003ca href=\"https://www.talos.dev/\"\u003eTalos\u003c/a\u003e, a very minimal operating system designed purely for running kubernetes. Managing talos nodes is, again, imperative. You run commands to update things. But if you\u0026rsquo;re already going all in on kubernetes, Talos does seem like a really nice way to minimize attack surface and alleviate overhead around patching and access control. I have a 4-node Talos cluster in my closet right now.\u003c/p\u003e\n\u003ch2 id=\"nixos\"\u003eNixOS\u003c/h2\u003e\n\u003cp\u003eSo then I think, maybe I should just install NixOS on all my servers. I really like the declarative nature of Nix, and if you do it right you can pretty easily decouple services from servers, allowing you to redeploy a service to any of your servers, or deploy it in parallel to multiple of your servers. But you don\u0026rsquo;t really get any sort of scaling with this, and keeping services available is a bit harder and more manual. Plus, if I\u0026rsquo;m being brutally honest, the \u003ca href=\"https://jade.fyi/blog/pinning-packages-in-nix/\"\u003edependency management story for NixOS kind of sucks\u003c/a\u003e. Pinning a package to a specific version is difficult. Stable can quickly get out of date, and unstable is often some random release candidate. While you can absolutely override versions for individual packages, it\u0026rsquo;s definitely not very intuitive and it is either a lot of overhead, or has a high risk of breaking randomly in the future. I would love something more like python\u0026rsquo;s dependency declarations for packages. The package namespace in nixpkgs seems globally unique, so in theory I should be able to just do \u003ccode\u003elistmonk~=6.0\u003c/code\u003e and have a high degree of confidence that redeploying gives me the latest version but without going up to \u003ccode\u003e7.0\u003c/code\u003e. I understand why NixOS doesn\u0026rsquo;t have this, but I can still wish.\u003c/p\u003e\n\u003cp\u003ePlus, running containers on NixOS is an interesting situation. You can enable docker, but it doesn\u0026rsquo;t seem like you can very easily define which containers you want to launch. I\u0026rsquo;d love to be able to just point NixOS at my docker compose files that I already have, and have that get built into the next deployment. It handles the restart conditions, the container dependencies, etc. Many people will say that you don\u0026rsquo;t need docker if you\u0026rsquo;re using NixOS because it achieves many of the same goals. That\u0026rsquo;s totally fair. Except I already have a bunch of docker compose files, and most of the apps I want to install ship with a docker compose file, very few of them ship with a nix file I can just import. There are tools like \u003ca href=\"https://github.com/aksiksi/compose2nix\"\u003ecompose2nix\u003c/a\u003e which can take a compose file and output nix files, which could meet my needs, but then I\u0026rsquo;m introducing this intermediary tool anytime I want to deploy a new service, and that just feels kind of clunky.\u003c/p\u003e\n\u003cp\u003eMaybe the answer here is that I need to go all-in on NixOS and just configure my services entirely as Nix and accept the adoption costs as one-time costs to get things configured. I mean, I\u0026rsquo;m still kind of at the mercy of nixpkgs configurations, but it\u0026rsquo;s a git repo and if something sucks, I can just open a PR to improve it. But this high adoption cost combined with the kinda bad dependency management experience does make me reconsider if this is the route I want to go. I do appreciate how tightly nix flakes are integrated with GitOps, and I also appreciate the NixOS configuration management story (certainly more than configuration management on ubuntu or any other operating system that isn\u0026rsquo;t designed to be completely declarative or completely ephemeral).\u003c/p\u003e\n\u003ch2 id=\"coreos\"\u003eCoreOS\u003c/h2\u003e\n\u003cp\u003eThere\u0026rsquo;s another option, one I haven\u0026rsquo;t experimented with so I can\u0026rsquo;t speak first hand to it yet, but that looks somewhat promising. That is \u003ca href=\"https://fedoraproject.org/coreos/\"\u003eCoreOS\u003c/a\u003e, a container optimized operating system. It is a minimal operating system that auto-updates. Pretty easy to treat this as a dumb and ephemeral underlying operating system. My first introduction to CoreOS was a post by Thomas Letan called \u0026ldquo;\u003ca href=\"https://soap.coffee/~lthms/posts/i-cannot-ssh-into-my-server-anymore.html\"\u003eI cannot SSH into my servers anymore (and that\u0026rsquo;s fine)\u003c/a\u003e\u0026rdquo;, and it looks fairly promising.\u003c/p\u003e\n\u003cp\u003eBut the caveat with this is that it has a similar problem to the NixOS problem \u0026ndash; I pretty much will always have to translate service definitions into podman\u0026rsquo;s quadlet syntax.  Updating containers would have to be entirely manual, since \u003ca href=\"https://docs.github.com/en/code-security/reference/supply-chain-security/supported-ecosystems-and-repositories\"\u003eDependabot does support docker-compose\u003c/a\u003e but doesn\u0026rsquo;t support podman-quadlet. While I don\u0026rsquo;t necessarily want every container to automatically update, I would like to have a better solution for being alerted when a service needs updating.\u003c/p\u003e\n\u003ch2 id=\"tradeoffs\"\u003eTradeoffs\u003c/h2\u003e\n\u003cp\u003eIt\u0026rsquo;s funny, this whole exercise has been weighing on my mind. When I\u0026rsquo;m at work, I am very aware that we have to make tradeoffs for different things. I also accept that using managed container runtimes in cloud providers gives businesses the need to not have to care about this stuff. I loved ECS Fargate for this reason. Git Repo + Terraform + CodePipeline + Fargate and everything was declarative, automatically updatable from Dependabot, and I never had to manage a server.\u003c/p\u003e\n\u003cp\u003eBut at home, I feel passionately about managing my infrastructure and not relying on the cloud. I mostly run everything from a dedicated server I pay for, which is still renting my internet presence, but feels less like renting than the modern cloud. I want to have my own autonomous system some day. I think it would be fun to own my own /24, run my own BGP routers, and be a proper citizen of the internet. There\u0026rsquo;s just something alluring about not being a serf in someone else\u0026rsquo;s kingdom, you know? But I also feel like if I\u0026rsquo;m doing this as a hobby, I want to look for the perfect solution. I know there\u0026rsquo;s no such thing as the perfect solution, but I still can\u0026rsquo;t help but look for it.\u003c/p\u003e\n\u003cp\u003eIn the meantime, I think I\u0026rsquo;m going to continue pursuing my NixOS servers. There\u0026rsquo;s a higher adoption cost to it, but I do really appreciate the simplicity of it, and I don\u0026rsquo;t really need all the complexity of being a one-man devops team. Maybe some day I can have an \u003ca href=\"https://oxide.computer/\"\u003eOxide\u003c/a\u003e rack in my closet and have cloud-native computing at the tip of my fingers. Until then, I guess I\u0026rsquo;ll just have to settle for what I can cobble together.\u003c/p\u003e\n"
        },
        {
            "title": "Experimenting with Nixos Anywhere",
            "date_published": "2026-02-19T19:43:06-08:00",
            "date_modified": "2026-02-19T19:59:09-08:00",
            "id": "https://0xda.de/blog/2026/02/experimenting-with-nixos-anywhere/",
            "url": "https://0xda.de/blog/2026/02/experimenting-with-nixos-anywhere/",
            "content_html": "\u003cp\u003eIn preparation for migrating my servers to NixOS, I want to get the deployment process down. For simplicity, I\u0026rsquo;m going to use \u003ca href=\"https://github.com/nix-community/nixos-anywhere\"\u003enixos-anywhere \u003c/a\u003eto deploy to a new ubuntu server. This will make it really easy to start with a basic server from any provider (or from my ESXi host) and get to the nixos configuration I want.\u003c/p\u003e\n\u003cp\u003eOne of the problems I\u0026rsquo;ve run into with how my nix config is setup so far is that my home-manager configuration assumes I will always be deploying my home config to a desktop environment. This isn\u0026rsquo;t necessarily true, so I\u0026rsquo;ll want to revisit that later to distinguish between server-home and desktop-home. But for now, I\u0026rsquo;m going to setup my disko configuration and test it out.\u003c/p\u003e\n\u003cp\u003eOne of the things that I\u0026rsquo;m not sure about for my disko config is my device setting - \u003ccode\u003edevice = \u0026quot;/dev/disk/by-diskseq/1\u0026quot;;\u003c/code\u003e I first tried to use \u003ccode\u003eby-diskseq\u003c/code\u003e thinking that I could avoid hardcoding in the disk UUID, which would make this more reusable.\u003c/p\u003e\n\u003cp\u003eTesting my configuration, which I\u0026rsquo;m calling \u003ccode\u003eds1\u003c/code\u003e in my flake, should be as easy as the following. But unfortunately I\u0026rsquo;m operating from my macbook, which has a different architecture, so even this test doesn\u0026rsquo;t work. The cross-architecture problems are going to be the bane of my existence until I figure out how to fix it. But that\u0026rsquo;ll be a problem for later.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003enix run github:nix-community/nixos-anywhere -- --flake ./github/0xdade/nixcfg#ds1 --vm-test\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eSince I can\u0026rsquo;t easily test, instead I took a snapshot of the VM in ESXi and I\u0026rsquo;m going to just test in \u0026ldquo;production\u0026rdquo; \u0026ndash; this server isn\u0026rsquo;t useful for anything yet and I can just revert the snapshot if I need to. To prepare to run the nixos-anywhere installer, I just need to give myself SSH access to the server as the root user (so that I can avoid being prompted for sudo).\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003enix run github:nix-community/nixos-anywhere -- --generate-hardware-config nixos-generate-config ~/github/0xdade/nixcfg/hosts/nixos/ds1/hardware-configuration.nix --flake ~/github/0xdade/nixcfg#ds1 --target-host root@51.81.64.17\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eAfter I run this, it appears to download some stuff and then use kexec to reboot into NixOS. It reboots and nixos-anywhere picks up where it left off, but immediately fails the disko configuration because my earlier decision about \u003ccode\u003eby-diskseq\u003c/code\u003e turned out to be a bad one.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eProblem opening /dev/disk/by-diskseq/1 for reading! Error is 2.\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eThe specified file does not exist!\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eInformation: Creating fresh partition table; will override earlier problems!\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eCaution! Secondary header was placed beyond the disk\u0026#39;s limits! Moving the\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eheader, but other problems may occur!\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eUnable to open device \u0026#39;\u0026#39; for writing! Errno is 2! Aborting write!\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eInstead, I think I\u0026rsquo;ll try to install this with \u003ccode\u003e/dev/sda\u003c/code\u003e, since I\u0026rsquo;m installing to a server with only one disk, and that will be my most common deployment pattern. I think I can override this value on a per-server basis when deploying, but that relies on specific imperative commands, which I\u0026rsquo;d like to try to minimize as much as possible. But I also don\u0026rsquo;t want to rely on disk UUIDs where every disk configuration has to be exactly aligned with the server I\u0026rsquo;m deploying it on. It\u0026rsquo;s just not very reusable.\u003c/p\u003e\n\u003cp\u003eNot sure what to do next, I figured I\u0026rsquo;ll just try to re-run my \u003ccode\u003enixos-anywhere\u003c/code\u003e command and see if it can pick up where it left off. Thankfully it seems like it does, which means so far I don\u0026rsquo;t need to restore the snapshot. I am getting periodic errors about the architecture difference, I imagine maybe nixos-anywhere was trying to save time by starting builds locally to copy them over later. But the errors don\u0026rsquo;t appear to be hard blocking, which means nixos-anywhere probably has fallback behavior that works correctly.\u003c/p\u003e\n\u003cp\u003eA few minutes later and my terminal shows:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eInstallation finished. No error reported.\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003einstallation finished!\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e### Rebooting ###\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ePseudo-terminal will not be allocated because stdin is not a terminal.\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e### Waiting for the machine to become unreachable due to reboot ###\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003emux_client_request_session: read from master failed: Broken pipe\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003essh: connect to host 51.81.64.17 port 22: Connection refused\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e### Done! ###\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eNeat. Let\u0026rsquo;s give it a few minutes and reboot, see what happens. If my configuration is correct, I should be able to ssh to \u003ccode\u003edade@\u0026lt;ip\u0026gt;\u003c/code\u003e with my SSH key and correctly use sudo with the password I set in my configuration. I went with a barebones deployment, so there shouldn\u0026rsquo;t be too many things running yet, and shouldn\u0026rsquo;t be too many things that could go wrong.\u003c/p\u003e\n\u003ch2 id=\"hardware-configuration\"\u003eHardware-configuration?\u003c/h2\u003e\n\u003cp\u003eSo I guess there was one thing that could go wrong. The nixos-anywhere command I ran that generated my hardware-configuration.nix file for the server sets the default value for networking.useDHCP to true. \u003ccode\u003enetworking.useDHCP = lib.mkDefault true;\u003c/code\u003e \u0026ndash; this server doesn\u0026rsquo;t use DHCP, and in fact most internet-routable servers probably aren\u0026rsquo;t using DHCP. But of course, I didn\u0026rsquo;t see this until after the reboot, so now I have to decide how to continue.\u003c/p\u003e\n\u003cp\u003eI could restore the snapshot and re-try from the beginning. That would be the best way to get the full end-to-end nixos-anywhere experience and make sure it works for the future. But for now I\u0026rsquo;m going to just try using the ESXi console to login and see if I can fix it.\u003c/p\u003e\n\u003cp\u003eUnfortunately for me, my password for this machine is a 32 character randomly generated password from my password manager, and I can\u0026rsquo;t paste into the ESXi console. So I have to type it in manually, and after a few attempts, I figured out that when I get the password wrong, it tells me as much. When I get the password correct, it is just redirecting me back to the login screen. This represents a problem, maybe my user\u0026rsquo;s shell isn\u0026rsquo;t set up correctly or something, I\u0026rsquo;m not sure. I guess it\u0026rsquo;s time to restore from snapshot.\u003c/p\u003e\n\u003cp\u003eThankfully the snapshot restore is nearly instant, so I modified my \u003ccode\u003ehardware-configuration.nix\u003c/code\u003e for the server to turn off DHCP and hopefully that prevents me from getting locked out via SSH. Or at least, hopefully it results in the SSH server listening.\u003c/p\u003e\n\u003cp\u003eUnfortunately, re-running the same command caused the entire hardware-configuration.nix file to get rewritten back to the \u0026ldquo;scanned\u0026rdquo; value. So that\u0026rsquo;s problematic. I\u0026rsquo;ll try rearranging my flake so that \u003ccode\u003ehardware-configuration.nix\u003c/code\u003e comes before \u003ccode\u003eds1/default.nix\u003c/code\u003e and then set \u003ccode\u003enetworking.useDHCP = false;\u003c/code\u003e in the default configuration.  Maybe this will cause the DHCP value to be ignored and the specific IP address to be handled correctly.\u003c/p\u003e\n\u003cp\u003eUnfortunately, still nothing. SSH does not appear to have come back up, and I still can\u0026rsquo;t login, for some reason.\u003c/p\u003e\n\u003ch2 id=\"disk-problems\"\u003eDisk Problems?\u003c/h2\u003e\n\u003cp\u003eAfter trying several more things, I didn\u0026rsquo;t really get anywhere. SSH still wasn\u0026rsquo;t coming up, and the console still wasn\u0026rsquo;t working. But once in a while the console would hang for a little bit and then flash an error message before resetting the screen to the login window. So I recorded my screen and discovered the error \u003ccode\u003eUnable to cd to /home/dade\u003c/code\u003e. That gives me\u0026hellip; something, I guess? I\u0026rsquo;m not sure why it\u0026rsquo;s happening, but at least gives me something to start looking at.\u003c/p\u003e\n\u003cp\u003eAfter a bit of searching, I found an \u003ca href=\"https://github.com/NixOS/nixpkgs/issues/10888\"\u003eIncorrect Home Directory Permissions\u003c/a\u003e github issue from NixOS. This looks to be a problem with declaring a specific home directory not getting the right permissions, but it made me realize that I wasn\u0026rsquo;t declaring my home directory.  Let\u0026rsquo;s set the home directory and try this again, I guess\u0026hellip; Still doesn\u0026rsquo;t explain the ssh server not starting, but one problem at a time, I guess.\u003c/p\u003e\n\u003cp\u003eAfter literal hours of trial and error, trying everything I could find that might vaguely be the problem, I finally found the culprit. My disko configuration has subvolumes in my btrfs volume, and I accidentally mounted \u003ccode\u003e/\u003c/code\u003e at both the top level as well as the \u003ccode\u003e/root\u003c/code\u003e subvolume. Apparently this was causing things to get mounted as read-only, or something like that, which in turn resulted in tons of software not being able to start during boot up. This included core networking services as well as ncsd which is apparently in the path to do things like\u0026hellip; look the user up in the passwd file? I guess?\u003c/p\u003e\n\u003cp\u003eAnyways, it\u0026rsquo;s almost midnight and I\u0026rsquo;ve spent 5 or 6 hours on this. I got to a functional boot, which is great. But now I\u0026rsquo;m going to restore the snapshot and undo a bunch of the random changes I had made while frantically trying to resolve the issue, then do a clean deploy to the state I want to start in. Then, I\u0026rsquo;m going to bed.\u003c/p\u003e\n"
        },
        {
            "title": "MacOS \u0026 Nix-Darwin",
            "date_published": "2026-02-18T19:05:30-08:00",
            "date_modified": "2026-02-18T19:14:19-08:00",
            "id": "https://0xda.de/blog/2026/02/macos-nix-darwin/",
            "url": "https://0xda.de/blog/2026/02/macos-nix-darwin/",
            "content_html": "\u003cp\u003eNote: Like my previous articles about Nix, this is not meant to be a guide. It\u0026rsquo;s just my narrative journey while I explore the thing.\u003c/p\u003e\n\u003cp\u003eIt\u0026rsquo;s been quite some time since my first foray into \u003ca href=\"https://0xda.de/blog/2024/06/framework-and-nixos-day-one/\"\u003eNixOS on my framework laptop\u003c/a\u003e. While I still love my Framework laptop, I find that I don\u0026rsquo;t use it that often \u0026ndash; in part because it doesn\u0026rsquo;t really integrate into my Apple ecosystem, but really because it turns out the 16\u0026quot; laptop was just not a very convenient choice. It barely fits in my backpack and it\u0026rsquo;s just generally too big to carry around. I\u0026rsquo;ll probably use it to replace my desktop whenever it dies, but I haven\u0026rsquo;t been using it very much as a daily driver laptop.\u003c/p\u003e\n\u003cp\u003eI have, however, been using my old first-gen M1 Macbook quite a bit. I also started a new job a few months ago where I got another Apple-silicon Macbook. It was around that time that I learned that I failed to save a lot of my configurations from my previous job\u0026rsquo;s Macbook, and so I was trying to remember what I liked. I\u0026rsquo;m not good at remembering things. So I found myself basically setting up two macbooks, and both of them have subtle differences. Not just because one is work and so has a bunch of work software on it, but because I\u0026rsquo;m human, forgetful, and error-prone.\u003c/p\u003e\n\u003cp\u003eI found myself longing for the declarative nature of my Framework laptop. I was also chatting with my friend, \u003ca href=\"https://technowizardry.net/\"\u003eAdam\u003c/a\u003e, about his \u003ca href=\"https://technowizardry.net/2025/11/i-like-the-idea-of-nix-but-dont-enjoy-using-it/\"\u003eNixOS experiences\u003c/a\u003e and some of the cool work he was doing with generating diffs on pull requests and the potential for better CI/CD integration. A very rapid unplanned inspiration event led me from \u0026ldquo;I should update my servers to NixOS so I don\u0026rsquo;t have to worry about them so much anymore\u0026rdquo; to \u0026ldquo;Well I have to use my laptop to update my servers, so I guess I should put Nix on my Macbook first.\u0026rdquo;\u003c/p\u003e\n\u003ch2 id=\"nix-darwin\"\u003eNix-Darwin\u003c/h2\u003e\n\u003cp\u003eThankfully \u003ca href=\"https://github.com/nix-darwin/nix-darwin/\"\u003eNix-Darwin\u003c/a\u003e exists, which lets you turn your Macbook into a NixOS-like experience, albeit with a few caveats. I think the most important caveat for me, and something I am exceedingly happy about while writing this, is that it doesn\u0026rsquo;t blow away all your installed applications or configuration when you set up Nix-Darwin. I hadn\u0026rsquo;t even considered this a possibility until the moment the rebuild started working (more on this in a minute), but then I briefly panicked like \u0026ldquo;Oh no, I already have a user, I already have all these apps installed, I already have a bunch of configuration, what if my barebones config blows that all away and I brick my Macbook?\u0026rdquo;\u003c/p\u003e\n\u003cp\u003eIn classic hacker fashion, of course the command was already running before those thoughts crossed my mind. It would have been too late. Thankfully Nix-Darwin seems to be more forgiving about being installed on existing functional systems and it didn\u0026rsquo;t modify any of my existing stuff.  But let\u0026rsquo;s rewind a little bit to the struggles that led up to this panic moment.\u003c/p\u003e\n\u003ch3 id=\"installing-nix-darwin\"\u003eInstalling nix-darwin\u003c/h3\u003e\n\u003cp\u003eThe readme for nix-darwin has some guidance in it, but the guidance was kind of confusing for me. I already had a flake from my existing NixOS configurations, and I\u0026rsquo;d like to reuse that so that I can keep it all in one repo and reuse components where appropriate. One could certainly make the argument that the darwin configuration and the nixos configuration should be completely separate, and I probably would even agree with that idea \u0026ndash; it certainly would have made my life easier tonight.\u003c/p\u003e\n\u003cp\u003eBefore I could install nix-darwin, I had to install nix. According to the nix-darwin readme, they recommend installing \u003ca href=\"https://lix.systems/install/#on-any-other-linuxmacos-system\"\u003eLix\u003c/a\u003e rather than Nix, because Lix ships with an uninstaller, whereas Nix does not. In the event that I don\u0026rsquo;t like declaratively managing my Macbook, I thought the uninstaller would be helpful.\u003c/p\u003e\n\u003cp\u003eInstalling Lix was uneventful and it behaves as Nix behaves, or at least so far it does. Next it was time to get the flake configuration setup. I cloned my \u003ccode\u003enixcfg\u003c/code\u003e repo that houses the rest of my configuration, and started trying to follow the nix-darwin guidance. Unfortunately the command it suggests running repeatedly did not work for me - \u003ccode\u003esudo nix run nix-darwin/nix-darwin-25.05#darwin-rebuild -- switch\u003c/code\u003e. It would just complain \u003ccode\u003ewarning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring error: file 'darwin' was not found in the Nix search path (add it using $NIX_PATH or -I)\u003c/code\u003e. Like, duh, I\u0026rsquo;m trying to install nix-darwin, of course it\u0026rsquo;s not in the path yet.\u003c/p\u003e\n\u003cp\u003eAfter a fair bit of searching, I figured out that the solution was obvious in hindsight \u0026ndash; I needed to enable flakes, specify my flake, and make sure my darwin configuration was added to my repo. Same as I did for my NixOS machine.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-shell\" data-lang=\"shell\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo nix run nix-darwin/master#darwin-rebuild --extra-experimental-features \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;nix-command flakes\u0026#34;\u003c/span\u003e -- switch --flake ./flake.nix\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eThis ended up working for me from inside my \u003ccode\u003enixcfg\u003c/code\u003e repo. But I\u0026rsquo;m pretty sure it would also work correctly from anywhere if I replaced \u003ccode\u003e./flake.nix\u003c/code\u003e with \u003ccode\u003e~/nixcfg\u003c/code\u003e, the path to my nixcfg repo.\u003c/p\u003e\n\u003cp\u003eAfter this ran successfully, I now had the \u003ccode\u003edarwin-\u003c/code\u003e commands available that I expected, such as \u003ccode\u003edarwin-rebuild\u003c/code\u003e, \u003ccode\u003edarwin-help\u003c/code\u003e, \u003ccode\u003edarwin-options\u003c/code\u003e, \u003ccode\u003edarwin-version\u003c/code\u003e, and \u003ccode\u003edarwin-uninstaller\u003c/code\u003e.\u003c/p\u003e\n\u003ch3 id=\"dustin-lyons-nix-config\"\u003eDustin Lyon\u0026rsquo;s Nix Config\u003c/h3\u003e\n\u003cp\u003eWhat also ended up being a huge help is \u003ca href=\"https://github.com/dustinlyons/nixos-config/\"\u003eDustin Lyon\u0026rsquo;s nixos-config repository\u003c/a\u003e. It\u0026rsquo;s well laid out, taught me several things about Nix, especially how to integrate nix-darwin into my existing config repo, and overall just gave a lot of inspiration. He even provides templates for new configurations, but since I\u0026rsquo;m integrating into my existing config, that won\u0026rsquo;t be particularly helpful for me. I\u0026rsquo;ll instead be manually integrating the things I like, and leaving out the things I don\u0026rsquo;t like.\u003c/p\u003e\n\u003cp\u003eThis also serves as a catalyst for me to clean up my nix config and make the repo public \u0026ndash; I have gotten a great deal of value from the repos that others have made public, I should contribute that back. I just need to look through the history and make sure there are no secrets that would be problematic if published. On the other hand, I don\u0026rsquo;t necessarily want to map out all my infrastructure in one repo, so I\u0026rsquo;m still weighing this. I have some specific ideas for NixOS server configurations that I might publish independently, though.\u003c/p\u003e\n"
        },
        {
            "title": "Framework and NixOS - Locking \u0026 Customization",
            "date_published": "2024-07-13T12:58:32-07:00",
            "date_modified": "2024-07-13T13:13:36-07:00",
            "id": "https://0xda.de/blog/2024/07/framework-and-nixos-locking-customization/",
            "url": "https://0xda.de/blog/2024/07/framework-and-nixos-locking-customization/",
            "content_html": "\u003cp\u003eThis is \u003cstrong\u003epart 7\u003c/strong\u003e in my series of posts learning how to setup NixOS on my Framework 16\u0026quot; AMD laptop. It is not meant as a guide, necessarily, but more as a captain\u0026rsquo;s log of my thoughts and processes along the way.\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ca href=\"https://0xda.de/blog/2024/06/framework-and-nixos-day-one/\"\u003eFramework and NixOS - Day One\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://0xda.de/blog/2024/06/framework-and-nixos-day-two/\"\u003eFramework and NixOS - Day Two\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://0xda.de/blog/2024/06/framework-and-nixos-secure-boot-day-three/\"\u003eFramework and NixOS - Secure Boot\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://0xda.de/blog/2024/06/framework-and-nixos-declarative-encrypted-disk-partitions/\"\u003eFramework and NixOS - Declarative Encrypted Disk Partitions\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://0xda.de/blog/2024/07/framework-and-nixos-sops-nix-secrets-management/\"\u003eFramework and NixOS - Sops-nix Secrets Management\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://0xda.de/blog/2024/07/framework-and-nixos-daily-use/\"\u003eFramework and NixOS - Daily Use\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch2 id=\"setting-up-a-lock-screen\"\u003eSetting up a lock screen\u003c/h2\u003e\n\u003cp\u003eI\u0026rsquo;ve done all this work to secure my laptop, setting up secure boot, setting up an encrypted disk partition, etc. But my laptop never locks \u0026ndash; there\u0026rsquo;s no idle timeout, no hot key, and there\u0026rsquo;s no lock screen.\u003c/p\u003e\n\u003cp\u003eThankfully, the folks over at Hyprland have produced tools just for this \u0026ndash; \u003ca href=\"https://wiki.hyprland.org/Hypr-Ecosystem/hyprlock/\"\u003ehyprlock\u003c/a\u003e and \u003ca href=\"https://wiki.hyprland.org/Hypr-Ecosystem/hypridle/\"\u003ehypridle\u003c/a\u003e. We\u0026rsquo;re going to get started by setting up a \u003ccode\u003ehyprlock\u003c/code\u003e config file. We\u0026rsquo;re going to put all of our config files into our \u003ccode\u003e~/nixcfg/home/dade/.config/hypr/\u003c/code\u003e folder. I copied the \u003ca href=\"https://github.com/catppuccin/hyprlock\"\u003ecatppuccin\u003c/a\u003e \u003ca href=\"https://github.com/catppuccin/hyprland/blob/main/themes/frappe.conf\"\u003efrappe\u003c/a\u003e hyprlock theme.\u003c/p\u003e\n\u003cp\u003eNext we need to update home.nix to include our new hypr config files into our home directory.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-nix\" data-lang=\"nix\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  home\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003efile \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;.config/hypr/hyprland.conf\u0026#34;\u003c/span\u003e\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003esource \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#81c8be\"\u003ehome/dade/.config/hypr/hyprland.conf\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;.config/hypr/hyprlock.conf\u0026#34;\u003c/span\u003e\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003esource \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#81c8be\"\u003ehome/dade/.config/hypr/hyprlock.conf\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;.config/hypr/frappe.conf\u0026#34;\u003c/span\u003e\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003esource \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#81c8be\"\u003ehome/dade/.config/hypr/frappe.conf\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  };\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eAfter doing this, I enabled hyprlock in \u003ccode\u003e~/nixcfg/hosts/serenity/configuration.nix\u003c/code\u003e via \u003ccode\u003eprograms.hyprlock.enable\u003c/code\u003e. I also read that I \u003ca href=\"https://mynixos.com/home-manager/option/programs.hyprlock.enable\"\u003eneed to set a pam service for hyprlock\u003c/a\u003e, so I added a line for that as well.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-nix\" data-lang=\"nix\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  programs\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003ehyprland\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003eenable \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#e5c890\"\u003etrue\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  programs\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003ehyprland\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003eportalPackage \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e pkgs\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003exdg-desktop-portal-hyprland;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  programs\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003ehyprlock\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003eenable \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#e5c890\"\u003etrue\u003c/span\u003e; \u003cspan style=\"color:#737994;font-style:italic\"\u003e# new line\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  security\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003epam\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003eservices\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003ehyprlock \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {}; \u003cspan style=\"color:#737994;font-style:italic\"\u003e# new line\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eAfter a \u003ccode\u003eswitch\u003c/code\u003e, I  manually ran \u003ccode\u003ehyprlock\u003c/code\u003e in the terminal and it presented the lock screen but I noticed a couple issues:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003eThe login prompt has a broken icon in it\u003c/li\u003e\n\u003cli\u003eMore importantly, my screen contents are still visible.\u003c/li\u003e\n\u003c/ol\u003e\n\u003ch3 id=\"installing-nerd-fonts\"\u003eInstalling Nerd Fonts\u003c/h3\u003e\n\u003cp\u003eTo fix the broken icon, I\u0026rsquo;m going to install the Jet Brains Mono Nerd Font. I don\u0026rsquo;t have a \u003cem\u003estrong\u003c/em\u003e preference on fonts, and since that\u0026rsquo;s what the theme uses by default, I\u0026rsquo;ll just stick with that for now. I can do this by adding the following to \u003ccode\u003e~/nixcfg/hosts/serenity/configuration.nix\u003c/code\u003e:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-nix\" data-lang=\"nix\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  fonts\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003epackages \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#ca9ee6\"\u003ewith\u003c/span\u003e pkgs; [ (nerdfonts\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003eoverride { fonts \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e [ \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;JetBrainsMono\u0026#34;\u003c/span\u003e ]; }) ];\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eRun a \u003ccode\u003eswitch\u003c/code\u003e and now I\u0026rsquo;ve got the relevant fonts installed and when I run \u003ccode\u003ehyprlock\u003c/code\u003e, I can see that the broken icon was actually a lock icon. Perfect. I might come back to this and update my Waybar configuration to use this font as well instead of Font Awesome.\u003c/p\u003e\n\u003ch3 id=\"hiding-screen-contents\"\u003eHiding Screen Contents\u003c/h3\u003e\n\u003cp\u003eNext, I need to address the fact that my screen contents are still visible. I believe that this is happening because the theme specifies a background file, but I\u0026rsquo;m not providing a background file. I\u0026rsquo;m going to just comment it out and see if that fixes the problem.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e# BACKGROUND\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ebackground {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    monitor =\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e#    path = ~/.config/background\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    blur_passes = 0\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    color = $base\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eSure enough, commenting out the line in the theme that sets a background image, it switches to just using the color for the background.\u003c/p\u003e\n\u003cp\u003eJust to give it a little more flare, I want to add a straight line across the screen similar to how the screenshot of the theme appears in the github repo. But instead of doing it with an image, I\u0026rsquo;m going to do it with a simple shape in the \u003ccode\u003ehyprlock.conf\u003c/code\u003e file.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eshape {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  monitor =\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  size = 2560, 4 # width, height (matches border thickness of login box)\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  color = $accent\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  rounding = -1\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  rotate = 0\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  xray = false\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  position = 0, -35 # -35 is the same offset as the login box\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  halign = center\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  valign = center\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch2 id=\"creating-a-lock-hotkey\"\u003eCreating a lock hotkey\u003c/h2\u003e\n\u003cp\u003eNow that I have a lock mechanism in place, I\u0026rsquo;d like to set up a hot key to quickly lock my screen. Since I already am used to windows environments, I\u0026rsquo;m pretty comfortable with \n\n\u003ckbd\u003eWIN\u003c/kbd\u003e\u003cspan\u003e+\u003c/span\u003e\u003ckbd\u003eL\u003c/kbd\u003e\n to lock the screen. Let\u0026rsquo;s add another keybind to \u003ccode\u003e~/nixcfg/home/.config/hypr/hyprland.conf\u003c/code\u003e.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ebind = $mainMod, l, exec, hyprlock\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eWe can \u003ccode\u003eswitch\u003c/code\u003e and then hit \n\n\u003ckbd\u003eWIN\u003c/kbd\u003e\u003cspan\u003e+\u003c/span\u003e\u003ckbd\u003eL\u003c/kbd\u003e\n and we\u0026rsquo;re greeted with our lock screen. Perfect. Now let\u0026rsquo;s get that automated.\u003c/p\u003e\n\u003ch2 id=\"hypridle\"\u003eHypridle\u003c/h2\u003e\n\u003cp\u003eNext I need an idle daemon that will automatically lock the screen after my laptop has been idle for a little while. I couldn\u0026rsquo;t find exact instructions on how to do this at the host level, but based on the \u003ca href=\"https://mynixos.com/home-manager/option/services.hypridle.enable\"\u003eMyNixOS\u003c/a\u003e page for Hypridle, it appears to be available as a home-manager service. I\u0026rsquo;m going to try to do the same thing in my NixOS configuration and just hope it works.\u003c/p\u003e\n\u003cp\u003eIn  \u003ccode\u003e~/nixcfg/hosts/serenity/configuration.nix\u003c/code\u003e I\u0026rsquo;m going to add the following line:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-nix\" data-lang=\"nix\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eservices\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003ehypridle\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003eenable \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#e5c890\"\u003etrue\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eAccording to the \u003ca href=\"https://wiki.hyprland.org/Hypr-Ecosystem/hypridle/\"\u003eHypridle wiki page\u003c/a\u003e, Hypridle \u003cem\u003erequires\u003c/em\u003e a config file. So let\u0026rsquo;s set one up. We\u0026rsquo;re going to start with the example from the wiki page and put it at \u003ccode\u003e~/nixcfg/home/dade/.config/hypr/hypridle.conf\u003c/code\u003e.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003egeneral {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    lock_cmd = pidof hyprlock || hyprlock       # avoid starting multiple hyprlock instances.\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    before_sleep_cmd = loginctl lock-session    # lock before suspend.\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    after_sleep_cmd = hyprctl dispatch dpms on  # to avoid having to press a key twice to turn on the display.\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003elistener {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    timeout = 150                                # 2.5min.\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    on-timeout = brightnessctl -s set 10         # set monitor backlight to minimum, avoid 0 on OLED monitor.\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    on-resume = brightnessctl -r                 # monitor backlight restore.\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e# turn off keyboard backlight, comment out this section if you dont have a keyboard backlight.\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003elistener {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    timeout = 150                                          # 2.5min.\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    on-timeout = brightnessctl -sd rgb:kbd_backlight set 0 # turn off keyboard backlight.\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    on-resume = brightnessctl -rd rgb:kbd_backlight        # turn on keyboard backlight.\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003elistener {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    timeout = 300                                 # 5min\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    on-timeout = loginctl lock-session            # lock screen when timeout has passed\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003elistener {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    timeout = 330                                 # 5.5min\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    on-timeout = hyprctl dispatch dpms off        # screen off when timeout has passed\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    on-resume = hyprctl dispatch dpms on          # screen on when activity is detected after timeout has fired.\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003elistener {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    timeout = 1800                                # 30min\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    on-timeout = systemctl suspend                # suspend pc\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eThe only thing that I don\u0026rsquo;t think will work with this config file is the keyboard backlight settings \u0026ndash; when I previously looked at the output of brightnessctl, I don\u0026rsquo;t think I had any keyboard backlight devices showing up. I can manually set the keyboard backlight brightness with a hotkey on the keyboard (\n\n\u003ckbd\u003eFN\u003c/kbd\u003e\u003cspan\u003e+\u003c/span\u003e\u003ckbd\u003eSPACE\u003c/kbd\u003e\n), but I didn\u0026rsquo;t have to do anything to get that to work, which makes me think it might be in the keyboard firmware itself.\u003c/p\u003e\n\u003cp\u003eI also had to add this new file to our \u003ccode\u003ehome.nix\u003c/code\u003e file.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  home.file = {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    ...\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u0026#34;.config/hypr/hypridle.conf\u0026#34;.source = home/dade/.config/hypr/hypridle.conf;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  };\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eAfter setting up this file, I ran another \u003ccode\u003eswitch\u003c/code\u003e, then logged out (\n\n\u003ckbd\u003eWIN\u003c/kbd\u003e\u003cspan\u003e+\u003c/span\u003e\u003ckbd\u003eM\u003c/kbd\u003e\n) and logged back in, which caused hypridle to get started, as well as caused \u003ccode\u003eloginctl\u003c/code\u003e to start working correctly for the \u003ccode\u003eloginctl lock-session\u003c/code\u003e command that hypridle will use.\u003c/p\u003e\n\u003ch2 id=\"adding-a-spotlight-like-keybind\"\u003eAdding a Spotlight-like keybind\u003c/h2\u003e\n\u003cp\u003eI\u0026rsquo;ve spent enough time on MacOS over the past 6-7 years that I\u0026rsquo;m very used to \n\n\u003ckbd\u003eCMD\u003c/kbd\u003e\u003cspan\u003e+\u003c/span\u003e\u003ckbd\u003eSPACE\u003c/kbd\u003e\n bringing up spotlight (and later Alfred). So \n\n\u003ckbd\u003eWIN\u003c/kbd\u003e\u003cspan\u003e+\u003c/span\u003e\u003ckbd\u003eR\u003c/kbd\u003e\n being my launcher shortcut isn\u0026rsquo;t second nature. But I can just add a new bind for \n\n\u003ckbd\u003eWIN\u003c/kbd\u003e\u003cspan\u003e+\u003c/span\u003e\u003ckbd\u003eSPACE\u003c/kbd\u003e\n to also launch the launcher.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ebind = $mainMod, SPACE, exec, $menu\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch2 id=\"testing-screensharing\"\u003eTesting Screensharing\u003c/h2\u003e\n\u003cp\u003eTo test my ability to screen share, and potentially my ability to record, I\u0026rsquo;m going to install \u003ccode\u003eobs-studio\u003c/code\u003e and make sure that the Pipewire screensharing device works.\u003c/p\u003e\n\u003cp\u003eI can simply add \u003ccode\u003eobs-studio\u003c/code\u003e to my \u003ccode\u003ehome.nix\u003c/code\u003e list of packages:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-nix\" data-lang=\"nix\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  home\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003epackages \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#ca9ee6\"\u003ewith\u003c/span\u003e pkgs; [\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e...\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    obs-studio\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  ];\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eNow I can rebuild my configuration with another \u003ccode\u003eswitch\u003c/code\u003e, launch \u003ccode\u003eobs-studio\u003c/code\u003e from my launcher, and setup Screen Sharing (Pipewire) as a source.\u003c/p\u003e\n\u003cp\u003eI\u0026rsquo;m not going to take any further steps on this process right now, but since OBS could see my screen, I am not super worried about being able to share my screen in the future in a video conference.\u003c/p\u003e\n"
        },
        {
            "title": "Framework and NixOS - Daily Use",
            "date_published": "2024-07-11T19:54:39-07:00",
            "date_modified": "2024-07-13T13:13:36-07:00",
            "id": "https://0xda.de/blog/2024/07/framework-and-nixos-daily-use/",
            "url": "https://0xda.de/blog/2024/07/framework-and-nixos-daily-use/",
            "content_html": "\u003cp\u003eThis is \u003cstrong\u003epart 6\u003c/strong\u003e in my series of posts learning how to setup NixOS on my Framework 16\u0026quot; AMD laptop. It is not meant as a guide, necessarily, but more as a captain\u0026rsquo;s log of my thoughts and processes along the way.\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ca href=\"https://0xda.de/blog/2024/06/framework-and-nixos-day-one/\"\u003eFramework and NixOS - Day One\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://0xda.de/blog/2024/06/framework-and-nixos-day-two/\"\u003eFramework and NixOS - Day Two\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://0xda.de/blog/2024/06/framework-and-nixos-secure-boot-day-three/\"\u003eFramework and NixOS - Secure Boot\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://0xda.de/blog/2024/06/framework-and-nixos-declarative-encrypted-disk-partitions/\"\u003eFramework and NixOS - Declarative Encrypted Disk Partitions\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://0xda.de/blog/2024/07/framework-and-nixos-sops-nix-secrets-management/\"\u003eFramework and NixOS - Sops-nix Secrets Management\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eI had some other plans for what I was going to do next, but I realized that I haven\u0026rsquo;t really moved into my laptop yet \u0026ndash; none of the posts that I\u0026rsquo;ve written so far have been written on my laptop. That changes today. I setup Obsidian, re-setup my 1Password vault, get a browser setup, and figure out if I can fix the touchpad sensitivity that has already screwed up my writing like 4 times while writing this small paragraph.\u003c/p\u003e\n\u003ch2 id=\"enabling-specific-non-free-packages\"\u003eEnabling Specific Non-Free Packages\u003c/h2\u003e\n\u003cp\u003eAs I previously noted, 1Password is my password manager of choice, but also isn\u0026rsquo;t free and required being explicitly declared as a non-free package in my \u003ccode\u003ehome.nix\u003c/code\u003e file. The same goes for Obsidian. I want to be explicit about my choices for non-free packages, so I\u0026rsquo;m going to reiterate the way we set that up in a previous post, as well as add obsidian to my list. In \u003ccode\u003ehome.nix\u003c/code\u003e, add the following:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-nix\" data-lang=\"nix\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e{\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  nixpkgs \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    config \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      allowUnfreePredicate \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e pkg: \u003cspan style=\"color:#99d1db\"\u003ebuiltins\u003c/span\u003e\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003eelem (lib\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003egetName pkg) [\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;1password\u0026#34;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;obsidian\u0026#34;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      ];\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eNote that when we add these unfree predicates, they are wrapped in quotes, which is different than what we do when we add new packages. Then we\u0026rsquo;ll have add the following to our \u003ccode\u003ehome.packages\u003c/code\u003e, further down in the file:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-nix\" data-lang=\"nix\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ehome\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003epackages \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#ca9ee6\"\u003ewith\u003c/span\u003e pkgs; [\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e...\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  _1password_gui\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  obsidian\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e];\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eWe can do a \u003ccode\u003eswitch\u003c/code\u003e and away we go, we now have Obsidian and 1Password available to us in our launcher (which we can access with \n\n\u003ckbd\u003eSUPER\u003c/kbd\u003e\u003cspan\u003e+\u003c/span\u003e\u003ckbd\u003eR\u003c/kbd\u003e\n, or \n\n\u003ckbd\u003eWIN\u003c/kbd\u003e\u003cspan\u003e+\u003c/span\u003e\u003ckbd\u003eR\u003c/kbd\u003e\n).\u003c/p\u003e\n\u003ch2 id=\"fixing-1password-to-float\"\u003eFixing 1Password to Float\u003c/h2\u003e\n\u003cp\u003eWhile most of the time I like that my windows automatically tile in Hyprland, 1Password is a good example of a window that I typically don\u0026rsquo;t want to open in a new tile; I\u0026rsquo;d rather it open as a floating window that I can quickly reference in whatever my current context is, then get it out of my way and get back to whatever I\u0026rsquo;m doing.\u003c/p\u003e\n\u003cp\u003eThankfully, Hyprland provides a way to do this with \u003ca href=\"https://wiki.hyprland.org/hyprland-wiki/pages/Configuring/Window-Rules/\"\u003eWindow Rules\u003c/a\u003e. We can open up our nix-managed hyprland.conf file, \u003ccode\u003e~/nixcfg/home/dade/.config/hypr/hyprland.conf\u003c/code\u003e, and add a new window rule. I\u0026rsquo;m going to do this towards the bottom, because there is already one window rule towards the bottom, and I\u0026rsquo;d like the window rules to be grouped together.\u003c/p\u003e\n\u003cp\u003eIn order to create the window rule, we need to decide if we\u0026rsquo;re going to use the class or the title of the window to apply the rule. To figure out the class of my 1Password window, I opened up 1Password using rofi with \n\n\u003ckbd\u003eSUPER\u003c/kbd\u003e\u003cspan\u003e+\u003c/span\u003e\u003ckbd\u003eR\u003c/kbd\u003e\n. Once it was open, I ran \u003ccode\u003ehyprctl clients\u003c/code\u003e in my terminal, which gave me information about all of my open windows.\u003c/p\u003e\n\u003cp\u003eUltimately, I decided to use \u003ccode\u003eclass\u003c/code\u003e instead of \u003ccode\u003etitle\u003c/code\u003e, since \u003ccode\u003etitle\u003c/code\u003e could match things like opening \u003ccode\u003e1Password\u003c/code\u003e in a browser window, among other things. I anticipate that the \u003ccode\u003eclass\u003c/code\u003e of my 1Password vault won\u0026rsquo;t change often. So I\u0026rsquo;m going to add this line to the bottom of \u003ccode\u003e~/nixcfg/home/dade/.config/hypr/hyprland.conf\u003c/code\u003e.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ewindowrulev2 = float,class:(1Password)\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eAfter running another \u003ccode\u003eswitch\u003c/code\u003e, I tried re-opening 1Password and it didn\u0026rsquo;t float automatically like I would have expected. In hindsight, this makes sense, since rebuilding nix and putting the config file in place didn\u0026rsquo;t actually cause Hyprland to reload the config. Thankfully \u003ccode\u003ehyprctl\u003c/code\u003e provides a useful command here, too \u0026ndash; \u003ccode\u003ehyprctl reload\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eAfter reloading the config, I launched 1Password again, and now it was floating. Fantastic. Now how do I move the floating window? Thankfully, this is already included in the default Hyprland config file I have:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ebindm = $mainMod, mouse:272, movewindow\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ebindm = $mainMod, mouse:273, resizewindow\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003e\u003ccode\u003emouse:272\u003c/code\u003e maps to the left mouse button, and \u003ccode\u003emouse:273\u003c/code\u003e maps to the right mouse button. I don\u0026rsquo;t really care to resize my 1Password window, but I can do that by clicking in the bottom right corner of my Touchpad if I do ever need to. I just want to be able to move it around so I can more easily see the primary page I\u0026rsquo;m working with.\u003c/p\u003e\n\u003ch2 id=\"disable-touchpad-while-typing\"\u003eDisable Touchpad While Typing\u003c/h2\u003e\n\u003cp\u003eBased on what I was able to find, this shouldn\u0026rsquo;t be a problem by default on Hyprland, but for some reason it was a problem for me. While I was typing this post, my cursor was randomly moving to wherever my pointer was. At first I just attributed this to learning to type on a new laptop keyboard, but it kept happening frequently enough that I thought surely something must be wrong.\u003c/p\u003e\n\u003cp\u003eHyprland uses libinput, according to a random reddit thread I found while searching for this problem, and one thing people recommended checking was whether or not the touchpad was being detected as a touchpad or as a generic mouse. I can use \u003ccode\u003elibinput list-devices\u003c/code\u003e for this. But I don\u0026rsquo;t have it installed right now, so instead I\u0026rsquo;m going to run it in a nix-shell. \u003ccode\u003esudo nix-shell -p libinput --run \u0026quot;libinput list-devices\u0026quot;\u003c/code\u003e shows that I have a mouse at \u003ccode\u003e/dev/input/event8\u003c/code\u003e and a touchpad at \u003ccode\u003e/dev/input/event9\u003c/code\u003e. I\u0026rsquo;m unclear what the Mouse device is, but the fact that a Touchpad device is seen is a good sign.\u003c/p\u003e\n\u003cp\u003eJust to make explicit my preferences, I\u0026rsquo;m going to update my \u003ccode\u003ehyprland.conf\u003c/code\u003e file with the following:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003einput {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  ...\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  touchpad {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    natural_scroll = true\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    disable_while_typing = true\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  }\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eThe default in my configuration file set \u003ccode\u003enatural_scroll\u003c/code\u003e to false and didn\u0026rsquo;t set \u003ccode\u003edisable_while_typing\u003c/code\u003e at all, so I figured it couldn\u0026rsquo;t hurt to mark it as \u003ccode\u003etrue\u003c/code\u003e explicitly.\u003c/p\u003e\n\u003cp\u003eI did another switch, did another \u003ccode\u003ehyprctl reload\u003c/code\u003e, and confirmed that my natural scrolling change took effect. Additionally, my touchpad seems to be messing up my typing considerably less frequently than it was, though it is definitely still happening occasionally. This might just be me adjusting to typing on this keyboard and might have done nothing at all, but worst case scenario, I\u0026rsquo;ve at least made my preference more explicit.\u003c/p\u003e\n\u003cp\u003eAnother interesting thing I noticed is that \u003ccode\u003enatural_scroll\u003c/code\u003e did change my scroll behavior, but when I re-ran \u003ccode\u003elibinput list-devices\u003c/code\u003e, it still showed the Touchpad device as having Natural scrolling disabled.\u003c/p\u003e\n\u003cp\u003eWhile hunting for a solution to a later problem in this post, I remembered the \u003ca href=\"https://wiki.nixos.org/wiki/Hardware/Framework/Laptop_16\"\u003eofficial NixOS wiki has a page for the Framework 16\u003c/a\u003e, and it explicitly calls out that the \u003cem\u003ekeyboard\u003c/em\u003e shows up as an external USB device, which causes the touchpad to stay enabled while typing. This was the opposite of what I was looking for (where the mouse might be an external USB device). But thankfully, the wiki provides a useful libinput quirks file that we should be able to use to fix the problem. I\u0026rsquo;m going to add the following to my \u003ccode\u003e~/nixcfg/hosts/serenity/configuration.nix\u003c/code\u003e file.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-nix\" data-lang=\"nix\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eenvironment\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003eetc \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;libinput/local-overrides.quirks\u0026#34;\u003c/span\u003e\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003etext \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#39;\u0026#39;\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#a6d189\"\u003e    [Keyboard]\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#a6d189\"\u003e    MatchUdevType=keyboard\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#a6d189\"\u003e    MatchName=Framework Laptop 16 Keyboard Module - ANSI Keyboard\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#a6d189\"\u003e    AttrKeyboardIntegration=internal\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#a6d189\"\u003e  \u0026#39;\u0026#39;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e};\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eAfter adding this to my configuration, I ran another \u003ccode\u003eswitch\u003c/code\u003e and one thing I immediately noticed is that my palm doesn\u0026rsquo;t seem to be triggering the touchpad as much, so this is \u003cem\u003eprobably\u003c/em\u003e the right fix, considerably moreso than the explicit setting in my \u003ccode\u003ehyprland.conf\u003c/code\u003e. I\u0026rsquo;ll leave the change to my \u003ccode\u003ehyprland.conf\u003c/code\u003e file anyways, just to be explicit.\u003c/p\u003e\n\u003ch2 id=\"configuring-a-browser\"\u003eConfiguring a browser\u003c/h2\u003e\n\u003cp\u003eI\u0026rsquo;ve managed to make it this far without a browser installed, and as nice as that\u0026rsquo;s been, I\u0026rsquo;m \u003cem\u003egoing\u003c/em\u003e to need a browser at some point. In fact, I\u0026rsquo;m probably going to need more than one browser at some point. For now, let\u0026rsquo;s start with Firefox, since I\u0026rsquo;ve become a little disenfranchised with the direction that Chrome browsers have been heading. I will note that in the future, I will probably need the non-free Chrome, as the Google Workspace integrations there can be quite useful for restricting access to only \u0026ldquo;managed\u0026rdquo; devices. But I\u0026rsquo;m getting well ahead of myself, so let\u0026rsquo;s just add \u003ccode\u003efirefox\u003c/code\u003e to our \u003ccode\u003ehome.nix\u003c/code\u003e packages:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ehome.packages = with pkgs; [\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  ...\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  firefox\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e];\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eAfter we \u003ccode\u003eswitch\u003c/code\u003e, we can launch firefox with rofi (\n\n\u003ckbd\u003eSUPER\u003c/kbd\u003e\u003cspan\u003e+\u003c/span\u003e\u003ckbd\u003eR\u003c/kbd\u003e\n). It opens up in a new tile on the current workspace, which I don\u0026rsquo;t love. Let\u0026rsquo;s see if we can get a window rule in place so that firefox always opens up in a consistent place, we\u0026rsquo;ll put it on workspace 2. That way I can always know that going to workspace 2 will be my browser.\u003c/p\u003e\n\u003cp\u003eBack in \u003ccode\u003enixcfg/home/dade/.config/hypr/hyprland.conf\u003c/code\u003e, we\u0026rsquo;re going to add another \u003ccode\u003ewindowrulev2\u003c/code\u003e:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ewindowrulev2 = workspace 2, class:(firefox)\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eTime to \u003ccode\u003eswitch\u003c/code\u003e again, followed by another \u003ccode\u003ehyprctl reload\u003c/code\u003e. As a note: It does get kind of annoying having to do a nixos-rebuild every time I want to change my window manager settings. I\u0026rsquo;ve actually seen some people rant and quit NixOS because of this pattern. It could be interesting to see if I can use simple symlinks for some files that I might want to change more frequently or without requiring a whole new nix derivation, but that can be another project for another day.\u003c/p\u003e\n\u003cp\u003eAfter reloading Hyprland, it\u0026rsquo;s time to close firefox and launch it again. Sure enough, when it launches, it automatically puts Firefox in workspace 2 and switches me over to it. This is great, though I\u0026rsquo;m likely to often forget and instead try to use my launcher to open firefox, even if it\u0026rsquo;s already open. It could be cool to have rofi see if firefox is already running before deciding to open a new one, otherwise switch to the existing one. Not sure if this is possible, but again, could be a useful thing to look into later.\u003c/p\u003e\n\u003cp\u003eOne thing that would be cool here is to setup firefox to only allow extensions that are installed via nix. It looks like the firefox nixpkg even might support this, however I can\u0026rsquo;t find basically any extensions I\u0026rsquo;m interested in in nixpkgs, so maybe this isn\u0026rsquo;t as good an idea as I\u0026rsquo;d hoped.\u003c/p\u003e\n\u003ch2 id=\"switching-to-pipewire\"\u003eSwitching to PipeWire\u003c/h2\u003e\n\u003cp\u003eThere are a few things I\u0026rsquo;ve learned about Wayland while learning how to setup my laptop, and one of those things is about how things like screen-sharing and screenshot tools are mostly broken in Wayland. This is in large part due to the security benefits of Wayland, as I understand it. Basically, if an application has access to the X socket in a typical X11 system, that application can listen to all inputs, see information about other windows open, etc. There are several tools out there for abusing this very access. Wayland, on the other hand, offers a more limited set of controls to applications and then composites those application windows together. Or something like that. I\u0026rsquo;ll be honest, I only know that X has some well-known ways to abuse it, and part of why I picked a Wayland based window manager was so that I could avoid those shortcomings.\u003c/p\u003e\n\u003cp\u003eBut in real life, it\u0026rsquo;s often necessary to record my screen or take screenshots, so I\u0026rsquo;m going to use \u003ca href=\"https://wiki.nixos.org/wiki/PipeWire\"\u003ePipeWire\u003c/a\u003e, which is what I\u0026rsquo;ve seen come up time and time again when talking about this problem.\u003c/p\u003e\n\u003cp\u003eIt also appears that PipeWire will manage capture and playback for sound \u003cem\u003eas well as\u003c/em\u003e video. So I can switch over to using PipeWire as my sound output and disable \u003ccode\u003esound.enable\u003c/code\u003e in my configuration file. In \u003ccode\u003ehosts/serenity/configuration.nix\u003c/code\u003e, I made the following changes:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-nix\" data-lang=\"nix\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e{\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e...\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  sound\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003eenable \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#e5c890\"\u003efalse\u003c/span\u003e; \u003cspan style=\"color:#737994;font-style:italic\"\u003e# previously true\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  nixpkgs\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003econfig\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003epulseaudio \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#e5c890\"\u003efalse\u003c/span\u003e; \u003cspan style=\"color:#737994;font-style:italic\"\u003e# previously true\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  hardware\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003epulseaudio\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003eenable \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#e5c890\"\u003efalse\u003c/span\u003e; \u003cspan style=\"color:#737994;font-style:italic\"\u003e# previously true\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  services\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003epipewire \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e { \u003cspan style=\"color:#737994;font-style:italic\"\u003e# net new block\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    enable \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#e5c890\"\u003etrue\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    alsa\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003eenable \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#e5c890\"\u003etrue\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    alsa\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003esupport32Bit \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#e5c890\"\u003etrue\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    pulse\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003eenable \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#e5c890\"\u003etrue\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eI then did another \u003ccode\u003eswitch\u003c/code\u003e and my audio still worked. To test it out, I opened up firefox and began playing the \u003ca href=\"https://www.youtube.com/watch?v=mNjmGuJY5OE\"\u003ebest hacker song of all time\u003c/a\u003e. This is either a great testament to how far linux has come, a scathing review of pulseaudio, or an indicator that I need to reboot before I see any issues.\u003c/p\u003e\n\u003cp\u003eBut that\u0026rsquo;s okay, I want to reboot anyways. In the Framework 16 NixOS wiki page, there\u0026rsquo;s a comment about switching a setting in UEFI configuration to \u0026ldquo;Linux Audio Compatibility\u0026rdquo; to improve speaker audio quality. So I\u0026rsquo;m going to go ahead and do that next and see if my audio still works after reboot.\u003c/p\u003e\n\u003cp\u003eHello, I have returned from a reboot. I went into my Framework\u0026rsquo;s UEFI \u0026ldquo;Advanced Settings\u0026rdquo; and switched \u0026ldquo;Linux Audio Compatibility\u0026rdquo; to \u003ccode\u003eLinux\u003c/code\u003e instead of \u003ccode\u003eWindows\u003c/code\u003e. I am once again listening to \u003ca href=\"https://www.youtube.com/watch?v=mNjmGuJY5OE\"\u003ebest hacker song of all time\u003c/a\u003e. Honestly, I can\u0026rsquo;t really tell the difference. But maybe that\u0026rsquo;s because the volume has been quite quiet, and my volume control buttons aren\u0026rsquo;t working\u0026hellip;\u003c/p\u003e\n\u003ch2 id=\"mapping-media-controls\"\u003eMapping Media Controls\u003c/h2\u003e\n\u003cp\u003eFramework\u0026rsquo;s function keys can be used to control volume (mute, lower, higher), as well as rewind, pause/play, and fast forward. They can also be used to control the screen brightness and toggle into airplane mode. Only one problem, none of these keys are working for me.\u003c/p\u003e\n\u003cp\u003eI\u0026rsquo;d heard some complaints about the sound quality on the Framework based on the direction of the speakers, so I wanted to try it out myself. But probably the first thing I noticed was \u003cem\u003eactually\u003c/em\u003e that the volume was relatively low, and I needed it to be a bit louder.\u003c/p\u003e\n\u003cp\u003eMy Waybar configuration does show the speaker and microphone volumes, which does help me confirm that it\u0026rsquo;s quieter than it can be. But it doesn\u0026rsquo;t \u003cem\u003econtrol\u003c/em\u003e my speaker and microphone volumes. So we have to figure that part out on our own.\u003c/p\u003e\n\u003cp\u003eI was surprised and a little annoyed to learn that there wasn\u0026rsquo;t a standard system-wide way to make these keys work. My understanding up until this point was that the keys sent pretty standardized scan codes to the host, and that I\u0026rsquo;d just need to install some daemon that responds to the scan codes correctly. But I think in hindsight, this makes some sense that there isn\u0026rsquo;t a single standard way to do this. After all, I\u0026rsquo;m not using a desktop environment \u0026ndash; I\u0026rsquo;m using a window manager. So why am I surprised that  I have to bring my own support for controlling the sound system I\u0026rsquo;m using, or controlling the screen brightness?\u003c/p\u003e\n\u003ch3 id=\"mapping-sound-controls-w-pipewire-and-wpctl\"\u003eMapping Sound Controls w/ Pipewire and wpctl\u003c/h3\u003e\n\u003cp\u003eSince the first thing I want to solve for is my audio controls, let\u0026rsquo;s figure out what commands we can use to toggle mute, lower the volume, and increase the volume. These will map to my \n\n\u003ckbd\u003eF1\u003c/kbd\u003e\n, \n\n\u003ckbd\u003eF2\u003c/kbd\u003e\n, and \n\n\u003ckbd\u003eF3\u003c/kbd\u003e\n keys, respectively \u0026ndash; or more particularly, they will map to these keys when these keys aren\u0026rsquo;t being used as \n\n\u003ckbd\u003eF1\u003c/kbd\u003e\n, \n\n\u003ckbd\u003eF2\u003c/kbd\u003e\n, and \n\n\u003ckbd\u003eF3\u003c/kbd\u003e\n.\u003c/p\u003e\n\u003cp\u003eAfter a bit of googling for things like \u0026ldquo;media controls hyprland\u0026rdquo;, I found a \u003ca href=\"https://www.reddit.com/r/hyprland/comments/1707yb8/comment/k3j8jgn/\"\u003ereddit post in r/hyprland\u003c/a\u003e) that helpfully provided the following commands for Pipewire, via the \u003ccode\u003ewpctl\u003c/code\u003e command. While I was hopeful I\u0026rsquo;d find a simple \u0026ldquo;toggle this input setting and it\u0026rsquo;ll auto map media controls\u0026rdquo;, I was thankful to at least get these commands working, and then I can go from there.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-shell\" data-lang=\"shell\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e$ wpctl set-volume -l 1.4 @DEFAULT_AUDIO_SINK@ 5%+\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e$ wpctl set-volume -l 1.4 @DEFAULT_AUDIO_SINK@ 5%-\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e$ wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eThe post also includes some information about how to bind specific keys to run these commands. But I\u0026rsquo;m not super familiar with the Hyprland bind syntax, other than a few minor changes I\u0026rsquo;ve made. So first I want to make sure I understand the syntax here.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ebinde =, XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.4 @DEFAULT_AUDIO_SINK@ 5%+\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ebinde =, XF86AudioLowerVolume, exec, wpctl set-volume -l 1.4 @DEFAULT_AUDIO_SINK@ 5%-\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ebind =, XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch4 id=\"binde-vs-bind\"\u003ebinde vs bind\u003c/h4\u003e\n\u003cp\u003eReading the \u003ca href=\"https://wiki.hyprland.org/Configuring/Binds/\"\u003eHyprland wiki page on Binds\u003c/a\u003e, I was able to figure out that \u003ccode\u003ebinde\u003c/code\u003e is a flag for \u003ccode\u003ebind\u003c/code\u003e that indicates that the bind will repeat when the key is held. This means that if I hold down the volume up or volume down buttons, it should automatically raise and lower the volume without having to spam tap it. I\u0026rsquo;m probably going to spam tap it anyways, but it\u0026rsquo;s nice to know I don\u0026rsquo;t have to.\u003c/p\u003e\n\u003ch4 id=\"wtf-is-\"\u003eWtf is =,\u003c/h4\u003e\n\u003cp\u003eThis is the strangest syntax I\u0026rsquo;ve ever seen, but after reading about bind configurations from the wiki, I understand that the first argument to a bind is for the modifier key (such as \n\n\u003ckbd\u003eSHIFT\u003c/kbd\u003e\n, \n\n\u003ckbd\u003eCTRL\u003c/kbd\u003e\n, \n\n\u003ckbd\u003eALT\u003c/kbd\u003e\n, \n\n\u003ckbd\u003eSUPER\u003c/kbd\u003e\n), and in these cases, we don\u0026rsquo;t care about a modifier key. In theory the keyboard should be handling that translation for us via \n\n\u003ckbd\u003efn\u003c/kbd\u003e\n / \n\n\u003ckbd\u003efn-lock\u003c/kbd\u003e\n, so the window manager doesn\u0026rsquo;t need to translate it. At least, I think that\u0026rsquo;s the case.\u003c/p\u003e\n\u003ch4 id=\"xf86audio-controls\"\u003eXF86Audio Controls\u003c/h4\u003e\n\u003cp\u003eBased on other bind syntax, this should be the key that we\u0026rsquo;re actually pressing. But I definitely don\u0026rsquo;t have a key labeled XF86AudioRaiseVolume. Thankfully, the Hyprland wiki also has us covered and links to this \u003ca href=\"https://github.com/xkbcommon/libxkbcommon/blob/master/include/xkbcommon/xkbcommon-keysyms.h\"\u003exkbcommon-keysyms.h\u003c/a\u003e file, which we can search through and find references to XF86. The naming convention comes from XFree86, and they are key symbols that map to various multimedia controls. This is actually super helpful, because the file also tells us the symbols for monitor and keyboard brightness, both of which I don\u0026rsquo;t know how to control at present.\u003c/p\u003e\n\u003ch4 id=\"exec\"\u003eexec\u003c/h4\u003e\n\u003cp\u003eThis section tells Hyprland what to do when the key bind is triggered. \u003ccode\u003eexec\u003c/code\u003e means we want to execute some system command. This is in contrast to doing things like resizing windows, moving windows, switching workspaces, switching focus, etc.\u003c/p\u003e\n\u003ch3 id=\"setting-the-media-control-binds\"\u003eSetting The Media Control Binds\u003c/h3\u003e\n\u003cp\u003eNow that I understand how the binds work, I\u0026rsquo;m going to add them to my \u003ccode\u003e~/nixcfg/home/dade/.config/hypr/hyprland.conf\u003c/code\u003e and do a \u003ccode\u003eswitch\u003c/code\u003e. In the section of the config with the rest of my bind definitions, I\u0026rsquo;m going to make a new section that looks like this:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e# MediaControls\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ebinde =, XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.4 @DEFAULT_AUDIO_SINK@ 5%+\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ebinde =, XF86AudioLowerVolume, exec, wpctl set-volume -l 1.4 @DEFAULT_AUDIO_SINK@ 5%-\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ebind =, XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eAfter running \u003ccode\u003eswitch\u003c/code\u003e to add the new version of my hyprland config to the nix store, I ran \u003ccode\u003ehyprctl reload\u003c/code\u003e and after a little fiddling to determine the status of my fn lock, I was able to toggle mute, lower the volume, and raise the volume, using only my keyboard binds. The status of my volume in my Waybar also automatically updated in real time, which was nice to see \u0026ndash; I didn\u0026rsquo;t want to have to go debugging that next.\u003c/p\u003e\n\u003cp\u003eIt\u0026rsquo;s kind of funny that in Linux in general, I really have to dig in to understand this stuff that I just take for granted working in Mac or Windows (or honestly even many other Linux distributions). But that\u0026rsquo;s why I\u0026rsquo;m writing these posts, too \u0026ndash; because there are a lot of things I\u0026rsquo;ve taken for granted for a long time, especially in the desktop environment.\u003c/p\u003e\n\u003ch3 id=\"mapping-monitor-brightness-controls\"\u003eMapping Monitor Brightness Controls\u003c/h3\u003e\n\u003cp\u003eNow that I\u0026rsquo;ve got the volume keys mapped, I\u0026rsquo;d love to get the monitor brightness keys working. Even if I skip the rewind, pause/play, fast forward keys, the ones I really care about are volume and brightness.\u003c/p\u003e\n\u003cp\u003eAfter a bit of searching around, it seems like \u003ca href=\"https://github.com/Hummer12007/brightnessctl\"\u003ebrightnessctl\u003c/a\u003e is a common package that I should be able to use. Before installing it system-wide, I\u0026rsquo;m going to test it out in \u003ccode\u003enix-shell -p brightnessctl\u003c/code\u003e. Once I\u0026rsquo;m in a shell, I can run \u003ccode\u003ebrightnessctl -l\u003c/code\u003e to see what devices it sees and their corresponding current and maximum brightness.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-shell\" data-lang=\"shell\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e[\u003c/span\u003enix-shell:~/nixcfg\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e]\u003c/span\u003e$ brightnessctl -l\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eAvailable devices:\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eDevice \u003cspan style=\"color:#a6d189\"\u003e\u0026#39;amdgpu_bl1\u0026#39;\u003c/span\u003e of class \u003cspan style=\"color:#a6d189\"\u003e\u0026#39;backlight\u0026#39;\u003c/span\u003e:\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\tCurrent brightness: \u003cspan style=\"color:#ef9f76\"\u003e255\u003c/span\u003e \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e(\u003c/span\u003e100%\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e)\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\tMax brightness: \u003cspan style=\"color:#ef9f76\"\u003e255\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e...\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eNow we can use brightnessctl to change the brightness level of the \u003ccode\u003ebacklight\u003c/code\u003e class of devices.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-shell\" data-lang=\"shell\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ebrightnessctl -c backlight s \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;10%-\u0026#34;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eAfter running this command a few times, I was able to see a brightness difference on my backlight, so it\u0026rsquo;s time to setup some keybinds to make our keyboard work correctly. We\u0026rsquo;re going to use a similar pattern that we used for volume controls, where we use \u003ccode\u003ebinde\u003c/code\u003e so we can hold the key down. In our \u003ccode\u003e~/nixcfg/home/dade/.config/hypr/hyprland.conf\u003c/code\u003e file, we\u0026rsquo;re going to add these binds:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ebinde =, XF86MonBrightnessUp, exec, brightnessctl -c backlight s \u0026#34;10%+\u0026#34;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ebinde =, XF86MonBrightnessDown, exec, brightnessctl -c backlight s \u0026#34;10%-\u0026#34;\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eWe also need to add \u003ccode\u003ebrightnessctl\u003c/code\u003e to our system packages in \u003ccode\u003ehosts/serenity/configuration.nix\u003c/code\u003e:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-nix\" data-lang=\"nix\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eenvironment\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003esystemPackages \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#ca9ee6\"\u003ewith\u003c/span\u003e pkgs; [\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e...\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  brightnessctl \u003cspan style=\"color:#737994;font-style:italic\"\u003e# backlight brightness controls\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e];\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eNow we can run \u003ccode\u003eswitch\u003c/code\u003e, \u003ccode\u003ehyprctl reload\u003c/code\u003e, and press the brightness up and down keys to see our backlight changing brightness.\u003c/p\u003e\n\u003cp\u003eThere are a few other keys I\u0026rsquo;d love to figure out how to map \u0026ndash; the \n\n\u003ckbd\u003eF9\u003c/kbd\u003e\n key looks like it is meant to change the display method for external displays (such as mirror vs extend), and the \n\n\u003ckbd\u003eF10\u003c/kbd\u003e\n key is for airplane mode. But for now, I have addressed the most important keys.\u003c/p\u003e\n\u003ch2 id=\"nix-flake-update\"\u003eNix Flake Update\u003c/h2\u003e\n\u003cp\u003eIt\u0026rsquo;s been a couple weeks since I started working on my laptop, and I haven\u0026rsquo;t really updated any packages yet. Since my whole system is declared in my \u003ccode\u003eflake.nix\u003c/code\u003e file, I can run \u003ccode\u003enix flake update\u003c/code\u003e to update the dependency manifest and then run \u003ccode\u003eswitch\u003c/code\u003e to actually build a new derivation with the new dependencies.\u003c/p\u003e\n\u003cp\u003eAfter running \u003ccode\u003eswitch\u003c/code\u003e, I got a couple warnings for deprecated settings, so we\u0026rsquo;re going to update them:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003etrace: warning: The option `hardware.opengl.driSupport32Bit\u0026#39; defined in `/nix/store/9zsjhdd42lnm603vaha6xdr70p8hkfq6-source/hosts/serenity/configuration.nix\u0026#39; has been renamed to `hardware.graphics.enable32Bit\u0026#39;.\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003etrace: warning: The option `hardware.opengl.enable\u0026#39; defined in `/nix/store/9zsjhdd42lnm603vaha6xdr70p8hkfq6-source/hosts/serenity/configuration.nix\u0026#39; has been renamed to `hardware.graphics.enable\u0026#39;.\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eWe can simply change the configuration settings to their new names, \u003ccode\u003eswitch\u003c/code\u003e, and we have no more warnings.\u003c/p\u003e\n\u003cp\u003eI would love to see how I can automate this. I\u0026rsquo;ve seen some mentions in places of an auto-update setting in nix system configurations, and we could probably run \u003ccode\u003enix flake update\u003c/code\u003e in a github workflow or something.\u003c/p\u003e\n"
        },
        {
            "title": "Framework and NixOS - Sops-nix Secrets Management",
            "date_published": "2024-07-05T23:46:44-07:00",
            "date_modified": "2024-07-06T00:11:04-07:00",
            "id": "https://0xda.de/blog/2024/07/framework-and-nixos-sops-nix-secrets-management/",
            "url": "https://0xda.de/blog/2024/07/framework-and-nixos-sops-nix-secrets-management/",
            "content_html": "\u003cp\u003eThis is part 5 in my series of posts learning how to setup NixOS on my Framework 16\u0026quot; AMD laptop. It is not meant as a guide, necessarily, but more as a captain\u0026rsquo;s log of my thoughts and processes along the way.\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ca href=\"https://0xda.de/blog/2024/06/framework-and-nixos-day-one/\"\u003eFramework and NixOS - Day One\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://0xda.de/blog/2024/06/framework-and-nixos-day-two/\"\u003eFramework and NixOS - Day Two\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://0xda.de/blog/2024/06/framework-and-nixos-secure-boot-day-three/\"\u003eFramework and NixOS - Secure Boot\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://0xda.de/blog/2024/06/framework-and-nixos-declarative-encrypted-disk-partitions/\"\u003eFramework and NixOS - Declarative Encrypted Disk Partitions\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch2 id=\"re-enabling-secure-boot\"\u003eRe-enabling Secure Boot\u003c/h2\u003e\n\u003cp\u003ePicking up right where I left off yesterday, I remembered that I had to disable secure boot enforcement to boot from the live installation USB. So I rebooted back into the UEFI interface and re-enabled secure boot enforcement, hit f10 to save and exit, and the booted back into NixOS. I was very thankful that I had no problems here, and I\u0026rsquo;m pretty sure that\u0026rsquo;s because I remembered to save the contents of \u003ccode\u003e/etc/secureboot\u003c/code\u003e before I reformatted my drive, and then restore it before re-enforcing secure boot. Otherwise I would have had to go through the secure boot key installation process again.\u003c/p\u003e\n\u003ch2 id=\"getting-connected-to-wifi\"\u003eGetting connected to WiFi\u003c/h2\u003e\n\u003cp\u003eAt the end of the previous post, I mentioned how my WiFi credentials weren\u0026rsquo;t declared as part of my Nix config \u0026ndash; as a result of this, I can\u0026rsquo;t really do anything on my laptop until I get my network configured. In the live media, it was easy because the system bar had a button you could click to configure WiFi.\u003c/p\u003e\n\u003cp\u003eHyprland doesn\u0026rsquo;t provide any such bar, and my Waybar configuration does tell me the status of my network, but I can\u0026rsquo;t click it to get into the configuration. So I will have to find out to do this on the terminal.\u003c/p\u003e\n\u003cp\u003eI did a little digging in \u003ccode\u003e/etc\u003c/code\u003e to see if I could find what controlled the network, and wouldn\u0026rsquo;t you know it, there\u0026rsquo;s a \u003ccode\u003e/etc/NetworkManager\u003c/code\u003e. Now I just have to learn how to use NetworkManager, or otherwise configure the network via the config file. I did a little searching and found out NetworkManager provides \u003ccode\u003enmcli\u003c/code\u003e, which I can use to interact with my network devices. Looks like I can simply use \u003ccode\u003enmcli device wifi connect\u003c/code\u003e \u0026ndash; or more completely:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-shell\" data-lang=\"shell\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003enmcli device wifi connect MY_WIFI_SSID password thepasswordisonthefridge\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eAfter a small amount of time, it returned and told me \u003ccode\u003eDevice 'wlp1s0' successfully activated with '\u0026lt;uuid\u0026gt;'\u003c/code\u003e. Waybar automatically updated to show that I\u0026rsquo;m connected to my network.\u003c/p\u003e\n\u003cp\u003eIt\u0026rsquo;s just about time to actually start working on adding safeguarded secrets to my Nix configurations.\u003c/p\u003e\n\u003ch2 id=\"restoring-my-backup-home-directory\"\u003eRestoring my backup home directory\u003c/h2\u003e\n\u003cp\u003eBefore I get into the next steps, I need to restore the files I backed up from my home directory \u0026ndash; specifically, I need to restore the \u003ccode\u003e.ssh/\u003c/code\u003e folder and the \u003ccode\u003enixcfg\u003c/code\u003e folder from my flashdrive into my new home directory. Once I did this, all my file permissions were messed up, all files were world readable by default, which I didn\u0026rsquo;t want (and in the case of ssh, it won\u0026rsquo;t allow it). It also captured the file mode change in the git repo, from 644 to 755, which I didn\u0026rsquo;t want. To fix this, I ran \u003ccode\u003efind . -type f -exec chmod 644 {} \\;\u003c/code\u003e \u0026ndash; ChatGPT told me to. Sure enough, that cleared the diff on all the files that I didn\u0026rsquo;t actually change the contents of.\u003c/p\u003e\n\u003cp\u003eOnce I fixed all my file permissions, I wanted to make sure to capture the changes to my configuration that I made during the live USB \u0026ndash; specifically, now I can remove the original filesystem declarations from my hardware config, and commit that change to add my disk config to my \u003ccode\u003ehosts/serenity/configuration.nix\u003c/code\u003e file.\u003c/p\u003e\n\u003cp\u003eI didn\u0026rsquo;t bother to restore all the other random stuff that was in my home directory, just the \u003ccode\u003enixcfg\u003c/code\u003e and \u003ccode\u003e.ssh\u003c/code\u003e directories \u0026ndash; the other stuff wasn\u0026rsquo;t really placed there by me, and I don\u0026rsquo;t care to keep it if I don\u0026rsquo;t need it. I\u0026rsquo;d like to be more particular about the way I manage files on here, which means not just letting random junk gunk up the output of my \u003ccode\u003els\u003c/code\u003e commands.\u003c/p\u003e\n\u003ch2 id=\"one-rebuild-for-good-measure\"\u003eOne Rebuild For Good Measure\u003c/h2\u003e\n\u003cp\u003eNow that I\u0026rsquo;m roughly back to where I started before having to format my disk, I am going to run a \u003ccode\u003eswitch\u003c/code\u003e command (which I have aliased to \u003ccode\u003esudo nixos-rebuild switch --flake ~/nixcfg\u003c/code\u003e), just to make sure everything is in a consistent state. While doing this, I noticed that \u003ccode\u003esudo\u003c/code\u003e is prompting me for my password again \u0026ndash; this means that my fingerprint is no longer enrolled, which makes sense. So I\u0026rsquo;ll go ahead and do that again real quick with \u003ccode\u003esudo fprintd-enroll dade\u003c/code\u003e. I wonder if we can manage the fingerprint enrollment with sops-nix as well\u0026hellip; I suppose I\u0026rsquo;ll have to look into how fprintd works.\u003c/p\u003e\n\u003ch2 id=\"installing-sops-nix\"\u003eInstalling Sops-nix\u003c/h2\u003e\n\u003cp\u003eAs I\u0026rsquo;ve previously mentioned, I am planning to use \u003ca href=\"https://github.com/Mic92/sops-nix\"\u003esops-nix\u003c/a\u003e to manage secrets in my nix configuration. I want to be able to capture secrets in a relatively safe way, since they are very often a necessary part of any machine. Whether it\u0026rsquo;s SSH keys, API keys, your WiFi password, or your user password, you probably want them present automatically on a new system \u0026ndash; after all, that is kind of the whole appeal to NixOS, isn\u0026rsquo;t it?\u003c/p\u003e\n\u003cp\u003eGetting started, I need to add sops-nix to my \u003ccode\u003eflake.nix\u003c/code\u003e inputs, outputs, and system modules. I\u0026rsquo;ve cut out other existing config using \u003ccode\u003e...\u003c/code\u003e where appropriate.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-nix\" data-lang=\"nix\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e{\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  inputs \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e...\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    sops-nix \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      url \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;github:Mic92/sops-nix\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      inputs\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003enixpkgs\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003efollows \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;nixpkgs\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  outputs \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e { self\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e,\u003c/span\u003e nixpkgs\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e,\u003c/span\u003e disko\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e,\u003c/span\u003e lanzaboote\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e,\u003c/span\u003e sops-nix\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e,\u003c/span\u003e \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e...\u003c/span\u003e}\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e@\u003c/span\u003einputs: {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    nixosConfigurations\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003eserenity \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e nixpkgs\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003elib\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003enixosSystem {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e...\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      modules \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e [\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e...\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        sops-nix\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003enixosModules\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003esops\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      ];\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eJust to make sure sops-nix gets picked up, I ran a \u003ccode\u003eswitch\u003c/code\u003e here and confirmed that I saw the new inputs getting added. I also noticed that sops-nix brings a \u003ccode\u003esops-nix/nixpkgs-stable\u003c/code\u003e input with it. My system input for nixpkgs is unstable, so I suppose this is probably for the best.\u003c/p\u003e\n\u003ch3 id=\"generating-encryption-keys\"\u003eGenerating encryption keys\u003c/h3\u003e\n\u003cp\u003eI\u0026rsquo;m going to be using \u003ca href=\"https://github.com/FiloSottile/age\"\u003eage\u003c/a\u003e for the encryption method, for two reasons: GPG sucks, and I use ed25519 ssh keys pretty much exclusively, which I can use conveniently with \u003ccode\u003essh-to-age\u003c/code\u003e. I anticipate I\u0026rsquo;m going to need \u003ccode\u003eage\u003c/code\u003e somewhat regularly, so I\u0026rsquo;m going to go ahead and add it to my \u003ccode\u003ehome.nix\u003c/code\u003e and do another \u003ccode\u003eswitch\u003c/code\u003e.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-nix\" data-lang=\"nix\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e{\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e...\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  home\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003epackages \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#ca9ee6\"\u003ewith\u003c/span\u003e pkgs; [\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e...\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    age\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  ];\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e...\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eNext, according to the sops-nix README, I can use \u003ccode\u003enix-shell -p ssh-to-age --run \u0026quot;ssh-to-age -private-key -i ~/.ssh/id_ed25519 \u0026gt; ~/.config/sops/age/keys.txt\u0026quot;\u003c/code\u003e to convert my ssh key to an age key. Unfortunately, my only ssh key for this host is \u003ccode\u003e~/.ssh/id_ed25519_sk\u003c/code\u003e \u0026ndash; a security key backed ed25519 key. \u003ccode\u003essh-to-age\u003c/code\u003e doesn\u0026rsquo;t support this ssh key format, so I guess I\u0026rsquo;ll be using an individually generated age key using \u003ccode\u003eage-keygen -o ~/.config/sops/age/keys.txt\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eNext, I need to get a public key for my laptop, since it\u0026rsquo;ll be the target machine of these initial secrets I setup. But currently I don\u0026rsquo;t have ssh host keys on my laptop. To do this, I\u0026rsquo;m going to use \u003ccode\u003essh-keygen\u003c/code\u003e to generate an ed25519 host keypair. I don\u0026rsquo;t have sshd running, because this is my laptop and I don\u0026rsquo;t need an ssh server on my laptop (yet, anyways), so I\u0026rsquo;m just going to generate the key in \u003ccode\u003e/etc/ssh/\u003c/code\u003e and hope it doesn\u0026rsquo;t get overwritten in some mysterious future accident. \u003ccode\u003esudo ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key\u003c/code\u003e and away we go. This should have created \u003ccode\u003e/etc/ssh/ssh_host_ed25519_key\u003c/code\u003e and \u003ccode\u003e/etc/ssh/ssh_host_ed25519_key.pub\u003c/code\u003e, which matches the naming scheme used by sshd on some of my ubuntu servers.\u003c/p\u003e\n\u003ch3 id=\"creating-our-sops-configuration\"\u003eCreating our sops configuration\u003c/h3\u003e\n\u003cp\u003eNow I can create a \u003ccode\u003e~/nixcfg/.sops.yaml\u003c/code\u003e file and add my public key to it. This follows pretty much exactly what the readme suggests, but I\u0026rsquo;ve pruned out the pgp related things and named my key appropriately.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-yaml\" data-lang=\"yaml\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#ca9ee6\"\u003ekeys\u003c/span\u003e:\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  - \u003cspan style=\"color:#737994;font-style:italic\"\u003e\u0026amp;serenity_dade\u003c/span\u003e \u0026lt;my user age public key here\u0026gt;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#ca9ee6\"\u003ecreation_rules\u003c/span\u003e:\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  - \u003cspan style=\"color:#ca9ee6\"\u003epath_regex\u003c/span\u003e: secrets/[^/]+\\.(yaml|json|env|ini)$\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#ca9ee6\"\u003ekey_groups\u003c/span\u003e:\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    - \u003cspan style=\"color:#ca9ee6\"\u003eage\u003c/span\u003e:\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      - \u003cspan style=\"color:#737994;font-style:italic\"\u003e*serenity_dade\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eNow I need to update my \u003ccode\u003e.sops.yaml\u003c/code\u003e with an age key based on the new host key. \u003ccode\u003enix-shell -p ssh-to-age --run 'cat /etc/ssh/ssh_host_ed25519_key.pub | ssh-to-age'\u003c/code\u003e will produce the age public key I need to copy into \u003ccode\u003e.sops.yaml\u003c/code\u003e, and now it will look like this:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-yaml\" data-lang=\"yaml\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#ca9ee6\"\u003ekeys\u003c/span\u003e:\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  - \u003cspan style=\"color:#737994;font-style:italic\"\u003e\u0026amp;serenity_dade\u003c/span\u003e \u0026lt;my user age public key here\u0026gt;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  - \u003cspan style=\"color:#737994;font-style:italic\"\u003e\u0026amp;host_serenity\u003c/span\u003e \u0026lt;my ssh-to-age host public key here\u0026gt;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#ca9ee6\"\u003ecreation_rules\u003c/span\u003e:\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  - \u003cspan style=\"color:#ca9ee6\"\u003epath_regex\u003c/span\u003e: secrets.yaml$\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#ca9ee6\"\u003ekey_groups\u003c/span\u003e:\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    - \u003cspan style=\"color:#ca9ee6\"\u003eage\u003c/span\u003e:\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      - \u003cspan style=\"color:#737994;font-style:italic\"\u003e*serenity_dade\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      - \u003cspan style=\"color:#737994;font-style:italic\"\u003e*host_serenity\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eNote: I understand that my public keys are just that, public. The only reason I\u0026rsquo;m using placeholders is because I\u0026rsquo;m writing my notes on a separate machine from my Nix laptop (for now) and didn\u0026rsquo;t feel like transcribing the public keys manually.\u003c/p\u003e\n\u003ch3 id=\"separating-our-secrets-from-our-config\"\u003eSeparating our secrets from our config\u003c/h3\u003e\n\u003cp\u003eBefore I get too far into this setup, I realized that I don\u0026rsquo;t really want to publish my secrets, even in their encrypted form, to my public github repo. I\u0026rsquo;d prefer if the secrets are in a separate repository that isn\u0026rsquo;t public. We can argue about how encrypted secrets, if properly encrypted, are entirely useless in the hands of an attacker. But it just makes me feel better.\u003c/p\u003e\n\u003cp\u003eThankfully, Emergent Mind has a guide on \u003ca href=\"https://unmovedcentre.com/posts/secrets-management/\"\u003ehow to separate your nix-secrets from your config\u003c/a\u003e, which should help me get moving on this quickly.\u003c/p\u003e\n\u003cp\u003eSo I\u0026rsquo;m going to make a new directory in my home, \u003ccode\u003emkdir ~/nix-secrets \u0026amp;\u0026amp; cd ~/nix-secrets \u0026amp;\u0026amp; git init\u003c/code\u003e and then move my \u003ccode\u003e.sops.yaml\u003c/code\u003e file into the nix-secrets directory instead of the nixcfg directory. \u003ccode\u003emv ~/nixcfg/.sops.yaml ~/nix-secrets/.sops.yaml\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eNow, from within my nix-secrets repository, I\u0026rsquo;m going to make a new secrets.yaml file with \u003ccode\u003enix-shell -p sops --run \u0026quot;sops secrets.yaml\u0026quot;\u003c/code\u003e. This will automatically open my editor with an example sops yaml file, showing how to add secrets. I deleted all of these lines to start with a blank file.\u003c/p\u003e\n\u003cp\u003eNext, in a second terminal, I ran \u003ccode\u003emkpasswd\u003c/code\u003e and input my preferred user password when prompted. It gave me a hash beginning with \u003ccode\u003e$y$\u003c/code\u003e, which I believe is the hash identifier for \u003ca href=\"https://www.openwall.com/yescrypt/\"\u003eyescrypt\u003c/a\u003e. I then copied this hash into my \u003ccode\u003esops\u003c/code\u003e terminal, using a key of \u003ccode\u003edade_passwd\u003c/code\u003e. My file looks like this:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-yaml\" data-lang=\"yaml\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#ca9ee6\"\u003edade_passwd\u003c/span\u003e: $y$\u0026lt;param\u0026gt;$\u0026lt;salt\u0026gt;$\u0026lt;hash\u0026gt;\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eFor the sake of keeping it simple, I\u0026rsquo;m going to consider that the end of my \u003ccode\u003esecrets.yaml\u003c/code\u003e file for now, so I save and exit the editor. Just to confirm the encryption worked correctly, I can \u003ccode\u003ecat secrets.yaml\u003c/code\u003e and see that the secrets are encrypted, along with some metadata. I can also make sure that I\u0026rsquo;m able to decrypt the encrypted values by re-running \u003ccode\u003enix-shell -p sops --run \u0026quot;sops secrets.yaml\u003c/code\u003e, and I can see my normal hash and none of the metadata.\u003c/p\u003e\n\u003cp\u003eNow I need to create the corresponding repository on Github and then push my changes so that I can reference them in my \u003ccode\u003enixcfg\u003c/code\u003e. After creating the repository in Github, I followed the instructions to push my local repository to it:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003egit add .\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003egit commit -m \u0026#34;Initial config and secret\u0026#34;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003egit remote add origin git@github.com:0xdade/nix-secrets.git\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003egit push -u origin main\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eThis pushed my changes up to Github, I refreshed, and I can see the encrypted file contents in Github.\u003c/p\u003e\n\u003ch3 id=\"adding-our-secrets-to-nixcfg\"\u003eAdding our secrets to nixcfg\u003c/h3\u003e\n\u003cp\u003eNow that we have a remote github repository with our secrets in it, we can add it to our \u003ccode\u003enixcfg\u003c/code\u003e flake as an input.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-nix\" data-lang=\"nix\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e{\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  description \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;nixos config flake\u0026#34;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  inputs \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e...\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    nix-secrets \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      url \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;git+ssh://git@github.com/0xdade/nix-secrets?shallow=1\u0026amp;ref=main\u0026#34;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      flake \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#e5c890\"\u003efalse\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eUnfortunately, Emergent Mind\u0026rsquo;s guide for this doesn\u0026rsquo;t seem to work well for me for two reasons:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003eMy github repository\u0026rsquo;s default branch is \u003ccode\u003emain\u003c/code\u003e, not \u003ccode\u003emaster\u003c/code\u003e, and I was getting an error about the master ref. In hindsight this might have also been a secondary error due to the next one.\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003egit@github.com: Permission denied (publickey)\u003c/code\u003e - Because I \u003ccode\u003esudo\u003c/code\u003e when doing a \u003ccode\u003enixos-rebuild\u003c/code\u003e, my ssh private keys aren\u0026rsquo;t being used by default.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp\u003eWe can solve this first bit by explicitly passing \u003ccode\u003eref=main\u003c/code\u003e in the url, e.g. \u003ccode\u003egit+ssh://git@github.com/0xdade/nix-secrets?ref=main\u0026amp;shallow=1\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eSolving the second part, however, is proving to be somewhat difficult. Now, one \u003cem\u003eeasy\u003c/em\u003e way to do this would be to copy my user\u0026rsquo;s private ssh key to \u003ccode\u003e/root/.ssh/id_ed25519_sk\u003c/code\u003e. This would probably work, but it feels less than ideal to have to duplicate the private key. After struggling with it for a while, this is ultimately what I ended up doing, though. I\u0026rsquo;d like to figure out a way to not need to do this, but I\u0026rsquo;m not sure that\u0026rsquo;s viable right now.\u003c/p\u003e\n\u003cp\u003eNow that I have the nix-secrets repository setup as an input to my nix flake, I can update \u003ccode\u003e~/nixcfg/hosts/serenity/configuration.nix\u003c/code\u003e to get the path to the secrets module and hook it up to automatically set my password.\u003c/p\u003e\n\u003cp\u003eWe\u0026rsquo;re going to add a \u003ccode\u003elet/in\u003c/code\u003e block to the top of our file, such that it looks like this:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-nix\" data-lang=\"nix\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e{ config\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e,\u003c/span\u003e pkgs\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e,\u003c/span\u003e lib\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e,\u003c/span\u003e inputs\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e,\u003c/span\u003e \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e...\u003c/span\u003e};\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#ca9ee6\"\u003elet\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  secretspath \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#99d1db\"\u003ebuiltins\u003c/span\u003e\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003e\u003cspan style=\"color:#99d1db\"\u003etoString\u003c/span\u003e inputs\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003enix-secrets;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#ca9ee6\"\u003ein\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e{\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  imports \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e [\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e...\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  ];\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e...\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eNow we can reference \u003ccode\u003esecretspath\u003c/code\u003e later in our configuration. First, I\u0026rsquo;m going to add \u003ccode\u003eusers.mutableUsers = false;\u003c/code\u003e to my config, which will force my password to always be what it is set to in my secrets file. This helps to ensure the deterministic behavior that we want.\u003c/p\u003e\n\u003cp\u003eNext, I\u0026rsquo;m going to modify my \u003ccode\u003euser\u003c/code\u003e attribute set such that it looks like this:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-nix\" data-lang=\"nix\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  users\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003eusers\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003edade \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    isNormalUser \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#e5c890\"\u003etrue\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    description \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;dade\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    hashedPasswordFile \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e config\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003esops\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003esecrets\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003edade_passwd\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003epath;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    extraGroups \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e [ \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;networkmanager\u0026#34;\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;wheel\u0026#34;\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;video\u0026#34;\u003c/span\u003e ];\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    shell \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e pkgs\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003ezsh;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  };\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eFinally, I need to add a new attribute set called \u003ccode\u003esops\u003c/code\u003e to my configuration file. This should be at the same indentation level as \u003ccode\u003ehome-manager\u003c/code\u003e or \u003ccode\u003eusers.users.dade\u003c/code\u003e, which is to say, at the top level of the config. This is where we\u0026rsquo;re going to use the \u003ccode\u003esecretspath\u003c/code\u003e variable we defined, as well as set the \u003ccode\u003edade_passwd\u003c/code\u003e secret from our user block.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-nix\" data-lang=\"nix\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  sops \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    defaultSopsFile \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;\u003c/span\u003e\u003cspan style=\"color:#a6d189\"\u003e${\u003c/span\u003esecretspath\u003cspan style=\"color:#a6d189\"\u003e}\u003c/span\u003e\u003cspan style=\"color:#a6d189\"\u003e/secrets.yaml\u0026#34;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    age \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      sshKeyPaths \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e [\u003cspan style=\"color:#a6d189\"\u003e\u0026#34;/etc/ssh/ssh_host_ed25519_key\u0026#34;\u003c/span\u003e];\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      keyFile \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;/var/lib/sops-nix/key.txt\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      generateKey \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#e5c890\"\u003etrue\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    secrets \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      dade_passwd \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        neededForUsers \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#e5c890\"\u003etrue\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  };\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eThe \u003ccode\u003eneededForUsers\u003c/code\u003e block is important, as it tells sops-nix to make this secret available before users are created, so that the hashed password can be retrieved from \u003ccode\u003econfig.sops.secrets.dade_passwd.path\u003c/code\u003e. By default, secrets go into \u003ccode\u003e/run/secrets\u003c/code\u003e, but when \u003ccode\u003eneededForUsers\u003c/code\u003e is true, those secrets will go into \u003ccode\u003e/run/secrets-for-users\u003c/code\u003e.\u003c/p\u003e\n\u003ch2 id=\"the-moment-of-truth\"\u003eThe moment of truth\u003c/h2\u003e\n\u003cp\u003eAfter all of this, we should be able to simply \u003ccode\u003eswitch\u003c/code\u003e and our password will now be deterministically set by our nix configuration. Just for the sake of safety, I\u0026rsquo;d recommend opening a second terminal and going into root access. This should just help to prevent a reboot if you need to go back a generation to fix something.\u003c/p\u003e\n\u003cp\u003eIf we run into any issues, here are some culprits I might look for:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003eDoes the root user have access to the ssh key necessary to pull the private repository?\u003c/li\u003e\n\u003cli\u003eDid you push your secrets file to the remote repository?\u003c/li\u003e\n\u003cli\u003eDid you update your flake.nix to make sure it is referencing the latest version of your secrets repository?\u003c/li\u003e\n\u003c/ol\u003e\n\u003ch3 id=\"testing-our-changes\"\u003eTesting our changes\u003c/h3\u003e\n\u003cp\u003eSince I have my fingerprint enrolled in fprintd, \u003ccode\u003esudo\u003c/code\u003e defaults to asking for my fingerprint instead of my password, which means checking that my password is what I expect is kind of annoying. What I ultimately ended up doing to test this out is using the \u003ccode\u003epasswd\u003c/code\u003e command to try to change my password.\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003e\u003ccode\u003epasswd\u003c/code\u003e and input a password you know is wrong, you\u0026rsquo;ll immediately get a \u003ccode\u003epermission denied\u003c/code\u003e error, so you know your password is not that.\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003epasswd\u003c/code\u003e and input your correct password, you\u0026rsquo;ll then get prompted for a new password \u0026ndash; this means your sops-nix user password is correctly set!\u003c/li\u003e\n\u003cli\u003eFollowing on from the previous step, you can input a new password and see that you\u0026rsquo;re \u003cem\u003estill\u003c/em\u003e met with a \u003ccode\u003epermission denied\u003c/code\u003e error, which means that the user\u0026rsquo;s password is not mutable. Perfect!\u003c/li\u003e\n\u003c/ol\u003e\n\u003ch2 id=\"next-time-on-dragon-ball-z\"\u003eNext Time on Dragon Ball Z\u003c/h2\u003e\n\u003cp\u003eNow that I have the basics of my secrets management in place, I\u0026rsquo;m going to try to add my WiFi credentials to my secrets, as well as look into adding my \u003ccode\u003efprintd\u003c/code\u003e fingerprint, if possible.\u003c/p\u003e\n\u003cp\u003eAdditionally, I\u0026rsquo;d like to make a backup age key to store in my password manager and include as a target in my key groups in sops. While I basically know the values of all of these secrets anyways, I want to make sure I can recover them in case of hardware failure where I might lose the host ssh key and my user\u0026rsquo;s ssh key at the same time. It would also be cool to figure out if I can use an age key that is backed by my yubikey instead of just one sitting in my home directory.\u003c/p\u003e\n\u003cp\u003eI also want to look into updating my flake inputs, since that\u0026rsquo;s how I will update packages on my machine, and it\u0026rsquo;s important to know how to do that. I\u0026rsquo;ll probably create a couple useful shell aliases for this, as well.\u003c/p\u003e\n\u003cp\u003eFinally, I\u0026rsquo;ll probably spend a bit of time setting up some pre-commit hooks for my \u003ccode\u003enixcfg\u003c/code\u003e repo, that way I can make sure everything is consistently formatted. Even though I\u0026rsquo;m the only one who will ever really use this repo, I want it to be consistent for future me.\u003c/p\u003e\n"
        },
        {
            "title": "Framework and NixOS - Declarative Encrypted Disk Partitions",
            "date_published": "2024-06-29T18:37:52-07:00",
            "date_modified": "2024-06-29T19:38:36-07:00",
            "id": "https://0xda.de/blog/2024/06/framework-and-nixos-declarative-encrypted-disk-partitions/",
            "url": "https://0xda.de/blog/2024/06/framework-and-nixos-declarative-encrypted-disk-partitions/",
            "content_html": "\u003cp\u003eThis is part 4 in my series of posts learning how to setup NixOS on my Framework 16\u0026quot; AMD laptop. It is not meant as a guide, necessarily, but more as a captain\u0026rsquo;s log of my thoughts and processes along the way.\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ca href=\"https://0xda.de/blog/2024/06/framework-and-nixos-day-one/\"\u003eFramework and NixOS - Day One\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://0xda.de/blog/2024/06/framework-and-nixos-day-two/\"\u003eFramework and NixOS - Day Two\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://0xda.de/blog/2024/06/framework-and-nixos-secure-boot-day-three/\"\u003eFramework and NixOS - Secure Boot\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch2 id=\"full-disk-encryption\"\u003eFull Disk Encryption\u003c/h2\u003e\n\u003cp\u003eAs a self-respecting security person, I can\u0026rsquo;t very well be walking around with a laptop with an unencrypted disk.\u003c/p\u003e\n\u003cp\u003eBut here\u0026rsquo;s my dilemma. I\u0026rsquo;ve already partitioned my disk when I did the original install and I\u0026rsquo;m not using luks. Additionally, my disk partition isn\u0026rsquo;t particularly declarative \u0026ndash; it\u0026rsquo;s not actually tracked in my configuration at all, so if I want to replicate my operating system in the future, I\u0026rsquo;d have to remember to set it all up just the right way.\u003c/p\u003e\n\u003cp\u003eSince I only have the one root partition right now, I need to back up a few files that I don\u0026rsquo;t want to lose before I do any partitioning. In particular, I\u0026rsquo;m going to save the contents of my \u003ccode\u003e/etc/secureboot\u003c/code\u003e directory that I generated earlier, as well as just save my whole \u003ccode\u003e/home/dade\u003c/code\u003e directory. In the future I\u0026rsquo;d like to avoid saving this whole directory all willy nilly like this, but right now I\u0026rsquo;d prefer to not lose any of the state that I\u0026rsquo;ve accumulated.\u003c/p\u003e\n\u003cp\u003eIt turns out I can\u0026rsquo;t copy a lot of things from my home directory over to my flash drive, because a bunch of things are symlinks to my nix store. That\u0026rsquo;s okay, though \u0026ndash; I have most everything I need, and anything in my nix store should be recoverable by just building my config again on the new disk layout when I\u0026rsquo;m done.\u003c/p\u003e\n\u003ch3 id=\"disk-partitioning\"\u003eDisk partitioning\u003c/h3\u003e\n\u003cp\u003eI\u0026rsquo;ll be using \u003ca href=\"https://github.com/nix-community/disko\"\u003edisko\u003c/a\u003e to setup a declarative disk partitioning scheme, as well as indicate my preference for a luks encrypted volume. I also want to be wary of my future intentions to use \u003ca href=\"https://github.com/nix-community/impermanence\"\u003eimpermanence\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003eI think to get started, I\u0026rsquo;m going to use the \u003ca href=\"https://github.com/nix-community/disko/blob/master/example/luks-btrfs-subvolumes.nix\"\u003eluks btrfs subvolumes example from the disko repository\u003c/a\u003e. This looks like it\u0026rsquo;ll be similar to what I want to do with impermanence and at least get me started.\u003c/p\u003e\n\u003cp\u003eOne thing of note is that the disko nix configuration used here uses a key file, or I can comment it out and specify a password file for an interactive password entry when I boot up my laptop. You\u0026rsquo;ll see a bit later on that I opted for a password entry, since this volume will contain my entire operating system, so using a key file is a bit harder than I\u0026rsquo;d like to figure out.\u003c/p\u003e\n\u003ch4 id=\"adding-disko-as-an-input\"\u003eAdding disko as an input\u003c/h4\u003e\n\u003cp\u003eFirst up, let\u0026rsquo;s add disko as an input to our \u003ccode\u003eflake.nix\u003c/code\u003e file.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-nix\" data-lang=\"nix\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e{\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  inputs \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e...\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    disko \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      url \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;github:nix-community/disko\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      inputs\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003enixpkgs\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003efollows \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;nixpkgs\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  ouputs \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e { self\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e,\u003c/span\u003e nixpkgs\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e,\u003c/span\u003e disko\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e,\u003c/span\u003e lanzaboote\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e,\u003c/span\u003e \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e...\u003c/span\u003e}\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e@\u003c/span\u003einputs: {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\t  nixosConfigurations\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003eserenity \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e nixpkgs\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003elib\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003enixosSystem {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\t    specialArgs \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e { \u003cspan style=\"color:#ca9ee6\"\u003einherit\u003c/span\u003e inputs; };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\t    modules \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e [\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\t      disko\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003enixosModules\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003edisko\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\t      lanzaboote\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003enixosModules\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003elanzaboote\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\t      \u003cspan style=\"color:#81c8be\"\u003e./hosts/serenity/configuration.nix\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\t      inputs\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003ehome-manager\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003enixosModules\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003edefault\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\t    ];\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\t  };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eI\u0026rsquo;m going to do a nixos-rebuild switch here, just to make sure the disko input gets picked up correctly. If all goes well, my next rebuild is going to reformat my drive, so this will likely be my last time rebuilding before the switch. I anticipate needing to boot into a live media to do the next rebuild, otherwise the rebuild will destroy the contents of the disk and nix will immediately stop working. But for now we\u0026rsquo;re going to stay in our nice environment and setup the disko configuration.\u003c/p\u003e\n\u003cp\u003eSince we\u0026rsquo;re going to base our config off the luks-btrfs-subvolumes example mentioned above, let\u0026rsquo;s get that onto our disk to start making it match what we want. To do this, I used \u003ccode\u003enix-shell -p wget\u003c/code\u003e to open a shell with wget installed, then \u003ccode\u003ewget https://raw.githubusercontent.com/nix-community/disko/master/example/luks-btrfs-subvolumes.nix -O ~/nixcfg/hosts/serenity/disko-config.nix\u003c/code\u003e.\u003c/p\u003e\n\u003ch4 id=\"setting-up-my-disko-config\"\u003eSetting up my disko config\u003c/h4\u003e\n\u003cp\u003eBased on the next steps of the \u003ca href=\"https://github.com/nix-community/disko/blob/master/docs/quickstart.md\"\u003eDisko Quickstart\u003c/a\u003e, it\u0026rsquo;s supposed to be time to boot into our installer image so we can modify the disk without issue. But I\u0026rsquo;m going to skip that just a little bit and make some tweaks to my disko-config.nix and commit it to my repo. It\u0026rsquo;s kind of a pain to use ssh to pull my nixcfg from a private repository from a live installer, so I\u0026rsquo;m going to try to get it as close to setup as possible and then do a little mount trick after I boot into the live media.\u003c/p\u003e\n\u003cp\u003eAt this point we can get the disk name, \u003ccode\u003envme0n1\u003c/code\u003e, which \u003cem\u003eshould\u003c/em\u003e remain consistent for the lifecycle of my Framework laptop. Even if I add an additional drive, \u003ccode\u003envme0n1\u003c/code\u003e should be a consistent name to refer to this drive. We\u0026rsquo;re also going to comment out the \u003ccode\u003ekeyFile\u003c/code\u003e and \u003ccode\u003eadditionalKeyFiles\u003c/code\u003e settings, and uncomment the passwordFile so that we can set a password for our lukscrypt volume when we run disko.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-nix\" data-lang=\"nix\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e{\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  disko\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003edevices \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    disk \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      main \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        type \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;disk\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        device \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;/dev/nvme0n1\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        content \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e          type \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;gpt\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e          partitions \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e            ESP \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e              size \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;512M\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e              type \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;EF00\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e              content \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                type \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;filesystem\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                format \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;vfat\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                mountpoint \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;/boot\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                mountOptions \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e [\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                  \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;defaults\u0026#34;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                ];\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e              };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e            };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e            luks \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e              size \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;100%\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e              content \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                type \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;luks\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                name \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;crypted\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                \u003cspan style=\"color:#737994;font-style:italic\"\u003e# disable settings.keyFile if you want to use interactive password entry\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                passwordFile \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;/tmp/secret.key\u0026#34;\u003c/span\u003e; \u003cspan style=\"color:#737994;font-style:italic\"\u003e# Interactive\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                settings \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                  allowDiscards \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#e5c890\"\u003etrue\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                  \u003cspan style=\"color:#737994;font-style:italic\"\u003e#keyFile = \u0026#34;/tmp/secret.key\u0026#34;;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                \u003cspan style=\"color:#737994;font-style:italic\"\u003e#additionalKeyFiles = [ \u0026#34;/tmp/additionalSecret.key\u0026#34; ];\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                content \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                  type \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;btrfs\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                  extraArgs \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e [ \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;-f\u0026#34;\u003c/span\u003e ];\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                  subvolumes \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                    \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;/root\u0026#34;\u003c/span\u003e \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                      mountpoint \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;/\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                      mountOptions \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e [ \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;compress=zstd\u0026#34;\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;noatime\u0026#34;\u003c/span\u003e ];\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                    };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                    \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;/persist\u0026#34;\u003c/span\u003e \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                      mountpoint \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;/persist\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                      mountOptions \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e [ \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;compress=zstd\u0026#34;\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;noatime\u0026#34;\u003c/span\u003e ];\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                    };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                    \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;/nix\u0026#34;\u003c/span\u003e \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                      mountpoint \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;/nix\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                      mountOptions \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e [ \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;compress=zstd\u0026#34;\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;noatime\u0026#34;\u003c/span\u003e ];\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                    };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                    \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;/swap\u0026#34;\u003c/span\u003e \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                      mountpoint \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;/.swapvol\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                      swap\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003eswapfile\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003esize \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;16G\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                    };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                  };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e                };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e              };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e            };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e          };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eAt this point, I\u0026rsquo;m stressing out because I\u0026rsquo;m worried I\u0026rsquo;ll do it wrong. Which is silly because the whole point of my nix config is that if I messed up, I just reinstall my config and I\u0026rsquo;m good to go. But nevertheless, I was paralyzed by indecision for a couple days before taking the next step.\u003c/p\u003e\n\u003ch3 id=\"get-on-with-it-already\"\u003eGet on with it already\u003c/h3\u003e\n\u003cp\u003e\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n  \n  \n    \n    \n    \n    \n    \n    \n    \n    \n  \u003cpicture\u003e\n    \u003csource srcset=\"/blog/2024/06/framework-and-nixos-declarative-encrypted-disk-partitions/img/two-days-later_hu_b1db4f880c7cc01f.webp\" type=\"image/webp\" /\u003e\n  \u003cimg class=\"img\" src=\"/blog/2024/06/framework-and-nixos-declarative-encrypted-disk-partitions/img/two-days-later.4a7cfc81f265e3b0e0dfd5b639888e84.jpeg\" alt=\"Spongebob Two Days Later\u0026hellip; title card\" loading=\"lazy\" height=\"720\" width=\"1280\" /\u003e\n\u003c/picture\u003e\n\u003c/p\u003e\n\u003cp\u003eI made sure I had a copy of my nixcfg repo, complete with the disko config, on a flash drive where I could easily mount it, make changes and persist them, in case I need to reboot from my live installer a few times to get it working. Then I rebooted into my live installer, created a file at \u003ccode\u003e/tmp/secret.key\u003c/code\u003e so that disko will be able to read the passphrase I want to use, and connected the live environment to my WiFi so nix can pull packages.\u003c/p\u003e\n\u003cp\u003eBefore I am ready to run the installation, I noticed that Disko recommends running \u003ccode\u003enixos-generate-config --no-filesystems --root /mnt\u003c/code\u003e. This made me realize that my existing nix configuration probably contains filesystem information that I need to remove. Sure enough, in my \u003ccode\u003enixcfg/hosts/serenity/hardware-configuration.nix\u003c/code\u003e, there are two filesystems defined. I\u0026rsquo;m going to just comment these out for now, since the disko config will supply filesystem information (hopefully). I\u0026rsquo;m also going to comment out \u003ccode\u003eswapDevices\u003c/code\u003e since disko has a swap volume defined.\u003c/p\u003e\n\u003cp\u003eNote: I\u0026rsquo;m commenting these out because at this point, I am working off my flash drive. I technically have the whole git repo on the flash drive and could make commits, but I don\u0026rsquo;t have my whole git config setup and I\u0026rsquo;ll just do a commit once I know things are working.\u003c/p\u003e\n\u003cp\u003eTime to install the disk partition \u0026ndash; I did this via the recommended command in the quick start guide, tweaking the path to where my disk config is. (Side note: It\u0026rsquo;s both super cool and kind of guano-insane that you can just run the github repo with some parameters and it just works.)\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-shell\" data-lang=\"shell\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo nix --experimental-features \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;nix-command flakes\u0026#34;\u003c/span\u003e run github:nix-community/disko -- --mode disko /run/media/nixos/Samsung USB/serenity-backup/dade/nixcfg/hosts/serenity/disko-config.nix\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eAfter it  downloaded disko, it ran a bunch of commands and formatted my drive \u0026ndash; I didn\u0026rsquo;t get any errors, so that\u0026rsquo;s a good sign. I ran \u003ccode\u003emount | grep /mnt\u003c/code\u003e to see if it correctly mounted \u003ccode\u003e/dev/nvme0n1\u003c/code\u003e, and it looks like it did create my \u003ccode\u003ecrypted\u003c/code\u003e volume and then mounted \u003ccode\u003e/\u003c/code\u003e, \u003ccode\u003e/nix\u003c/code\u003e, and \u003ccode\u003e/persist\u003c/code\u003e into \u003ccode\u003e/mnt/\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eAt this point, it seems like I\u0026rsquo;ve done everything right, I just have to finish the new nixos install to be able to reboot into it. But since my whole system config is a flake, I need to use a modified version of the install command.\u003c/p\u003e\n\u003cp\u003eI copied my whole nixcfg into /mnt/etc/nixos and then ran \u003ccode\u003enixos-install --flake /mnt/etc/nixos#serenity\u003c/code\u003e. This started to work, but I got errors that the \u003ccode\u003efileSystems\u003c/code\u003e option does not specify my root file system. This is because I forgot to include my \u003ccode\u003edisko-config.nix\u003c/code\u003e in my \u003ccode\u003ehosts/serenity/configuration.nix\u003c/code\u003e imports.\u003c/p\u003e\n\u003cp\u003eOnce I did this, I re-ran the install command and it began building my whole system again. It mostly succeeded, but it gave me a \u0026ldquo;Failed to install generation: No such file or directory\u0026rdquo; after the \u0026ldquo;Installing Lanzaboote to /boot\u0026rdquo; line. Then it prompted me for my root password, and I was done. I looked at \u003ccode\u003e/mnt\u003c/code\u003e and it looked like a typical linux filesystem, so I think it\u0026rsquo;s time to reboot and see if it works\u0026hellip;\u003c/p\u003e\n\u003ch3 id=\"it-didnt-work\"\u003eIt didn\u0026rsquo;t work\u0026hellip;\u003c/h3\u003e\n\u003cp\u003e\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n  \n  \n    \n    \n    \n    \n    \n    \n    \n    \n  \u003cpicture\u003e\n    \u003csource srcset=\"/blog/2024/06/framework-and-nixos-declarative-encrypted-disk-partitions/img/failed-boot_hu_9df5b947be2cd63.webp\" type=\"image/webp\" /\u003e\n  \u003cimg class=\"img\" src=\"/blog/2024/06/framework-and-nixos-declarative-encrypted-disk-partitions/img/failed-boot.5319647b93db1bbe67cdf91af50ad32e.jpeg\" alt=\"Framework laptop error screen when no boot media is present\" loading=\"lazy\" height=\"518\" width=\"800\" /\u003e\n\u003c/picture\u003e\n\u003c/p\u003e\n\u003cp\u003eLooks like I did \u003cem\u003esomething\u003c/em\u003e wrong. I guess that \u0026ldquo;failed to install generation\u0026rdquo; error makes plenty of sense. If the first generation couldn\u0026rsquo;t be installed into \u003ccode\u003e/boot\u003c/code\u003e then it\u0026rsquo;s not really surprising that I couldn\u0026rsquo;t boot.\u003c/p\u003e\n\u003cp\u003eTo see if I can fix it without having to redo the whole process, I booted back up into my live media, \u003ccode\u003enix-shell -p cryptsetup\u003c/code\u003e to get a shell that has the necessary packages to decrypt my encrypted volume, and then ran the following:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo cryptsetup luksOpen /dev/nvme0n1p2 crypted\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eThis prompted me for my password from the disko config \u003ccode\u003e/tmp/secret.key\u003c/code\u003e and then successfully decrypted the volume. This then allowed me to mount the btrfs subvolumes with \u003ccode\u003emount --options subvol=\u0026lt;volume\u0026gt; /dev/mapper/crypted /mnt\u003c/code\u003e, so I mounted the \u003ccode\u003eroot\u003c/code\u003e subvolume to \u003ccode\u003e/mnt\u003c/code\u003e, \u003ccode\u003epersist\u003c/code\u003e subvol to \u003ccode\u003e/mnt/persist\u003c/code\u003e, \u003ccode\u003enix\u003c/code\u003e subvol to \u003ccode\u003e/mnt/nix\u003c/code\u003e, and then mounted the boot partition to \u003ccode\u003e/mnt/boot\u003c/code\u003e with \u003ccode\u003emount /dev/nvme0n1p1 /mnt/boot\u003c/code\u003e. Now I\u0026rsquo;m basically set back up the way I was after disko ran. In hindsight, I am pretty sure disko has a command that will just mount your disko config for you, so I didn\u0026rsquo;t have to do it by hand.\u003c/p\u003e\n\u003cp\u003eAfter digging around in the mounted drive and double checking my configuration, I couldn\u0026rsquo;t really figure out what was going on. I re-ran the install and got the same error about a file not being found during the lanzaboote install stage. I wondered if it might be the \u003ccode\u003e/etc/secureboot\u003c/code\u003e folder that lanzaboote is configured for, so I copied that off my backup drive into \u003ccode\u003e/mnt/etc/secureboot\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eI re-ran the install, again, \u003ccode\u003enixos-install --flake /mnt/etc/nixos#serenity\u003c/code\u003e, and it didn\u0026rsquo;t error the same way this time! It did give me some errors trying to read files from the boot directory that didn\u0026rsquo;t exist, but then it said it replaced the missing files with signed binaries.\u003c/p\u003e\n\u003cp\u003eI think it\u0026rsquo;s time to try to reboot again?\u003c/p\u003e\n\u003ch2 id=\"it-boots\"\u003eIt boots!\u003c/h2\u003e\n\u003cp\u003e\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n  \n  \n    \n    \n    \n    \n    \n    \n    \n    \n  \u003cpicture\u003e\n    \u003csource srcset=\"/blog/2024/06/framework-and-nixos-declarative-encrypted-disk-partitions/img/generation-one_hu_22ec7f27772509b8.webp\" type=\"image/webp\" /\u003e\n  \u003cimg class=\"img\" src=\"/blog/2024/06/framework-and-nixos-declarative-encrypted-disk-partitions/img/generation-one.22c7fc8f4403203da9c3ee689c4244f3.jpeg\" alt=\"NixOs generation one boot prompt\" loading=\"lazy\" height=\"178\" width=\"800\" /\u003e\n\u003c/picture\u003e\n\u003c/p\u003e\n\u003cp\u003eWe have NixOS generations, so our boot partition must be working now! Even better, we get prompted to enter our lukscrypt volume password\u0026hellip;\u003c/p\u003e\n\u003cp\u003e\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n  \n  \n    \n    \n    \n    \n    \n    \n    \n    \n  \u003cpicture\u003e\n    \u003csource srcset=\"/blog/2024/06/framework-and-nixos-declarative-encrypted-disk-partitions/img/luks-passphrase_hu_c2b72dbcc4934796.webp\" type=\"image/webp\" /\u003e\n  \u003cimg class=\"img\" src=\"/blog/2024/06/framework-and-nixos-declarative-encrypted-disk-partitions/img/luks-passphrase.4f7b3204717fec690173910505b0e663.jpeg\" alt=\"Photo of screen prompting for luks passphrase\" loading=\"lazy\" height=\"286\" width=\"800\" /\u003e\n\u003c/picture\u003e\n\u003c/p\u003e\n\u003cp\u003eIt booted up into my login window, with hyprland installed and everything! All this time working on these config files wasn\u0026rsquo;t wasted.\u003c/p\u003e\n\u003cp\u003eBut one problem\u0026hellip;\u003c/p\u003e\n\u003cp\u003e\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n  \n  \n    \n    \n    \n    \n    \n    \n    \n    \n  \u003cpicture\u003e\n    \u003csource srcset=\"/blog/2024/06/framework-and-nixos-declarative-encrypted-disk-partitions/img/booted-up_hu_6e5caa95300ea967.webp\" type=\"image/webp\" /\u003e\n  \u003cimg class=\"img\" src=\"/blog/2024/06/framework-and-nixos-declarative-encrypted-disk-partitions/img/booted-up.0e0e68290339c19b01e26edff2e2820d.jpeg\" alt=\"My linux login screen with todays date, and a password prompt for dade\" loading=\"lazy\" height=\"450\" width=\"800\" /\u003e\n\u003c/picture\u003e\n\u003c/p\u003e\n\u003cp\u003eTurns out, I never set the password for my regular user. A better linux user than I would have switched to another tty, logged in as root, and then set the password without rebooting.\u003c/p\u003e\n\u003cp\u003eCouldn\u0026rsquo;t be me, dawg. I rebooted back into my live NixOS environment, re-launched a \u003ccode\u003enix-shell -p cryptsetup\u003c/code\u003e, re-opened my luks volume, re-mounted all my subvolumes to their appropriate place in \u003ccode\u003e/mnt\u003c/code\u003e, and then learned that \u003ccode\u003echroot\u003c/code\u003e doesn\u0026rsquo;t work the way I expected it to when I tried to \u003ccode\u003echroot /mnt\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eTurns out, NixOS has a tool called \u003ccode\u003enixos-enter\u003c/code\u003e, which is specifically designed to enter into NixOS installations from rescue systems. So I went into \u003ccode\u003e/mnt\u003c/code\u003e and ran \u003ccode\u003enixos-enter\u003c/code\u003e, then ran \u003ccode\u003epasswd dade\u003c/code\u003e. I set my password, and now I should be able to reboot and get into my user environment.\u003c/p\u003e\n\u003cp\u003eSure enough, I repeat the reboot process and am able to login. I\u0026rsquo;m in. This time with 100% more disk encryption, and 100% more disk partition declarations.\u003c/p\u003e\n\u003cp\u003e\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n  \n  \n    \n    \n    \n    \n    \n    \n    \n    \n  \u003cpicture\u003e\n    \u003csource srcset=\"/blog/2024/06/framework-and-nixos-declarative-encrypted-disk-partitions/img/im-in_hu_ffcb9d6384ec1a71.webp\" type=\"image/webp\" /\u003e\n  \u003cimg class=\"img\" src=\"/blog/2024/06/framework-and-nixos-declarative-encrypted-disk-partitions/img/im-in.67be737afa7fb099b63d3bd331455c25.jpeg\" alt=\"Photo of hyprland desktop showing a default wallpaper\" loading=\"lazy\" height=\"509\" width=\"800\" /\u003e\n\u003c/picture\u003e\n\u003c/p\u003e\n\u003ch2 id=\"whats-next\"\u003eWhat\u0026rsquo;s next?\u003c/h2\u003e\n\u003cp\u003eThis was a bit of a painful experience, if I\u0026rsquo;m being honest. I think disko isn\u0026rsquo;t as well documented as it could/should be, and I think my lack of experience with btrfs also put me at a slight disadvantage, because I wasn\u0026rsquo;t sure what was necessary as part of disko and what was necessary for btrfs. But the good news is that it\u0026rsquo;s done, the config works, which means I can use it on any system if I want.\u003c/p\u003e\n\u003cp\u003eBut I did run into a couple issues that I\u0026rsquo;d love to solve next. The first, my luks volume password isn\u0026rsquo;t managed in my configuration. As a self-respecting security professional, I\u0026rsquo;m not about to just commit the password to my git repo, though. The second happens to be very similar \u0026ndash; I went through all this work and then failed to login because I forgot to set my user password. Finally, the third issue, is that my wifi password wasn\u0026rsquo;t saved and I had to type it out again. I\u0026rsquo;d like all of these passwords to just be automatically set as part of my nix config.\u003c/p\u003e\n\u003cp\u003eI think my next exploration will be into \u003ca href=\"https://github.com/Mic92/sops-nix\"\u003esops-nix\u003c/a\u003e, so that I can manage my secrets in a safe way, as part of a separate, private repository. I should be able to manage my secrets for home in a repository only available in my home, and then manage secrets for servers in a private github repo.\u003c/p\u003e\n\u003cp\u003eI\u0026rsquo;m also going to make a backup of my luks header, which I was reminded to do by this \u003ca href=\"https://askubuntu.com/a/1319689\"\u003elovely askubuntu post\u003c/a\u003e. I might also look into adding a backup key on a flash drive in my safe, as a recovery mechanism in case I forget my password or in case something happens to me and someone needs to unravel the madness of my laptop.\u003c/p\u003e\n\u003cp\u003eAfter I get my secrets managed, it\u0026rsquo;ll probably be time to start configuring Impermanence and seeing if I did this disk configuration correctly.\u003c/p\u003e\n"
        },
        {
            "title": "Framework and NixOS - Secure Boot (Day Three)",
            "date_published": "2024-06-24T22:07:10-07:00",
            "date_modified": "2024-06-29T19:38:36-07:00",
            "id": "https://0xda.de/blog/2024/06/framework-and-nixos-secure-boot-day-three/",
            "url": "https://0xda.de/blog/2024/06/framework-and-nixos-secure-boot-day-three/",
            "content_html": "\u003cp\u003eThis is part 3 in my series of posts learning how to setup NixOS on my Framework 16\u0026quot; AMD laptop. It is not meant as a guide, necessarily, but more as a captain\u0026rsquo;s log of my thoughts and processes along the way.\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ca href=\"https://0xda.de/blog/2024/06/framework-and-nixos-day-one/\"\u003eFramework and NixOS - Day One\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://0xda.de/blog/2024/06/framework-and-nixos-day-two/\"\u003eFramework and NixOS - Day Two\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch2 id=\"secure-boot-with-lanzaboote\"\u003eSecure Boot with Lanzaboote\u003c/h2\u003e\n\u003cp\u003eBefore I get too far into using my laptop, I want to figure out some of the more advanced features I want to use. If I don\u0026rsquo;t figure them out now, it\u0026rsquo;ll be a huge pain later if I brick it once I have actual important data on my device.\u003c/p\u003e\n\u003cp\u003eSo first up on my list is Lanzaboote, what appears to be the most-recommended way to enable secure boot on NixOS. They have some \u003ca href=\"https://github.com/nix-community/lanzaboote/blob/master/docs/QUICK_START.md\"\u003esetup instructions\u003c/a\u003e that I can follow with my flake.nix configuration. But while reading these instructions, I noticed that \u003ccode\u003esbctl\u003c/code\u003e places the secureboot keys in \u003ccode\u003e/etc/secureboot\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eI don\u0026rsquo;t \u003cem\u003elove\u003c/em\u003e this, since it\u0026rsquo;s putting the secure boot signing keys on the device that relies on the signatures to be valid. What I\u0026rsquo;d like is for my signing keys to be hardware backed, either in the on-board TPM or in a yubikey. But \u003ccode\u003esbctl\u003c/code\u003e \u003ca href=\"https://github.com/Foxboron/sbctl/issues/84\"\u003edoesn\u0026rsquo;t currently support this\u003c/a\u003e and I am new to doing this type of thing, so I\u0026rsquo;m going to just follow the instructions for now instead of venturing out into manual key generation. But when I am ready to try to do \u003ca href=\"https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#Manual_process\"\u003ehardware backed key generation\u003c/a\u003e, Arch Wiki has me covered.\u003c/p\u003e\n\u003cp\u003eFirst I generated some keys with a simple \u003ccode\u003enix-shell -p sbctl\u003c/code\u003e and then ran \u003ccode\u003esudo sbctl create-keys\u003c/code\u003e from within the nix-shell. Next, I added lanzaboote as an input to my \u003ccode\u003eflake.nix\u003c/code\u003e file.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-nix\" data-lang=\"nix\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  inputs \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e...\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    lanzaboote \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\t  url \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;github:nix-community/lanzaboote/v0.4.1\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\t  inputs\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003enixpkgs\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003efollow \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;nixpkgs\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  };\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eNext, I added \u003ccode\u003elanzaboote\u003c/code\u003e as a parameter to the \u003ccode\u003eoutputs\u003c/code\u003e and added the module to my laptop\u0026rsquo;s configuration.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-nix\" data-lang=\"nix\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  outputs \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {self\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e,\u003c/span\u003e nixpkgs\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e,\u003c/span\u003e lanzaboote\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e,\u003c/span\u003e \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e...\u003c/span\u003e}: {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    nixosConfigurations\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003eserenity \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e nixpkgs\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003elib\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003enixosSystem {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      specialArgs \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\u003cspan style=\"color:#ca9ee6\"\u003einherit\u003c/span\u003e inputs;};\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      modules \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e [\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        lanzaboote\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003enixosModules\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003elanzaboote\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        \u003cspan style=\"color:#81c8be\"\u003e./hosts/serenity/configuration.nix\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        inputs\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003ehome-manager\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003enixosModules\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003edefault\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\t  ];\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    };\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eNow I am ready to modify the \u003ccode\u003e./hosts/serenity/configuration.nix\u003c/code\u003e file to include the necessary configuration to tell nix to use lanzaboote instead of systemd-boot.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-nix\" data-lang=\"nix\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e{ config\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e,\u003c/span\u003e pkgs\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e,\u003c/span\u003e lib\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e,\u003c/span\u003e inputs\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e,\u003c/span\u003e \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e...\u003c/span\u003e};\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e{\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  boot\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003eloader\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003esystemd-boot\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003eenable \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e lib\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003emkForce \u003cspan style=\"color:#e5c890\"\u003efalse\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  boot\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003elanzaboote \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    enable \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#e5c890\"\u003etrue\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    pkiBundle \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;/etc/secureboot\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e...\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  environment\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003esystemPackages \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e [\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e...\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  sbctl \u003cspan style=\"color:#737994;font-style:italic\"\u003e# Secure boot key management\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  ]\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eAfter running a rebuild (\u003ccode\u003esudo nixos-rebuild switch --flake ~/nixcfg\u003c/code\u003e), I am ready to verify signatures with \u003ccode\u003esudo sbctl verify\u003c/code\u003e. Everything except my kernel images are signed. The lanzaboote guide says that files ending in \u003ccode\u003e.bzImage.efi\u003c/code\u003e are not signed. My kernel images don\u0026rsquo;t end in \u003ccode\u003e.bzImage.efi\u003c/code\u003e, but I\u0026rsquo;m pretty sure they are fine.\u003c/p\u003e\n\u003cp\u003eBefore I go any further, I\u0026rsquo;m going to \u003ca href=\"https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#Backing_up_current_variables\"\u003ebackup my existing EFI variables\u003c/a\u003e, which I found instructions for in the Arch wiki.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-shell\" data-lang=\"shell\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#ca9ee6\"\u003efor\u003c/span\u003e var in PK KEK db dbx ; \u003cspan style=\"color:#ca9ee6\"\u003edo\u003c/span\u003e efi-readvar -v \u003cspan style=\"color:#f2d5cf\"\u003e$var\u003c/span\u003e -o old_\u003cspan style=\"color:#a6d189\"\u003e${\u003c/span\u003e\u003cspan style=\"color:#f2d5cf\"\u003evar\u003c/span\u003e\u003cspan style=\"color:#a6d189\"\u003e}\u003c/span\u003e.esl ; \u003cspan style=\"color:#ca9ee6\"\u003edone\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eTime to get back to the Lanzaboote instructions and reboot my computer to get into secure boot setup mode. \u003ccode\u003eshutdown now\u003c/code\u003e and then spam the f12 key while rebooting (it has the framework gear on it). This seems to go directly to the boot manager, and getting to the settings from there doesn\u0026rsquo;t really work correctly, from my experience. But I just went into the nixos boot menu and scrolled to the bottom where it said \u0026ldquo;Reboot into firmware interface\u0026rdquo;.\u003c/p\u003e\n\u003cp\u003eFrom the framework UEFI interface, we want to go to Administer Secure Boot, then \u0026ldquo;Erase all Secure Boot Settings.\u0026rdquo; Toggle this to Enable. Hit f10 to save and exit.\u003c/p\u003e\n\u003cp\u003eLet NixOS boot up again and login. Open up a terminal and enroll our keys - \u003ccode\u003esudo sbctl enroll-keys --microsoft\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eWe had to disable secure boot in the UEFI configuration on day one, then we cleared the settings and enrolled our keys. Now we need to enable it again. Reboot into the framework firmware interface again, Administer Secure Boot, and toggle Enforce Secure Boot to enabled. F10 to save and exit, then let NixOS boot up.\u003c/p\u003e\n\u003cp\u003eLogin and open up a terminal, run \u003ccode\u003ebootctl status\u003c/code\u003e and you should see something like this:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eSystem:\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      Firmware: UEFI 2.80 (INSYDE Corp. 0.770)\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e Firmware Arch: x64\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e   Secure Boot: enabled (user)\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  TPM2 Support: yes\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  Measured UKI: yes\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  Boot into FW: supported\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eNow we\u0026rsquo;ve got secureboot working. Time to see if we can avoid breaking it when we enable disk encryption.  But that will be a problem for my next post.\u003c/p\u003e\n"
        },
        {
            "title": "Framework and NixOS - Day Two",
            "date_published": "2024-06-11T22:23:18-07:00",
            "date_modified": "2024-06-11T22:29:21-07:00",
            "id": "https://0xda.de/blog/2024/06/framework-and-nixos-day-two/",
            "url": "https://0xda.de/blog/2024/06/framework-and-nixos-day-two/",
            "content_html": "\u003cp\u003eIn order to start making better use of my laptop, I need to get a little more moved in. This means things like 1Password, Tailscale, fixing my display resolution, and customizing my Hyprland config to remove that annoying warning message.\u003c/p\u003e\n\u003ch2 id=\"installing-tailscale\"\u003eInstalling Tailscale\u003c/h2\u003e\n\u003cp\u003eWhile 1Password and Obsidian are a little more clearly user-space packages, I want Tailscale at the system level, because I\u0026rsquo;d ideally like it to start when the device starts, regardless of if the user has logged in yet or not. This is because there may be times where I want to remotely access my laptop via ssh, perhaps from another laptop, and I may want/need to reboot my laptop remotely, so I want it to come back up after reboot.\u003c/p\u003e\n\u003cp\u003eInstalling Tailscale as a system package is pretty easy, I just added \u003ccode\u003etailscale\u003c/code\u003e to my \u003ccode\u003eenvironment.systemPackages\u003c/code\u003e in \u003ccode\u003e~/nixcfg/hosts/serenity/configuration.nix\u003c/code\u003e. Unfortunately I can\u0026rsquo;t actually login and get my device connected to my Tailnet yet, because I don\u0026rsquo;t know my google password, and I prefer to keep it that way.\u003c/p\u003e\n\u003ch2 id=\"installing-1password\"\u003eInstalling 1Password\u003c/h2\u003e\n\u003cp\u003e1Password is much more clearly a user-space program, as I said previously, so I\u0026rsquo;m going to install it in my home manager configuration, \u003ccode\u003e~/nixcfg/home.nix\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eBut when I added \u003ccode\u003e_1password-gui\u003c/code\u003e to my list of packages and tried to rebuild, I was met with an error about unfree packages. Apparently home-manager doesn\u0026rsquo;t share the allowUnfree setting from my system configuration, which I had set to true from the initial device setup.\u003c/p\u003e\n\u003cp\u003eThis error caused me to think to myself about how much I want to allow unfree software into my system. I love 1Password, it has easily been the best password manager experience I\u0026rsquo;ve had, and I\u0026rsquo;ve used Keepass, Lastpass, and Bitwarden before switching to 1Password. So I don\u0026rsquo;t think I\u0026rsquo;m going to abandon my preferred password manager just because it isn\u0026rsquo;t free.\u003c/p\u003e\n\u003cp\u003eBut to avoid accidentally including a bunch of unexpected unfree software in the future, I want to be very explicit about which unfree packages I\u0026rsquo;m going to allow. So in the top of my \u003ccode\u003e~/nixcfg/home.nix\u003c/code\u003e file, I added the following:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-nix\" data-lang=\"nix\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e{\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  nixpkgs \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    config \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      allowUnfreePredicate \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e pkg: \u003cspan style=\"color:#99d1db\"\u003ebuiltins\u003c/span\u003e\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003eelem (lib\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003egetName pkg) [\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;1password\u0026#34;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      ];\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e...\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eNow I have 1password installed, and have a pattern for explicitly including other unfree software. I opened up the app (by running \u003ccode\u003e1password\u003c/code\u003e in my terminal) and used the \u0026ldquo;Scan setup code\u0026rdquo; option to get the device setup.\u003c/p\u003e\n\u003cp\u003eThe resolution of this app is all sorts of messed up, though, so I\u0026rsquo;ll probably have to figure out how to improve that.\u003c/p\u003e\n\u003ch2 id=\"removing-that-annoying-hyprland-autogenerated-config-warning\"\u003eRemoving that annoying Hyprland autogenerated config warning\u003c/h2\u003e\n\u003cp\u003eUp until now, my desktop has had a yellow warning bar across the top, indicating that I\u0026rsquo;m using the autogenerated configuration. Removing this is as simple as managing my hyprland config and changing a setting. But instead of just changing the file in my home directory, which would result in system state change, I am going to copy \u003ccode\u003e.config/hypr/hyprland.conf\u003c/code\u003e into my home-manager configuration.\u003c/p\u003e\n\u003cp\u003eIt\u0026rsquo;s in my repository as \u003ccode\u003e~/nixcfg/home/dade/.config/hypr/hyprland.conf\u003c/code\u003e and I use \u003ccode\u003ehome.file\u003c/code\u003e inside my \u003ccode\u003ehome.nix\u003c/code\u003e file to set it up, like so:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-nix\" data-lang=\"nix\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ehome\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003efile \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;.config/hypr/hyprland.conf\u0026#34;\u003c/span\u003e\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003esource \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#81c8be\"\u003ehome/dade/.config/hypr/hyprland.conf\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e};\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eOnce this is setup, you have to do a \u003ccode\u003enixos-rebuild switch --flake\u003c/code\u003e to update your hyprland config. Make sure you commit the hyprland.conf file into your repository, \u003cstrong\u003eotherwise the rebuild will ignore it and error out\u003c/strong\u003e.\u003c/p\u003e\n\u003cp\u003eNow I can modify the \u003ccode\u003e~/nixcfg/home/dade/.config/hypr/hyprland.conf\u003c/code\u003e file and remove the \u003ccode\u003eautogenerated=1\u003c/code\u003e line, which will remove the warning. Time to do another rebuild.\u003c/p\u003e\n\u003ch2 id=\"setting-up-an-application-launcher\"\u003eSetting up an application launcher\u003c/h2\u003e\n\u003cp\u003eThe default hyprland experience has me just running commands in my terminal, but I want a way to launch graphical applications that doesn\u0026rsquo;t just leave the terminal window open as well. Enter the application launcher.\u003c/p\u003e\n\u003cp\u003eThere are some existing resources on this, including the \u003ca href=\"https://wiki.hyprland.org/Useful-Utilities/App-Launchers/\"\u003eHyprland documentation\u003c/a\u003e as well as this \u003ca href=\"https://www.youtube.com/watch?v=61wGzIv12Ds\"\u003eVimjoyer video about Nixos and Hyprland\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003eIt defaults to \u003ccode\u003ewofi\u003c/code\u003e but I\u0026rsquo;m switching to \u003ccode\u003erofi\u003c/code\u003e which is a wayland native app launcher. The default \u003ccode\u003e$menu\u003c/code\u003e variable in \u003ccode\u003ehyprland.conf\u003c/code\u003e can be changed to \u003ccode\u003erofi -show drun -show-icons\u003c/code\u003e after adding rofi to your environment. Make sure to note that rofi uses single dashes for argument names, not double dashes.\u003c/p\u003e\n\u003cp\u003eI added \u003ccode\u003erofi-wayland\u003c/code\u003e to my \u003ccode\u003e~/nixcfg/hosts/serenity/configuration.nix\u003c/code\u003e \u003ccode\u003eenvironment.systemPackages\u003c/code\u003e, though I think it would probably work fine as a package in my home-manager config as well. It just seems like the sort of thing that is more specific to my particular usage of Hyprland on this host, and not something that I\u0026rsquo;d necessarily want in all of my home configurations across all devices. I\u0026rsquo;m sure I can setup some variables for this later, but I am trying not to overwhelm myself too much in my pursuit of getting a functional system.\u003c/p\u003e\n\u003ch2 id=\"setting-up-a-status-bar\"\u003eSetting up a status bar\u003c/h2\u003e\n\u003cp\u003eFor a menu/status bar across the screen, I\u0026rsquo;m going to use \u003ccode\u003ewaybar\u003c/code\u003e \u0026ndash; another wayland native package. It\u0026rsquo;s the \u003ca href=\"https://wiki.hyprland.org/Useful-Utilities/Status-Bars/\"\u003efirst status bar in the Hyprland documentation\u003c/a\u003e, and it seems pretty easy to get working. It\u0026rsquo;s already referenced in a commented out block of my \u003ccode\u003ehyprland.conf\u003c/code\u003e file, so I just need to make sure it\u0026rsquo;s installed and then replicate an autostart command in my conf file for when hyprland starts.\u003c/p\u003e\n\u003cp\u003eAdd \u003ccode\u003ewaybar\u003c/code\u003e to \u003ccode\u003e~/nixcfg/hosts/serenity/configuration.nix\u003c/code\u003e \u003ccode\u003eenvironment.systemPackages\u003c/code\u003e. This, like \u003ccode\u003erofi\u003c/code\u003e, seems like something that is probably fine to have in my home-manager configuration instead of my host configuration, but I\u0026rsquo;m okay with blurring the lines a bit right now.\u003c/p\u003e\n\u003cp\u003eAfter adding waybar to my system packages, I also need to update \u003ccode\u003e~/nixcfg/home/dade/.config/hypr/hyprland.conf\u003c/code\u003e and add the following line \u0026ndash; I added it under the \u003ccode\u003eAUTOSTART\u003c/code\u003e section header, but technically you should just be able to add it anywhere.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eexec-once = waybar\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eThere\u0026rsquo;s already a commented out line that starts waybar in this section, but it also starts hyprpaper and firefox, and I don\u0026rsquo;t want firefox to start every time I login to my desktop.\u003c/p\u003e\n\u003cp\u003eI am curious about hyprpaper, though. But first, my \u003ccode\u003ewaybar\u003c/code\u003e looks terrible, all the icons are broken. What\u0026rsquo;s going on with that.\u003c/p\u003e\n\u003ch2 id=\"fixing-my-waybar-fonts\"\u003eFixing my Waybar Fonts\u003c/h2\u003e\n\u003cp\u003eA bit of searching around turned up a \u003ca href=\"https://www.reddit.com/r/swaywm/comments/rsp7rm/font_icons_arent_properly_shown_in_waybar/\"\u003ereddit thread\u003c/a\u003e where someone is complaining about a similar problem, and someone mentions that \u003ccode\u003eotf-font-awesome\u003c/code\u003e is the default font used by waybar. In Nixpkgs, this appears to be the \u003ccode\u003efont-awesome\u003c/code\u003e package. So let\u0026rsquo;s give that a try.\u003c/p\u003e\n\u003cp\u003eFonts are a little different than packages like \u003ccode\u003ewaybar\u003c/code\u003e and \u003ccode\u003erofi\u003c/code\u003e, though. I could see myself wanting font-awesome icons available across many machines, regardless if I am using waybar or not. So I am going to install it into my \u003ccode\u003e~/nixcfg/home.nix\u003c/code\u003e config instead of my host config. Inside \u003ccode\u003ehome.packages\u003c/code\u003e, I added the following:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-nix\" data-lang=\"nix\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ehome\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003epackages \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#ca9ee6\"\u003ewith\u003c/span\u003e pkgs; [\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e...\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  font-awesome\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e];\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eAfter rebuilding my config, I exited Hyprland with SUPER+m, and then logged back in. When I logged back in, \u003ccode\u003ewaybar\u003c/code\u003e started automatically and had the correct fonts. Or at least, mostly. There\u0026rsquo;s one more icon that doesn\u0026rsquo;t show up, and it\u0026rsquo;s next to a 100% indicator. Hovering it does not tell me what it is, and while trying to figure it out, I just learned that my mute and volume control fn keys don\u0026rsquo;t work, nor does my screen brightness utility. Add those to the things left to fix. Eventually I\u0026rsquo;ll come back and read about the \u003ca href=\"https://github.com/Alexays/Waybar/wiki/Configuration\"\u003ewaybar configuration\u003c/a\u003e, which will help me figure out what the modules are that I don\u0026rsquo;t recognize.\u003c/p\u003e\n\u003ch2 id=\"a-new-display-resolution\"\u003eA new (display) resolution\u003c/h2\u003e\n\u003cp\u003eWhen I launch an application like 1Password, the resolution is really bad. My terminal looks fine, but anything with finer detail looks bad. This is surely just a Hyprland setting, since it didn\u0026rsquo;t happen with graphical windows in Budgie. After a bit of googling, I found a reddit post of someone who had a \u003ca href=\"https://www.reddit.com/r/hyprland/comments/10uzsaf/issue_with_resolution/\"\u003esimilar problem with their display resolution\u003c/a\u003e on r/hyprland. I followed the top comment and modified my monitor configuration in \u003ccode\u003e~/nixcfg/home/dade/.config/hypr/hyprland.conf\u003c/code\u003e, like so.\u003c/p\u003e\n\u003ch4 id=\"before\"\u003eBefore\u003c/h4\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003emonitor=,preffered,auto,auto\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch4 id=\"after\"\u003eAfter\u003c/h4\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003emonitor=,highres,auto,1\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eAfter rebuilding my configuration, I closed hyprland and launched it again, then used rofi (via \u003ccode\u003eSUPER+r\u003c/code\u003e) to launch 1Password, and now it looks like a normal resolution that I\u0026rsquo;d expect. Perfect.\u003c/p\u003e\n\u003ch2 id=\"fixing-the-rebootshutdown-issue\"\u003eFixing the reboot/shutdown issue\u003c/h2\u003e\n\u003cp\u003eApparently I picked a bad time to do my install, the kernel version that was installed is what was causing my inability to use the reboot and shutdown commands. As a reminder, the \u003ccode\u003eshutdown\u003c/code\u003e and \u003ccode\u003ereboot\u003c/code\u003e commands have been completing the operating system shutdown, but not correctly signaling the hardware to actually power off or restart.\u003c/p\u003e\n\u003cp\u003eThankfully, someone replied to \u003ca href=\"https://crime.st/@dade/112598413549036093\"\u003emy post on mastodon\u003c/a\u003e sharing yesterday\u0026rsquo;s endeavors, and they\u003ca href=\"https://crime.st/@eliasin@hachyderm.io/112599711271629064\"\u003erecommended updating to the latest kernel version\u003c/a\u003e, which should fix the reboot/shutdown problem. So I gave it a shot this evening and it worked. I modified \u003ccode\u003e~/nixcfg/hosts/serenity/configuration.nix\u003c/code\u003e and added this line towards the top, under the other boot settings.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-nix\" data-lang=\"nix\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eboot\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003ekernelPackages \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e pkgs\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003elinuxPackages_latest;\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eI rebuilt my config and typed \u003ccode\u003ereboot\u003c/code\u003e. Nothing happened. Of course nothing happened. I\u0026rsquo;m not using the new kernel yet. I hard powered off my device, then powered back up. I logged in and typed \u0026ldquo;reboot\u0026rdquo; into my terminal, and sure enough, it rebooted correctly. Finally. I did the same process and made sure \u003ccode\u003eshutdown\u003c/code\u003e worked, and now I\u0026rsquo;m good to go.\u003c/p\u003e\n\u003cp\u003eNot a very satisfying result, to be honest. \u0026ldquo;Just update to the latest kernel\u0026rdquo; means it was a kernel regression or something, which is silly.\u003c/p\u003e\n\u003ch2 id=\"thats-a-wrap\"\u003eThat\u0026rsquo;s a wrap\u003c/h2\u003e\n\u003cp\u003eI\u0026rsquo;m going to go ahead and close this post up at the end of day 2 with my laptop. There\u0026rsquo;s still a lot left to do, but I am in a much more comfortably usable position now for the short term. It\u0026rsquo;ll probably be a few weeks until my next update in this series, as I\u0026rsquo;m pretty busy the next week and a half or so and won\u0026rsquo;t have time to work on it.\u003c/p\u003e"
        },
        {
            "title": "Framework and NixOS - Day One",
            "date_published": "2024-06-11T00:04:23-07:00",
            "date_modified": "2024-06-11T22:29:21-07:00",
            "id": "https://0xda.de/blog/2024/06/framework-and-nixos-day-one/",
            "url": "https://0xda.de/blog/2024/06/framework-and-nixos-day-one/",
            "content_html": "\u003cp\u003eMy first day with my Framework 16 AMD 7040 Series, and my experience getting NixOS setup on it.\u003c/p\u003e\n\u003cp\u003e\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n  \n  \n    \n    \n    \n    \n    \n    \n    \n    \n  \u003cpicture\u003e\n    \u003csource srcset=\"/blog/2024/06/framework-and-nixos-day-one/img/2024-06-10-neofetch_hu_dfc2ee63fd517e20.webp\" type=\"image/webp\" /\u003e\n  \u003cimg class=\"img\" src=\"/blog/2024/06/framework-and-nixos-day-one/img/2024-06-10-neofetch.f2f24fe3e4cbf2faa861bfc3263341ac.jpeg\" alt=\"neofetch output showing my NixOS configuration\" loading=\"lazy\" height=\"1152\" width=\"2048\" /\u003e\n\u003c/picture\u003e\n\u003c/p\u003e\n\u003cp\u003eNote: This is less of a how-to guide, and not really a cohesive blog post. Instead, it\u0026rsquo;s a series of steps I took, in roughly the order I took them, to get my new laptop setup.\u003c/p\u003e\n\u003ch2 id=\"putting-it-together\"\u003ePutting it together\u003c/h2\u003e\n\u003cp\u003eI ordered the DIY kit, which is less of a full DIY and more of a \u0026ldquo;some assembly required\u0026rdquo; kit. I had to install the SSD (WD Black 4TB NVMe), the RAM (64GB DDR5), the keyboard, and the bezel around the screen. The process was super easy, everything was very well labeled and the instructions were very clear. My only complaint is that 17 screws is a lot to remove if I want to add that second SSD later.\u003c/p\u003e\n\u003cp\u003eOverall I\u0026rsquo;m very pleased with the build quality. The dimensions and weight of the laptop will likely take a little getting used to, since it\u0026rsquo;s a bit bigger than my 14\u0026quot; MacBook Pro M1 Pro for work, and considerably larger than my personal 13\u0026quot; MacBook Pro. But all that extra size and weight is just the added freedom I get for going with a Framework, I suppose.\u003c/p\u003e\n\u003ch2 id=\"disable-secureboot\"\u003eDisable SecureBoot\u003c/h2\u003e\n\u003cp\u003eAs I\u0026rsquo;ve previously discovered, NixOS does not boot with Secure Boot by default. Instead of spending time getting \u003ca href=\"https://github.com/nix-community/lanzaboote\"\u003eLanzaboote\u003c/a\u003e setup, I opted to just go with it disabled for the time being. Disabling it is easy and then NixOS installs easily.\u003c/p\u003e\n\u003ch2 id=\"installing-nixos\"\u003eInstalling NixOS\u003c/h2\u003e\n\u003cp\u003eI used the 23.11 NixOS GNOME installer, which made installation a breeze. I had to open the system settings and connect to my WiFi, then exit and re-open the installer, then I was off to the races.\u003c/p\u003e\n\u003cp\u003eDuring the installation, I don\u0026rsquo;t think it prompted me for a hostname \u0026ndash; this would have been nice, but not necessary I suppose.\u003c/p\u003e\n\u003ch2 id=\"bootstrapping-my-configuration\"\u003eBootstrapping my configuration\u003c/h2\u003e\n\u003cp\u003eI already have a configuration that I\u0026rsquo;ve been working on in a virtual machine on my desktop that is stored in git and uses flakes. To get my configuration working on my new laptop, I had to make a couple changes.\u003c/p\u003e\n\u003ch3 id=\"getting-git\"\u003eGetting Git\u003c/h3\u003e\n\u003cp\u003eNix doesn\u0026rsquo;t ship with git by default, and I need git to clone my private repository. Thankfully, \u003ccode\u003enix-shell -p git\u003c/code\u003e made this really easy. But once I had git, I didn\u0026rsquo;t have an SSH key, and my nix config is private right now.\u003c/p\u003e\n\u003ch3 id=\"setting-up-an-ssh-key\"\u003eSetting Up an SSH key\u003c/h3\u003e\n\u003cp\u003eI like to use an SSH key per device and avoid copying SSH keys between devices, so I had to generate a new key before I could clone my repository. \u003ccode\u003essh-keygen -t ed25519-sk\u003c/code\u003e to generate a key that uses FIDO2 attestation from my yubikey. I would love to have been able to use a platform authenticator (e.g. my fingerprint reader), but I didn\u0026rsquo;t try very hard and it was easy enough to just plug my yubikey in.\u003c/p\u003e\n\u003cp\u003eNow I have an SSH key that requires touching my yubikey to use, I have to get the public key added to my Github. Since all my credentials are in my password manager, which isn\u0026rsquo;t on my new laptop yet, I had to get the public key to my desktop. Nothing a little pastebin can\u0026rsquo;t handle. Pasted the key into pastebin on my laptop, typed the url into my desktop, copied the key into Github, and I\u0026rsquo;m good to go.\u003c/p\u003e\n\u003ch2 id=\"clone-my-config\"\u003eClone my config\u003c/h2\u003e\n\u003cp\u003e\u003ccode\u003egit clone git@github.com:0xdade/nixcfg\u003c/code\u003e \u0026ndash; This was it, I keep my nix config in my home directory right now, easy peasy.\u003c/p\u003e\n\u003ch3 id=\"adding-a-second-host-configuration-to-flakenix\"\u003eAdding a second host configuration to flake.nix\u003c/h3\u003e\n\u003cp\u003eEvery video I\u0026rsquo;ve watched and nix config I\u0026rsquo;ve looked at has separated out their configs by host, and now I understand why. Previously most of my configuration was in just a plain \u003ccode\u003econfiguration.nix\u003c/code\u003e file in the root of my repository. But my VM doesn\u0026rsquo;t support hyprland, I think because hyper-v doesn\u0026rsquo;t do graphics hardware acceleration or something like that. It also has some extra kernel modules specifically for running in hyper-v.\u003c/p\u003e\n\u003cp\u003eSo I made some new directories in my config repo, \u003ccode\u003ehosts/serenity\u003c/code\u003e and \u003ccode\u003ehosts/solacevm\u003c/code\u003e \u0026ndash; \u003ccode\u003eserenity\u003c/code\u003e is my new laptop, and \u003ccode\u003esolacevm\u003c/code\u003e is my Nix VM on my \u003ccode\u003esolace\u003c/code\u003e desktop. I copied the existing \u003ccode\u003enixcfg/configuration.nix\u003c/code\u003e and \u003ccode\u003enixcfg/hardware-configuration.nix\u003c/code\u003e into \u003ccode\u003ehosts/solacevm/\u003c/code\u003e and then also copied \u003ccode\u003enixcfg/configuration.nix\u003c/code\u003e into \u003ccode\u003ehosts/serenity/\u003c/code\u003e. I haven\u0026rsquo;t made any tweaks to it yet, but now I have two copies of the configuration file in my repository, one for each host I want to run nix on.\u003c/p\u003e\n\u003cp\u003eI also copied \u003ccode\u003e/etc/nixos/hardware-configuration.nix\u003c/code\u003e into \u003ccode\u003e~/nixcfg/hosts/serenity/hardware-configuration.nix\u003c/code\u003e so that my repository would track it. I read somewhere that Flake doesn\u0026rsquo;t care about files that aren\u0026rsquo;t tracked in your git repo, so this seemed like a wise move to avoid a potential future headache.\u003c/p\u003e\n\u003cp\u003eNow that I have the second configuration setup, I modified \u003ccode\u003eflake.nix\u003c/code\u003e to add a second output nixosConfiguration, like so:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003enixosConfigurations.serenity = nixpkgs.lib.nixosSystem {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  specialArgs = {inherit inputs;};\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  modules = [\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    ./hosts/serenity/configuration.nix\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    inputs.home-manager.nixosModules.default\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  ];\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e};\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003enixosConfigurations.solacevm = nixpkgs.lib.nixosSystem {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  specialArgs = {inherit inputs;};\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  modules = [\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    ./hosts/solacevm/configuration.nix\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    inputs.home-manager.nixosModules.default\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  ];\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e};\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eEach nixosConfiguration is named according to the hostname of the machine it runs on, which means I don\u0026rsquo;t have to specify which configuration to use when I do a flake rebuild. For example, if I run \u003ccode\u003enixos-rebuild switch --flake ~/nixcfg\u003c/code\u003e on my \u003ccode\u003eserenity\u003c/code\u003e device, it is equivalent to running \u003ccode\u003enixos-rebuild switch --flake ~/nixcfg#serenity\u003c/code\u003e \u0026ndash; Just nice to save a couple keystrokes and share a single \u003ccode\u003eswitch\u003c/code\u003e alias across all my environments.\u003c/p\u003e\n\u003ch2 id=\"setting-up-hyprland\"\u003eSetting up Hyprland\u003c/h2\u003e\n\u003cp\u003eI got Hyprland set up by making some minor tweaks from my old vm configuration. My VM was running Budgie with lightdm, which was pretty easy to setup, but I wanted Hyprland. I have long been a sucker for tiling window managers, and Hyprland looks great.\u003c/p\u003e\n\u003cp\u003eThe key things I had to do while setting up Hyprland were pretty simple program enables, but there were a couple caveats I wanted to be aware of.\u003c/p\u003e\n\u003ch3 id=\"you-probably-want-a-login-manager-and-you-probably-dont-want-lightdm\"\u003eYou probably want a login manager, and you probably don\u0026rsquo;t want lightdm\u003c/h3\u003e\n\u003cp\u003eI switched \u003ccode\u003eservices.xserver.displayManager.lightdm.enable\u003c/code\u003e to \u003ccode\u003eservices.xserver.displayManager.sddm.enable\u003c/code\u003e. Prior to doing this, I had accidentally commented out my entire \u003ccode\u003eservices.xserver\u003c/code\u003e block in favor of the hyprland block, only for my rebuild to kill Budgie and leave me with a black screen with a blinking cursor that I couldn\u0026rsquo;t type into. I rebooted and went back to my previous configuration and realized I needed this.\u003c/p\u003e\n\u003cp\u003eSo my complete set of changes to get hyprland working was:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-gdscript3\" data-lang=\"gdscript3\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eprograms\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003ehyprland\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003eenable \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#99d1db\"\u003etrue\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eprograms\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003ehyprland\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003eportalPackage \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e pkgs\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003exdg\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e-\u003c/span\u003edesktop\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e-\u003c/span\u003eportal\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e-\u003c/span\u003ehyprland;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eservices\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003exserver \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  enable \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#99d1db\"\u003etrue\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  xkb\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003elayout \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;us\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  xkb\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003evariant \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6d189\"\u003e\u0026#34;\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  displayManager\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003esddm\u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e.\u003c/span\u003eenable \u003cspan style=\"color:#99d1db;font-weight:bold\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#99d1db\"\u003etrue\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e};\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id=\"kitty\"\u003eKitty\u003c/h3\u003e\n\u003cp\u003eSo hyprland is apparently a little bit opinionated \u0026ndash; the default configuration gives you a hot key to open the \u003ccode\u003ekitty\u003c/code\u003e terminal emulator. The only problem is that I didn\u0026rsquo;t install the \u003ccode\u003ekitty\u003c/code\u003e terminal emulator because I didn\u0026rsquo;t know this.\u003c/p\u003e\n\u003cp\u003eSo I gave it the old reboot, went back to a previous version of my nix config that was running Budgie, and added \u003ccode\u003ekitty\u003c/code\u003e to my \u003ccode\u003eenvironment.systemPackages\u003c/code\u003e list. I think technically I could have just added this to my home-manager home file, I don\u0026rsquo;t think I need it to be installed as a system package. But since \u003ccode\u003ehyprland\u003c/code\u003e is also enabled at the system level, it seemed wise to also include kitty at the system level. Besides, my laptop is a single-user device, so the difference between a system package and a home package isn\u0026rsquo;t particularly meaningful to me.\u003c/p\u003e\n\u003ch2 id=\"setting-up-my-fingerprint-reader\"\u003eSetting up my Fingerprint Reader\u003c/h2\u003e\n\u003cp\u003eWhile scouring the web to try to understand why the \u003ccode\u003ereboot\u003c/code\u003e and \u003ccode\u003eshutdown\u003c/code\u003e commands don\u0026rsquo;t actually turn off my laptop, I came across this thread on the Framework forums about \u003ca href=\"https://community.frame.work/t/nixos-on-the-framework-laptop-16/46743/94\"\u003eNixOS on the Framework Laptop 16\u003c/a\u003e. Within this thread I picked up a few neat things, including this \u003ca href=\"https://community.frame.work/t/nixos-on-the-framework-laptop-16/46743/18\"\u003ecomment by CodeMichael\u003c/a\u003e that shows how to setup the fingerprint reader and the power profiles daemon.\u003c/p\u003e\n\u003cp\u003e\u003ccode\u003eservices.fprintd.enable = true;\u003c/code\u003e \u0026ndash; easy as pie. Rebuilt my configuration and ran \u003ccode\u003esudo fprintd-enroll dade\u003c/code\u003e and now I can use my fingerprint to sudo, as well as a secondary prompt after entering my password when logging in.\u003c/p\u003e\n\u003ch2 id=\"enabling-framework-specific-nixos-modules\"\u003eEnabling Framework specific nixos modules\u003c/h2\u003e\n\u003cp\u003eI think I had seen nixos-hardware before, but didn\u0026rsquo;t really understand it, especially since I have been running purely inside a virtual machine up until today. But sure enough, there is a set of NixOS modules specifically for the \u003ca href=\"https://github.com/NixOS/nixos-hardware/tree/master/framework/16-inch/7040-amd\"\u003eFramework 16 AMD 7040 series laptops\u003c/a\u003e, so I set out to understand how to include the nixos-hardware modules.\u003c/p\u003e\n\u003cp\u003eFirst, I had to add nixos-hardware as an input in my \u003ccode\u003eflake.nix\u003c/code\u003e file. Towards the top, in my \u003ccode\u003einputs\u003c/code\u003e attribute set, I added:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003einputs = {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  ...\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  nixos-hardware.url = \u0026#34;github:NixOS/nixos-hardware/master\u0026#34;;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e};\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eI then added the appropriate NixOS module to my \u003ccode\u003e~/nixcfg/hosts/serenity/configuration.nix\u003c/code\u003e imports:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#c6d0f5;background-color:#303446;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eimports = [\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  ./hardware-configuration.nix\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  inputs.nixos-hardware.nixosModules.framework-16-7040-amd\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  inputs.home-manager.nixosModules.default\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e];\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eAnother rebuild, and I\u0026rsquo;m off to the races. This contains some specific hardware workarounds for the Framework 16 on AMD 7040 series, including enabling power-profiles-daemon, an acpi alarm kernel param depending on your kernel version, as well as some powerstate (or maybe performance state? idk what \u003ccode\u003epstate\u003c/code\u003e is) tweaks for specific kernel versions, and some hardware settings for opengl and other AMD video driver specific settings.\u003c/p\u003e\n\u003cp\u003eI can\u0026rsquo;t say I fully understand all of them, but in this case I figured it couldn\u0026rsquo;t hurt to try. Especially if there was a chance it would fix my reboot problem.\u003c/p\u003e\n\u003ch2 id=\"home-manager\"\u003eHome-manager\u003c/h2\u003e\n\u003cp\u003eI am only including this section out of completeness \u0026ndash; I didn\u0026rsquo;t have to change anything about my home-manager configuration to get it working. Everything in my home-manager configuration, including my shell configuration and my applications all just worked when I did my rebuild. I suspect in the future I might want to split up my home-manager config, though, since the things I\u0026rsquo;ll want in a desktop environment and a server environment are definitely different.\u003c/p\u003e\n\u003ch2 id=\"outstanding-issues\"\u003eOutstanding Issues\u003c/h2\u003e\n\u003cp\u003eThe only real outstanding issue I have at the end of day 1 with my laptop is that \u003ccode\u003eshutdown\u003c/code\u003e and \u003ccode\u003ereboot\u003c/code\u003e aren\u0026rsquo;t actually turning the computer off. Based on the shutdown logs, I believe the operating system is exiting cleanly and then the hardware is just not turning off.\u003c/p\u003e\n\u003ch2 id=\"next-steps\"\u003eNext Steps\u003c/h2\u003e\n\u003cul\u003e\n\u003cli\u003eI\u0026rsquo;d love to get the power issues resolved for shutdown and reboot as a priority, but I\u0026rsquo;m not sure what else to try. There\u0026rsquo;s a closed issue with activity as recent as a few days ago suggesting this might be a \u003ca href=\"https://github.com/NixOS/nixpkgs/issues/249388\"\u003eregression in a recent kernel version\u003c/a\u003e.\u003c/li\u003e\n\u003cli\u003eI need to bring my hyprland config into home-manager and get it customized. I hate when the mouse cursor position changes the focused window, and I also hate the large yellow warning bar about using an autogenerated config across the top of my screen.\u003c/li\u003e\n\u003cli\u003eI want to run \u003ca href=\"https://github.com/nix-community/impermanence\"\u003eimpermanence\u003c/a\u003e on my laptop in an effort to keep my system clean by default and keep my configuration completely reproducible. I\u0026rsquo;ve read that this is not the sort of thing that is easy to implement later on, so I want to get it figured out sooner rather than later before I start to actually have data on the system.\u003c/li\u003e\n\u003cli\u003eI\u0026rsquo;d also like to get \u003ca href=\"https://github.com/nix-community/lanzaboote\"\u003eLanzaboote\u003c/a\u003e up and running on the system, I don\u0026rsquo;t love having to disable secure boot. I\u0026rsquo;ll probably experiment with this on my virtual machine first.\u003c/li\u003e\n\u003cli\u003eI ordered the RGB macropad but haven\u0026rsquo;t installed it yet. I also might order the LED panels, and then I can try setting those up following \u003ca href=\"https://community.frame.work/t/nixos-on-the-framework-laptop-16/46743/118\"\u003eCaffineeTim\u0026rsquo;s module\u003c/a\u003e.\u003c/li\u003e\n\u003cli\u003eI need to also get my password manager setup before I can fully move in. Thankfully it looks like \u003ca href=\"https://search.nixos.org/packages?channel=24.05\u0026amp;show=_1password-gui\u0026amp;from=0\u0026amp;size=50\u0026amp;sort=relevance\u0026amp;type=packages\u0026amp;query=1password\"\u003ethere\u0026rsquo;s a module for that\u003c/a\u003e.\u003c/li\u003e\n\u003cli\u003eFigure out how to take screenshots so I can include a fancier neofetch output than the one I\u0026rsquo;m going to include at the top of this post.\u003c/li\u003e\n\u003cli\u003eGet my obsidian vault moved in. Would you look at that, \u003ca href=\"https://search.nixos.org/packages?channel=24.05\u0026amp;show=obsidian\u0026amp;from=0\u0026amp;size=50\u0026amp;sort=relevance\u0026amp;type=packages\u0026amp;query=obsidian\"\u003ethere\u0026rsquo;s a module for that.\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eSide Note: \u003ca href=\"https://discourse.nixos.org/t/exciting-partnership-announcement-framework-community-nixos-communities-join-forces/44640\"\u003eNixOS Communities and Framework Community have partnered together\u003c/a\u003e, which is exciting and means it\u0026rsquo;s likely only going to get easier to run NixOS on Framework devices.\u003c/p\u003e"
        }
        ]
}
