Update
This commit is contained in:
parent
6f6c8bebf7
commit
c618feced4
@ -6,62 +6,73 @@
|
||||
printf "\n\e[0;92m- \e[0m\e[1;77mNixy's Installation Script\e[0;96m [anotherhadi/nixy]\e[0m"
|
||||
|
||||
# Check if we're on the good directory
|
||||
[[ -f "./docs/scripts/install.sh" ]] || (printf "\n\e[0;91mx \e[0m\e[1;77mNot in the project root directory\e[0m"; exit 1)
|
||||
DIR=$(pwd)
|
||||
[[ -f "./docs/scripts/install.sh" ]] || (
|
||||
printf "\n\e[0;91mx \e[0m\e[1;77mNot in the project root directory\e[0m"
|
||||
exit 1
|
||||
)
|
||||
DIR=$PWD
|
||||
|
||||
# Create a new configuration
|
||||
read -p $'\n\e[0;92m+\e[0m\e[1;77m Username: \e[0;96m' username
|
||||
read -p $'\n\e[0;92m+\e[0m\e[1;77m Hostname: \e[0;96m' hostname
|
||||
read -rp $'\n\e[0;92m+\e[0m\e[1;77m Username: \e[0;96m' username
|
||||
read -rp $'\n\e[0;92m+\e[0m\e[1;77m Hostname: \e[0;96m' hostname
|
||||
|
||||
HOST_DIR="./hosts/$hostname"
|
||||
mkdir $HOST_DIR
|
||||
mkdir "$HOST_DIR"
|
||||
|
||||
nixos-generate-config # check that hardware-configuration.nix is indeed created and with user right
|
||||
rm configuration.nix
|
||||
mv hardware-configuration.nix "$HOST_DIR"
|
||||
nixos-generate-config --show-hardware-config >"$HOST_DIR/hardware-configuration.nix"
|
||||
|
||||
printf "\n\e[0;92m? \e[0m\e[1;77mInstall Nvidia drivers?\e[0;96m [y/N]\e[0m"
|
||||
read yn
|
||||
read -r yn
|
||||
yn=$(echo "$yn" | tr '[:upper:]' '[:lower:]')
|
||||
if [[ $yn == "y" || $yn == "yes" ]]; then
|
||||
nvidia=true
|
||||
nvidia=true
|
||||
else
|
||||
nvidia=false
|
||||
nvidia=false
|
||||
fi
|
||||
|
||||
printf "\n\e[0;92m? \e[0m\e[1;77mInstall prime?\e[0;96m [y/N]\e[0m"
|
||||
read yn
|
||||
read -r yn
|
||||
yn=$(echo "$yn" | tr '[:upper:]' '[:lower:]')
|
||||
if [[ $yn == "y" || $yn == "yes" ]]; then
|
||||
prime=true
|
||||
prime=true
|
||||
else
|
||||
prime=false
|
||||
prime=false
|
||||
fi
|
||||
|
||||
GUEST_CONFIG="./hosts/guest"
|
||||
|
||||
cp "$LAPTOP_CONFIG/configuration.nix" "$HOST_DIR/configuration.nix"
|
||||
cp "$LAPTOP_CONFIG/variables.nix" "$HOST_DIR/variables.nix"
|
||||
|
||||
config=$(cat "$LAPTOP_CONFIG/configuration.nix")
|
||||
if [[ $nvidia == false ]];then
|
||||
config=$(echo "$config" | sed 's/..\/shared\/nvidia/# ..\/shared\/nvidia/')
|
||||
if [[ $nvidia == false ]]; then
|
||||
config=$(echo "$config" | sed 's/..\/shared\/nvidia/# ..\/shared\/nvidia/')
|
||||
fi
|
||||
if [[ $prime == false ]];then
|
||||
config=$(echo "$config" | sed 's/..\/shared\/prime/# ..\/shared\/prime/')
|
||||
if [[ $prime == false ]]; then
|
||||
config=$(echo "$config" | sed 's/..\/shared\/prime/# ..\/shared\/prime/')
|
||||
fi
|
||||
echo "$config" >"$HOST_DIR/configuration.nix"
|
||||
|
||||
variables=$(cat "$LAPTOP_CONFIG/variables.nix")
|
||||
variables=$(echo "$variables" | sed 's/112569860+anotherhadi@users.noreply.github.com/your_email/')
|
||||
variables=$(echo "$variables" | sed 's/hadi/$username/')
|
||||
variables=$(echo "$variables" | sed 's/nixy/$username/') # FIXME: Host name can be mixed with themes
|
||||
variables=$(echo "$variables" | sed 's/Hadi/your_username/')
|
||||
variables=$(echo "$variables" | sed "s/hadi/$username/")
|
||||
variables=$(echo "$variables" | sed "s/nixy/$hostname/") # FIXME: Host name can be mixed with themes
|
||||
variables=$(echo "$variables" | sed "s/Hadi/$username/")
|
||||
variables=$(echo "$variables" | sed 's/sops = true/sops = false/')
|
||||
variables=$(echo "$variables" | sed 's/obsidian = true/obsidian = false/')
|
||||
variables=$(echo "$variables" | sed 's/tailscale = true/tailscale = false/')
|
||||
echo "$variables" >"$HOST_DIR/variables.nix"
|
||||
|
||||
# printf "\n\e[0;92m✓ \e[0m\e[1;77mSucess Message\e[0m"
|
||||
# printf "\n\e[0;92m+ \e[0m\e[1;77mAdded Message\e[0m"
|
||||
# printf "\n\e[0;92m? \e[0m\e[1;77mAn issue? Open an issue/pull request at : \e[0;96mhttps://github.com/anotherhadi/nixy \e[0m"
|
||||
# Add it to the git index
|
||||
git add .
|
||||
|
||||
printf "\n\e[0;92m+ \e[0m\e[1;77mHost added!\e[0m"
|
||||
|
||||
# REBUILD
|
||||
|
||||
printf "\n\e[0;92m? \e[0m\e[1;77mDo you want to rebuild?\e[0;96m [y/N]\e[0m"
|
||||
read -r yn
|
||||
yn=$(echo "$yn" | tr '[:upper:]' '[:lower:]')
|
||||
if [[ $yn == "y" || $yn == "yes" ]]; then
|
||||
sudo nixos-rebuild switch --flake "$DIR"#"$hostname"
|
||||
fi
|
||||
|
||||
printf "\n\e[0;92m✓ \e[0m\e[1;77mDone!\e[0m"
|
||||
|
32
flake.lock
32
flake.lock
@ -281,11 +281,11 @@
|
||||
"xdph": "xdph"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1719324347,
|
||||
"narHash": "sha256-hyvKFjeYOmikUr3A4DumBXGTFZSOj/1cIr1aj9w/AEo=",
|
||||
"lastModified": 1719338642,
|
||||
"narHash": "sha256-oy2IpTiMTof5rUqdmUMYzn6Xugc8kTh629soVCyC3L4=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "1d70962892a6e3e1cacd3663b390bbdf81426984",
|
||||
"revCount": 4887,
|
||||
"rev": "95782de966ec9e182d49b2f032b74a1101f423e8",
|
||||
"revCount": 4889,
|
||||
"submodules": true,
|
||||
"type": "git",
|
||||
"url": "https://github.com/hyprwm/Hyprland"
|
||||
@ -489,11 +489,11 @@
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1719075281,
|
||||
"narHash": "sha256-CyyxvOwFf12I91PBWz43iGT1kjsf5oi6ax7CrvaMyAo=",
|
||||
"lastModified": 1719254875,
|
||||
"narHash": "sha256-ECni+IkwXjusHsm9Sexdtq8weAq/yUyt1TWIemXt3Ko=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "a71e967ef3694799d0c418c98332f7ff4cc5f6af",
|
||||
"rev": "2893f56de08021cffd9b6b6dfc70fd9ccd51eb60",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -533,11 +533,11 @@
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1719326913,
|
||||
"narHash": "sha256-pQxnJ2kTak6FuTIMy8hyQKiHpE/gqOx+8KZw2HXkcGs=",
|
||||
"lastModified": 1719334058,
|
||||
"narHash": "sha256-5uhWaoHhUYEPNC42NVW+srBgldwQKQE6dvW45rg0K3Q=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixvim",
|
||||
"rev": "7ac283f05074485c08aefe578a139e34d508edb9",
|
||||
"rev": "76a8790764ec983ca0659c952c4b6924c4e9bf1a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -548,11 +548,11 @@
|
||||
},
|
||||
"nur": {
|
||||
"locked": {
|
||||
"lastModified": 1719326701,
|
||||
"narHash": "sha256-IDEPbakCvjk61uX19cnmSB8fsdFTmMe5Wt4bCyIUGdA=",
|
||||
"lastModified": 1719337524,
|
||||
"narHash": "sha256-bYp4//+XM+J1Y23sW6VjXAiCHUdq3aqgXue/tVeCxLw=",
|
||||
"owner": "nix-community",
|
||||
"repo": "NUR",
|
||||
"rev": "a331f41142ed524ce58ed0df1c72a7d0b13ec867",
|
||||
"rev": "37ae43594731d4d801f53dffe465006421c7c292",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -562,11 +562,11 @@
|
||||
},
|
||||
"nurpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1719326701,
|
||||
"narHash": "sha256-IDEPbakCvjk61uX19cnmSB8fsdFTmMe5Wt4bCyIUGdA=",
|
||||
"lastModified": 1719337524,
|
||||
"narHash": "sha256-bYp4//+XM+J1Y23sW6VjXAiCHUdq3aqgXue/tVeCxLw=",
|
||||
"owner": "nix-community",
|
||||
"repo": "NUR",
|
||||
"rev": "a331f41142ed524ce58ed0df1c72a7d0b13ec867",
|
||||
"rev": "37ae43594731d4d801f53dffe465006421c7c292",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -11,6 +11,7 @@
|
||||
./programs/nvim
|
||||
./programs/qutebrowser
|
||||
./programs/spicetify
|
||||
./programs/zathura
|
||||
|
||||
# Scripts
|
||||
./scripts # All scripts
|
||||
@ -25,6 +26,8 @@
|
||||
./system/waybar
|
||||
./system/wlogout
|
||||
./system/wofi
|
||||
./system/mime
|
||||
./system/udiskie
|
||||
];
|
||||
|
||||
home = {
|
||||
|
17
home/programs/zathura/default.nix
Normal file
17
home/programs/zathura/default.nix
Normal file
@ -0,0 +1,17 @@
|
||||
# PDF viewer
|
||||
{
|
||||
programs.zathura = {
|
||||
enable = true;
|
||||
|
||||
options = {
|
||||
guioptions = "v";
|
||||
adjust-open = "width";
|
||||
statusbar-basename = true;
|
||||
render-loading = false;
|
||||
scroll-step = 120;
|
||||
|
||||
# highlight-color = ");
|
||||
# highlight-active-color = mkForce (rgba "base0D");
|
||||
};
|
||||
};
|
||||
}
|
17
home/system/mime/default.nix
Normal file
17
home/system/mime/default.nix
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
xdg.mimeApps = {
|
||||
enable = true;
|
||||
|
||||
defaultApplications = {
|
||||
"text/markdown" = "nvim.desktop";
|
||||
"text/plain" = "nvim.desktop";
|
||||
"image/png" = "imv.desktop";
|
||||
"image/jpeg" = "imv.desktop";
|
||||
"image/gif" = "org.qutebrowser.qutebrowser.desktop";
|
||||
"x-scheme-handler/http" = "org.qutebrowser.qutebrowser.desktop";
|
||||
"x-scheme-handler/https" = "org.qutebrowser.qutebrowser.desktop";
|
||||
"text/html" = "org.qutebrowser.qutebrowser.desktop";
|
||||
"application/pdf" = "zathura.desktop";
|
||||
};
|
||||
};
|
||||
}
|
@ -6,6 +6,7 @@
|
||||
./zoxide.nix
|
||||
./tmux.nix
|
||||
./lazygit.nix
|
||||
./eza.nix
|
||||
./fetch
|
||||
./lf
|
||||
];
|
||||
|
13
home/system/shell/eza.nix
Normal file
13
home/system/shell/eza.nix
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
programs.eza = {
|
||||
enable = true;
|
||||
icons = true;
|
||||
|
||||
extraOptions = [
|
||||
"--group-directories-first"
|
||||
"--no-quotes"
|
||||
"--git-ignore"
|
||||
"--icons=always"
|
||||
];
|
||||
};
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
{ pkgs, lib, config, ... }: {
|
||||
|
||||
home.packages = with pkgs; [ eza bat ripgrep tldr ];
|
||||
home.packages = with pkgs; [ bat ripgrep tldr ];
|
||||
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
@ -42,8 +42,8 @@
|
||||
celar = "clear";
|
||||
e = "exit";
|
||||
cd = "z";
|
||||
ls = "${pkgs.eza}/bin/eza --icons=always";
|
||||
tree = "${pkgs.eza}/bin/eza --icons=always --tree";
|
||||
ls = "eza --icons=always --no-quotes";
|
||||
tree = "eza --icons=always --tree --no-quotes";
|
||||
sl = "ls";
|
||||
open = "${pkgs.xdg_utils}/bin/xdg-open";
|
||||
icat = "${pkgs.kitty}/bin/kitty +kitten icat";
|
||||
|
6
home/system/udiskie/default.nix
Normal file
6
home/system/udiskie/default.nix
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
services.udiskie = {
|
||||
enable = true;
|
||||
tray = "always";
|
||||
};
|
||||
}
|
@ -5,6 +5,7 @@
|
||||
../modules/nvidia.nix
|
||||
../modules/prime.nix
|
||||
../modules/tuigreet.nix
|
||||
../modules/usb.nix
|
||||
./variables.nix
|
||||
];
|
||||
|
||||
|
@ -2,21 +2,21 @@
|
||||
|
||||
{
|
||||
# USB Automounting
|
||||
services.gvfs.enable = true;
|
||||
# services.udisks2.enable = true;
|
||||
# services.gvfs.enable = true;
|
||||
services.udisks2.enable = true;
|
||||
# services.devmon.enable = true;
|
||||
|
||||
# Enable USB Guard
|
||||
services.usbguard = {
|
||||
enable = true;
|
||||
dbus.enable = true;
|
||||
implicitPolicyTarget = "block";
|
||||
# FIXME: set yours pref USB devices (change {id} to your trusted USB device), use `lsusb` command (from usbutils package) to get list of all connected USB devices including integrated devices like camera, bluetooth, wifi, etc. with their IDs or just disable `usbguard`
|
||||
rules = ''
|
||||
allow id {id} # device 1
|
||||
allow id {id} # device 2
|
||||
'';
|
||||
};
|
||||
# services.usbguard = {
|
||||
# enable = true;
|
||||
# dbus.enable = true;
|
||||
# implicitPolicyTarget = "block";
|
||||
# # FIXME: set yours pref USB devices (change {id} to your trusted USB device), use `lsusb` command (from usbutils package) to get list of all connected USB devices including integrated devices like camera, bluetooth, wifi, etc. with their IDs or just disable `usbguard`
|
||||
# rules = ''
|
||||
# allow id {id} # device 1
|
||||
# allow id {id} # device 2
|
||||
# '';
|
||||
# };
|
||||
|
||||
# Enable USB-specific packages
|
||||
environment.systemPackages = with pkgs; [ usbutils ];
|
||||
|
Loading…
Reference in New Issue
Block a user