"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"; url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
# hyprlock = {
# url = "github:hyprwm/hyprlock";
# inputs.hyprland.follows = "hyprland";
# };
home-manager = { home-manager = {
url = "github:nix-community/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 { nixosConfigurations.default = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {inherit inputs;}; specialArgs = {inherit inputs;};
modules = [ modules = [
({pkgs, ...}: {
# Let 'nixos-version --json' know about the Git revision
# of this flake.
system.configurationRevision = self.lastModifiedDate;
})
./hosts/default/configuration.nix ./hosts/default/configuration.nix
inputs.home-manager.nixosModules.default inputs.home-manager.nixosModules.default
]; ];

View File

@ -1,14 +1,18 @@
# Edit this configuration file to define what should be installed on # Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help). # and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, inputs, ... }:
{ {
imports = config,
[ # Include the results of the hardware scan. pkgs,
inputs,
...
}: {
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
inputs.home-manager.nixosModules.default inputs.home-manager.nixosModules.default
# Secrets Manager
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
]; ];
@ -81,7 +85,6 @@
alsa.support32Bit = true; alsa.support32Bit = true;
pulse.enable = true; pulse.enable = true;
jack.enable = true; jack.enable = true;
}; };
users.groups.fsc = { users.groups.fsc = {
@ -110,9 +113,7 @@
nerdfonts nerdfonts
]; ];
programs = { programs = {
steam = { steam = {
enable = true; enable = true;
}; };
@ -145,8 +146,6 @@
variables = { variables = {
EDITOR = "hx"; EDITOR = "hx";
}; };
}; };
hardware = { hardware = {
@ -162,6 +161,14 @@ home-manager = {
"root" = { "root" = {
home.stateVersion = "23.11"; home.stateVersion = "23.11";
home.file.".config/helix".source = ../../dotfiles/helix; home.file.".config/helix".source = ../../dotfiles/helix;
programs.bash = {
enable = true;
shellAliases = {
ls = "eza -la --git";
grep = "rg";
cat = "bat";
};
};
}; };
}; };
}; };
@ -171,58 +178,106 @@ home-manager = {
xdg.portal.enable = true; xdg.portal.enable = true;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
age # nix specific
## Secrets Manager
sops 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
(waybar.overrideAttrs (oldAttrs: { (
waybar.overrideAttrs (oldAttrs: {
mesonFlags = oldAttrs.mesonFlags ++ ["-Dexperimental=true"]; mesonFlags = oldAttrs.mesonFlags ++ ["-Dexperimental=true"];
}) })
) )
## ???
dunst dunst
## Notification Daemone (?)
libnotify libnotify
swww ## File Manager
broot
jq
poppler
fzf
dolphin dolphin
breeze-icons breeze-icons
# cifs-utils ## ???
swww
networkmanagerapplet # Clipboard Manager
alacritty xclip
xdg-desktop-portal-gtk
xdg-desktop-portal-hyprland
rofi-wayland
pavucontrol
blueman
hyprlock
# Image Manipulation
inkscape inkscape
gimp gimp
ffmpeg
xclip
eza
bat
ripgrep
gitFull
rustup
helix
# vim
thunderbird
# Video
ffmpeg
vlc vlc
# Music
spotify 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; [ services.xserver.excludePackages =
(with pkgs; [
nano nano
xterm xterm
]) ++ ( with pkgs.gnome; [ ])
++ (with pkgs.gnome; [
cheese cheese
gnome-music gnome-music
epiphany epiphany
@ -256,7 +311,6 @@ home-manager = {
fsType = "cifs"; fsType = "cifs";
options = let options = let
automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s,user"; 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"]; in ["${automount_opts},credentials=${config.sops.secrets."nas".path},uid=1000,gid=1010"];
}; };
"/mnt/shared" = { "/mnt/shared" = {
@ -264,7 +318,6 @@ home-manager = {
fsType = "cifs"; fsType = "cifs";
options = let options = let
automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s,user"; 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"]; in ["${automount_opts},credentials=${config.sops.secrets."nas".path},uid=1000,gid=1010"];
}; };
}; };
@ -276,5 +329,4 @@ home-manager = {
]; ];
system.stateVersion = "23.11"; # Did you read the comment? system.stateVersion = "23.11"; # Did you read the comment?
} }

