Working config (until now)

This commit is contained in:
2025-05-05 21:53:36 +02:00
parent 516d786c1b
commit fa8f769068
16 changed files with 297 additions and 69 deletions

7
Makefile Normal file
View File

@@ -0,0 +1,7 @@
HOSTNAME ?= $(hostname)
switch:
sudo nixos-rebuild switch --flake ".#${HOSTNAME}"
test:
sudo nixos-rebuild test --flake ".#${HOSTNAME}"

View File

@@ -1,11 +1,9 @@
{ pkgs, zen-browser, ... }: { pkgs, ... }:
{ {
imports = imports =
[ # Include the results of the hardware scan. [ # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
./modules/boot.nix ./modules
./modules/nvidia.nix
./modules/services.nix
]; ];
nix.gc = { nix.gc = {
@@ -49,7 +47,8 @@
}; };
environment.sessionVariables = { environment.sessionVariables = {
NIXOS_OZONE_WL = "1"; # Use Wayland when possible NIXOS_OZONE_WL = "1"; # Use Wayland when possible (this does not seem to work)
ELECTRON_OZONE_PLATFORM_HINT = "wayland";
GOPATH = "$HOME/.go"; GOPATH = "$HOME/.go";
}; };
@@ -84,6 +83,7 @@
fish fish
fzf fzf
git git
gnumake
htop htop
jq jq
killall killall
@@ -124,19 +124,22 @@
brave brave
kdePackages.xdg-desktop-portal-kde kdePackages.xdg-desktop-portal-kde
kitty kitty
libreoffice libresprite
mpv mpv
nextcloud-client
spotube spotube
telegram-desktop telegram-desktop
xdg-desktop-portal
xdg-desktop-portal-gtk
]; ];
programs.steam.enable = true; programs.steam.enable = true;
programs.steam.remotePlay.openFirewall = true; programs.steam.remotePlay.openFirewall = true;
virtualisation.podman.enable = true; virtualisation.podman.enable = true;
virtualisation.podman.dockerCompat = true; virtualisation.podman.dockerCompat = true;
# virtualisation.vmware.host.enable = true;
programs.virt-manager.enable = true;
users.groups.libvirtd.members = ["r3ddy"];
virtualisation.libvirtd.enable = true;
virtualisation.spiceUSBRedirection.enable = true;
system.stateVersion = "24.05"; # Did you read the comment? system.stateVersion = "24.05"; # Did you read the comment?
} }

32
flake.lock generated
View File

