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 @ {
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")
];
};
};
}

View file

@ -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.

View file

@ -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

View file

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

View file

@ -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 = [ ];
}

View file

@ -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
];

View file

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

View file

@ -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;
};
};

View file

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

View file

@ -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}
'';
};
}

View file

@ -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" ];
};
};

View file

@ -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");
};

View file

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

View file

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

View file

@ -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);

View file

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