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

104
flake.nix
View file

@ -9,57 +9,69 @@
}; };
}; };
outputs = inputs @ { outputs =
self, inputs @ { self
nixpkgs, , nixpkgs
nixpkgs-unstable, , nixpkgs-unstable
home-manager, , home-manager
... , ...
}: let }:
inherit (self) outputs; let
lib = nixpkgs.lib // home-manager.lib; inherit (self) outputs;
mkHost = { systems = [
hostname, "aarch64-linux"
user ? "sammy", "i686-linux"
}: { "x86_64-linux"
imports = [ "aarch64-darwin"
./hosts/${hostname}/configuration.nix "x86_64-darwin"
./modules/nixos/common.nix
(import "${home-manager}/nixos")
]; ];
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 = { deployment = {
targetUser = user; targetUser = user;
allowLocalDeployment = true; allowLocalDeployment = true;
}; };
}; };
in { in
inherit lib; {
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra; inherit lib;
colmena = { formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixpkgs-fmt);
meta = { colmena = {
description = "All my NixoS machines"; meta = {
specialArgs = {inherit inputs outputs;}; description = "All my NixoS machines";
nixpkgs = import nixpkgs { specialArgs = { inherit inputs outputs; };
system = "x86_64-linux"; nixpkgs = import nixpkgs {
overlays = []; system = "x86_64-linux";
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";
specialArgs = { specialArgs = {
flake = self; flake = self;
};
modules = [
./modules
./hosts/test-vm/configuration.nix
(import "${home-manager}/nixos")
];
}; };
modules = [
./modules
./hosts/test-vm/configuration.nix
(import "${home-manager}/nixos")
];
}; };
};
} }

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,101 +1,102 @@
{ { config
config, , pkgs
pkgs, , inputs
inputs, , ...
...
}: { }: {
programs.neovim = let programs.neovim =
toLua = str: "lua << EOF\n${str}\nEOF\n"; let
toLuaFile = file: "lua << EOF\n${builtins.readFile file}\nEOF\n"; toLua = str: "lua << EOF\n${str}\nEOF\n";
in { toLuaFile = file: "lua << EOF\n${builtins.readFile file}\nEOF\n";
enable = true; in
{
enable = true;
viAlias = true; viAlias = true;
vimAlias = true; vimAlias = true;
vimdiffAlias = true; vimdiffAlias = true;
extraPackages = with pkgs; [ extraPackages = with pkgs; [
lua-language-server lua-language-server
rnix-lsp rnix-lsp
xclip xclip
wl-clipboard wl-clipboard
rustfmt rustfmt
black black
isort isort
alejandra alejandra
prettierd prettierd
codespell codespell
stylua stylua
]; ];
plugins = with pkgs.vimPlugins; [ plugins = with pkgs.vimPlugins; [
plenary-nvim plenary-nvim
persistence-nvim persistence-nvim
nvim-web-devicons nvim-web-devicons
nui-nvim nui-nvim
{ {
plugin = comment-nvim; plugin = comment-nvim;
config = toLua "require(\"Comment\").setup()"; config = toLua "require(\"Comment\").setup()";
} }
{ {
plugin = catppuccin-nvim; plugin = catppuccin-nvim;
config = "colorscheme catppuccin-mocha"; config = "colorscheme catppuccin-mocha";
} }
{ {
plugin = which-key-nvim; plugin = which-key-nvim;
config = toLua "require(\"which-key\").setup()"; config = toLua "require(\"which-key\").setup()";
} }
{ {
plugin = neo-tree-nvim; plugin = neo-tree-nvim;
config = toLuaFile ./plugins/neo-tree.lua; config = toLuaFile ./plugins/neo-tree.lua;
} }
{ {
plugin = conform-nvim; plugin = conform-nvim;
config = toLuaFile ./plugins/conform.lua; config = toLuaFile ./plugins/conform.lua;
} }
{ {
plugin = dressing-nvim; plugin = dressing-nvim;
config = toLua "require(\"dressing\").setup()"; config = toLua "require(\"dressing\").setup()";
} }
{ {
plugin = bufferline-nvim; plugin = bufferline-nvim;
config = toLua "require(\"bufferline\").setup()"; config = toLua "require(\"bufferline\").setup()";
} }
{ {
plugin = lualine-nvim; plugin = lualine-nvim;
config = toLua "require(\"lualine\").setup()"; config = toLua "require(\"lualine\").setup()";
} }
{ {
plugin = indent-blankline-nvim; plugin = indent-blankline-nvim;
config = toLua "require(\"ibl\").setup()"; config = toLua "require(\"ibl\").setup()";
} }
{ {
plugin = noice-nvim; plugin = noice-nvim;
config = toLuaFile ./plugins/noice.lua; config = toLuaFile ./plugins/noice.lua;
} }
{ {
plugin = dashboard-nvim; plugin = dashboard-nvim;
config = toLuaFile ./plugins/dashboard.lua; config = toLuaFile ./plugins/dashboard.lua;
} }
nvim-notify nvim-notify
vim-nix vim-nix
]; ];
extraLuaConfig = '' extraLuaConfig = ''
${builtins.readFile ./options.lua} ${builtins.readFile ./options.lua}
${builtins.readFile ./keymap.lua} ${builtins.readFile ./keymap.lua}
''; '';
}; };
} }

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";