dev environment setup

This commit is contained in:
Daniel Bulant 2024-07-16 14:46:05 +02:00
parent 122f159832
commit 483c40dfc4
5 changed files with 105 additions and 46 deletions

1
.default-python-packages Normal file
View file

@ -0,0 +1 @@
pipx

View file

@ -2,12 +2,17 @@
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }:
{ config, pkgs, lib, ... }:
let
unstable-pkgs = import <nixos-unstable> {};
in
{
imports =
[ # Include the results of the hardware scan.
[
<nixos-hardware/lenovo/legion/16ach6h/hybrid>
./hardware-configuration.nix
<home-manager/nixos>
./cachix.nix
];
# Bootloader.
@ -15,6 +20,15 @@
boot.loader.efi.canTouchEfiVariables = true;
boot.supportedFilesystems = [ "ntfs" ];
fileSystems."/media/New BTRFS" = {
device = "/dev/disk/by-uuid/26b1fa88-e270-45c7-a6c0-d46c9d4c6c90";
fsType = "btrfs";
};
fileSystems."/media/secondary" = {
device = "/dev/disk/by-uuid/050574C34881C3B9";
fsType = "ntfs";
};
networking.hostName = "lenovo-nix";
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
@ -57,11 +71,15 @@
pulse.enable = true;
#jack.enable = true;
};
services.geoclue2.enable = true;
services.localtimed.enable = true;
time.hardwareClockInLocalTime = true;
users.users.dan = {
isNormalUser = true;
description = "John";
extraGroups = [ "networkmanager" "wheel" ];
extraGroups = [ "networkmanager" "wheel" "docker" "fuse" ];
shell = pkgs.fish;
packages = with pkgs; [
kdePackages.kate
# thunderbird
@ -75,9 +93,11 @@
programs.firefox.enable = true;
programs.hyprland.enable = true;
programs.hyprland.package = unstable-pkgs.hyprland;
programs.hyprlock.enable = true;
services.hypridle.enable = true;
programs.fish.enable = true;
programs.nix-ld.enable = true; # Fix dynamic binaries from outside of nix
services.openssh.enable = true;
services.tailscale = {
enable = true;
@ -86,6 +106,7 @@
extraUpFlags = [ "--advertise-exit-node" ];
};
hardware.opentabletdriver.enable = true;
virtualisation.docker.enable = true;
environment.systemPackages = with pkgs; [
@ -96,51 +117,18 @@
];
nixpkgs.config.allowUnfree = true;
nixpkgs.config.cudaSupport = true;
# The nvidia fun part
hardware.opengl.enable = true;
services.xserver.videoDrivers = ["nvidia"];
hardware.nvidia = {
prime = {
# hardware specific, beware!
amdgpuBusId = "PCI:01:00:0";
nvidiaBusId = "PCI:06:00:0";
offload = {
enable = true;
enableOffloadCmd = true;
amdgpuBusId = lib.mkForce "PCI:01:00:0";
nvidiaBusId = lib.mkForce "PCI:06:00:0";
};
};
# Modesetting is required.
modesetting.enable = true;
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
# Enable this if you have graphical corruption issues or application crashes after waking
# up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead
# of just the bare essentials.
powerManagement.enable = false;
# Fine-grained power management. Turns off GPU when not in use.
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
powerManagement.finegrained = false;
# Use the NVidia open source kernel module (not to be confused with the
# independent third-party "nouveau" open source driver).
# Support is limited to the Turing and later architectures. Full list of
# supported GPUs is at:
# https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
# Only available from driver 515.43.04+
# Currently alpha-quality/buggy, so false is currently the recommended setting.
open = false;
# Enable the Nvidia settings menu,
# accessible via `nvidia-settings`.
nvidiaSettings = true;
# Optionally, you may need to select the appropriate driver version for your specific GPU.
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
security.polkit.enable = true;
@ -161,4 +149,6 @@
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.05"; # Did you read the comment?
nix.settings.experimental-features = [ "nix-command" "flakes" ];
}

View file

@ -1,4 +1,8 @@
{ pkgs, ...}: {
{ pkgs, ...}:
let
unstable-pkgs = import <nixos-unstable> {};
in
{
home = {
stateVersion = "24.05";
@ -40,7 +44,19 @@
slurp
wl-clipboard
nextcloud-client
python3
kdePackages.partitionmanager
kdePackages.filelight
kdePackages.kate
xorg.xbacklight
cachix
playerctl
libcanberra-gtk3 # sound events
qt6ct
nil # nix language server
jq
htmlq
fzf
strace
ghidra
@ -57,6 +73,23 @@
feroxbuster
python312Packages.pypykatz
screen
(python312.withPackages (ps: with ps; [
pyquery
pygobject3
]))
pipx
gobject-introspection
unstable-pkgs.prisma-engines
openssl
gcc
# required by mise plugins
automake
autoconf
ncurses
pkg-config
gnumake
];
};
programs = {
@ -65,8 +98,13 @@
interactiveShellInit = ''
set fish_greeting # Disable greeting
'';
shellInit = ''
shellInit = with unstable-pkgs; ''
source ~/.config/fish/config-old.fish
set -x PRISMA_SCHEMA_ENGINE_BINARY "${prisma-engines}/bin/schema-engine"
set -x PRISMA_QUERY_ENGINE_BINARY "${prisma-engines}/bin/query-engine"
set -x PRISMA_QUERY_ENGINE_LIBRARY "${prisma-engines}/lib/libquery_engine.node"
set -x PRISMA_FMT_BINARY "${prisma-engines}/bin/prisma-fmt"
'';
plugins = with pkgs.fishPlugins; [
{ name = "grc"; src = grc.src; }
@ -88,8 +126,37 @@
bat.enable = true;
lsd.enable = true;
fastfetch.enable = true;
mise.enable = true;
mise = {
enable = true;
globalConfig = {
tools = {
usage = "latest";
node = "latest";
python = "3";
terraform = "latest";
erlang = "latest";
gleam = "latest";
"pipx:pypykats" = "latest";
"pipx:pyquery" = "latest";
"pipx:pygobject" = "latest";
"npm:pnpm" = "latest";
};
plugins = {
gleam = "https://github.com/asdf-community/asdf-gleam.git";
};
env = {
MISE_NODE_COMPILE = "false";
MISE_PYTHON_COMPILE = "false";
MISE_NODE_COREPACK = "true";
};
};
settings = {
python_compile = false;
python_precompiled_os = "unknown-linux-musl";
};
};
direnv.enable = true;
direnv.nix-direnv.enable = true;
# firefox.enable = true;
};
services.kdeconnect.enable = true;

View file

@ -1,3 +1,4 @@
sudo nix-channel --add https://github.com/nix-community/home-manager/archive/release-24.05.tar.gz home-manager
sudo nix-channel --add https://github.com/NixOS/nixos-hardware/archive/master.tar.gz nixos-hardware
sudo nix-channel --add https://nixos.org/channels/nixos-unstable nixos-unstable
sudo nix-channel --update

View file

@ -1,5 +1,5 @@
echo "Copying configurations"
cp .config/* ~/.config/ -r
sudo cp configuration.nix /etc/nixos/configuration.nix
sudo cp home.nix /etc/nixos/home.nix
cp .default-python-packages ~
sudo cp *.nix /etc/nixos/
sudo nixos-rebuild switch