"20240512111706"

This commit is contained in:
itsscb 2024-05-12 23:50:07 +02:00
parent 5c4533e893
commit 63da041bf5
7 changed files with 335 additions and 224 deletions

View File

@ -14,10 +14,6 @@
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# hyprlock = {
# url = "github:hyprwm/hyprlock";
# inputs.hyprland.follows = "hyprland";
# };
home-manager = {
url = "github:nix-community/home-manager";
@ -25,10 +21,21 @@
};
};
outputs = { self, nixpkgs, ... }@inputs: {
outputs = {
self,
nixpkgs,
...
} @ inputs: {
inherit self;
nixosConfigurations.default = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {inherit inputs;};
modules = [
({pkgs, ...}: {
# Let 'nixos-version --json' know about the Git revision
# of this flake.
system.configurationRevision = self.lastModifiedDate;
})
./hosts/default/configuration.nix
inputs.home-manager.nixosModules.default
];

View File

@ -1,16 +1,20 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, inputs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
inputs.home-manager.nixosModules.default
inputs.sops-nix.nixosModules.sops
];
config,
pkgs,
inputs,
...
}: {
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
inputs.home-manager.nixosModules.default
# Secrets Manager
inputs.sops-nix.nixosModules.sops
];
sops.validateSopsFiles = false;
sops.defaultSopsFile = "/etc/nixos/secrets/secrets.yaml";
@ -32,7 +36,7 @@
boot.initrd.luks.devices."luks-ddb552e7-c477-4d71-899b-9224d6782b9f".device = "/dev/disk/by-uuid/ddb552e7-c477-4d71-899b-9224d6782b9f";
networking.hostName = "scbnb"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
nix.settings.experimental-features = [ "nix-command" "flakes"];
nix.settings.experimental-features = ["nix-command" "flakes"];
# Enable networking
networking.networkmanager.enable = true;
@ -63,7 +67,7 @@
services.xserver.desktopManager.gnome.enable = true;
# Configure keymap in X11
services.xserver.xkb= {
services.xserver.xkb = {
layout = "us";
variant = "";
};
@ -81,7 +85,6 @@
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
};
users.groups.fsc = {
@ -93,37 +96,35 @@
isNormalUser = true;
uid = 1000;
description = "itsscb";
extraGroups = [ "networkmanager" "wheel" "fsc"];
extraGroups = ["networkmanager" "wheel" "fsc"];
packages = with pkgs; [
];
];
};
users.users."k.sc"= {
users.users."k.sc" = {
isNormalUser = true;
uid = 1001;
description = "k.sc";
extraGroups = [ "networkmanager" "fsc"];
extraGroups = ["networkmanager" "fsc"];
packages = with pkgs; [
];
];
};
fonts.packages = with pkgs; [
nerdfonts
];
programs = {
steam = {
enable = true;
enable = true;
};
hyprland = {
enable = true;
xwayland.enable = true;
};
chromium = {
enable=true;
enable = true;
homepageLocation = "https://start.duckduckgo.com";
extraOpts = {
syncDisabled = true;
@ -131,7 +132,7 @@
PasswordManagerEnabled = false;
SpellcheckEnabled = false;
};
defaultSearchProviderEnabled= true;
defaultSearchProviderEnabled = true;
defaultSearchProviderSearchURL = "https://start.duckduckgo.com/?q={searchTerms}";
};
};
@ -141,12 +142,10 @@
WLR_NO_HARDWARE_CURSORS = "1";
NIXOS_OZONE_WL = "1";
};
variables = {
EDITOR = "hx";
};
};
hardware = {
@ -154,85 +153,141 @@
nvidia.modesetting.enable = true;
};
home-manager = {
extraSpecialArgs = { inherit inputs; };
backupFileExtension = "backup";
users = {
"itsscb" = import ./home.nix; # ( config.sops.secrets."git");
"root" = {
home.stateVersion = "23.11";
home.file.".config/helix".source = ../../dotfiles/helix;
home-manager = {
extraSpecialArgs = {inherit inputs;};
backupFileExtension = "backup";
users = {
"itsscb" = import ./home.nix; # ( config.sops.secrets."git");
"root" = {
home.stateVersion = "23.11";
home.file.".config/helix".source = ../../dotfiles/helix;
programs.bash = {
enable = true;
shellAliases = {
ls = "eza -la --git";
grep = "rg";
cat = "bat";
};
};
};
};
};
};
nixpkgs.config.allowUnfree = true;
xdg.portal.enable = true;
environment.systemPackages = with pkgs; [
age
# nix specific
## Secrets Manager
sops
curl
## nix formatter
alejandra
# Encryption
age
# Hyprland / Window Manager
xdg-desktop-portal-gtk
xdg-desktop-portal-hyprland
## App Starter
rofi-wayland
## Network Settings
networkmanagerapplet
# Audio Settings
pavucontrol
## Bluetooth Settings
blueman
## Lockscreen
hyprlock
## Top Bar
waybar
(waybar.overrideAttrs (oldAttrs: {
(
waybar.overrideAttrs (oldAttrs: {
mesonFlags = oldAttrs.mesonFlags ++ ["-Dexperimental=true"];
})
)
## ???
dunst
## Notification Daemone (?)
libnotify
swww
broot
jq
poppler
fzf
## File Manager
dolphin
breeze-icons
# cifs-utils
networkmanagerapplet
alacritty
xdg-desktop-portal-gtk
xdg-desktop-portal-hyprland
rofi-wayland
pavucontrol
blueman
hyprlock
## ???
swww
# Clipboard Manager
xclip
# Image Manipulation
inkscape
gimp
ffmpeg
xclip
eza
bat
ripgrep
gitFull
rustup
helix
# vim
thunderbird
# Video
ffmpeg
vlc
# Music
spotify
# Terminal
alacritty
## 'ls' replacement
eza
## 'cat' replacement
bat
## 'grep' replacement
ripgrep
## 'find' replacement
fd
## Default Tools
curl
gitFull # git
broot # file manager
jq # json tool
poppler # ???
fzf # ???
# Editor
helix
# Mail Client
thunderbird
];
services.xserver.excludePackages = (with pkgs; [
nano
xterm
]) ++ ( with pkgs.gnome; [
cheese
gnome-music
epiphany
geary
totem
tali
iagno
hitori
atomix
]);
services.xserver.excludePackages =
(with pkgs; [
nano
xterm
])
++ (with pkgs.gnome; [
cheese
gnome-music
epiphany
geary
totem
tali
iagno
hitori
atomix
]);
fileSystems = {
"/mnt/home" = {
@ -256,7 +311,6 @@ home-manager = {
fsType = "cifs";
options = let
automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s,user";
in ["${automount_opts},credentials=${config.sops.secrets."nas".path},uid=1000,gid=1010"];
};
"/mnt/shared" = {
@ -264,17 +318,15 @@ home-manager = {
fsType = "cifs";
options = let
automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s,user";
in ["${automount_opts},credentials=${config.sops.secrets."nas".path},uid=1000,gid=1010"];
};
};
programs.nix-ld.enable = true;
programs.nix-ld.libraries = with pkgs; [
# Add any missing dynamic libraries for unpackaged
# Add any missing dynamic libraries for unpackaged
# programs here, NOT in environment.systemPackages
];
system.stateVersion = "23.11"; # Did you read the comment?
}

View File

@ -1,34 +1,38 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"];
boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = [];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/b57531b3-bf78-466e-a2f7-7eab09ce9284";
fsType = "ext4";
};
fileSystems."/" = {
device = "/dev/disk/by-uuid/b57531b3-bf78-466e-a2f7-7eab09ce9284";
fsType = "ext4";
};
boot.initrd.luks.devices."luks-1ed60977-b0ee-4751-99f3-05f0b224634b".device = "/dev/disk/by-uuid/1ed60977-b0ee-4751-99f3-05f0b224634b";
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/59A3-0BC5";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/59A3-0BC5";
fsType = "vfat";
options = ["fmask=0022" "dmask=0022"];
};
swapDevices =
[ { device = "/dev/disk/by-uuid/968cd561-fb73-496a-a37a-0e662bf45597"; }
];
swapDevices = [
{device = "/dev/disk/by-uuid/968cd561-fb73-496a-a37a-0e662bf45597";}
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's

View File

@ -1,93 +1,94 @@
{ config, pkgs, inputs, ... }:
{
# imports = [
# inputs.sops-nix.nixosModules.sops
# ];
config,
pkgs,
inputs,
...
}: {
home.username = "itsscb";
home.homeDirectory = "/home/itsscb";
home.stateVersion = "23.11"; # Please read the comment before changing.
programs = {
helix = {
enable = true;
defaultEditor = true;
settings = {
theme = "onedark";
editor = {
line-number = "relative";
bufferline = "multiple";
auto-completion = true;
auto-save = true;
auto-format = true;
cursorline = true;
gutters = [
"diff"
"diagnostics"
"line-numbers"
"spacer"
];
text-width = 80;
cursor-shape = {
helix = {
enable = true;
defaultEditor = true;
settings = {
theme = "onedark";
editor = {
line-number = "relative";
bufferline = "multiple";
auto-completion = true;
auto-save = true;
auto-format = true;
cursorline = true;
gutters = [
"diff"
"diagnostics"
"line-numbers"
"spacer"
];
text-width = 80;
cursor-shape = {
insert = "bar";
normal = "block";
select = "underline";
};
select = "underline";
};
statusline = {
left = [
"mode"
"spinner"
"file-modification-indicator"
"read-only-indicator"
];
statusline = {
left = [
"mode"
"spinner"
"file-modification-indicator"
"read-only-indicator"
];
center = ["file-name"];
center = ["file-name"];
right = [
"diagnostics"
"register"
"selections"
"position"
"file-encoding"
"file-line-ending"
"file-type"
];
right = [
"diagnostics"
"register"
"selections"
"position"
"file-encoding"
"file-line-ending"
"file-type"
];
separator = "|";
};
separator = "|";
};
lsp = {
enable = true;
auto-signature-help = true;
display-messages = true;
display-inlay-hints = true;
};
lsp = {
enable = true;
auto-signature-help = true;
display-messages = true;
display-inlay-hints = true;
};
indent-guides = {
render = true;
character = "";
skip-levels = 1;
};
indent-guides = {
render = true;
character = "";
skip-levels = 1;
};
};
keys.insert.j.k="normal_mode";
keys.insert."C-c"="normal_mode";
keys.insert.j.k = "normal_mode";
keys.insert."C-c" = "normal_mode";
keys.normal.g.a = "code_action";
keys.normal.backspace = {
r = ":run-shell-command cargo run";
t = ":run-shell-command cargo test";
b = ":run-shell-command cargo build";
c = ":run-shell-command cargo check";
};
};
};
keys.normal.g.a = "code_action";
keys.normal.backspace = {
r=":run-shell-command cargo run";
t=":run-shell-command cargo test";
b=":run-shell-command cargo build";
c=":run-shell-command cargo check";
};
};
};
bash = {
enable = true;
shellAliases = {
ls = "eza -la --git";
grep = "rg";
cat = "bat";
};
};
@ -99,16 +100,14 @@
extraConfig = {
credential.helper = "store";
};
# init = {
# defaultBranch = "main";
# };
};
vim = {
enable=true;
enable = true;
};
chromium = {
enable=true;
enable = true;
commandLineArgs = [
"--disable-default-apps"
"--homepage https://start.duckduckgo.com"
@ -133,22 +132,20 @@
settings."org/gnome/desktop/background".secondary-color = "#000000";
settings."org/gnome/desktop/interface".show-battery-percentage = true;
settings."org/gnome/settings-daemon/plugins/media-keys".home = ["<Super>e"];
settings."org/gnome/settings-daemon/plugins/media-keys".control-center= ["<Super>i"];
settings."org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0".binding= "<Super>t";
settings."org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0".command= "gnome-terminal";
settings."org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0".name= "gt1";
settings."org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1".binding= "<Control><Alt>t";
settings."org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1".command= "gnome-terminal";
settings."org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1".name= "gt2";
settings."org/gnome/settings-daemon/plugins/media-keys".custom-keybindings= ["/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/" "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/"];
settings."org/gnome/settings-daemon/plugins/media-keys".control-center = ["<Super>i"];
settings."org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0".binding = "<Super>t";
settings."org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0".command = "gnome-terminal";
settings."org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0".name = "gt1";
settings."org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1".binding = "<Control><Alt>t";
settings."org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1".command = "gnome-terminal";
settings."org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1".name = "gt2";
settings."org/gnome/settings-daemon/plugins/media-keys".custom-keybindings = ["/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/" "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/"];
};
home.packages = [
];
wayland.windowManager.hyprland.enable = true;
wayland.windowManager.hyprland.settings = {
wayland.windowManager.hyprland.enable = true;
wayland.windowManager.hyprland.settings = {
exec-once = [
"swww-daemon"
"swww img /etc/nixos/dotfiles/hypr/rust.png"
@ -157,11 +154,11 @@ wayland.windowManager.hyprland.settings = {
"waybar"
"dunst"
];
"$terminal" = "alacritty";
"$fileManager" = "dolphin";
"$menu" = "rofi -show drun";
"$mod" = "SUPER";
monitor = ",preferred,auto,1";
@ -177,7 +174,6 @@ wayland.windowManager.hyprland.settings = {
allow_tearing = false;
};
decoration = {
rounding = 10;
@ -206,7 +202,6 @@ wayland.windowManager.hyprland.settings = {
"fade, 1, 7, default"
"workspaces, 1, 6, default"
];
};
gestures = {
@ -218,14 +213,13 @@ wayland.windowManager.hyprland.settings = {
};
windowrulev2 = "suppressevent maximize, class:.*";
input = {
follow_mouse = 2;
touchpad = {
natural_scroll = "yes";
natural_scroll = "yes";
};
};
master = {
@ -236,7 +230,7 @@ wayland.windowManager.hyprland.settings = {
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
];
bind =
[
"$mod, T, exec, $terminal"
@ -277,7 +271,7 @@ wayland.windowManager.hyprland.settings = {
10)
);
};
home.file = {
".config/hypr/hyprlock.conf".source = ../../dotfiles/hypr/hyprlock.conf;
".config/waybar".source = ../../dotfiles/waybar;

52
nixos-rebuild.sh Executable file
View File

@ -0,0 +1,52 @@
#!/usr/bin/env bash
if [ -z "$1"]
then
file='configuration.nix'
else
file=$1
fi
# A rebuild script that commits on a successful build
set -e
# cd to your config dir
cd /etc/nixos/
# Edit your config
sudo hx $(fd $file . --max-results=1 -E hardware-configuration.nix -e nix)
# Early return if no changes were detected (thanks @singiamtel!)
if sudo git diff --quiet '*.nix'; then
echo "No changes detected, exiting."
cd -
exit 0
fi
sudo rm nixos-switch.log
# Autoformat your nix files
sudo alejandra . &>/dev/null \
|| ( sudo alejandra . ; echo "formatting failed!" && exit 1)
# Shows your changes
sudo git diff -U0 '*.nix'
echo -n "NixOS - Testing new configuration..."
# Rebuild, output simplified errors, log trackebacks
sudo nixos-rebuild dry-build --flake .#default &>nixos-switch.log || (cat nixos-switch.log | grep --color error && exit 1)
echo -e 'KNixOS - Test passed. Adding files to git'
sudo git add *
echo -e "NixOS - Rebuilding..."
sudo nixos-rebuild dry-build --flake .#default &>nixos-switch.log || (cat nixos-switch.log | grep --color error && sudo git restore --staged ./**/*.nix && cd - && exit 1)
# Get current generation metadata
current=$(sudo nixos-version --json | jq .configurationRevision)
# Commit all changes witih the generation metadata
sudo git commit -am "$current"
echo -e "NixOS - New Build commited as $current"
cd -

2
nixos-switch.log Normal file
View File

@ -0,0 +1,2 @@
building the system configuration...
warning: Git tree '/etc/nixos' is dirty

View File

@ -1,7 +1,7 @@
{ pkgs ? import <nixpkgs> {} }:
let
overrides = (builtins.fromTOML (builtins.readFile ./rust-toolchain.toml));
libPath = with pkgs; lib.makeLibraryPath [
{pkgs ? import <nixpkgs> {}}: let
overrides = builtins.fromTOML (builtins.readFile ./rust-toolchain.toml);
libPath = with pkgs;
lib.makeLibraryPath [
# load external libraries that you need in your rust project here
];
in
@ -14,27 +14,27 @@ in
];
RUSTC_VERSION = overrides.toolchain.channel;
# https://github.com/rust-lang/rust-bindgen#environment-variables
LIBCLANG_PATH = pkgs.lib.makeLibraryPath [ pkgs.llvmPackages_latest.libclang.lib ];
LIBCLANG_PATH = pkgs.lib.makeLibraryPath [pkgs.llvmPackages_latest.libclang.lib];
shellHook = ''
export PATH=$PATH:''${CARGO_HOME:-~/.cargo}/bin
export PATH=$PATH:''${RUSTUP_HOME:-~/.rustup}/toolchains/$RUSTC_VERSION-x86_64-unknown-linux-gnu/bin/
'';
'';
# Add precompiled library to rustc search path
RUSTFLAGS = (builtins.map (a: ''-L ${a}/lib'') [
RUSTFLAGS = builtins.map (a: ''-L ${a}/lib'') [
# add libraries here (e.g. pkgs.libvmi)
]);
];
LD_LIBRARY_PATH = libPath;
# Add glibc, clang, glib, and other headers to bindgen search path
BINDGEN_EXTRA_CLANG_ARGS =
# Includes normal include path
(builtins.map (a: ''-I"${a}/include"'') [
# add dev libraries here (e.g. pkgs.libvmi.dev)
pkgs.glibc.dev
])
# Includes with special directory paths
++ [
''-I"${pkgs.llvmPackages_latest.libclang.lib}/lib/clang/${pkgs.llvmPackages_latest.libclang.version}/include"''
''-I"${pkgs.glib.dev}/include/glib-2.0"''
''-I${pkgs.glib.out}/lib/glib-2.0/include/''
];
# Includes normal include path
(builtins.map (a: ''-I"${a}/include"'') [
# add dev libraries here (e.g. pkgs.libvmi.dev)
pkgs.glibc.dev
])
# Includes with special directory paths
++ [
''-I"${pkgs.llvmPackages_latest.libclang.lib}/lib/clang/${pkgs.llvmPackages_latest.libclang.version}/include"''
''-I"${pkgs.glib.dev}/include/glib-2.0"''
''-I${pkgs.glib.out}/lib/glib-2.0/include/''
];
}