"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,14 +1,18 @@
# 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.
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
];
@ -81,7 +85,6 @@
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
};
users.groups.fsc = {
@ -110,9 +113,7 @@
nerdfonts
];
programs = {
steam = {
enable = true;
};
@ -145,8 +146,6 @@
variables = {
EDITOR = "hx";
};
};
hardware = {
@ -162,6 +161,14 @@ home-manager = {
"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";
};
};
};
};
};
@ -171,58 +178,106 @@ home-manager = {
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
## ???
swww
networkmanagerapplet
alacritty
xdg-desktop-portal-gtk
xdg-desktop-portal-hyprland
rofi-wayland
pavucontrol
blueman
hyprlock
# 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; [
services.xserver.excludePackages =
(with pkgs; [
nano
xterm
]) ++ ( with pkgs.gnome; [
])
++ (with pkgs.gnome; [
cheese
gnome-music
epiphany
@ -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,7 +318,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"];
};
};
@ -276,5 +329,4 @@ home-manager = {
];
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
# 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"];
@ -13,21 +17,21 @@
boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = [];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/b57531b3-bf78-466e-a2f7-7eab09ce9284";
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";
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

View File

@ -1,9 +1,9 @@
{ config, pkgs, inputs, ... }:
{
# imports = [
# inputs.sops-nix.nixosModules.sops
# ];
config,
pkgs,
inputs,
...
}: {
home.username = "itsscb";
home.homeDirectory = "/home/itsscb";
@ -88,6 +88,7 @@
enable = true;
shellAliases = {
ls = "eza -la --git";
grep = "rg";
cat = "bat";
};
};
@ -99,14 +100,12 @@
extraConfig = {
credential.helper = "store";
};
# init = {
# defaultBranch = "main";
# };
};
vim = {
enable = true;
};
chromium = {
enable = true;
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".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 = {
exec-once = [
"swww-daemon"
"swww img /etc/nixos/dotfiles/hypr/rust.png"
@ -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 = {
@ -225,7 +220,6 @@ wayland.windowManager.hyprland.settings = {
touchpad = {
natural_scroll = "yes";
};
};
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> {} }:
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
@ -20,9 +20,9 @@ in
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 =