View File

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

View File

@ -1,9 +1,9 @@
{ config, pkgs, inputs, ... }:
{ {
# imports = [ config,
# inputs.sops-nix.nixosModules.sops pkgs,
# ]; inputs,
...
}: {
home.username = "itsscb"; home.username = "itsscb";
home.homeDirectory = "/home/itsscb"; home.homeDirectory = "/home/itsscb";
@ -88,6 +88,7 @@
enable = true; enable = true;
shellAliases = { shellAliases = {
ls = "eza -la --git"; ls = "eza -la --git";
grep = "rg";
cat = "bat"; cat = "bat";
}; };
}; };
@ -99,14 +100,12 @@
extraConfig = { extraConfig = {
credential.helper = "store"; credential.helper = "store";
}; };
# init = {
# defaultBranch = "main";
# };
}; };
vim = { vim = {
enable = true; enable = true;
}; };
chromium = { chromium = {
enable = true; enable = true;
commandLineArgs = [ commandLineArgs = [
@ -142,13 +141,11 @@
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".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/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".custom-keybindings = ["/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/" "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/"];
}; };
home.packages = [ home.packages = [
]; ];
wayland.windowManager.hyprland.enable = true; wayland.windowManager.hyprland.enable = true;
wayland.windowManager.hyprland.settings = { wayland.windowManager.hyprland.settings = {
exec-once = [ exec-once = [
"swww-daemon" "swww-daemon"
"swww img /etc/nixos/dotfiles/hypr/rust.png" "swww img /etc/nixos/dotfiles/hypr/rust.png"
@ -177,7 +174,6 @@ wayland.windowManager.hyprland.settings = {
allow_tearing = false; allow_tearing = false;
}; };
decoration = { decoration = {
rounding = 10; rounding = 10;
@ -206,7 +202,6 @@ wayland.windowManager.hyprland.settings = {
"fade, 1, 7, default" "fade, 1, 7, default"
"workspaces, 1, 6, default" "workspaces, 1, 6, default"
]; ];
}; };
gestures = { gestures = {
@ -225,7 +220,6 @@ wayland.windowManager.hyprland.settings = {
touchpad = { touchpad = {
natural_scroll = "yes"; natural_scroll = "yes";
}; };
}; };
master = { master = {

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> {} }: {pkgs ? import <nixpkgs> {}}: let
let overrides = builtins.fromTOML (builtins.readFile ./rust-toolchain.toml);
overrides = (builtins.fromTOML (builtins.readFile ./rust-toolchain.toml)); libPath = with pkgs;
libPath = with pkgs; lib.makeLibraryPath [ lib.makeLibraryPath [
# load external libraries that you need in your rust project here # load external libraries that you need in your rust project here
]; ];
in in
@ -20,9 +20,9 @@ in
export PATH=$PATH:''${RUSTUP_HOME:-~/.rustup}/toolchains/$RUSTC_VERSION-x86_64-unknown-linux-gnu/bin/ export PATH=$PATH:''${RUSTUP_HOME:-~/.rustup}/toolchains/$RUSTC_VERSION-x86_64-unknown-linux-gnu/bin/
''; '';
# Add precompiled library to rustc search path # 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) # add libraries here (e.g. pkgs.libvmi)
]); ];
LD_LIBRARY_PATH = libPath; LD_LIBRARY_PATH = libPath;
# Add glibc, clang, glib, and other headers to bindgen search path # Add glibc, clang, glib, and other headers to bindgen search path
BINDGEN_EXTRA_CLANG_ARGS = BINDGEN_EXTRA_CLANG_ARGS =