@@ -46,11 +46,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1744380363, "lastModified": 1746317522,
"narHash": "sha256-cXjAUuAfQDPSLSsckZuTioQ986iqSPTzx8D7dLAcC+Q=", "narHash": "sha256-/jZ4Wd4HHUEWPSlNj48k1E4Mh+1fUbwI/vSlPPIMG3U=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "e43c6bcb101ba3301522439c459288c4a248f624", "rev": "621986fed37c5d0cb8df010ed8369694dc47c09b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -73,27 +73,27 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1729958008, "lastModified": 1737371634,
"narHash": "sha256-EiOq8jF4Z/zQe0QYVc3+qSKxRK//CFHMB84aYrYGwEs=", "narHash": "sha256-fTVAWzT1UMm1lT+YxHuVPtH+DATrhYfea3B0MxG/cGw=",
"owner": "NuschtOS", "owner": "NuschtOS",
"repo": "ixx", "repo": "ixx",
"rev": "9fd01aad037f345350eab2cd45e1946cc66da4eb", "rev": "a1176e2a10ce745ff8f63e4af124ece8fe0b1648",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NuschtOS", "owner": "NuschtOS",
"ref": "v0.0.6", "ref": "v0.0.7",
"repo": "ixx", "repo": "ixx",
"type": "github" "type": "github"
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1744232761, "lastModified": 1746232882,
"narHash": "sha256-gbl9hE39nQRpZaLjhWKmEu5ejtQsgI5TWYrIVVJn30U=", "narHash": "sha256-MHmBH2rS8KkRRdoU/feC/dKbdlMkcNkB5mwkuipVHeQ=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "f675531bc7e6657c10a18b565cfebd8aa9e24c14", "rev": "7a2622e2c0dbad5c4493cb268aba12896e28b008",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -112,11 +112,11 @@
"nuschtosSearch": "nuschtosSearch" "nuschtosSearch": "nuschtosSearch"
}, },
"locked": { "locked": {
"lastModified": 1744383153, "lastModified": 1746309817,
"narHash": "sha256-We4ePUixXnMOIqA9IRMWXGEW6efZRTGwTVCv5/yCvcU=", "narHash": "sha256-oqOpTyjdeY+LP+WiU9LxGdZ/bZ9YK7MNzNMDUw98kPM=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixvim", "repo": "nixvim",
"rev": "e537d4a6b4c1c81f8b71dfd916fdf970d0d5c987", "rev": "c978122396a4208bf1965d346b7456e7256fe70c",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -135,11 +135,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1743683223, "lastModified": 1745046075,
"narHash": "sha256-LdXtHFvhEC3S64dphap1pkkzwjErbW65eH1VRerCUT0=", "narHash": "sha256-8v4y6k16Ra/fiecb4DxhsoOGtzLKgKlS+9/XJ9z0T2I=",
"owner": "NuschtOS", "owner": "NuschtOS",
"repo": "search", "repo": "search",
"rev": "56a49ffef2908dad1e9a8adef1f18802bc760962", "rev": "066afe8643274470f4a294442aadd988356a478f",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -1,6 +1,4 @@
{ {
description = "My NixOS";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager = { home-manager = {
@@ -15,9 +13,20 @@
outputs = { self, nixpkgs, home-manager, nixvim, ... }@inputs: outputs = { self, nixpkgs, home-manager, nixvim, ... }@inputs:
let let
system = "x86_64-linux"; overlays = [];
personalEmail = "patrickcanal3@gmail.com";
mkSystem = import ./lib/mksystem.nix {
inherit
overlays
inputs;
};
in in
{ {
nixosConfigurations.katana = mkSystem "katana" {
system = "x86_64-linux";
user = "r3ddy";
email = personalEmail;
};
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
modules = [ modules = [
./configuration.nix ./configuration.nix

View File

@@ -4,6 +4,8 @@
enable = true; enable = true;
interactiveShellInit = '' interactiveShellInit = ''
set fish_greeting # Disable greeting set fish_greeting # Disable greeting
fish_config theme choose Catppuccin\ Mocha
function weather function weather
curl "wttr.in/Bolzano?0?Q?" curl "wttr.in/Bolzano?0?Q?"
end end

View File

@@ -11,6 +11,7 @@
{ name = "nvim_lsp_signature_help"; } { name = "nvim_lsp_signature_help"; }
{ name = "path"; } { name = "path"; }
{ name = "buffer"; } { name = "buffer"; }
{ name = "dap"; }
]; ];
mapping = { mapping = {
"<Tab>" = "cmp.mapping.select_next_item()"; "<Tab>" = "cmp.mapping.select_next_item()";

View File

@@ -46,6 +46,15 @@
}; };
mode = "n"; mode = "n";
} }
{
action = ":lua vim.lsp.buf.format()<CR>";
key = "<C-f>";
options = {
silent = true;
desc = "Format buffer";
};
mode = "n";
}
{ {
action = ":q<CR>"; action = ":q<CR>";
key = "<C-q>"; key = "<C-q>";
@@ -129,5 +138,32 @@
}; };
mode = "n"; mode = "n";
} }
# Dap
{
action.__raw = ''
function()
require("dap").toggle_breakpoint()
end
'';
key = "<Space>b";
mode = "n";
options = {
silent = true;
desc = "Toggle breakpoint";
};
}
{
action.__raw = ''
function()
require("dapui").toggle()
end
'';
key = "<Space>y";
mode = "n";
options = {
silent = true;
desc = "Toggle debugger";
};
}
]; ];
} }

View File

