diff --git a/flake.nix b/flake.nix index 2eb85cd..0647225 100644 --- a/flake.nix +++ b/flake.nix @@ -9,57 +9,69 @@ }; }; - outputs = inputs @ { - self, - nixpkgs, - nixpkgs-unstable, - home-manager, - ... - }: let - inherit (self) outputs; - lib = nixpkgs.lib // home-manager.lib; - mkHost = { - hostname, - user ? "sammy", - }: { - imports = [ - ./hosts/${hostname}/configuration.nix - ./modules/nixos/common.nix - (import "${home-manager}/nixos") + outputs = + inputs @ { self + , nixpkgs + , nixpkgs-unstable + , home-manager + , ... + }: + let + inherit (self) outputs; + systems = [ + "aarch64-linux" + "i686-linux" + "x86_64-linux" + "aarch64-darwin" + "x86_64-darwin" ]; + forEachSystem = f: lib.genAttrs systems (system: f); + forAllSystems = lib.genAttrs systems; + lib = nixpkgs.lib // home-manager.lib; + mkHost = + { hostname + , user ? "sammy" + , + }: { + imports = [ + ./hosts/${hostname}/configuration.nix + ./modules/nixos/common.nix + (import "${home-manager}/nixos") + ]; - deployment = { - targetUser = user; - allowLocalDeployment = true; - }; - }; - in { - inherit lib; - formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra; - colmena = { - meta = { - description = "All my NixoS machines"; - specialArgs = {inherit inputs outputs;}; - nixpkgs = import nixpkgs { - system = "x86_64-linux"; - overlays = []; + deployment = { + targetUser = user; + allowLocalDeployment = true; + }; + }; + in + { + inherit lib; + formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixpkgs-fmt); + colmena = { + meta = { + description = "All my NixoS machines"; + specialArgs = { inherit inputs outputs; }; + nixpkgs = import nixpkgs { + system = "x86_64-linux"; + overlays = [ ]; + }; }; - }; - bengal = mkHost {hostname = "bengal";}; + bengal = mkHost { hostname = "bengal"; }; - maine-coon = mkHost {hostname = "maine-coon";}; - }; - nixosConfigurations.test = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = { - flake = self; + maine-coon = mkHost { hostname = "maine-coon"; }; + }; + nixosConfigurations.test = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + flake = self; + }; + modules = [ + ./modules + ./hosts/test-vm/configuration.nix + (import "${home-manager}/nixos") + ]; }; - modules = [ - ./modules - ./hosts/test-vm/configuration.nix - (import "${home-manager}/nixos") - ]; }; - }; } diff --git a/hosts/bengal/configuration.nix b/hosts/bengal/configuration.nix index b52b20a..e894862 100644 --- a/hosts/bengal/configuration.nix +++ b/hosts/bengal/configuration.nix @@ -1,11 +1,10 @@ # Edit this configuration file to define what should be installed on # your system. Help is available in the configuration.nix(5) man page, on # https://search.nixos.org/options and in the NixOS manual (`nixos-help`). -{ - config, - lib, - pkgs, - ... +{ config +, lib +, pkgs +, ... }: { imports = [ # Include the results of the hardware scan. diff --git a/hosts/bengal/hardware-configuration.nix b/hosts/bengal/hardware-configuration.nix index bf34bd3..19c2716 100644 --- a/hosts/bengal/hardware-configuration.nix +++ b/hosts/bengal/hardware-configuration.nix @@ -1,21 +1,20 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ - config, - lib, - pkgs, - modulesPath, - ... +{ config +, lib +, pkgs +, modulesPath +, ... }: { imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod"]; - boot.initrd.kernelModules = []; - boot.kernelModules = ["kvm-amd"]; - boot.extraModulePackages = []; + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; fileSystems."/" = { device = "/dev/disk/by-uuid/7a713df7-7027-4ae6-b1a3-839dda62dcbc"; @@ -29,7 +28,7 @@ fsType = "vfat"; }; - swapDevices = [{device = "/dev/disk/by-uuid/8cca600e-735e-4486-92e3-01ff6c0b7599";}]; + swapDevices = [{ device = "/dev/disk/by-uuid/8cca600e-735e-4486-92e3-01ff6c0b7599"; }]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/hosts/maine-coon/configuration.nix b/hosts/maine-coon/configuration.nix index 8c54f39..d3af4b5 100644 --- a/hosts/maine-coon/configuration.nix +++ b/hosts/maine-coon/configuration.nix @@ -1,8 +1,7 @@ -{ - config, - pkgs, - lib, - ... +{ config +, pkgs +, lib +, ... }: { imports = [ # Include the results of the hardware scan. @@ -31,7 +30,7 @@ address = "fe80::1"; interface = "enp0s31f6"; }; - networking.nameservers = ["8.8.8.8"]; + networking.nameservers = [ "8.8.8.8" ]; # Initial empty root password for easy login: services.openssh.permitRootLogin = lib.mkForce "prohibit-password"; diff --git a/hosts/maine-coon/hardware-configuration.nix b/hosts/maine-coon/hardware-configuration.nix index fd899c3..40d34c4 100644 --- a/hosts/maine-coon/hardware-configuration.nix +++ b/hosts/maine-coon/hardware-configuration.nix @@ -1,16 +1,15 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ - config, - lib, - pkgs, - ... +{ config +, lib +, pkgs +, ... }: { - boot.initrd.availableKernelModules = ["ahci" "nvme"]; - boot.initrd.kernelModules = []; - boot.kernelModules = ["kvm-intel"]; - boot.extraModulePackages = []; + boot.initrd.availableKernelModules = [ "ahci" "nvme" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; fileSystems."/" = { device = "/dev/nvme0n1p2"; @@ -22,5 +21,5 @@ fsType = "ext2"; }; - swapDevices = []; + swapDevices = [ ]; } diff --git a/hosts/test-vm/configuration.nix b/hosts/test-vm/configuration.nix index daaf81c..afda8fc 100644 --- a/hosts/test-vm/configuration.nix +++ b/hosts/test-vm/configuration.nix @@ -1,17 +1,16 @@ -{ - config, - lib, - pkgs, - ... +{ config +, lib +, pkgs +, ... }: { users.users.admin = { isNormalUser = true; - extraGroups = ["wheel"]; + extraGroups = [ "wheel" ]; password = "admin"; group = "admin"; }; - users.groups.admin = {}; + users.groups.admin = { }; virtualisation.vmVariant = { # following configuration is added only when building VM with build-vm @@ -27,7 +26,7 @@ settings.PasswordAuthentication = lib.mkForce true; }; - networking.firewall.allowedTCPPorts = [22]; + networking.firewall.allowedTCPPorts = [ 22 ]; environment.systemPackages = with pkgs; [ htop ]; diff --git a/misc/module-template.nix b/misc/module-template.nix index ef28f49..855efa5 100644 --- a/misc/module-template.nix +++ b/misc/module-template.nix @@ -1,12 +1,13 @@ -{ - pkgs, - config, - lib, - ... -}: let +{ pkgs +, config +, lib +, ... +}: +let cfg = config.cherrykitten; -in { - options.cherrykitten = {}; +in +{ + options.cherrykitten = { }; - config = {}; + config = { }; } diff --git a/modules/home/default.nix b/modules/home/default.nix index dab1483..4581249 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -1,10 +1,9 @@ -{ - pkgs, - config, - lib, - ... +{ pkgs +, config +, lib +, ... }: { - imports = [./fish ./nvim]; + imports = [ ./fish ./nvim ]; home.packages = with pkgs; [ bat lsd @@ -19,8 +18,8 @@ git = { enable = true; extraConfig = { - init = {defaultBranch = "main";}; - core = {editor = "nvim";}; + init = { defaultBranch = "main"; }; + core = { editor = "nvim"; }; pull.rebase = true; }; }; diff --git a/modules/home/fish/default.nix b/modules/home/fish/default.nix index e99233b..f176e6f 100644 --- a/modules/home/fish/default.nix +++ b/modules/home/fish/default.nix @@ -1,8 +1,7 @@ -{ - pkgs, - config, - lib, - ... +{ pkgs +, config +, lib +, ... }: { programs.fish = { enable = true; diff --git a/modules/home/nvim/default.nix b/modules/home/nvim/default.nix index d21b22c..0ba0a5b 100644 --- a/modules/home/nvim/default.nix +++ b/modules/home/nvim/default.nix @@ -1,101 +1,102 @@ -{ - config, - pkgs, - inputs, - ... +{ config +, pkgs +, inputs +, ... }: { - programs.neovim = let - toLua = str: "lua << EOF\n${str}\nEOF\n"; - toLuaFile = file: "lua << EOF\n${builtins.readFile file}\nEOF\n"; - in { - enable = true; + programs.neovim = + let + toLua = str: "lua << EOF\n${str}\nEOF\n"; + toLuaFile = file: "lua << EOF\n${builtins.readFile file}\nEOF\n"; + in + { + enable = true; - viAlias = true; - vimAlias = true; - vimdiffAlias = true; + viAlias = true; + vimAlias = true; + vimdiffAlias = true; - extraPackages = with pkgs; [ - lua-language-server - rnix-lsp + extraPackages = with pkgs; [ + lua-language-server + rnix-lsp - xclip - wl-clipboard + xclip + wl-clipboard - rustfmt - black - isort - alejandra - prettierd - codespell - stylua - ]; + rustfmt + black + isort + alejandra + prettierd + codespell + stylua + ]; - plugins = with pkgs.vimPlugins; [ - plenary-nvim - persistence-nvim - nvim-web-devicons - nui-nvim + plugins = with pkgs.vimPlugins; [ + plenary-nvim + persistence-nvim + nvim-web-devicons + nui-nvim - { - plugin = comment-nvim; - config = toLua "require(\"Comment\").setup()"; - } + { + plugin = comment-nvim; + config = toLua "require(\"Comment\").setup()"; + } - { - plugin = catppuccin-nvim; - config = "colorscheme catppuccin-mocha"; - } + { + plugin = catppuccin-nvim; + config = "colorscheme catppuccin-mocha"; + } - { - plugin = which-key-nvim; - config = toLua "require(\"which-key\").setup()"; - } + { + plugin = which-key-nvim; + config = toLua "require(\"which-key\").setup()"; + } - { - plugin = neo-tree-nvim; - config = toLuaFile ./plugins/neo-tree.lua; - } + { + plugin = neo-tree-nvim; + config = toLuaFile ./plugins/neo-tree.lua; + } - { - plugin = conform-nvim; - config = toLuaFile ./plugins/conform.lua; - } + { + plugin = conform-nvim; + config = toLuaFile ./plugins/conform.lua; + } - { - plugin = dressing-nvim; - config = toLua "require(\"dressing\").setup()"; - } + { + plugin = dressing-nvim; + config = toLua "require(\"dressing\").setup()"; + } - { - plugin = bufferline-nvim; - config = toLua "require(\"bufferline\").setup()"; - } + { + plugin = bufferline-nvim; + config = toLua "require(\"bufferline\").setup()"; + } - { - plugin = lualine-nvim; - config = toLua "require(\"lualine\").setup()"; - } + { + plugin = lualine-nvim; + config = toLua "require(\"lualine\").setup()"; + } - { - plugin = indent-blankline-nvim; - config = toLua "require(\"ibl\").setup()"; - } - { - plugin = noice-nvim; - config = toLuaFile ./plugins/noice.lua; - } - { - plugin = dashboard-nvim; - config = toLuaFile ./plugins/dashboard.lua; - } + { + plugin = indent-blankline-nvim; + config = toLua "require(\"ibl\").setup()"; + } + { + plugin = noice-nvim; + config = toLuaFile ./plugins/noice.lua; + } + { + plugin = dashboard-nvim; + config = toLuaFile ./plugins/dashboard.lua; + } - nvim-notify - vim-nix - ]; + nvim-notify + vim-nix + ]; - extraLuaConfig = '' - ${builtins.readFile ./options.lua} - ${builtins.readFile ./keymap.lua} - ''; - }; + extraLuaConfig = '' + ${builtins.readFile ./options.lua} + ${builtins.readFile ./keymap.lua} + ''; + }; } diff --git a/modules/nixos/common.nix b/modules/nixos/common.nix index 63dfe07..ae7513f 100644 --- a/modules/nixos/common.nix +++ b/modules/nixos/common.nix @@ -1,11 +1,12 @@ -{ - lib, - config, - pkgs, - ... -}: let +{ lib +, config +, pkgs +, ... +}: +let cfg = config.cherrykitten.common; -in { +in +{ options.cherrykitten.common = { test = lib.mkOption { type = lib.types.str; @@ -21,7 +22,7 @@ in { ]; config = { - nix.settings.experimental-features = ["nix-command" "flakes"]; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; @@ -45,10 +46,10 @@ in { nerdfonts ]; fontconfig = { - defaultFonts.emoji = ["Noto Emoji"]; - defaultFonts.serif = ["Monaspace Xenon" "FiraCode Nerd Font" "Hack Nerd Font" "NotoSans Nerd Font"]; - defaultFonts.sansSerif = ["Monaspace Xenon" "FiraCode Nerd Font" "Hack Nerd Font" "NotoSerif Nerd Font"]; - defaultFonts.monospace = ["Monaspace Xenon" "FiraCode Nerd Font" "Hack Nerd Font"]; + defaultFonts.emoji = [ "Noto Emoji" ]; + defaultFonts.serif = [ "Monaspace Xenon" "FiraCode Nerd Font" "Hack Nerd Font" "NotoSans Nerd Font" ]; + defaultFonts.sansSerif = [ "Monaspace Xenon" "FiraCode Nerd Font" "Hack Nerd Font" "NotoSerif Nerd Font" ]; + defaultFonts.monospace = [ "Monaspace Xenon" "FiraCode Nerd Font" "Hack Nerd Font" ]; }; }; diff --git a/modules/nixos/graphical.nix b/modules/nixos/graphical.nix index 9a63ffc..fba13a1 100644 --- a/modules/nixos/graphical.nix +++ b/modules/nixos/graphical.nix @@ -1,11 +1,12 @@ -{ - pkgs, - config, - lib, - ... -}: let +{ pkgs +, config +, lib +, ... +}: +let cfg = config.cherrykitten.graphical; -in { +in +{ options.cherrykitten.graphical = { enable = lib.mkEnableOption (lib.mdDoc "graphical stuffs"); }; diff --git a/modules/nixos/security.nix b/modules/nixos/security.nix index 381de29..19f19e0 100644 --- a/modules/nixos/security.nix +++ b/modules/nixos/security.nix @@ -1,5 +1,5 @@ -{pkgs, ...}: { - networking.firewall.allowedTCPPorts = [22]; +{ pkgs, ... }: { + networking.firewall.allowedTCPPorts = [ 22 ]; services.openssh = { enable = true; diff --git a/modules/nixos/yubikey.nix b/modules/nixos/yubikey.nix index 8edc4f9..cf90c61 100644 --- a/modules/nixos/yubikey.nix +++ b/modules/nixos/yubikey.nix @@ -1,5 +1,5 @@ -{pkgs, ...}: { - services.udev.packages = with pkgs; [libu2f-host yubikey-personalization]; +{ pkgs, ... }: { + services.udev.packages = with pkgs; [ libu2f-host yubikey-personalization ]; programs.gnupg.agent = { enable = true; diff --git a/modules/users/default.nix b/modules/users/default.nix index 04aa4bc..e486207 100644 --- a/modules/users/default.nix +++ b/modules/users/default.nix @@ -1,22 +1,23 @@ -{ - pkgs, - config, - lib, - ... -}: let +{ pkgs +, config +, lib +, ... +}: +let cfg = config.cherrykitten.users; -in { +in +{ options.cherrykitten.users = { - sammy.enable = lib.mkEnableOption "sammy" // {default = true;}; + sammy.enable = lib.mkEnableOption "sammy" // { default = true; }; }; config = { users.users.sammy = lib.mkIf cfg.sammy.enable { isNormalUser = true; - extraGroups = ["networkmanager" "wheel" "docker"]; + extraGroups = [ "networkmanager" "wheel" "docker" ]; shell = pkgs.fish; ignoreShellProgramCheck = true; - openssh.authorizedKeys.keys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJZyQSZw+pExsx2RXB+yxbaJGB9mtvudbQ/BP7E1yKvr openpgp:0x6068FEBB"]; + openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJZyQSZw+pExsx2RXB+yxbaJGB9mtvudbQ/BP7E1yKvr openpgp:0x6068FEBB" ]; }; home-manager.users.sammy = lib.mkIf cfg.sammy.enable (import ./sammy.nix); diff --git a/modules/users/sammy.nix b/modules/users/sammy.nix index 97f5844..391ded7 100644 --- a/modules/users/sammy.nix +++ b/modules/users/sammy.nix @@ -1,5 +1,5 @@ -{...}: { - imports = [../home]; +{ ... }: { + imports = [ ../home ]; programs.git = { userName = "CherryKitten";