Merge branch 'main' of github.com:asosnovsky/nixos-setup

This commit is contained in:
ari committed 2024-09-28 15:47:03 -04:00
commit 101044ca0e
23 files changed
+285 -163

No files matched your search

File renamed without changes.
File renamed without changes.
Executable
+148
View File
@@ -0,0 +1,148 @@
#!/usr/bin/env bash
set -e
# Bootstrap
## Folder handlings
set -e
ROOT_FOLDER=$(realpath $0 | xargs dirname | xargs dirname)
## Colors
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
NC='\033[0m'
BOLD='\033[1m'
BLUE_BOLD='\033[1;34m'
YELLOW_BOLD='\033[1;33m'
# Bootstrap
MENAME=$(basename $0)
LOCKS_FOLDER=/tmp/skyg/$ROOT_FOLDER/.tmp/.locks
LOCK_FILE=$LOCKS_FOLDER/.built_via_skg
mkdir -p $LOCKS_FOLDER
function lock() {
touch $LOCK_FILE
}
function unlock() {
rm -f $LOCK_FILE
}
function run-build() {
: Run nixos build and emits difference
:
unlock
echo "sudo nixos-rebuild build --flake ."
sudo nixos-rebuild build --flake .
lock
run-diff
}
function run-switch() {
: Runs nixos switch and ensures that we actually saw a build\'s difference
:
if [ ! -f $LOCK_FILE ]; then
run-build
echo "Do you want to continue? (y/N)"
read -r answer
if [[ $answer =~ ^[yY]$ ]]; then
echo "Continuing..."
else
echo "Exiting."
exit 1
fi
fi
sudo nixos-rebuild switch --flake .
unlock
}
function run-rollback() {
: Rolls back to last configuration
:
sudo nixos-rebuild switch --rollback
}
function run-update() {
: Updates a single flake and runs update
: Usage: skyg update {name-of-input}
nix flake lock --update-input ${1}
run-update
}
function run-diff() {
: Diff results to current system
:
echo -e "Running ${YELLOW_BOLD}nvd${NC}"
sudo nvd diff /run/current-system result | sed "s/^/\t│ /"
echo "press any key to continue "
read
echo -e "\t└──${NC}DONE ${BLUE_BOLD}nvd${NC}"
echo -e "Running ${YELLOW_BOLD}diff${NC}"
diff --color=always -r /run/current-system result > result.diff
cat result.diff | sed "s/^/\t│ /"
echo -e "\t└──${NC}DONE ${BLUE_BOLD}diff${NC} @ ${pwd}/result.diff"
}
function run-remote-deploy() {
: Builds locally the system and deploys to an external system
: Usage: skyg remote-deploy {target} {cmd}
target=${1}
cmd=${2}
$ROOT_FOLDER/bin/extra/build-remote-nixos ${target} ${cmd}
}
function run-build-all() {
: Builds all remote and local configurations
: Usage: skyg build-all
mkdir -p results
nix flake show --json | jq -r -c '.nixosConfigurations | keys[]' | while read i; do
echo "[[SKYG]] Building current $i"
sudo nixos-rebuild build --flake .#$i
rm -f results/$i-result
mv result results/$i-result
done
nix flake update
rm -f diffs
mkdir diffs
nix flake show --json | jq -r -c '.nixosConfigurations | keys[]' | while read i; do
echo "[[SKYG]] Building new $i"
sudo nixos-rebuild build --flake .#$i
rm -f results/$i-result-post
mv result results/$i-result-post
nvd diff results/$i-result results/$i-result-post > diffs/$i
done
}
function list_run_functions() {
declare -F | awk '$3 ~ /^run-/{sub("run-", "", $3); print $3}'
}
all_functions=$(list_run_functions)
for f in ${all_functions[@]}; do
if [ "$1" == "$f" ]; then
echo -e "Running ${BLUE_BOLD}$1${NC}"
run-$1 ${@:2} 2>&1 | sed "s/^/\t│ /"
ecode=$(echo $?)
echo -e "\t└──${NC}DONE ${BLUE_BOLD}$1${NC}"
exit $ecode
fi
done
echo -e "Invalid Command '$1' please select one of${NC}"
for function_name in $all_functions; do
start_line=$(grep -n -m 1 "function run-$function_name" "${BASH_SOURCE[0]}" | cut -d: -f1)
end_line=$(awk "NR > $start_line && /^}/ {print NR; exit}" "${BASH_SOURCE[0]}")
function_body=$(sed -n "${start_line},${end_line}p" "${BASH_SOURCE[0]}")
description=$(echo "$function_body" | sed -n '/^\s*:/,/^\s*[^:]/p' | sed 's/^\s*:\s*/ │ /')
echo -e "$BOLD\r$MENAME \`${function_name}\`$NC\n${description}\n └──────────\n"
done
-8
View File
@@ -1,8 +0,0 @@
#!/bin/sh
set -e
mkdir -p .locks
rm -f .locks/.built_via_skg
sudo nixos-rebuild build --flake .
touch .locks/.built_via_skg
nvd diff /run/current-system result
@@ -1,6 +1,6 @@
$term = alacritty
$browser = firefox
$filemanager = thunar
$filemanager = nautilus
$editor = code
$applauncher = wofi --show drun
$cmdlauncher = wofi --show run
@@ -16,7 +16,7 @@ windowrulev2 = float,class:(Rofi)
windowrulev2 = size 30% 90%,class:(Rofi)
windowrulev2 = move 5% 5%,class:(Rofi)
$centerable = (Slack|nm-connection-editor|pavucontrol|system-config-printer|lxqt-policykit-agent|amdgpu_top|.*blueman.*|thunar)
$centerable = (Slack|nm-connection-editor|pavucontrol|system-config-printer|lxqt-policykit-agent|amdgpu_top|.*blueman.*|thunar|xdg-desktop-portal-gtk)
# Centerable & Floatable
windowrulev2 = float, class:$centerable
+9 -6
View File
@@ -1,7 +1,10 @@
monitor=eDP-1,2256x1504@60.0,4176x1381,1.175
monitor=eDP-1,2256x1504@60.0,0x0,1.175
# External Monitors
monitor=DP-11,1920x1080@60.0,5186x301,1.0
monitor=DP-12,1920x1080@60.0,3266x301,1.0
monitor=DP-9,1920x1080@60.0,5186x301,1.0
monitor=DP-10,1920x1080@60.0,3266x301,1.0
# Home External Monitors
monitor=DP-9,1920x1080@60.0,1420x-1085,1.0
monitor=DP-10,1920x1080@60.0,-500x-1085,1.0
monitor=DP-11,1920x1080@60.0,1420x-1085,1.0
monitor=DP-12,1920x1080@60.0,-500x-1085,1.0
monitor=*,preffered,auto,1
Whitespace-only changes.
Generated
+27 -40
View File
@@ -20,11 +20,11 @@
]
},
"locked": {
"lastModified": 1725753098,
"narHash": "sha256-/NO/h/qD/eJXAQr/fHA4mdDgYsNT9thHQ+oT6KPi2ac=",
"lastModified": 1726665257,
"narHash": "sha256-rEzEZtd3iyVo5RJ1OGujOlnywNf3gsrOnjAn1NLciD4=",
"owner": "hyprwm",
"repo": "aquamarine",
"rev": "e4a13203112a036fc7f437d391c7810f3dd5ab52",
"rev": "752d0fbd141fabb5a1e7f865199b80e6e76f8d8e",
"type": "github"
},
"original": {
@@ -137,11 +137,11 @@
"xdph": "xdph"
},
"locked": {
"lastModified": 1726430622,
"narHash": "sha256-50vt1snpVwS5lqvvH4p6DHiEWspJUZuJ1kYy1DKtrfM=",
"lastModified": 1727257173,
"narHash": "sha256-J4VU76LLWEILNTZ8osUaUxSny+cTUH/wCKcV+Lqr3Bw=",
"ref": "refs/heads/main",
"rev": "9e356562446f44c471ae38a80506a9df039305d6",
"revCount": 5224,
"rev": "8b86ee8bf08eaf8b57d0a7f12af876216323cc3d",
"revCount": 5257,
"submodules": true,
"type": "git",
"url": "https://github.com/hyprwm/Hyprland"
@@ -208,26 +208,6 @@
"type": "github"
}
},
"hyprspace": {
"inputs": {
"hyprland": [
"hyprland"
]
},
"locked": {
"lastModified": 1726437584,
"narHash": "sha256-lMIFDORuyMYHtUPrRWU5WjGcS+ZMrR4/wBSO+sgUVSY=",
"owner": "KZDKM",
"repo": "Hyprspace",
"rev": "8f14fa2e10d24742d713f04c278bc7651037b74b",
"type": "github"
},
"original": {
"owner": "KZDKM",
"repo": "Hyprspace",
"type": "github"
}
},
"hyprutils": {
"inputs": {
"nixpkgs": [
@@ -240,11 +220,11 @@
]
},
"locked": {
"lastModified": 1724966483,
"narHash": "sha256-WXDgKIbzjYKczxSZOsJplCS1i1yrTUpsDPuJV/xpYLo=",
"lastModified": 1727219120,
"narHash": "sha256-wmT+JpnDk6EjgASU2VGfS0nnu6oKA4Cw25o5fzpDD/Q=",
"owner": "hyprwm",
"repo": "hyprutils",
"rev": "8976e3f6a5357da953a09511d0c7f6a890fb6ec2",
"rev": "db956287d3aa194dda91d05c8eb286de2a569edf",
"type": "github"
},
"original": {
@@ -265,11 +245,11 @@
]
},
"locked": {
"lastModified": 1721324119,
"narHash": "sha256-SOOqIT27/X792+vsLSeFdrNTF+OSRp5qXv6Te+fb2Qg=",
"lastModified": 1726840673,
"narHash": "sha256-HIPEXyRRVZoqD6U+lFS1B0tsIU7p83FaB9m7KT/x6mQ=",
"owner": "hyprwm",
"repo": "hyprwayland-scanner",
"rev": "a048a6cb015340bd82f97c1f40a4b595ca85cc30",
"rev": "b68dab23fc922eae99306988133ee80a40b39ca5",
"type": "github"
},
"original": {
@@ -397,7 +377,6 @@
"inputs": {
"home-manager": "home-manager",
"hyprland": "hyprland",
"hyprspace": "hyprspace",
"nix-darwin": "nix-darwin",
"nixos-cosmic": "nixos-cosmic",
"nixos-hardware": "nixos-hardware",
@@ -467,11 +446,11 @@
},
"unstable": {
"locked": {
"lastModified": 1726491728,
"narHash": "sha256-bopKO2CikcosUq+gPKRRzeaSyj4lPvrqgyfxAMLjIbM=",
"lastModified": 1727275485,
"narHash": "sha256-uoKC6huWVsGrv8YbepyeXgj5L80TEesa7s8S9+mDT4I=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "107b787d201c792c41c2d716eecc480194b8b3fe",
"rev": "3510b853efd22fd14062785300e171cd0867b7c8",
"type": "github"
},
"original": {
@@ -509,6 +488,14 @@
"hyprland",
"hyprlang"
],
"hyprutils": [
"hyprland",
"hyprutils"
],
"hyprwayland-scanner": [
"hyprland",
"hyprwayland-scanner"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
@@ -519,11 +506,11 @@
]
},
"locked": {
"lastModified": 1726046979,
"narHash": "sha256-6SEsjurq9cdTkITA6d49ncAJe4O/8CgRG5/F//s6Xh8=",
"lastModified": 1727109343,
"narHash": "sha256-1PFckA8Im7wMSl26okwOKqBZeCFLD3LvZZFaxswDhbY=",
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"rev": "e695669fd8e1d1be9eaae40f35e00f8bd8b64c18",
"rev": "4adb6c4c41ee5014bfe608123bfeddb26e5f5cea",
"type": "github"
},
"original": {
+4 -8
View File
@@ -17,10 +17,6 @@
inputs.nixpkgs.follows = "unstable";
inputs.systems.follows = "systems";
};
hyprspace = {
url = "github:KZDKM/Hyprspace";
inputs.hyprland.follows = "hyprland";
};
# Home manager
home-manager = {
url = "github:nix-community/home-manager/release-24.05";
@@ -47,7 +43,6 @@
, unstable-home-manager
, nix-darwin
, hyprland
, hyprspace
, nixos-cosmic
}:
let
@@ -96,8 +91,8 @@
specialArgs = {
inputs = {
inherit
hyprspace
hyprland;
hyprland
unstable;
};
};
};
@@ -141,7 +136,8 @@
nixd
];
shellHook = ''
export PROMPT="<nixos-setup> "$PROMPT
export PS1="<nixos-setup> $PS1"
export PATH=$PATH:$(pwd)/bin
'';
};
});
+9 -14
View File
@@ -70,24 +70,19 @@ in
dvc-with-remotes
google-cloud-sdk
awscli
dbeaver-bin
# Web
chromium
unstable.dbeaver-bin
# Photo Editing
krita
gimp-with-plugins
];
programs.firefox = {
enable = true;
};
programs.chromium = {
enable = true;
enablePlasmaBrowserIntegration = true;
extensions = [
"cjpalhdlnbpafiamejdnhcphjbkeiagm" # ublock origin
"nngceckbapebfimnlniiiahkandclblb" # bitwarden
];
};
# programs.chromium = {
# enable = true;
# enablePlasmaBrowserIntegration = true;
# extensions = [
# "cjpalhdlnbpafiamejdnhcphjbkeiagm" # ublock origin
# "nngceckbapebfimnlniiiahkandclblb" # bitwarden
# ];
# };
# # Opengl
hardware.opengl = {
+5
View File
@@ -23,6 +23,11 @@
services.xserver.videoDrivers = [ "nvidia" ];
services.xserver.enable = true;
services.openssh.settings.X11Forwarding = true;
services.xserver.displayManager.gdm.autoLogin.delay = 0;
services.displayManager.autoLogin = {
enable = true;
user = config.skyg.user.name;
};
hardware.graphics.enable32Bit = true;
hardware.graphics.enable = true;
#hardware.opengl.enable = true;
+2
View File
@@ -25,6 +25,7 @@ in
"https://cache.nixos.org"
"https://cache.flox.dev"
"https://devenv.cachix.org"
"https://hyprland.cachix.org"
] ++ cfg.urls;
nix.settings.trusted-substituters = [
"https://cache.flox.dev"
@@ -33,6 +34,7 @@ in
nix.settings.trusted-public-keys = [
"flox-cache-public-1:7F4OyH7ZCnFhcze3fJdfyXYLQw/aV7GEed86nQ7IsOs="
"devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
] ++ cfg.keys;
nix.settings.trusted-users = [ "root" skygUser.name ];
};
+3
View File
@@ -30,3 +30,6 @@ sync = "!f() { \
clean-branches = "!f() { \
git for-each-ref --format '%(refname:short)' refs/heads| grep -v 'master\\|main' | xargs git branch -D ; \
}; f";
# aliases = "!f() { \
# git config --get-regexp alias | awk '{print $1}' | sed 's/alias\./ - /' \
# }; f"
+3 -1
View File
@@ -28,7 +28,9 @@ let
let joinedttrs = masterAttrs // attrs;
in
nixpkgs.lib.nixosSystem {
inherit specialArgs;
specialArgs = specialArgs // {
inherit system;
};
system = system;
modules = (makeImports {
attrs = joinedttrs;
+2
View File
@@ -23,6 +23,8 @@ in
services.displayManager.sddm.enable = false;
services.displayManager.sddm.wayland.enable = false;
services.xserver.displayManager.gdm.enable = true;
services.xserver.displayManager.gdm.autoSuspend = false;
services.xserver.displayManager.gdm.banner = ''Ari's PC'';
services.xserver.displayManager.gdm.wayland = true;
xdg = {
autostart.enable = true;
+42 -35
View File
@@ -1,42 +1,49 @@
{ config, lib, pkgs, inputs, ... }:
let
cfg = config.skyg.nixos.desktop.hyprland;
hyprpkgs = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system};
in
{
config = lib.mkIf cfg.enabled {
programs.hyprland = {
enable = true;
# package = hyprpkgs.hyprland;
portalPackage = pkgs.xdg-desktop-portal-hyprland;
xwayland.enable = true;
systemd.setPath.enable = true;
config =
let
hyprpkgs =
if cfg.useDevelopmentMode then inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}
else pkgs
;
in
lib.mkIf cfg.enabled {
programs.hyprland = {
enable = true;
package = hyprpkgs.hyprland;
portalPackage = hyprpkgs.xdg-desktop-portal-hyprland;
xwayland.enable = true;
systemd.setPath.enable = true;
};
xdg.portal.extraPortals = [ hyprpkgs.xdg-desktop-portal-hyprland ];
services.hypridle.enable = true;
environment.sessionVariables = { NIXOS_OZONE_WL = "1"; };
environment.systemPackages = with pkgs; [
# sound
pavucontrol
# notification daemon
dunst
libnotify
# App Support
xwaylandvideobridge
lxqt.lxqt-policykit
xdg-desktop-portal
auto-cpufreq
# general utilities
brightnessctl # brightness ctl
networkmanagerapplet # networking
];
# <Sound
services.mpd.enable = true;
services.pipewire.wireplumber.enable = true;
users.users.${config.skyg.user.name}.extraGroups = [ "input" ];
# Sound />
};
xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-hyprland ];
services.hypridle.enable = true;
environment.sessionVariables = { NIXOS_OZONE_WL = "1"; };
environment.systemPackages = with pkgs; [
# sound
pavucontrol
# notification daemon
dunst
libnotify
# App Support
xwaylandvideobridge
lxqt.lxqt-policykit
xdg-desktop-portal
auto-cpufreq
# general utilities
brightnessctl # brightness ctl
networkmanagerapplet # networking
];
# <Sound
services.mpd.enable = true;
services.pipewire.wireplumber.enable = true;
users.users.${config.skyg.user.name}.extraGroups = [ "input" ];
# Sound />
};
}
@@ -11,6 +11,8 @@
"Hyprland";
useNWG = mkEnableOption
"nwg-shell experience";
useDevelopmentMode = mkEnableOption
"use the dev mode of hyprland";
};
};
}
+19 -22
View File
@@ -1,4 +1,4 @@
{ config, lib, pkgs, inputs, ... }:
{ config, lib, pkgs, inputs, system, ... }:
let
cfg = config.skyg.nixos.desktop.hyprland;
in
@@ -7,33 +7,30 @@ in
home-manager.users.${config.skyg.user.name}.wayland.windowManager.hyprland = {
enable = true;
xwayland.enable = true;
# package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
# plugins = [
# inputs.hyprspace.packages.${pkgs.system}.Hyprspace
# ];
extraConfig = ''
source = ~/.config/hypr/hyprland.d/*.conf
debug:enable_stdout_logs = true
'';
};
programs.hyprlock.enable = true;
environment.systemPackages = with pkgs; [
# general utilities
swappy # screenshot editor
hyprshot # screenshots
cliphist # clipboard manager
xfce.thunar # file manager
wofi # app launcher
wl-screenrec # screen recorder
slurp # helper selection tools
waypaper # wallpaper manager
swww # wallpaper service
waybar # top bar
nwg-panel # top bar
nwg-dock-hyprland # bottom bar
nwg-displays # display management
nwg-bar # logout window
];
environment.systemPackages =
(with pkgs; [
# general utilities
swappy # screenshot editor
hyprshot # screenshots
cliphist # clipboard manager
gnome.nautilus # file manager
wofi # app launcher
wl-screenrec # screen recorder
slurp # helper selection tools
waypaper # wallpaper manager
swww # wallpaper service
waybar # top bar
nwg-panel # top bar
nwg-dock-hyprland # bottom bar
nwg-displays # display management
nwg-bar # logout window
]);
system.userActivationScripts.hyprlandMineConfig.text = ''
rm -f "$HOME/.config/hypr"
if [[ ! -h "$HOME/.config/hypr" ]]; then
+3 -5
View File
@@ -1,17 +1,15 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.skyg.nixos.desktop.kde;
in
{
options = {
skyg.nixos.desktop.kde = {
enabled = mkEnableOption
enabled = lib.mkEnableOption
"KDE";
};
};
config = mkIf cfg.enabled {
config = lib.mkIf cfg.enabled {
services.desktopManager.plasma6.enable = true;
services.desktopManager.plasma6.enableQt5Integration = true;
environment.plasma6.excludePackages = with pkgs.kdePackages; [
@@ -20,12 +18,12 @@ in
kate # text editor
gwenview # image viewer
];
xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-kde ];
environment.systemPackages = with pkgs; [
kdePackages.plasma-browser-integration
kdePackages.xdg-desktop-portal-kde
konsave # save configs
];
services.desktopManager.plasma6.notoPackage = pkgs.fira-code;
xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-kde ];
};
}
+4 -4
View File
@@ -32,9 +32,6 @@ in
# development
vscode
# web
brave
# mail
thunderbird
@@ -60,9 +57,12 @@ in
# Video recording
obs-studio
];
programs.firefox = {
enable = true;
};
home-manager.users.${config.skyg.user.name}.home.shellAliases = {
open-image = "feh";
open-file = "thunar";
open-file = "nautilus";
};
};
}
+1
View File
@@ -13,5 +13,6 @@ in
xdg-desktop-portal-gtk
];
programs.xwayland.enable = true;
xdg.portal.enable = true;
};
}
-18
View File
@@ -1,18 +0,0 @@
#!/bin/sh
set -e
if [ ! -f .locks/.built_via_skg ]; then
./build-nixos.sh
echo "Do you want to continue? (y/N)"
read -r answer
if [[ $answer =~ ^[yY]$ ]]; then
echo "Continuing..."
else
echo "Exiting."
exit 1
fi
fi
sudo nixos-rebuild switch --flake .
git cap
rm -f .locks/.built_via_skg