From eebaa957af3c08e721a170bf4f945dddc3f913b1 Mon Sep 17 00:00:00 2001 From: Kenryu Shibata Date: Sun, 18 Aug 2024 18:52:15 +0900 Subject: [PATCH] Update: 08/18/2024 06:51:28 PM --- flake.lock | 16 ++--- flake.nix | 4 +- machines/workstation/configuration.nix | 5 ++ .../workstation/hardware-configuration.nix | 5 ++ machines/workstation/home.nix | 22 +++++-- newpkg.sh | 63 +++++++++++++++++++ pkgs/AppMan/AppMan.nix | 60 ++++++++++++++++++ system/hardware/kernel.nix | 2 +- system/hardware/opengl.nix | 6 +- system/services/network-manager.nix | 1 + user/apps/games/mangohud.nix | 6 ++ user/apps/media/mpv.nix | 6 ++ user/apps/media/vlc.nix | 6 ++ user/apps/media/yt-dlp.nix | 6 ++ user/{ => apps}/utils/alacritty.nix | 0 user/apps/utils/cava.nix | 6 ++ user/apps/utils/fzf.nix | 6 ++ user/apps/utils/keepassxc.nix | 6 ++ user/apps/utils/owncloud-client.nix | 6 ++ user/apps/utils/zoxide.nix | 6 ++ user/dev/editor/neovim.nix | 16 +++++ user/dev/tools/gitui.nix | 6 ++ 22 files changed, 240 insertions(+), 20 deletions(-) create mode 100644 newpkg.sh create mode 100644 pkgs/AppMan/AppMan.nix create mode 100644 user/apps/games/mangohud.nix create mode 100644 user/apps/media/mpv.nix create mode 100644 user/apps/media/vlc.nix create mode 100644 user/apps/media/yt-dlp.nix rename user/{ => apps}/utils/alacritty.nix (100%) create mode 100644 user/apps/utils/cava.nix create mode 100644 user/apps/utils/fzf.nix create mode 100644 user/apps/utils/keepassxc.nix create mode 100644 user/apps/utils/owncloud-client.nix create mode 100644 user/apps/utils/zoxide.nix create mode 100644 user/dev/editor/neovim.nix create mode 100644 user/dev/tools/gitui.nix diff --git a/flake.lock b/flake.lock index 6c252ef..06d8d61 100644 --- a/flake.lock +++ b/flake.lock @@ -7,16 +7,16 @@ ] }, "locked": { - "lastModified": 1723399884, - "narHash": "sha256-97wn0ihhGqfMb8WcUgzzkM/TuAxce2Gd20A8oiruju4=", + "lastModified": 1720042825, + "narHash": "sha256-A0vrUB6x82/jvf17qPCpxaM+ulJnD8YZwH9Ci0BsAzE=", "owner": "nix-community", "repo": "home-manager", - "rev": "086f619dd991a4d355c07837448244029fc2d9ab", + "rev": "e1391fb22e18a36f57e6999c7a9f966dc80ac073", "type": "github" }, "original": { "owner": "nix-community", - "ref": "master", + "ref": "release-24.05", "repo": "home-manager", "type": "github" } @@ -39,16 +39,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1723362943, - "narHash": "sha256-dFZRVSgmJkyM0bkPpaYRtG/kRMRTorUIDj8BxoOt1T4=", + "lastModified": 1723688146, + "narHash": "sha256-sqLwJcHYeWLOeP/XoLwAtYjr01TISlkOfz+NG82pbdg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a58bc8ad779655e790115244571758e8de055e3d", + "rev": "c3d4ac725177c030b1e289015989da2ad9d56af0", "type": "github" }, "original": { "id": "nixpkgs", - "ref": "nixos-unstable", + "ref": "nixos-24.05", "type": "indirect" } }, diff --git a/flake.nix b/flake.nix index b697192..c8ea003 100644 --- a/flake.nix +++ b/flake.nix @@ -2,8 +2,8 @@ description = "kenryuS nixos configurations/dotfiles"; inputs = { - nixpkgs.url = "nixpkgs/nixos-unstable"; - home-manager.url = "github:nix-community/home-manager/master"; + nixpkgs.url = "nixpkgs/nixos-24.05"; + home-manager.url = "github:nix-community/home-manager/release-24.05"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; nixos-hardware.url = "github:NixOS/nixos-hardware/master"; }; diff --git a/machines/workstation/configuration.nix b/machines/workstation/configuration.nix index 968894a..6b734fd 100644 --- a/machines/workstation/configuration.nix +++ b/machines/workstation/configuration.nix @@ -24,6 +24,11 @@ boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; + programs.appimage = { + enable = true; + binfmt = true; + }; + # Open ports in the firewall. # networking.firewall.allowedTCPPorts = [ ... ]; # networking.firewall.allowedUDPPorts = [ ... ]; diff --git a/machines/workstation/hardware-configuration.nix b/machines/workstation/hardware-configuration.nix index 1ca7675..86160c4 100644 --- a/machines/workstation/hardware-configuration.nix +++ b/machines/workstation/hardware-configuration.nix @@ -24,6 +24,11 @@ options = [ "fmask=0077" "dmask=0077" ]; }; + fileSystems."/run/media/kenryus/hdd" = { + device = "/dev/disk/by-uuid/0d146628-12f4-4bb6-abde-bbf798a57c25"; + fsType = "ext4"; + }; + swapDevices = [ { device = "/dev/disk/by-uuid/d933c349-8e70-41e1-8d13-605656dba18b"; } ]; diff --git a/machines/workstation/home.nix b/machines/workstation/home.nix index 17c789b..96e0e6d 100644 --- a/machines/workstation/home.nix +++ b/machines/workstation/home.nix @@ -1,23 +1,33 @@ { pkgs, userSettings, ... }: { - home.username = userSettings.username; - home.homeDirectory = "/home/" + userSettings.username; - - programs.home-manager.enable = true; - imports = [ ../../user/apps/browsers/firefox.nix ../../user/dev/tools/git.nix + ../../user/dev/tools/gitui.nix ../../user/dev/editor/vscodium.nix ../../user/dev/editor/zed-editor.nix ../../user/dev/lang/cc.nix ../../user/dev/lang/python.nix ../../user/dev/lang/rust.nix ../../user/dev/ide/qtcreator.nix - ../../user/utils/alacritty.nix + ../../user/apps/utils/alacritty.nix + ../../user/apps/utils/keepassxc.nix + ../../user/apps/utils/cava.nix + ../../user/apps/utils/owncloud-client.nix + ../../user/apps/utils/fzf.nix + ../../user/apps/utils/zoxide.nix + ../../user/apps/media/vlc.nix + ../../user/apps/media/mpv.nix + ../../user/apps/media/yt-dlp.nix + ../../user/apps/games/mangohud.nix ../../user/wm/xmonad/xmonad.nix ]; + home.username = userSettings.username; + home.homeDirectory = "/home/" + userSettings.username; + + programs.home-manager.enable = true; + home.stateVersion = "24.05"; home.packages = with pkgs; []; diff --git a/newpkg.sh b/newpkg.sh new file mode 100644 index 0000000..c5db416 --- /dev/null +++ b/newpkg.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +echo "newpkg.sh: create minimal nix file in current directory" + +if [ -z "$NIXOSSYSCONFIG" ]; then + echo "Error: Env Variable Missing, NIXOSSYSCONFIG" + exit 1 +fi + +if [ -z "$NIXOSHOMECONFIG" ]; then + echo "Error: Env Variable Missing, NIXOSHOMECONFIG" + exit 1 +fi + +if [ -z "$EDITOR" ]; then + echo "Error: Env Variable Missing, EDITOR" + exit 1 +fi + +echo -e "Select installation destination:\n[1]: System\n[2]: User\n[q]: quit" +read dest +echo "Specifiy the package to add:" +read pkgName + +touch "$PWD/${pkgName}.nix" + +if [[ $dest -eq 1 ]]; then + echo -e "{ pkgs, ... }:\n{\n environment.systemPackages = with pkgs; [\n ${pkgName}\n ];\n}" > "$PWD/${pkgName}.nix" + echo "Open editor to modify system imports? [y/N]: " + read doEdit + if [ "$doEdit" == "y" ] || [ "$doEdit" == "Y" ]; then + $EDITOR $NIXOSSYSCONFIG + fi +elif [[ $dest -eq 2 ]]; then + echo -e "{ pkgs, ... }:\n{\n home.packages = with pkgs; [\n ${pkgName}\n ];\n}" > "$PWD/${pkgName}.nix" + echo "Open editor to modify home imports? [y/N]: " + read doEdit + if [ "$doEdit" == "y" ] || [ "$doEdit" == "Y" ]; then + $EDITOR $NIXOSHOMECONFIG + fi +elif [[ $dest == "q" ]]; then + exit 0 +else + echo "Error: Non-numeric or Out-ranged value inputed" + exit 1 +fi + +echo "Would you like to edit new nix file for further configuration? [y/N]: " +read doNixEdit +if [ "$doNixEdit" == "y" ] || [ "$doNixEdit" == "Y" ]; then + $EDITOR "$PWD/${pkgName}.nix" +fi + +echo "Would you like to execute nixos-rebuild? [y/N]: " +read doExec + +if [ "$doExec" == "y" ] || [ "$doExec" == "Y" ]; then + cd ~/.dotfiles + sudo nixos-rebuild --flake '.#system' +else + echo "Exiting" + exit 0 +fi diff --git a/pkgs/AppMan/AppMan.nix b/pkgs/AppMan/AppMan.nix new file mode 100644 index 0000000..33235d3 --- /dev/null +++ b/pkgs/AppMan/AppMan.nix @@ -0,0 +1,60 @@ +{ + lib, + stdenv, + fetchFromGitHub, + coreutils, + gnused, + gnugrep, + curl, + wget, + binutils, + unzip, + gnutar, + zsync +}: + +stdenv.mkDerivation rec { + pname = "AppMan"; + version = "7.7"; + + src = fetchFromGitHub { + owner = "ivan-hc"; + repo = "AM"; + rev = "e8abedace64c32023086a9c79fe646d84588a995"; + hash = "sha256-n0m5VWdMTYWv18cB++NYWMQZXNKWfnj0iHgj0ZNdjy8="; + }; + + propagatedBuildInputs = [ + coreutils + gnused + gnugrep + curl + wget + binutils + unzip + gnutar + zsync + ]; + + buildPhase = '' + + ''; + + installPhase = '' + mkdir -p $out/bin + cp APP-MANAGER $out/bin + ln -sf $out/bin/APP-MANAGER $out/bin/am + ''; + + meta = with lib; { + description = "Database & solutions for all AppImages and portable apps for GNU/Linux!"; + longDescription = '' + AppImage package manager to install, update (for real) and manage ALL of them (system-wide or locally) thanks to its ever-growing AUR-inspired database listing 2000+ portable apps and programs for GNU/Linux. + The first, real centralized repository to manage your AppImages with the ease of APT and the power of PacMan. + ''; + homepage = "https://portable-linux-apps.github.io/"; + changelog = "https://github.com/ivan-hc/AM/releases/tag/${version}"; + license = licenses.gpl3; + platforms = platforms.all; + }; +} diff --git a/system/hardware/kernel.nix b/system/hardware/kernel.nix index 9d1f31c..3fd85b8 100644 --- a/system/hardware/kernel.nix +++ b/system/hardware/kernel.nix @@ -1,5 +1,5 @@ { config, pkgs, ... }: { - boot.kernelPackages = pkgs.linuxPackages_xanmod_stable; + boot.kernelPackages = pkgs.linuxPackages; boot.consoleLogLevel = 3; } diff --git a/system/hardware/opengl.nix b/system/hardware/opengl.nix index eca5f82..55243c1 100644 --- a/system/hardware/opengl.nix +++ b/system/hardware/opengl.nix @@ -1,8 +1,8 @@ { pkgs, ... }: { - hardware.graphics.enable = true; - hardware.graphics.enable32Bit = true; - hardware.graphics.extraPackages = with pkgs; [ + hardware.opengl.enable = true; + hardware.opengl.driSupport32Bit = true; + hardware.opengl.extraPackages = with pkgs; [ mesa ]; } diff --git a/system/services/network-manager.nix b/system/services/network-manager.nix index 68c1cf1..47fea2e 100644 --- a/system/services/network-manager.nix +++ b/system/services/network-manager.nix @@ -1,4 +1,5 @@ { ... }: { networking.networkmanager.enable = true; + systemd.network.wait-online.enable = false; } diff --git a/user/apps/games/mangohud.nix b/user/apps/games/mangohud.nix new file mode 100644 index 0000000..37b2002 --- /dev/null +++ b/user/apps/games/mangohud.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + mangohud + ]; +} diff --git a/user/apps/media/mpv.nix b/user/apps/media/mpv.nix new file mode 100644 index 0000000..477a6db --- /dev/null +++ b/user/apps/media/mpv.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + mpv + ]; +} diff --git a/user/apps/media/vlc.nix b/user/apps/media/vlc.nix new file mode 100644 index 0000000..2cdf857 --- /dev/null +++ b/user/apps/media/vlc.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + vlc + ]; +} diff --git a/user/apps/media/yt-dlp.nix b/user/apps/media/yt-dlp.nix new file mode 100644 index 0000000..7ea6ec0 --- /dev/null +++ b/user/apps/media/yt-dlp.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + yt-dlp + ]; +} diff --git a/user/utils/alacritty.nix b/user/apps/utils/alacritty.nix similarity index 100% rename from user/utils/alacritty.nix rename to user/apps/utils/alacritty.nix diff --git a/user/apps/utils/cava.nix b/user/apps/utils/cava.nix new file mode 100644 index 0000000..50b4808 --- /dev/null +++ b/user/apps/utils/cava.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + cava + ]; +} diff --git a/user/apps/utils/fzf.nix b/user/apps/utils/fzf.nix new file mode 100644 index 0000000..8a29408 --- /dev/null +++ b/user/apps/utils/fzf.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + fzf + ]; +} diff --git a/user/apps/utils/keepassxc.nix b/user/apps/utils/keepassxc.nix new file mode 100644 index 0000000..0f52cf5 --- /dev/null +++ b/user/apps/utils/keepassxc.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + keepassxc + ]; +} diff --git a/user/apps/utils/owncloud-client.nix b/user/apps/utils/owncloud-client.nix new file mode 100644 index 0000000..0f894f6 --- /dev/null +++ b/user/apps/utils/owncloud-client.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + owncloud-client + ]; +} diff --git a/user/apps/utils/zoxide.nix b/user/apps/utils/zoxide.nix new file mode 100644 index 0000000..e60015d --- /dev/null +++ b/user/apps/utils/zoxide.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + zoxide + ]; +} diff --git a/user/dev/editor/neovim.nix b/user/dev/editor/neovim.nix new file mode 100644 index 0000000..45d3eaa --- /dev/null +++ b/user/dev/editor/neovim.nix @@ -0,0 +1,16 @@ +{ config, pkgs, ... }: +{ + home.packages = with pkgs; [ + neovim + ]; + + programs.neovim = { + enable = true; + vimAlias = false; + viAlias = false; + withRuby = false; + withPython3 = false; + withNodeJs = false; + package = pkgs.neovim-unwrapped; + }; +} diff --git a/user/dev/tools/gitui.nix b/user/dev/tools/gitui.nix new file mode 100644 index 0000000..985aa4a --- /dev/null +++ b/user/dev/tools/gitui.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + gitui + ]; +}