still working

This commit is contained in:
Ivan Kirilov Dimitrov 2024-06-10 22:41:40 +02:00
parent 196683aceb
commit 55e4c663f4
No known key found for this signature in database
GPG Key ID: 0BDAD4B211C49294
8 changed files with 226 additions and 248 deletions

5
default.nix Normal file
View File

@ -0,0 +1,5 @@
{ ... }: {
imports = [ ./nixos ];
systems = [ "x86_64-linux" ];
perSystem = { system, ... }: { };
}

View File

@ -23,42 +23,5 @@
}; };
catppuccin.url = "github:catppuccin/nix"; catppuccin.url = "github:catppuccin/nix";
}; };
outputs = inputs@{ parts, nixpkgs, ide, nid, home-manager, hosts, catppuccin, ... }: outputs = inputs: inputs.parts.lib.mkFlake { inherit inputs; } { imports = [ ./. ]; };
parts.lib.mkFlake { inherit inputs; } {
flake =
let
stateVersion = "24.05";
my-overlay = self: super: {
scripts = (super.buildEnv { name = "scripts"; paths = [ ./. ]; });
};
pkgs = import nixpkgs {
overlays = [ my-overlay ];
};
modules = import ./modules {
inherit nixpkgs pkgs ide my-overlay;
system = "x86_64-linux";
};
home = import ./home {
inherit stateVersion pkgs modules home-manager nid catppuccin;
system = "x86_64-linux";
};
nixos = import ./nixos {
inherit stateVersion nixpkgs modules hosts catppuccin;
system = "x86_64-linux";
};
in
{
nixosConfigurations = {
nixos = nixos.laptop;
};
homeConfigurations = {
ivand = home.ivand;
};
modules = modules;
};
systems = [
"x86_64-linux"
];
perSystem = { config, ... }: { };
};
} }

View File

@ -1,18 +0,0 @@
{
networking.wg-quick.interfaces = {
wg0 = {
address = [ "10.0.0.2/24" "fdc9:281f:04d7:9ee9::2/64" ];
dns = [ "1.1.1.1" "fdc9:281f:04d7:9ee9::1" ];
privateKeyFile = "/etc/wireguard/privatekey";
peers = [
{
publicKey = "5FiTLnzbgcbgQLlyVyYeESEd+2DtwM1JHCGz/32UcEU=";
allowedIPs = [ "0.0.0.0/0" "::/0" ];
endpoint = "37.205.13.29:51820";
persistentKeepalive = 25;
}
];
};
};
}

View File

@ -1,13 +1,3 @@
{ stateVersion, system, nixpkgs, modules, hosts, catppuccin, ... }: { { ... }: {
laptop = nixpkgs.lib.nixosSystem { imports = [ ./modules ./systems ];
inherit system;
modules = [
{ system.stateVersion = stateVersion; }
../hardware-configuration.nix
./laptop
modules.nixos.wireguard
hosts.nixosModule
catppuccin.nixosModules.catppuccin
];
};
} }

View File

@ -1,180 +0,0 @@
{ config, pkgs, ... }: {
nix = {
extraOptions = ''
experimental-features = nix-command flakes
'';
};
hardware = {
opengl = {
enable = true;
driSupport = true;
};
};
catppuccin = {
enable = true;
flavor = "mocha";
};
boot = {
loader = {
grub = {
enable = true;
catppuccin.enable = true;
useOSProber = true;
efiSupport = true;
device = "nodev";
};
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot/efi";
};
};
extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ];
kernelModules = [ "v4l2loopback" ];
};
security = {
sudo = {
enable = false;
execWheelOnly = true;
extraRules = [
{
groups = [ "wheel" ];
commands = [{ command = "${pkgs.light}/bin/light"; options = [ "SETENV" "NOPASSWD" ]; }];
}
];
};
doas = {
enable = true;
extraRules = [
# Allow wheel to run all commands without password and keep user env.
{ groups = [ "wheel" ]; noPass = true; keepEnv = true; }
];
};
polkit.enable = true;
rtkit.enable = true;
pam = { services = { swaylock = { }; }; };
};
xdg = {
portal = {
enable = true;
wlr.enable = true;
config.common.default = "*";
};
};
i18n.supportedLocales = [ "all" ];
time.timeZone = "Europe/Prague";
fonts.packages = with pkgs; [ (nerdfonts.override { fonts = [ "FiraCode" ]; }) noto-fonts noto-fonts-emoji noto-fonts-lgc-plus ];
environment = {
systemPackages = with pkgs; [
cmatrix
coreutils-full
cryptsetup
dig
fd
file
git
glibc
gnumake
jq
mlocate
moreutils
ntfs3g
openssl
srm
unzip
vim
zip
];
shells = with pkgs; [ zsh nushell ];
};
networking = {
wireless = {
enable = true;
networks = {
"Smart-Hostel-2.4" = {
psk = "smarttrans.bg";
};
"Yohohostel2.4G" = {
psk = "kaskamaska";
};
"Nomado_Guest" = {
psk = "welcomehome";
};
"HostelMusala Uni" = {
psk = "mhostelm";
};
"BOUTIQUE APARTMENTS" = {
psk = "boutique26";
};
"Safestay" = {
psk = "AlldayrooftopBAR";
};
"HOSTEL JASMIN 2" = {
psk = "Jasmin2024";
};
"HOME" = {
psk = "iloveprague";
};
"Vodafone-B925" = {
psk = "7aGh3FE6pN4p4cu6";
};
};
};
stevenBlackHosts = {
enable = true;
blockFakenews = true;
blockGambling = true;
};
};
programs = {
zsh.enable = true;
nix-ld.enable = true;
adb.enable = true;
dconf.enable = true;
};
users = {
defaultUserShell = pkgs.zsh;
users = {
ivand = {
isNormalUser = true;
extraGroups = [
"adbusers"
"adm"
"audio"
"bluetooth"
"dialout"
"flatpak"
"kvm"
"mlocate"
"render"
"video"
"wheel"
];
};
};
extraGroups = { mlocate = { }; };
};
services = {
xserver.videoDrivers = [ "nouveau" ];
dbus.enable = true;
flatpak.enable = true;
pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
};
};
}

