completely ripping off fufexan in hopes of fixing things

This commit is contained in:
cnst
2024-07-30 21:41:28 +02:00
parent d0cf745c41
commit 7e6787ff38
17 changed files with 549 additions and 249 deletions

24
nixos/core/lanzaboote.nix Normal file
View File

@@ -0,0 +1,24 @@
{
pkgs,
lib,
inputs,
...
}:
# lanzaboote config
{
imports = [
inputs.lanzaboote.nixosModules.lanzaboote
];
boot = {
lanzaboote = {
enable = true;
pkiBundle = "/etc/secureboot";
};
# we let lanzaboote install systemd-boot
loader.systemd-boot.enable = lib.mkForce false;
};
environment.systemPackages = [pkgs.sbctl];
}

28
nixos/default.nix Normal file
View File

@@ -0,0 +1,28 @@
let
desktop = [
./core/hyprland.nix
./core/zsh.nix
./core/fonts.nix
./locale
./services/audio
./services/greetd
./services/gnome-keyring
./services/gvfs
./services/locate
./services/mullvad
./services/openssh
./services/power
./services/samba
./services/udisks
];
laptop =
desktop
++ [
./services/fwupd
];
in {
inherit desktop laptop;
}

View File

@@ -1,4 +1,8 @@
{pkgs, ...}: {
{
pkgs,
inputs,
...
}: {
programs.gamemode = {
enable = true;
settings = {
@@ -17,4 +21,9 @@
};
};
};
# see https://github.com/fufexan/nix-gaming/#pipewire-low-latency
services.pipewire.lowLatency.enable = true;
imports = [
inputs.nix-gaming.nixosModules.pipewireLowLatency
];
}

View File