@@ -10,15 +10,18 @@
lua_ls.enable = true; lua_ls.enable = true;
rust_analyzer = { rust_analyzer = {
enable = true; enable = true;
installCargo = true; installCargo = false;
installRustc = true; installRustc = false;
installRustfmt = true; installRustfmt = false;
}; };
zls.enable = true; zls.enable = true;
nim_langserver.enable = true; nim_langserver.enable = true;
pyright.enable = true; pyright.enable = true;
emmet_language_server.enable = true; emmet_language_server.enable = true;
ts_ls.enable = true; ts_ls.enable = true;
docker_compose_language_service.enable = true;
jsonls.enable = true;
phpactor.enable = true;
}; };
keymaps = { keymaps = {
lspBuf = { lspBuf = {

66
home/nvim/plugins/dap.nix Normal file
View File

@@ -0,0 +1,66 @@
{ pkgs, ... }:
{
programs.nixvim.plugins = {
dap = {
enable = true;
adapters = {
executables = {
gdb = {
command = "gdb";
args = [
"-i"
"dap"
];
};
lldb = {
command = "lldb";
};
};
servers = {
codelldb = {
port = 13000;
executable = {
command = "${pkgs.vscode-extensions.vadimcn.vscode-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb";
args = [
"--port"
"13000"
];
};
};
};
};
configurations = {
cpp = [
{
name = "Launch GDB";
type = "gdb";
request = "launch";
program.__raw = ''
function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
end'';
}
{
name = "Launch LLDB";
type = "lldb";
request = "launch";
program.__raw = ''
function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
end'';
}
{
name = "Launch CodeLLDB";
type = "codelldb";
request = "launch";
program.__raw = ''
function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
end'';
}
];
};
};
dap-ui.enable = true;
};
}

View File

@@ -1,4 +1,4 @@
{ ... }: { pkgs, ... }:
{ {
imports = [ imports = [
./telescope.nix ./telescope.nix
@@ -7,6 +7,7 @@
./lualine.nix ./lualine.nix
./dashboard.nix ./dashboard.nix
./neotree.nix ./neotree.nix
./dap.nix
]; ];
programs.nixvim.plugins = { programs.nixvim.plugins = {

100
lib/mksystem.nix Normal file
View File

@@ -0,0 +1,100 @@
# This file comes from https://github.com/kahlstrm/nixos-config/blob/main/lib/mksystem.nix
{
overlays,
inputs,
}:
name:
{
system,
user,
email,
wsl ? false,
stable ? false,
}:
let
# True if this is a WSL system.
isWSL = wsl;
# resolves NixOS vs nix-darwin and stable vs unstable functions
inherit
(import ./resolve-inputs.nix {
inherit
system
stable
inputs
;
})
isDarwin
lib
systemFunc
nixpkgs-stable
home-manager
;
# The config files for this system.
nixConfig = ../modules/nix-config/default.nix;
machineConfig = ../machines/${name}.nix;
OSConfig = ../modules/${if isDarwin then "darwin" else "nixos"}.nix;
HMConfig = ../modules/home-manager.nix;
systemPackages = ../modules/packages.nix;
# TODO: make this cleaner
nix-homebrew = lib.optionalAttrs isDarwin inputs.nix-homebrew.darwinModules.nix-homebrew;
nix-homebrew-config = lib.optionalAttrs isDarwin {
nix-homebrew = {
enable = true;
inherit user;
# Detect and automatically migrate existing Homebrew installations
autoMigrate = true;
# With mutableTaps disabled, taps can no longer be added imperatively with `brew tap`.
#mutableTaps = false;
};
};
specialArgs = {
pkgs-stable = import nixpkgs-stable {
inherit system;
config.allowUnfree = true;
};
pkgs-unstable = import inputs.nixpkgs-unstable {
inherit system;
config.allowUnfree = true;
};
currentSystem = system;
currentSystemName = name;
currentSystemUser = user;
currentSystemEmail = email;
isWSL = isWSL;
isDarwin = isDarwin;
inputs = inputs;
};
in
assert isWSL -> !isDarwin;
systemFunc {
inherit system specialArgs;
# We expose some extra arguments so that our modules can parameterize
# better based on these values.
modules = [
# Apply our overlays. Overlays are keyed by system type so we have
# to go through and apply our system type. We do this first so
# the overlays are available globally.
{ nixpkgs.overlays = overlays; }
# Allow unfree packages.
{ nixpkgs.config.allowUnfree = true; }
# Bring in WSL if this is a WSL build
(if isWSL then inputs.nixos-wsl.nixosModules.wsl else { })
nixConfig
nix-homebrew
nix-homebrew-config
systemPackages
OSConfig
# TODO: make user config & home-manager optional
home-manager.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.${user} = import HMConfig;
home-manager.extraSpecialArgs = specialArgs;
}
machineConfig
];
}

4
machines/katana.nix Normal file
View File

@@ -0,0 +1,4 @@
{ ... }:
{
}

View File

@@ -4,5 +4,5 @@
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
boot.loader.systemd-boot.configurationLimit = 10; boot.loader.systemd-boot.configurationLimit = 10;
boot.initrd.luks.devices."luks-332a07bd-65fb-4d91-91ba-fe3f594063b1".device = "/dev/disk/by-uuid/332a07bd-65fb-4d91-91ba-fe3f594063b1"; boot.initrd.luks.devices."luks-332a07bd-65fb-4d91-91ba-fe3f594063b1".device = "/dev/disk/by-uuid/332a07bd-65fb-4d91-91ba-fe3f594063b1";
boot.kernelPackages = pkgs.linuxPackages_zen; boot.kernelPackages = pkgs.linuxPackages_latest;
} }

8
modules/default.nix Normal file
View File

@@ -0,0 +1,8 @@
{ ... }:
{
imports = [
./boot.nix
./nvidia.nix
./services.nix
];
}

View File

@@ -1,11 +1,33 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
services.flatpak.enable = true;
services.xserver.videoDrivers = ["nvidia"]; services.xserver.videoDrivers = ["nvidia"];
services.xserver.enable = true; services.xserver.enable = true;
services.flatpak.enable = true;
services.displayManager.sddm.enable = true; services.displayManager.sddm.enable = true;
services.desktopManager.plasma6.enable = true; services.desktopManager.plasma6.enable = true;
services.displayManager.sddm.wayland.enable = true;
# services.xserver.displayManager.gdm.enable = true;
# services.xserver.desktopManager.gnome.enable = true;
# environment.gnome.excludePackages = (with pkgs; [
# atomix # puzzle game
# cheese # webcam tool
# epiphany # web browser
# evince # document viewer
# geary # email reader
# gedit # text editor
# gnome-characters
# gnome-music
# gnome-photos
# gnome-terminal
# gnome-tour
# hitori # sudoku game
# iagno # go game
# tali # poker game
# totem # video player
# ]);
# Configure keymap in X11 # Configure keymap in X11
services.xserver.xkb = { services.xserver.xkb = {

View File

@@ -1,34 +0,0 @@
{ pkgs, config, ... }:
{
# Currently trying to get rid of stylix
# stylix.enable = false;
# stylix.image = pkgs.fetchurl {
# url = "https://wallpaperaccess.com/full/4268145.jpg";
# sha256 = "06c8jmm7m0n4xlfki8sx6msdjjjbyydpyxs4k71d1lxn20ga2zph";
# };
# stylix.base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml";
# stylix.cursor.package = pkgs.bibata-cursors;
# stylix.cursor.name = "Bibata-Modern-Classic";
# stylix.cursor.size = 24;
# stylix.fonts = {
# monospace = {
# package = pkgs.nerd-fonts.jetbrains-mono;
# name = "JetBrainsMono Nerd Font";
# };
# sansSerif = {
# package = pkgs.dejavu_fonts;
# name = "DejaVu Sans";
# };
# serif = {
# package = pkgs.dejavu_fonts;
# name = "DejaVu Serif";
# };
# sizes = {
# terminal = 16;
# desktop = 10;
# popups = 10;
# applications = 10;
# };
# };
# stylix.polarity = "dark";
}