diff --git a/flake.lock b/flake.lock index 310bf3e..a024de3 100644 --- a/flake.lock +++ b/flake.lock @@ -1,35 +1,5 @@ { "nodes": { - "all-systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "darwin-systems": { - "locked": { - "lastModified": 1689347925, - "narHash": "sha256-ozenz5bFe1UUqOn7f60HRmgc01BgTGIKZ4Xl+HbocGQ=", - "owner": "nix-systems", - "repo": "default-darwin", - "rev": "2235d7e6cc29ae99878133c95e9fe5e157661ffb", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default-darwin", - "type": "github" - } - }, "home-manager": { "inputs": { "nixpkgs": [ @@ -37,11 +7,11 @@ ] }, "locked": { - "lastModified": 1712759992, - "narHash": "sha256-2APpO3ZW4idlgtlb8hB04u/rmIcKA8O7pYqxF66xbNY=", + "lastModified": 1712212014, + "narHash": "sha256-s+lbaf3nLRn1++/X2eXwY9mYCA/m9l8AvyG8beeOaXE=", "owner": "nix-community", "repo": "home-manager", - "rev": "31357486b0ef6f4e161e002b6893eeb4fafc3ca9", + "rev": "7e91f2a0ba4b62b88591279d54f741a13e36245b", "type": "github" }, "original": { @@ -50,28 +20,13 @@ "type": "github" } }, - "linux-systems": { - "locked": { - "lastModified": 1689347949, - "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", - "owner": "nix-systems", - "repo": "default-linux", - "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default-linux", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1712608508, - "narHash": "sha256-vMZ5603yU0wxgyQeHJryOI+O61yrX2AHwY6LOFyV1gM=", + "lastModified": 1712163089, + "narHash": "sha256-Um+8kTIrC19vD4/lUCN9/cU9kcOsD1O1m+axJqQPyMM=", "owner": "nixos", "repo": "nixpkgs", - "rev": "4cba8b53da471aea2ab2b0c1f30a81e7c451f4b6", + "rev": "fd281bd6b7d3e32ddfa399853946f782553163b5", "type": "github" }, "original": { @@ -83,10 +38,7 @@ }, "root": { "inputs": { - "all-systems": "all-systems", - "darwin-systems": "darwin-systems", "home-manager": "home-manager", - "linux-systems": "linux-systems", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index 90b1273..4ebf332 100644 --- a/flake.nix +++ b/flake.nix @@ -4,26 +4,14 @@ inputs = { # Specify the source of Home Manager and Nixpkgs. nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - # Allows for easy enumeration of available Darwin and Linux systems. - all-systems.url = "github:nix-systems/default"; - darwin-systems.url = "github:nix-systems/default-darwin"; - linux-systems.url = "github:nix-systems/default-linux"; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; }; - outputs = { nixpkgs, home-manager, linux-systems, darwin-systems, all-systems, ... }: + outputs = { nixpkgs, home-manager, ... }: let - # TODO(spotlightishere): Is there a better way to approach this that doesn't - # involve importing so many separate flakes? - # - # (We could manually merge Darwin and Linux themselves, but this is primarily for readability.) - allSystems = nixpkgs.lib.genAttrs (import all-systems); - darwinSystems = nixpkgs.lib.genAttrs (import darwin-systems); - linuxSystems = nixpkgs.lib.genAttrs (import linux-systems); - homeManager = { system, specialArgs ? { } }: home-manager.lib.homeManagerConfiguration { modules = [ @@ -34,72 +22,64 @@ }; in { - # There's a few things going on here that are all merged in the end. - # We start with system-specific packages, providing home-manager. - packages = - ########################## - # Linux-specific options # - ########################## - linuxSystems - (system: { - homeConfigurations = { - # First, we currently assume that Linux devices - # only require dotfiles and utilize the username `spotlight`. - # - # For now, this is effectively true, sans a few specific configurations :) - spotlight = homeManager { - system = system; - specialArgs = { - desktop = false; - gpg = false; - }; - }; + packages = { + # We currently assume that all x86_64-linux devices only + # require dotfiles. For now, this is mostly true :) + x86_64-linux.homeConfigurations.spotlight = homeManager { + system = "x86_64-linux"; + }; - # For a special case: with the Steam Deck, we have to assume the user - # is named `deck` due to its immutable system image. - deck = homeManager { - system = system; - specialArgs = { - gpg = true; - username = "deck"; - }; - }; - }; - }) + # Similarly (as of writing), all aarch64 Linux devices are headless + # and primarily managed by other distro package managers. + # This should likely be dealt with in the future! + aarch64-linux.homeConfigurations.spotlight = homeManager { + system = "aarch64-linux"; + }; - // - - ########################### - # Darwin-specific options # - ########################### - darwinSystems (system: { - # We use the username `spot` under Darwin. - # We also assume that desktop applications should be made available, alongside GPG. - homeConfigurations.spot = homeManager { - system = system; - specialArgs = { - desktop = true; - gpg = true; - }; + # For all architecture variants of Darwin, we don't want only dotfiles. + aarch64-darwin.homeConfigurations.spot = homeManager { + system = "aarch64-darwin"; + specialArgs = { + desktop = true; + gpg = true; }; - }); + }; + x86_64-darwin.homeConfigurations.spot = homeManager { + system = "x86_64-darwin"; + specialArgs = { + desktop = true; + gpg = true; + }; + }; + + # For a special case: with the Steam Deck, we have to assume the user + # is named `deck` due to its immutable system image. + x86_64-linux.homeConfigurations.deck = homeManager { + system = "x86_64-linux"; + specialArgs = { + gpg = true; + username = "deck"; + }; + }; + }; - # We provide a NixOS module for easy usage within other system flakes. - # (Again, we assume a default name of `spotlight` under Linux.) nixosModules.default = { imports = [ - home-manager.nixosModules.home-manager { - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - users.spotlight = import ./home/home.nix; - extraSpecialArgs = { desktop = false; gpg = false; }; - }; + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.spotlight = import ./home/home.nix; + home-manager.extraSpecialArgs = { desktop = false; gpg = false; }; } ]; }; - # Lastly, ensure a formatter is available for all systems. - formatter = allSystems (system: nixpkgs.legacyPackages.${system}.nixpkgs-fmt); + formatter = { + aarch64-darwin = nixpkgs.legacyPackages.aarch64-darwin.nixpkgs-fmt; + x86_64-darwin = nixpkgs.legacyPackages.x86_64-darwin.nixpkgs-fmt; + aarch64-linux = nixpkgs.legacyPackages.aarch64-linux.nixpkgs-fmt; + x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt; + }; }; } diff --git a/home/desktop.nix b/home/desktop.nix index 87c03bc..9c2d3fd 100644 --- a/home/desktop.nix +++ b/home/desktop.nix @@ -41,7 +41,6 @@ pwgen qemu radare2 - ripgrep rustup socat swiftformat