207
nixos/modules/default.nix Normal file
View File

@ -0,0 +1,207 @@
{ inputs, ... }:
let pkgs = import inputs.nixpkgs { system = "x86_64-linux"; }; in {
flake.nixosModules = {
wireguard = {
networking.wg-quick.interfaces = {
wg0 = {
address = [ "10.0.0.2/24" "fdc9:281f:04d7:9ee9::2/64" ];
dns = [ "1.1.1.1" "fdc9:281f:04d7:9ee9::1" ];
privateKeyFile = "/etc/wireguard/privatekey";
peers = [
{
publicKey = "5FiTLnzbgcbgQLlyVyYeESEd+2DtwM1JHCGz/32UcEU=";
allowedIPs = [ "0.0.0.0/0" "::/0" ];
endpoint = "37.205.13.29:51820";
persistentKeepalive = 25;
}
];
};
};
};
catppuccin = {
catppuccin = {
enable = true;
flavor = "mocha";
};
boot.loader.grub.catppuccin.enable = true;
};
boot = {
boot = {
loader = {
grub = {
enable = true;
useOSProber = true;
efiSupport = true;
device = "nodev";
};
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot/efi";
};
};
kernelModules = [ "v4l2loopback" ];
};
};
security = {
security = {
sudo = {
enable = false;
execWheelOnly = true;
extraRules = [
{
groups = [ "wheel" ];
commands = [{ command = "${pkgs.light}/bin/light"; options = [ "SETENV" "NOPASSWD" ]; }];
}
];
};
doas = {
enable = true;
extraRules = [
# Allow wheel to run all commands without password and keep user env.
{ groups = [ "wheel" ]; noPass = true; keepEnv = true; }
];
};
polkit.enable = true;
rtkit.enable = true;
pam = { services = { swaylock = { }; }; };
};
};
xdg = {
xdg = {
portal = {
enable = true;
wlr.enable = true;
config.common.default = "*";
};
};
};
networking = {
networking = {
wireless = {
enable = true;
networks = {
"Smart-Hostel-2.4" = {
psk = "smarttrans.bg";
};
"Yohohostel2.4G" = {
psk = "kaskamaska";
};
"Nomado_Guest" = {
psk = "welcomehome";
};
"HostelMusala Uni" = {
psk = "mhostelm";
};
"BOUTIQUE APARTMENTS" = {
psk = "boutique26";
};
"Safestay" = {
psk = "AlldayrooftopBAR";
};
"HOSTEL JASMIN 2" = {
psk = "Jasmin2024";
};
"HOME" = {
psk = "iloveprague";
};
"Vodafone-B925" = {
psk = "7aGh3FE6pN4p4cu6";
};
};
};
stevenBlackHosts = {
enable = true;
blockFakenews = true;
blockGambling = true;
};
};
};
users = {
users = {
defaultUserShell = pkgs.zsh;
users = {
ivand = {
isNormalUser = true;
extraGroups = [
"adbusers"
"adm"
"audio"
"bluetooth"
"dialout"
"flatpak"
"kvm"
"mlocate"
"render"
"video"
"wheel"
];
};
};
extraGroups = { mlocate = { }; };
};
};
services = {
services = {
xserver.videoDrivers = [ "nouveau" ];
dbus.enable = true;
flatpak.enable = true;
pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
};
};
};
programs = {
programs = {
zsh.enable = true;
nix-ld.enable = true;
adb.enable = true;
dconf.enable = true;
};
};
env = {
environment = {
systemPackages = with pkgs; [
cmatrix
coreutils-full
cryptsetup
dig
fd
file
git
glibc
gnumake
jq
mlocate
moreutils
ntfs3g
openssl
srm
unzip
vim
zip
];
shells = with pkgs; [ zsh nushell ];
};
};
rest = {
nix = {
extraOptions = ''
experimental-features = nix-command flakes
'';
};
hardware = {
opengl = {
enable = true;
driSupport = true;
};
};
i18n.supportedLocales = [ "all" ];
time.timeZone = "Europe/Prague";
fonts.packages = with pkgs; [ (nerdfonts.override { fonts = [ "FiraCode" ]; }) noto-fonts noto-fonts-emoji noto-fonts-lgc-plus ];
};
};
}

11
nixos/systems/default.nix Normal file
View File

@ -0,0 +1,11 @@
{ inputs, config, ... }: {
flake.nixosConfigurations = {
nixos = inputs.nixpkgs.lib.nixosSystem {
modules = [
./laptop-hardware.nix
inputs.hosts.nixosModule
inputs.catppuccin.nixosModules.catppuccin
] ++ (with config.flake.nixosModules; [ wireguard catppuccin boot security xdg networking users services programs env rest ]);
};
};
}