@@ -4,7 +4,7 @@
hardware = {
bluetooth = {
enable = true;
powerOnBoot = true;
powerOnBoot = false;
};
logitech.wireless = {
enable = true;

View File

@@ -37,44 +37,19 @@ in {
imports = [
inputs.home-manager.nixosModules.home-manager
./imports.nix
./system.nix
./hardware-configuration.nix
./substituters.nix
];
home-manager.users.cnst = import ../../../home/users/cnst/home.nix;
boot.kernelPackages = lib.mkForce pkgs.linuxPackages_cachyos;
environment.systemPackages = [pkgs.scx];
nix = {
# pin the registry to avoid downloading and evaling a new nixpkgs version every time
registry = lib.mapAttrs (_: v: {flake = v;}) inputs;
# set the path for channels compat
nixPath = lib.mapAttrsToList (key: _: "${key}=flake:${key}") config.nix.registry;
settings = {
auto-optimise-store = true;
builders-use-substitutes = true;
warn-dirty = false;
experimental-features = ["nix-command" "flakes"];
flake-registry = "/etc/nix/registry.json";
# for direnv GC roots
keep-derivations = true;
keep-outputs = true;
trusted-users = ["root" "@wheel"];
};
};
# Bootloader
boot.loader = {
systemd-boot.enable = lib.mkForce false;
efi.canTouchEfiVariables = true;
};
boot.lanzaboote = {
enable = true;
pkiBundle = "/etc/secureboot";
};
boot.kernelParams = [
"amd_pstate=active"
"quiet"
"splash"
];
environment.sessionVariables = {
FLAKE = "/home/cnst/.nix-config";

View File

@@ -9,28 +9,17 @@
...
}: {
imports = [(modulesPath + "/installer/scan/not-detected.nix")];
boot = {
initrd = {
availableKernelModules = [
"nvme"
"xhci_pci"
"ahci"
"usbhid"
"usb_storage"
"sd_mod"
];
kernelModules = ["amdgpu"];
};
kernelModules = ["kvm-amd"];
kernelPackages = lib.mkForce pkgs.linuxPackages_cachyos;
consoleLogLevel = 3;
kernelParams = [
"amd_pstate=active"
"quiet"
"splash"
];
extraModulePackages = [];
};
boot.initrd.availableKernelModules = [
"nvme"
"xhci_pci"
"ahci"
"usbhid"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = ["amdgpu"];
boot.kernelModules = ["kvm-amd"];
boot.extraModulePackages = [];
fileSystems."/" = {
device = "/dev/disk/by-uuid/de372c64-89a2-4bbe-ad57-926cdd98e97d";

View File

@@ -1,6 +1,8 @@
{
inputs,
outputs,
lib,
config,
...
}: {
programs = {
@@ -12,6 +14,27 @@
};
};
nix = {
# pin the registry to avoid downloading and evaling a new nixpkgs version every time
registry = lib.mapAttrs (_: v: {flake = v;}) inputs;
# set the path for channels compat
nixPath = lib.mapAttrsToList (key: _: "${key}=flake:${key}") config.nix.registry;
settings = {
auto-optimise-store = true;
builders-use-substitutes = true;
experimental-features = ["nix-command" "flakes"];
flake-registry = "/etc/nix/registry.json";
# for direnv GC roots
keep-derivations = true;
keep-outputs = true;
trusted-users = ["root" "@wheel"];
};
};
security = {
rtkit.enable = true;
pam.services.hyprlock = {};
@@ -20,13 +43,7 @@
environment.localBinInPath = true;
console.useXkbConfig = true;
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {
inherit inputs outputs;
};
};
nixpkgs = {
overlays = [
(_: prev: {

74
nixos/hosts/default.nix Normal file
View File

@@ -0,0 +1,74 @@
{
self,
inputs,
homeImports,
...
}: {
flake.nixosConfigurations = let
# shorten paths
inherit (inputs.nixpkgs.lib) nixosSystem;
mod = "${self}/nixos";
# get the basic config to build on top of
inherit (import "${self}/nixos") desktop laptop;
# get these into the module system
specialArgs = {inherit inputs self;};
in {
cnix = nixosSystem {
inherit specialArgs;
modules =
desktop
++ [
./cnix
"${mod}/core/lanzaboote.nix"
"${mod}/core/network/cnix.nix"
"${mod}/hardware/cnix.nix"
"${mod}/services/blueman"
"${mod}/services/xserver/cnix.nix"
"${mod}/extra/gaming.nix"
"${mod}/extra/android"
"${mod}/extra/workstation"
{
home-manager = {
users.cnst.imports = homeImports."cnst@cnix";
extraSpecialArgs = specialArgs;
};
}
# inputs.agenix.nixosModules.default
inputs.chaotic.nixosModules.default
];
};
# rog = nixosSystem {
# inherit specialArgs;
# modules =
# laptop
# ++ [
# ./rog
# "${mod}/core/lanzaboote.nix"
# "${mod}/programs/gamemode.nix"
# "${mod}/programs/hyprland.nix"
# "${mod}/programs/games.nix"
# "${mod}/services/kanata"
# {home-manager.users.mihai.imports = homeImports."mihai@rog";}
# ];
# };
# kiiro = nixosSystem {
# inherit specialArgs;
# modules =
# desktop
# ++ [
# ./kiiro
# {home-manager.users.mihai.imports = homeImports.server;}
# ];
# };
};
}

13
nixos/pkgs/default.nix Normal file
View File

@@ -0,0 +1,13 @@
{
systems = ["x86_64-linux"];
perSystem = {
pkgs,
inputs',
...
}: {
packages = {
wl-ocr = pkgs.callPackage ./wl-ocr {};
};
};
}

View File

@@ -0,0 +1,17 @@
{
writeShellScriptBin,
lib,
grim,
libnotify,
slurp,
tesseract5,
wl-clipboard,
langs ? "eng+hun+fra+jpn+jpn_vert+kor+kor_vert+pol+ron+spa",
}: let
_ = lib.getExe;
in
writeShellScriptBin "wl-ocr" ''
${_ grim} -g "$(${_ slurp})" -t ppm - | ${_ tesseract5} -l ${langs} - - | ${wl-clipboard}/bin/wl-copy
echo "$(${wl-clipboard}/bin/wl-paste)"
${_ libnotify} -- "$(${wl-clipboard}/bin/wl-paste)"
''