diff --git a/flake.lock b/flake.lock index d1c52ca..db566d7 100644 --- a/flake.lock +++ b/flake.lock @@ -66,11 +66,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1712014858, - "narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=", + "lastModified": 1714641030, + "narHash": "sha256-yzcRNDoyVP7+SCNX0wmuDju1NUCt8Dz9+lyUXEI0dbI=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "9126214d0a59633752a136528f5f3b9aa8565b7d", + "rev": "e5d10a24b66c3ea8f150e47dfdb0416ab7c3390e", "type": "github" }, "original": { @@ -119,11 +119,11 @@ ] }, "locked": { - "lastModified": 1712386041, - "narHash": "sha256-dA82pOMQNnCJMAsPG7AXG35VmCSMZsJHTFlTHizpKWQ=", + "lastModified": 1714043624, + "narHash": "sha256-Xn2r0Jv95TswvPlvamCC46wwNo8ALjRCMBJbGykdhcM=", "owner": "nix-community", "repo": "home-manager", - "rev": "d6bb9f934f2870e5cbc5b94c79e9db22246141ff", + "rev": "86853e31dc1b62c6eeed11c667e8cdd0285d4411", "type": "github" }, "original": { @@ -135,11 +135,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1713344939, - "narHash": "sha256-jpHkAt0sG2/J7ueKnG7VvLLkBYUMQbXQ2L8OBpVG53s=", + "lastModified": 1714531828, + "narHash": "sha256-ILsf3bdY/hNNI/Hu5bSt2/KbmHaAVhBbNUOdGztTHEg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e402c3eb6d88384ca6c52ef1c53e61bdc9b84ddd", + "rev": "0638fe2715d998fa81d173aad264eb671ce2ebc1", "type": "github" }, "original": { @@ -150,29 +150,23 @@ }, "nixpkgs-lib": { "locked": { - "dir": "lib", - "lastModified": 1711703276, - "narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "d8fe5e6c92d0d190646fb9f1056741a229980089", - "type": "github" + "lastModified": 1714640452, + "narHash": "sha256-QBx10+k6JWz6u7VsohfSw8g8hjdBZEf8CFzXH1/1Z94=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz" }, "original": { - "dir": "lib", - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz" } }, "nixpkgs-unstable": { "locked": { - "lastModified": 1713562564, - "narHash": "sha256-NQpYhgoy0M89g9whRixSwsHb8RFIbwlxeYiVSDwSXJg=", + "lastModified": 1714656196, + "narHash": "sha256-kjQkA98lMcsom6Gbhw8SYzmwrSo+2nruiTcTZp5jK7o=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "92d295f588631b0db2da509f381b4fb1e74173c5", + "rev": "94035b482d181af0a0f8f77823a790b256b7c3cc", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index a0f6015..cb0b251 100644 --- a/flake.nix +++ b/flake.nix @@ -56,6 +56,25 @@ flake = { + + nixosModules = builtins.listToAttrs ( + map + (x: { + name = x; + value = import (./modules/nixos + "/${x}"); + }) + (builtins.attrNames (builtins.readDir ./modules/nixos)) + ); + + homeManagerModules = builtins.listToAttrs ( + map + (name: { + inherit name; + value = import (./modules/home + "/${name}"); + }) + (builtins.attrNames (builtins.readDir ./modules/home)) + ); + packages.x86_64-linux.iso = self.nixosConfigurations.iso.config.system.build.isoImage; homeConfigurations = @@ -67,6 +86,7 @@ modules = [ ./users/${name}/home.nix ]; extraSpecialArgs = { inherit inputs; + flake = self; pkgs-unstable = import nixpkgs-unstable { system = "x86_64-linux"; }; }; }); diff --git a/hive.nix b/hive.nix index b5b468a..c28356c 100644 --- a/hive.nix +++ b/hive.nix @@ -16,13 +16,19 @@ in description = "All my NixoS machines"; specialArgs = { inherit inputs outputs pkgs-unstable; + flake = self; nodes = colmenaHive.nodes; }; nixpkgs = pkgs; }; defaults = { lib, config, name, nodes, ... }: { - imports = [ ./hosts/${name} ./profiles/base (import ./overlays) ]; + imports = [ + ./hosts/${name} + ./profiles/base + (import ./overlays) + inputs.home-manager.nixosModules.home-manager + ] ++ builtins.attrValues self.nixosModules; options.cherrykitten = { primaryIPv4 = lib.mkOption { @@ -45,8 +51,13 @@ in networking.hostName = name; networking.domain = "cherrykitten.xyz"; + deployment = { + targetUser = lib.mkDefault "sammy"; + tags = [ pkgs.stdenv.hostPlatform.system ]; + }; home-manager.extraSpecialArgs = { inherit inputs outputs pkgs-unstable; + flake = self; }; }; }; diff --git a/modules/home/default.nix b/modules/home/default.nix deleted file mode 100644 index a477f95..0000000 --- a/modules/home/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ ... }: { - imports = [ - ./fish - ./nvim - ./tmux.nix - ./starship.nix - ./git.nix - ./foot.nix - ./ssh.nix - ]; -} diff --git a/modules/home/fish/default.nix b/modules/home/fish/default.nix index 122eb66..f5367f8 100644 --- a/modules/home/fish/default.nix +++ b/modules/home/fish/default.nix @@ -1,19 +1,23 @@ -{ ... }: { - programs.fish = { - enable = true; +{ lib, ... }: { + options.cherrykitten.fish = { + enable = lib.mkEnableOption "Fish Shell"; + } // { default = true; }; + config = { + programs.fish = { + enable = true; - interactiveShellInit = '' - set -g fish_greeting - set -g fish_key_bindings fish_vi_key_bindings + interactiveShellInit = '' + set -g fish_greeting + set -g fish_key_bindings fish_vi_key_bindings - set -x GPG_TTY (tty) - gpgconf --launch gpg-agent - gpg-connect-agent updatestartuptty /bye > /dev/null - ''; + set -x GPG_TTY (tty) + gpgconf --launch gpg-agent + gpg-connect-agent updatestartuptty /bye > /dev/null + ''; - shellAliases = { - g = "git"; + shellAliases = { + g = "git"; + }; }; - }; } diff --git a/modules/home/foot.nix b/modules/home/foot.nix deleted file mode 100644 index 1a3f2a4..0000000 --- a/modules/home/foot.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ ... }: -{ - programs.foot = { - enable = true; - settings = { - main = { - font = "monospace:size=8"; - dpi-aware = "yes"; - initial-window-size-pixels = "1920x1080"; - }; - - bell.visual = "yes"; - - # colors taken from https://codeberg.org/dnkl/foot/src/branch/master/themes/catppuccin - cursor.color = "1A1826 D9E0EE"; - colors = { - foreground = "D9E0EE"; - background = "1E1D2F"; - regular0 = "6E6C7E"; - regular1 = "F28FAD"; - regular2 = "ABE9B3"; - regular3 = "FAE3B0"; - regular4 = "96CDFB"; - regular5 = "F5C2E7"; - regular6 = "89DCEB"; - regular7 = "D9E0EE"; - bright0 = "988BA2"; - bright1 = "F28FAD"; - bright2 = "ABE9B3"; - bright3 = "FAE3B0"; - bright4 = "96CDFB"; - bright5 = "F5C2E7"; - bright6 = "89DCEB"; - bright7 = "D9E0EE"; - }; - }; - }; -} diff --git a/modules/home/foot/default.nix b/modules/home/foot/default.nix new file mode 100644 index 0000000..3e04758 --- /dev/null +++ b/modules/home/foot/default.nix @@ -0,0 +1,43 @@ +{ lib, ... }: +{ + options.cherrykitten.foot = { + enable = lib.mkEnableOption "Foot Terminal Emulator"; + } // { default = true; }; + config = { + programs.foot = { + enable = true; + settings = { + main = { + font = "monospace:size=8"; + dpi-aware = "yes"; + initial-window-size-pixels = "1920x1080"; + }; + + bell.visual = "yes"; + + # colors taken from https://codeberg.org/dnkl/foot/src/branch/master/themes/catppuccin + cursor.color = "1A1826 D9E0EE"; + colors = { + foreground = "D9E0EE"; + background = "1E1D2F"; + regular0 = "6E6C7E"; + regular1 = "F28FAD"; + regular2 = "ABE9B3"; + regular3 = "FAE3B0"; + regular4 = "96CDFB"; + regular5 = "F5C2E7"; + regular6 = "89DCEB"; + regular7 = "D9E0EE"; + bright0 = "988BA2"; + bright1 = "F28FAD"; + bright2 = "ABE9B3"; + bright3 = "FAE3B0"; + bright4 = "96CDFB"; + bright5 = "F5C2E7"; + bright6 = "89DCEB"; + bright7 = "D9E0EE"; + }; + }; + }; + }; +} diff --git a/modules/home/git.nix b/modules/home/git/default.nix similarity index 100% rename from modules/home/git.nix rename to modules/home/git/default.nix diff --git a/modules/home/ssh.nix b/modules/home/ssh/default.nix similarity index 100% rename from modules/home/ssh.nix rename to modules/home/ssh/default.nix diff --git a/modules/home/starship.nix b/modules/home/starship/default.nix similarity index 100% rename from modules/home/starship.nix rename to modules/home/starship/default.nix diff --git a/modules/home/tmux.nix b/modules/home/tmux/default.nix similarity index 100% rename from modules/home/tmux.nix rename to modules/home/tmux/default.nix diff --git a/modules/nixos/.gitkeep b/modules/nixos/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/modules/nixos/backups/default.nix b/modules/nixos/backups/default.nix index aaecfb3..1d0da4a 100644 --- a/modules/nixos/backups/default.nix +++ b/modules/nixos/backups/default.nix @@ -42,9 +42,9 @@ in ".cache" ".git" ]; - environmentFile = "/root/keys/restic_env"; - repositoryFile = "/root/keys/restic_repository_file"; - passwordFile = "/root/keys/restic_password_file"; + environmentFile = config.deployment.keys."restic_env".path; + repositoryFile = config.deployment.keys."restic_repository_file".path; + passwordFile = config.deployment.keys."restic_password_file".path; }; }; }; diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix deleted file mode 100644 index 62a39a1..0000000 --- a/modules/nixos/default.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ ... }: { - imports = [ ./backups ]; -} diff --git a/overlays/default.nix b/overlays/default.nix index 2d10ba1..ca6a325 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,30 +1,7 @@ -{ config, pkgs, lib, ... }: +{ ... }: { nixpkgs.overlays = [ - (final: prev: { - gotosocial = - let - web-assets = prev.fetchurl { - url = "https://github.com/superseriousbusiness/gotosocial/releases/download/v0.15.0/gotosocial_0.15.0_web-assets.tar.gz"; - hash = "sha256-vrSdFIdBcfj6+sxtvv1s/Mu85I1mKxjyUYS902oLKk4="; - }; - in - prev.gotosocial.overrideAttrs { - version = "0.15.0"; - doCheck = false; - src = prev.fetchFromGitHub { - owner = "superseriousbusiness"; - repo = "gotosocial"; - rev = "refs/tags/v0.15.0"; - hash = "sha256-z0iETddkw4C2R6ig9ZO8MTvhuWnmQ37/6q3oZ4WAzd4="; - }; - postInstall = '' - tar xf ${web-assets} - mkdir -p $out/share/gotosocial - mv web $out/share/gotosocial/ - ''; - }; - }) + (import ./gotosocial.nix) ]; } diff --git a/overlays/gotosocial.nix b/overlays/gotosocial.nix new file mode 100644 index 0000000..7eecdde --- /dev/null +++ b/overlays/gotosocial.nix @@ -0,0 +1,24 @@ +final: prev: { + gotosocial = + let + web-assets = prev.fetchurl { + url = "https://github.com/superseriousbusiness/gotosocial/releases/download/v0.15.0/gotosocial_0.15.0_web-assets.tar.gz"; + hash = "sha256-vrSdFIdBcfj6+sxtvv1s/Mu85I1mKxjyUYS902oLKk4="; + }; + in + prev.gotosocial.overrideAttrs { + version = "0.15.0"; + doCheck = false; + src = prev.fetchFromGitHub { + owner = "superseriousbusiness"; + repo = "gotosocial"; + rev = "refs/tags/v0.15.0"; + hash = "sha256-z0iETddkw4C2R6ig9ZO8MTvhuWnmQ37/6q3oZ4WAzd4="; + }; + postInstall = '' + tar xf ${web-assets} + mkdir -p $out/share/gotosocial + mv web $out/share/gotosocial/ + ''; + }; +} diff --git a/profiles/base/default.nix b/profiles/base/default.nix index 53e3331..8266fc8 100644 --- a/profiles/base/default.nix +++ b/profiles/base/default.nix @@ -2,12 +2,8 @@ imports = [ ../../users/root ../../users/sammy - ../../modules/nixos - inputs.home-manager.nixosModules.home-manager ]; - deployment.tags = [ pkgs.stdenv.hostPlatform.system ]; - deployment.targetUser = lib.mkDefault "sammy"; nix = { settings = { @@ -82,6 +78,7 @@ enable = lib.mkDefault true; maxretry = 5; }; + services.udev.packages = with pkgs; [ libu2f-host yubikey-personalization ]; programs.gnupg.agent = { diff --git a/profiles/iso/default.nix b/profiles/iso/default.nix index dfc3087..891c3a9 100644 --- a/profiles/iso/default.nix +++ b/profiles/iso/default.nix @@ -44,7 +44,7 @@ home-manager.users.nixos = { imports = [ - ../../modules/home/foot.nix + ../../modules/home/foot ]; home.stateVersion = "23.11"; diff --git a/users/root/default.nix b/users/root/default.nix index caa2164..aaa4441 100644 --- a/users/root/default.nix +++ b/users/root/default.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, ... }: +{ pkgs, lib, config, ... }: { deployment.keys."root_password_hash" = { keyCommand = [ "pass" "users/root/hashedPassword" ]; @@ -6,7 +6,7 @@ users.users.root = { shell = pkgs.fish; - hashedPasswordFile = lib.mkDefault "/run/keys/root_password_hash"; + hashedPasswordFile = lib.mkDefault config.deployment.keys."root_password_hash".path; }; home-manager.users.root = import ./home.nix; diff --git a/users/root/home.nix b/users/root/home.nix index 1239d58..1baede3 100644 --- a/users/root/home.nix +++ b/users/root/home.nix @@ -1,5 +1,5 @@ -{ ... }: { - imports = [ ../../modules/home ]; +{ flake, ... }: { + imports = (builtins.attrValues flake.homeManagerModules); home.stateVersion = "23.11"; # Please read the comment before changing. diff --git a/users/sammy/default.nix b/users/sammy/default.nix index fc49205..a148376 100644 --- a/users/sammy/default.nix +++ b/users/sammy/default.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, ... }: +{ pkgs, lib, config, ... }: { deployment.keys."sammy_password_hash" = { destDir = "/home/sammy/.keys"; @@ -10,7 +10,7 @@ extraGroups = [ "networkmanager" "wheel" "docker" ]; shell = pkgs.fish; openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJZyQSZw+pExsx2RXB+yxbaJGB9mtvudbQ/BP7E1yKvr openpgp:0x6068FEBB" ]; - hashedPasswordFile = lib.mkDefault "/home/sammy/.keys/sammy_password_hash"; + hashedPasswordFile = lib.mkDefault config.deployment.keys."sammy_password_hash".path; }; home-manager.users.sammy = import ./home.nix; diff --git a/users/sammy/home.nix b/users/sammy/home.nix index 25bae39..5aefee6 100644 --- a/users/sammy/home.nix +++ b/users/sammy/home.nix @@ -1,5 +1,5 @@ -{ ... }: { - imports = [ ../../modules/home ]; +{ flake, ... }: { + imports = (builtins.attrValues flake.homeManagerModules); programs.git = { userName = "CherryKitten";