This commit is contained in:
CherryKitten 2024-03-24 19:02:29 +01:00
parent 9233d64ef3
commit 001f641a7f
Signed by: sammy
GPG key ID: 98D8F75FB0658276
16 changed files with 236 additions and 226 deletions

View file

@ -9,18 +9,29 @@
}; };
}; };
outputs = inputs @ { outputs =
self, inputs @ { self
nixpkgs, , nixpkgs
nixpkgs-unstable, , nixpkgs-unstable
home-manager, , home-manager
... , ...
}: let }:
let
inherit (self) outputs; 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; lib = nixpkgs.lib // home-manager.lib;
mkHost = { mkHost =
hostname, { hostname
user ? "sammy", , user ? "sammy"
,
}: { }: {
imports = [ imports = [
./hosts/${hostname}/configuration.nix ./hosts/${hostname}/configuration.nix
@ -33,22 +44,23 @@
allowLocalDeployment = true; allowLocalDeployment = true;
}; };
}; };
in { in
{
inherit lib; inherit lib;
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra; formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixpkgs-fmt);
colmena = { colmena = {
meta = { meta = {
description = "All my NixoS machines"; description = "All my NixoS machines";
specialArgs = {inherit inputs outputs;}; specialArgs = { inherit inputs outputs; };
nixpkgs = import nixpkgs { nixpkgs = import nixpkgs {
system = "x86_64-linux"; system = "x86_64-linux";
overlays = []; overlays = [ ];
}; };
}; };
bengal = mkHost {hostname = "bengal";}; bengal = mkHost { hostname = "bengal"; };
maine-coon = mkHost {hostname = "maine-coon";}; maine-coon = mkHost { hostname = "maine-coon"; };
}; };
nixosConfigurations.test = nixpkgs.lib.nixosSystem { nixosConfigurations.test = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";

View file

@ -1,11 +1,10 @@
# Edit this configuration file to define what should be installed on # Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, 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`). # https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ { config
config, , lib
lib, , pkgs
pkgs, , ...
...
}: { }: {
imports = [ imports = [
# Include the results of the hardware scan. # Include the results of the hardware scan.

View file

@ -1,21 +1,20 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ { config
config, , lib
lib, , pkgs
pkgs, , modulesPath
modulesPath, , ...
...
}: { }: {
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod"]; boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = []; boot.initrd.kernelModules = [ ];
boot.kernelModules = ["kvm-amd"]; boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = []; boot.extraModulePackages = [ ];
fileSystems."/" = { fileSystems."/" = {
device = "/dev/disk/by-uuid/7a713df7-7027-4ae6-b1a3-839dda62dcbc"; device = "/dev/disk/by-uuid/7a713df7-7027-4ae6-b1a3-839dda62dcbc";
@ -29,7 +28,7 @@
fsType = "vfat"; 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 # 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 # (the default) this is the recommended approach. When using systemd-networkd it's

View file

@ -1,8 +1,7 @@
{ { config
config, , pkgs
pkgs, , lib
lib, , ...
...
}: { }: {
imports = [ imports = [
# Include the results of the hardware scan. # Include the results of the hardware scan.
@ -31,7 +30,7 @@
address = "fe80::1"; address = "fe80::1";
interface = "enp0s31f6"; interface = "enp0s31f6";
}; };
networking.nameservers = ["8.8.8.8"]; networking.nameservers = [ "8.8.8.8" ];
# Initial empty root password for easy login: # Initial empty root password for easy login:
services.openssh.permitRootLogin = lib.mkForce "prohibit-password"; services.openssh.permitRootLogin = lib.mkForce "prohibit-password";

View file

@ -1,16 +1,15 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ { config
config, , lib
lib, , pkgs
pkgs, , ...
...
}: { }: {
boot.initrd.availableKernelModules = ["ahci" "nvme"]; boot.initrd.availableKernelModules = [ "ahci" "nvme" ];
boot.initrd.kernelModules = []; boot.initrd.kernelModules = [ ];
boot.kernelModules = ["kvm-intel"]; boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = []; boot.extraModulePackages = [ ];
fileSystems."/" = { fileSystems."/" = {
device = "/dev/nvme0n1p2"; device = "/dev/nvme0n1p2";
@ -22,5 +21,5 @@
fsType = "ext2"; fsType = "ext2";
}; };
swapDevices = []; swapDevices = [ ];
} }

View file

@ -1,17 +1,16 @@
{ { config
config, , lib
lib, , pkgs
pkgs, , ...
...
}: { }: {
users.users.admin = { users.users.admin = {
isNormalUser = true; isNormalUser = true;
extraGroups = ["wheel"]; extraGroups = [ "wheel" ];
password = "admin"; password = "admin";
group = "admin"; group = "admin";
}; };
users.groups.admin = {}; users.groups.admin = { };
virtualisation.vmVariant = { virtualisation.vmVariant = {
# following configuration is added only when building VM with build-vm # following configuration is added only when building VM with build-vm
@ -27,7 +26,7 @@
settings.PasswordAuthentication = lib.mkForce true; settings.PasswordAuthentication = lib.mkForce true;
}; };
networking.firewall.allowedTCPPorts = [22]; networking.firewall.allowedTCPPorts = [ 22 ];
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
htop htop
]; ];

View file

@ -1,12 +1,13 @@
{ { pkgs
pkgs, , config
config, , lib
lib, , ...
... }:
}: let let
cfg = config.cherrykitten; cfg = config.cherrykitten;
in { in
options.cherrykitten = {}; {
options.cherrykitten = { };
config = {}; config = { };
} }

View file

@ -1,10 +1,9 @@
{ { pkgs
pkgs, , config
config, , lib
lib, , ...
...
}: { }: {
imports = [./fish ./nvim]; imports = [ ./fish ./nvim ];
home.packages = with pkgs; [ home.packages = with pkgs; [
bat bat
lsd lsd
@ -19,8 +18,8 @@
git = { git = {
enable = true; enable = true;
extraConfig = { extraConfig = {
init = {defaultBranch = "main";}; init = { defaultBranch = "main"; };
core = {editor = "nvim";}; core = { editor = "nvim"; };
pull.rebase = true; pull.rebase = true;
}; };
}; };

View file

@ -1,8 +1,7 @@
{ { pkgs
pkgs, , config
config, , lib
lib, , ...
...
}: { }: {
programs.fish = { programs.fish = {
enable = true; enable = true;

View file

@ -1,13 +1,14 @@
{ { config
config, , pkgs
pkgs, , inputs
inputs, , ...
...
}: { }: {
programs.neovim = let programs.neovim =
let
toLua = str: "lua << EOF\n${str}\nEOF\n"; toLua = str: "lua << EOF\n${str}\nEOF\n";
toLuaFile = file: "lua << EOF\n${builtins.readFile file}\nEOF\n"; toLuaFile = file: "lua << EOF\n${builtins.readFile file}\nEOF\n";
in { in
{
enable = true; enable = true;
viAlias = true; viAlias = true;

View file

@ -1,11 +1,12 @@
{ { lib
lib, , config
config, , pkgs
pkgs, , ...
... }:
}: let let
cfg = config.cherrykitten.common; cfg = config.cherrykitten.common;
in { in
{
options.cherrykitten.common = { options.cherrykitten.common = {
test = lib.mkOption { test = lib.mkOption {
type = lib.types.str; type = lib.types.str;
@ -21,7 +22,7 @@ in {
]; ];
config = { config = {
nix.settings.experimental-features = ["nix-command" "flakes"]; nix.settings.experimental-features = [ "nix-command" "flakes" ];
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
@ -45,10 +46,10 @@ in {
nerdfonts nerdfonts
]; ];
fontconfig = { fontconfig = {
defaultFonts.emoji = ["Noto Emoji"]; defaultFonts.emoji = [ "Noto Emoji" ];
defaultFonts.serif = ["Monaspace Xenon" "FiraCode Nerd Font" "Hack Nerd Font" "NotoSans Nerd Font"]; 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.sansSerif = [ "Monaspace Xenon" "FiraCode Nerd Font" "Hack Nerd Font" "NotoSerif Nerd Font" ];
defaultFonts.monospace = ["Monaspace Xenon" "FiraCode Nerd Font" "Hack Nerd Font"]; defaultFonts.monospace = [ "Monaspace Xenon" "FiraCode Nerd Font" "Hack Nerd Font" ];
}; };
}; };

View file

@ -1,11 +1,12 @@
{ { pkgs
pkgs, , config
config, , lib
lib, , ...
... }:
}: let let
cfg = config.cherrykitten.graphical; cfg = config.cherrykitten.graphical;
in { in
{
options.cherrykitten.graphical = { options.cherrykitten.graphical = {
enable = lib.mkEnableOption (lib.mdDoc "graphical stuffs"); enable = lib.mkEnableOption (lib.mdDoc "graphical stuffs");
}; };

View file

@ -1,5 +1,5 @@
{pkgs, ...}: { { pkgs, ... }: {
networking.firewall.allowedTCPPorts = [22]; networking.firewall.allowedTCPPorts = [ 22 ];
services.openssh = { services.openssh = {
enable = true; enable = true;

View file

@ -1,5 +1,5 @@
{pkgs, ...}: { { pkgs, ... }: {
services.udev.packages = with pkgs; [libu2f-host yubikey-personalization]; services.udev.packages = with pkgs; [ libu2f-host yubikey-personalization ];
programs.gnupg.agent = { programs.gnupg.agent = {
enable = true; enable = true;

View file

@ -1,22 +1,23 @@
{ { pkgs
pkgs, , config
config, , lib
lib, , ...
... }:
}: let let
cfg = config.cherrykitten.users; cfg = config.cherrykitten.users;
in { in
{
options.cherrykitten.users = { options.cherrykitten.users = {
sammy.enable = lib.mkEnableOption "sammy" // {default = true;}; sammy.enable = lib.mkEnableOption "sammy" // { default = true; };
}; };
config = { config = {
users.users.sammy = lib.mkIf cfg.sammy.enable { users.users.sammy = lib.mkIf cfg.sammy.enable {
isNormalUser = true; isNormalUser = true;
extraGroups = ["networkmanager" "wheel" "docker"]; extraGroups = [ "networkmanager" "wheel" "docker" ];
shell = pkgs.fish; shell = pkgs.fish;
ignoreShellProgramCheck = true; 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); home-manager.users.sammy = lib.mkIf cfg.sammy.enable (import ./sammy.nix);

View file

@ -1,5 +1,5 @@
{...}: { { ... }: {
imports = [../home]; imports = [ ../home ];
programs.git = { programs.git = {
userName = "CherryKitten"; userName = "CherryKitten";