removed scripts for adding and removing packages from config files, and also removed the nixcommit/nixpush commands
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
imports = [
|
imports = [
|
||||||
./../../modules/sys
|
./../../modules/sys/configuration.nix
|
||||||
./hardware.nix
|
./hardware.nix
|
||||||
./boot.nix
|
./boot.nix
|
||||||
./services.nix
|
./services.nix
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
{pkgs, ...}: {
|
{pkgs, ...}: {
|
||||||
environment = {
|
environment = {
|
||||||
variables = {
|
variables = {
|
||||||
XCURSOR_SIZE = "24";
|
|
||||||
PATH = "${pkgs.clang-tools}/bin:$PATH";
|
PATH = "${pkgs.clang-tools}/bin:$PATH";
|
||||||
};
|
};
|
||||||
shells = with pkgs; [
|
shells = with pkgs; [
|
||||||
|
|||||||
53
hosts/laptop/hardware.nix.old
Normal file
53
hosts/laptop/hardware.nix.old
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
# 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")
|
||||||
|
];
|
||||||
|
|
||||||
|
boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod"];
|
||||||
|
boot.initrd.kernelModules = [];
|
||||||
|
boot.kernelModules = ["kvm-amd"];
|
||||||
|
boot.extraModulePackages = [];
|
||||||
|
|
||||||
|
fileSystems."/" = {
|
||||||
|
device = "/dev/disk/by-partlabel/disk-main-root";
|
||||||
|
fsType = "ext4";
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/nix" = {
|
||||||
|
device = "/dev/disk/by-partlabel/disk-main-nix";
|
||||||
|
fsType = "ext4";
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/boot" = {
|
||||||
|
device = "/dev/disk/by-partlabel/disk-main-ESP";
|
||||||
|
fsType = "vfat";
|
||||||
|
options = ["fmask=0077" "dmask=0077"];
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/home" = {
|
||||||
|
device = "/dev/disk/by-partlabel/disk-main-home";
|
||||||
|
fsType = "ext4";
|
||||||
|
};
|
||||||
|
|
||||||
|
swapDevices = [];
|
||||||
|
|
||||||
|
# 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
|
||||||
|
# still possible to use this option, but it's recommended to use it in conjunction
|
||||||
|
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||||
|
networking.useDHCP = lib.mkDefault true;
|
||||||
|
# networking.interfaces.enp14s0.useDHCP = lib.mkDefault true;
|
||||||
|
# networking.interfaces.wlp15s0.useDHCP = lib.mkDefault true;
|
||||||
|
|
||||||
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
|
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||||
|
}
|
||||||
@@ -44,26 +44,10 @@
|
|||||||
self = self;
|
self = self;
|
||||||
pkgs = pkgs;
|
pkgs = pkgs;
|
||||||
};
|
};
|
||||||
homep = import ./nix/homep.nix {
|
|
||||||
self = self;
|
|
||||||
pkgs = pkgs;
|
|
||||||
};
|
|
||||||
homer = import ./nix/homer.nix {
|
|
||||||
self = self;
|
|
||||||
pkgs = pkgs;
|
|
||||||
};
|
|
||||||
nsp = import ./nix/nsp.nix {
|
nsp = import ./nix/nsp.nix {
|
||||||
self = self;
|
self = self;
|
||||||
pkgs = pkgs;
|
pkgs = pkgs;
|
||||||
};
|
};
|
||||||
nixr = import ./nix/nixr.nix {
|
|
||||||
self = self;
|
|
||||||
pkgs = pkgs;
|
|
||||||
};
|
|
||||||
nixp = import ./nix/nixp.nix {
|
|
||||||
self = self;
|
|
||||||
pkgs = pkgs;
|
|
||||||
};
|
|
||||||
hyprland = import ./wm-controls/hyprland.nix {pkgs = pkgs;};
|
hyprland = import ./wm-controls/hyprland.nix {pkgs = pkgs;};
|
||||||
lofi = import ./wm-controls/lofi.nix {
|
lofi = import ./wm-controls/lofi.nix {
|
||||||
self = self;
|
self = self;
|
||||||
@@ -105,15 +89,6 @@
|
|||||||
chscheme = import ./nix/chscheme.nix {
|
chscheme = import ./nix/chscheme.nix {
|
||||||
pkgs = pkgs;
|
pkgs = pkgs;
|
||||||
};
|
};
|
||||||
nixcommit = import ./nix/nixcommit.nix {
|
|
||||||
host = host;
|
|
||||||
self = self;
|
|
||||||
pkgs = pkgs;
|
|
||||||
};
|
|
||||||
nixpush = import ./nix/nixpush.nix {
|
|
||||||
self = self;
|
|
||||||
pkgs = pkgs;
|
|
||||||
};
|
|
||||||
in {
|
in {
|
||||||
home.packages = [
|
home.packages = [
|
||||||
compress
|
compress
|
||||||
@@ -122,17 +97,11 @@ in {
|
|||||||
crs
|
crs
|
||||||
extract
|
extract
|
||||||
garbage-collect
|
garbage-collect
|
||||||
homep
|
|
||||||
homer
|
|
||||||
hyprland
|
hyprland
|
||||||
invoke
|
invoke
|
||||||
lofi
|
lofi
|
||||||
mcd
|
mcd
|
||||||
music
|
music
|
||||||
nixcommit
|
|
||||||
nixp
|
|
||||||
nixpush
|
|
||||||
nixr
|
|
||||||
rebuild
|
rebuild
|
||||||
nsp
|
nsp
|
||||||
runbg
|
runbg
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
{
|
|
||||||
self,
|
|
||||||
pkgs,
|
|
||||||
}:
|
|
||||||
pkgs.writeShellScriptBin "homep" ''
|
|
||||||
#!/run/current-system/sw/bin/bash
|
|
||||||
|
|
||||||
# Ensure the package manifest is generated or updated
|
|
||||||
if [ ! -f "/tmp/nixpkgs_manifest.txt" ]; then
|
|
||||||
echo "Generating Nixpkgs manifest..."
|
|
||||||
nix-env -qaP 2>/dev/null | awk '{print $1}' | sed 's/nixos\.//' > /tmp/nixpkgs_manifest.txt
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Select packages using fzf with multi-select enabled
|
|
||||||
selected_packages=$(cat /tmp/nixpkgs_manifest.txt | fzf -m)
|
|
||||||
|
|
||||||
# Check if any packages were selected
|
|
||||||
if [ -n "$selected_packages" ]; then
|
|
||||||
echo "$selected_packages" | while read -r package; do
|
|
||||||
# Append each selected package to the Nix config file
|
|
||||||
sed -i "/^\t]/i \ \t\t$package" "${self}/modules/home/userpkgs.nix"
|
|
||||||
echo "Added $package to the Home Manager configuration."
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "Packages added successfully. Rebuild system config?"
|
|
||||||
select yn in "Yes" "No"; do
|
|
||||||
case $yn in
|
|
||||||
"Yes" ) nixswitch;break;;
|
|
||||||
"No" ) exit;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
else
|
|
||||||
echo "No packages selected."
|
|
||||||
fi
|
|
||||||
''
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
{
|
|
||||||
self,
|
|
||||||
pkgs,
|
|
||||||
}:
|
|
||||||
pkgs.writeShellScriptBin "homer" ''
|
|
||||||
#!/run/current-system/sw/bin/bash
|
|
||||||
|
|
||||||
selected_packages=$(sed -n '/\[/,/\]/p' "${self}/modules/home/userpkgs.nix" | sed '1d;$d' | fzf -m)
|
|
||||||
|
|
||||||
if [ -n "$selected_packages" ]; then
|
|
||||||
echo "$selected_packages" | while read -r package; do
|
|
||||||
sed -i "/\b$package\b/d" "${self}/modules/home/userpkgs.nix"
|
|
||||||
echo "Removed $package from the Home Manager configuration."
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "Removed packages. Rebuild system config?"
|
|
||||||
select yn in "Yes" "No"; do
|
|
||||||
case $yn in
|
|
||||||
"Yes" ) nixswitch;break;;
|
|
||||||
"No" ) exit;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
else
|
|
||||||
echo "No packages removed."
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
''
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
{
|
|
||||||
self,
|
|
||||||
pkgs,
|
|
||||||
host,
|
|
||||||
}:
|
|
||||||
pkgs.writeShellScriptBin "nixcommit" ''
|
|
||||||
#!/run/current-system/sw/bin/bash
|
|
||||||
|
|
||||||
scheck && runbg aplay ${self}/media/sound/nixswitch-start.wav
|
|
||||||
pushd "${self}" || exit
|
|
||||||
|
|
||||||
if [ -n "$2" ]; then
|
|
||||||
echo "too many arguments"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
diffcheck=$(git status | grep "working tree clean")
|
|
||||||
if [ -n "$diffcheck" ]; then
|
|
||||||
scheck && runbg aplay ${self}/media/sound/warning.wav
|
|
||||||
echo "Nothing to commit"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
alejandra . &> /dev/null
|
|
||||||
git add .
|
|
||||||
|
|
||||||
# Automatic fixup commit to the most recent commit (HEAD~1)
|
|
||||||
if [ -z "$1" ]; then
|
|
||||||
commits=$(git log origin/$(git rev-parse --abbrev-ref HEAD)..HEAD --oneline)
|
|
||||||
if [ -n "$commits" ]; then
|
|
||||||
git commit --fixup HEAD
|
|
||||||
echo "No commit message given"
|
|
||||||
echo "Squashing into most recent commit"
|
|
||||||
git rebase --autosquash master
|
|
||||||
else
|
|
||||||
echo "No prior local commits to squash into, please provide a commit message"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# Generate the system generation number
|
|
||||||
gen=$(readlink /nix/var/nix/profiles/system | sed 's/.*system-\([0-9]*\)-link/\1/')
|
|
||||||
gen=$((gen + 1))
|
|
||||||
git commit -m "(${host}) Gen $gen: $1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
scheck && runbg aplay ${self}/media/sound/gitcommit.wav
|
|
||||||
popd || exit
|
|
||||||
''
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
{
|
|
||||||
self,
|
|
||||||
pkgs,
|
|
||||||
}:
|
|
||||||
pkgs.writeShellScriptBin "nixp" ''
|
|
||||||
#!/run/current-system/sw/bin/bash
|
|
||||||
|
|
||||||
# Ensure the package manifest is generated or updated
|
|
||||||
if [ ! -f "/tmp/nixpkgs_manifest.txt" ]; then
|
|
||||||
echo "Generating Nixpkgs manifest..."
|
|
||||||
nix-env -qaP 2>/dev/null | awk '{print $1}' | sed 's/nixos\.//' > /tmp/nixpkgs_manifest.txt
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Select packages using fzf with multi-select enabled
|
|
||||||
selected_packages=$(cat /tmp/nixpkgs_manifest.txt | fzf -m)
|
|
||||||
|
|
||||||
# Check if any packages were selected
|
|
||||||
if [ -n "$selected_packages" ]; then
|
|
||||||
echo "$selected_packages" | while read -r package; do
|
|
||||||
# Append each selected package to the Nix config file
|
|
||||||
sed -i "/^\t]/i \ \t\t$package" "${self}/modules/sys/packages.nix"
|
|
||||||
echo "Added $package to the Nix configuration."
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "Packages added successfully. Rebuild system config?"
|
|
||||||
select yn in "Yes" "No"; do
|
|
||||||
case $yn in
|
|
||||||
"Yes" ) nixswitch;break;;
|
|
||||||
"No" ) exit;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
else
|
|
||||||
echo "No packages selected."
|
|
||||||
fi
|
|
||||||
''
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
{
|
|
||||||
self,
|
|
||||||
pkgs,
|
|
||||||
}:
|
|
||||||
pkgs.writeShellScriptBin "nixpush" ''
|
|
||||||
#!/run/current-system/sw/bin/bash
|
|
||||||
|
|
||||||
scheck && runbg aplay ${self}/media/sound/nixswitch-start.wav
|
|
||||||
set -e
|
|
||||||
pushd "${self}"
|
|
||||||
|
|
||||||
commits=$(git log origin/$(git rev-parse --abbrev-ref HEAD)..HEAD --oneline)
|
|
||||||
if [ -z "$commits" ]; then
|
|
||||||
scheck && runbg aplay ${self}/media/sound/warning.wav
|
|
||||||
echo "Nothing to push"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Pushing the following commits upstream on branch '$(git branch | rg "\*" | awk '{print $2}')'"
|
|
||||||
echo "$commits"
|
|
||||||
|
|
||||||
git push
|
|
||||||
scheck && runbg aplay ${self}/media/sound/gitpush.wav
|
|
||||||
popd
|
|
||||||
''
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
{
|
|
||||||
self,
|
|
||||||
pkgs,
|
|
||||||
}:
|
|
||||||
pkgs.writeShellScriptBin "nixr" ''
|
|
||||||
#!/run/current-system/sw/bin/bash
|
|
||||||
|
|
||||||
selected_packages=$(sed -n '/\[/,/\]/p' "${self}/modules/sys/packages.nix" | sed '1d;$d' | fzf -m)
|
|
||||||
|
|
||||||
if [ -n "$selected_packages" ]; then
|
|
||||||
echo "$selected_packages" | while read -r package; do
|
|
||||||
sed -i "/\b$package\b/d" "${self}/modules/sys/packages.nix"
|
|
||||||
echo "Removed $package from the Nix configuration."
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "Removed packages. Rebuild system config?"
|
|
||||||
select yn in "Yes" "No"; do
|
|
||||||
case $yn in
|
|
||||||
"Yes" ) nixswitch;break;;
|
|
||||||
"No" ) exit;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
else
|
|
||||||
echo "No packages removed."
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
''
|
|
||||||
Reference in New Issue
Block a user