shit i changed way too much at once

This commit is contained in:
CherryKitten 2024-03-24 19:02:28 +01:00
parent 7fd8e6c7c4
commit 38287035e7
Signed by: sammy
GPG key ID: 98D8F75FB0658276
22 changed files with 195 additions and 172 deletions

View file

@ -1,5 +1,23 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1709126324,
"narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "d465f4819400de7c8d874d50b982301f28a84605",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@ -53,10 +71,26 @@
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"home-manager": "home-manager",
"nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

100
flake.nix
View file

@ -2,62 +2,64 @@
inputs = {
nixpkgs.url = "nixpkgs/nixos-23.11";
nixpkgs-unstable.url = "nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
home-manager = {
url = "github:nix-community/home-manager/release-23.11";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
inputs @ { self
, nixpkgs
, nixpkgs-unstable
, home-manager
, ...
}:
let
mkHost = { hostname, user ? "sammy" }: {
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/common.nix
(import "${home-manager}/nixos")
];
imports = [
./hosts/${hostname}/configuration.nix
./modules
(import "${home-manager}/nixos")
];
deployment = {
targetUser = user;
allowLocalDeployment = true;
};
};
in
{
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
colmena = {
meta = {
description = "All my NixoS machines";
specialArgs = {
flake = self;
};
nixpkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [ ];
};
};
bengal = mkHost { hostname = "bengal"; };
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")
];
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 = [];
};
};
bengal = mkHost {hostname = "bengal";};
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")
];
};
};
}

View file

@ -7,7 +7,6 @@
pkgs,
...
}: {
boot.initrd.availableKernelModules = ["ahci" "nvme"];
boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-intel"];

View file

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

View file

@ -13,10 +13,19 @@ in {
example = "nyanya";
};
};
imports = [
./graphical.nix
./security.nix
./users
./yubikey.nix
];
config = {
nix.settings.experimental-features = ["nix-command" "flakes"];
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
time.timeZone = "Europe/Berlin";
i18n.defaultLocale = "en_US.UTF-8";

View file

@ -1,24 +0,0 @@
{ pkgs, config, lib, ... }:
let
cfg = config.cherrykitten;
in
with lib;
{
imports = [
./common.nix
./graphical.nix
./security.nix
./users.nix
./yubikey.nix
./nvim
./shell/fish.nix
];
options.cherrykitten = { };
config = {
cherrykitten.fish.enable = mkDefault true;
cherrykitten.graphical.enable = mkDefault false;
};
}

28
modules/home/default.nix Normal file
View file

@ -0,0 +1,28 @@
{
pkgs,
config,
lib,
...
}: {
imports = [./fish ./nvim];
home.packages = with pkgs; [
bat
lsd
gnupg
tmux
colmena
];
programs = {
home-manager.enable = true;
git = {
enable = true;
extraConfig = {
init = {defaultBranch = "main";};
core = {editor = "nvim";};
pull.rebase = true;
};
};
};
}

View file

@ -0,0 +1,21 @@
{
pkgs,
config,
lib,
...
}: {
programs.fish = {
enable = true;
};
home.file = {
fish_prompt = {
source = ./fish_prompt.fish;
target = ".config/fish/functions/fish_prompt.fish";
};
fish_right_prompt = {
source = ./fish_right_prompt.fish;
target = ".config/fish/functions/fish_right_prompt.fish";
};
};
}

View file

@ -4,7 +4,7 @@
inputs,
...
}: {
home-manager.users.sammy.programs.neovim = let
programs.neovim = let
toLua = str: "lua << EOF\n${str}\nEOF\n";
toLuaFile = file: "lua << EOF\n${builtins.readFile file}\nEOF\n";
in {

View file

@ -7,7 +7,7 @@
logLevel = "VERBOSE";
extraConfig = ''
StreamLocalBindUnlink yes
'';
'';
settings = {
PermitRootLogin = "no";
PasswordAuthentication = false;

View file

@ -1,30 +0,0 @@
{ pkgs, config, lib, flake, ... }:
let
cfg = config.cherrykitten.fish;
in
with lib;
{
options.cherrykitten.fish.enable = mkEnableOption "Fish-Shell";
config = mkIf cfg.enable {
home-manager.users.sammy = {
programs.fish = {
enable = true;
};
home.file = {
fish_prompt = {
source = flake + files/config/fish/functions/fish_prompt.fish;
target = ".config/fish/functions/fish_prompt.fish";
};
fish_right_prompt = {
source = flake + files/config/fish/functions/fish_right_prompt.fish;
target = ".config/fish/functions/fish_right_prompt.fish";
};
};
};
};
}

View file

@ -1,59 +0,0 @@
{ lib
, pkgs
, config
, ...
}:
let
cfg = config.cherrykitten;
in
{
options.cherrykitten.users = { };
config = {
users.users = {
sammy = {
isNormalUser = true;
extraGroups = [ "networkmanager" "wheel" "docker" ];
shell = pkgs.fish;
ignoreShellProgramCheck = true;
openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJZyQSZw+pExsx2RXB+yxbaJGB9mtvudbQ/BP7E1yKvr openpgp:0x6068FEBB" ];
};
};
home-manager.users.sammy = {
home.username = "sammy";
home.homeDirectory = "/home/sammy";
home.stateVersion = "23.11"; # Please read the comment before changing.
home.packages = with pkgs; [
bat
lsd
gnupg
tmux
colmena
];
programs = {
home-manager.enable = true;
git = {
enable = true;
userName = "CherryKitten";
userEmail = "git@cherrykitten.dev";
signing.key = "0xC01A7CBBA617BD5F";
signing.signByDefault = true;
extraConfig = {
init = { defaultBranch = "main"; };
core = { editor = "nvim"; };
pull.rebase = true;
};
};
};
home.sessionVariables = {
EDITOR = "nvim";
};
};
};
}

24
modules/users/default.nix Normal file
View file

@ -0,0 +1,24 @@
{
pkgs,
config,
lib,
...
}: let
cfg = config.cherrykitten.users;
in {
options.cherrykitten.users = {
sammy.enable = lib.mkEnableOption "sammy" // {default = true;};
};
config = {
users.users.sammy = lib.mkIf cfg.sammy.enable {
isNormalUser = true;
extraGroups = ["networkmanager" "wheel" "docker"];
shell = pkgs.fish;
ignoreShellProgramCheck = true;
openssh.authorizedKeys.keys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJZyQSZw+pExsx2RXB+yxbaJGB9mtvudbQ/BP7E1yKvr openpgp:0x6068FEBB"];
};
home-manager.users.sammy = lib.mkIf cfg.sammy.enable (import ./sammy.nix);
};
}

17
modules/users/sammy.nix Normal file
View file

@ -0,0 +1,17 @@
{...}: {
imports = [../home];
programs.git = {
userName = "CherryKitten";
userEmail = "git@cherrykitten.dev";
signing.key = "0xC01A7CBBA617BD5F";
signing.signByDefault = true;
};
home.username = "sammy";
home.homeDirectory = "/home/sammy";
home.stateVersion = "23.11"; # Please read the comment before changing.
home.sessionVariables = {
EDITOR = "nvim";
};
}