diff options
-rw-r--r-- | derivations/crazydiskinfo/default.nix | 38 | ||||
-rw-r--r-- | derivations/lowbat/default.nix | 32 | ||||
-rw-r--r-- | derivations/pavolctld/default.nix | 28 | ||||
-rw-r--r-- | derivations/st/default.nix | 43 | ||||
-rw-r--r-- | flake.nix | 32 | ||||
-rw-r--r-- | modules/home/default.nix | 6 | ||||
-rw-r--r-- | modules/home/firefox.nix | 27 | ||||
-rw-r--r-- | modules/home/gtk-bookmarks.nix | 8 | ||||
-rw-r--r-- | modules/home/initial-home-setup.nix | 4 | ||||
-rw-r--r-- | modules/home/resources/activation-scripts/clone-repos.sh | 8 | ||||
-rw-r--r-- | modules/hosts/T430/configuration.nix | 1 | ||||
-rw-r--r-- | modules/hosts/T430/home.nix | 1 | ||||
-rw-r--r-- | modules/hosts/T495/configuration.nix | 8 | ||||
-rw-r--r-- | modules/hosts/hp-envy-office/configuration.nix | 5 | ||||
-rw-r--r-- | modules/hosts/libreX60/configuration.nix | 1 | ||||
-rw-r--r-- | modules/hosts/optiplex/configuration.nix | 13 | ||||
-rw-r--r-- | modules/root/bluetooth.nix | 2 | ||||
-rw-r--r-- | modules/root/default.nix | 2 | ||||
-rw-r--r-- | modules/root/hosts.nix | 4 | ||||
-rw-r--r-- | modules/root/software/system.nix | 1 | ||||
-rw-r--r-- | modules/root/software/utilities.nix | 1 | ||||
-rw-r--r-- | modules/root/suspend.nix | 16 |
22 files changed, 159 insertions, 122 deletions
diff --git a/derivations/crazydiskinfo/default.nix b/derivations/crazydiskinfo/default.nix new file mode 100644 index 0000000..69d9fa1 --- /dev/null +++ b/derivations/crazydiskinfo/default.nix @@ -0,0 +1,38 @@ +{ lib +, cmake +, fetchFromGitHub +, fetchpatch +, libatasmart +, ncurses5 +, stdenv +}: + +stdenv.mkDerivation rec { + pname = "crazydiskinfo"; + version = "1.1.0"; + + src = fetchFromGitHub { + owner = "otakuto"; + repo = pname; + rev = "refs/tags/${version}"; + sha256 = "sha256-+6ShoaggQ256sLSJDj4d16OipUYX/4JjEwLL5hswjiQ="; + }; + + patches = [ + # Fix build warnings, original maintainer is MIA + (fetchpatch { + url = "https://patch-diff.githubusercontent.com/raw/otakuto/crazydiskinfo/pull/33.diff"; + sha256 = "sha256-z9aOQFsivu6sYgsZBOlnTvqnoR2ro/jyuO/WOimLSXk="; + }) + ]; + + buildInputs = [ cmake libatasmart ncurses5 ]; + + cmakeFlags = [ "-DCMAKE_INSTALL_PREFIX=$out" ]; + + meta = with lib; { + description = "CrazyDiskInfo is an interactive TUI S.M.A.R.T viewer for Unix systems"; + license = licenses.mit; + maintainers = [ maintainers.tjkeller ]; + }; +} diff --git a/derivations/lowbat/default.nix b/derivations/lowbat/default.nix index 02ff111..64ec205 100644 --- a/derivations/lowbat/default.nix +++ b/derivations/lowbat/default.nix @@ -1,28 +1,26 @@ -{ pkgs ? import <nixpkgs> {} }: +{ lib +, fetchzip +, glib +, libnotify +, pkg-config +, stdenv +}: -pkgs.stdenv.mkDerivation rec { +stdenv.mkDerivation rec { pname = "lowbat"; - version = "1.2.1"; + version = "1.2.2"; - src = pkgs.fetchzip { + src = fetchzip { url = "https://git.tjkeller.xyz/${pname}/snapshot/${pname}-${version}.tar.xz"; - sha256 = "sha256-xsUHdmicHX/fQQgojVjWfzI82e4NezkmlACOpdPxLE0="; + sha256 = "sha256-utdcY9qoDcrBWnGC8m/LUsnoxQ0ilssPDF44A6D/C+8="; }; - nativeBuildInputs = [ pkgs.pkg-config ]; - buildInputs = [ pkgs.libnotify pkgs.glib ]; + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ libnotify glib ]; - buildPhase = '' - make - ''; + installFlags = [ "PREFIX=$(out)" ]; - installPhase = '' - mkdir -p $out/bin $out/share/man/man1 - cp lowbat $out/bin/ - cp lowbat.1 $out/share/man/man1/ - ''; - - meta = with pkgs.lib; { + meta = with lib; { description = "A minimal battery level monitor daemon, written in C"; license = licenses.mit; maintainers = [ maintainers.tjkeller ]; diff --git a/derivations/pavolctld/default.nix b/derivations/pavolctld/default.nix index c78e3fe..d092ed5 100644 --- a/derivations/pavolctld/default.nix +++ b/derivations/pavolctld/default.nix @@ -1,27 +1,23 @@ -{ pkgs ? import <nixpkgs> {} }: +{ lib +, fetchzip +, libpulseaudio +, stdenv +}: -pkgs.stdenv.mkDerivation rec { +stdenv.mkDerivation rec { pname = "pavolctld"; - version = "1.0.0"; + version = "1.0.1"; - src = pkgs.fetchzip { + src = fetchzip { url = "https://git.tjkeller.xyz/${pname}/snapshot/${pname}-${version}.tar.xz"; - sha256 = "sha256-eJ5njP2wu2kxsNgDdULOaATJJarLh+LkM5M9+kujRt4="; + sha256 = "sha256-nmN8bQKQNGpCGvHQnZK9YQgB80SxRSds0V9Y7h/Guh8="; }; - buildInputs = [ pkgs.libpulseaudio ]; + buildInputs = [ libpulseaudio ]; - buildPhase = '' - make - ''; + installFlags = [ "PREFIX=$(out)" ]; - installPhase = '' - mkdir -p $out/bin $out/share/man/man1 - cp pavolctld $out/bin/ - cp pavolctld.1 $out/share/man/man1/ - ''; - - meta = with pkgs.lib; { + meta = with lib; { description = "A minimal PulseAudio volume control/monitoring daemon"; license = licenses.mit; maintainers = [ maintainers.tjkeller ]; diff --git a/derivations/st/default.nix b/derivations/st/default.nix index eb7c6bc..4c7f3a6 100644 --- a/derivations/st/default.nix +++ b/derivations/st/default.nix @@ -1,14 +1,13 @@ -{ - lib, - stdenv, - fetchzip, - fontconfig, - libX11, - libXcursor, - libXext, - libXft, - ncurses, - pkg-config, +{ lib +, fetchzip +, fontconfig +, libX11 +, libXcursor +, libXext +, libXft +, ncurses +, pkg-config +, stdenv }: stdenv.mkDerivation rec { @@ -20,25 +19,11 @@ stdenv.mkDerivation rec { sha256 = "sha256-p1u7TEeLeC5Kjvi8na4YhyQQ0qdPaUWZL6hq9O4HaKA="; }; - nativeBuildInputs = [ - pkg-config - ]; - buildInputs = [ - fontconfig - libX11 - libXcursor - libXext - libXft - ncurses - ]; + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ fontconfig libX11 libXcursor libXext libXft ncurses ]; - installPhase = '' - runHook preInstall - - TERMINFO=$out/share/terminfo make install PREFIX=$out - - runHook postInstall - ''; + makeFlags = [ "CFLAGS=-Ofast" ]; + installFlags = [ "PREFIX=$(out)" "TERMINFO=$(out)/share/terminfo" ]; meta = with lib; { homepage = "https://git.tjkeller.xyz/st"; @@ -8,12 +8,10 @@ rec { url = "github:Mic92/sops-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; - home-manager = { url = "github:nix-community/home-manager/release-24.11"; inputs.nixpkgs.follows = "nixpkgs"; }; - arkenfox = { url = "github:dwarfmaster/arkenfox-nixos"; inputs.nixpkgs.follows = "nixpkgs"; @@ -26,17 +24,21 @@ rec { pkgs = nixpkgs.legacyPackages.${system}; userDetails = { username = "timmy"; - home.root = "/home/timmy"; - home.downloads = "/home/timmy/dls"; - home.documents = "/home/timmy/docs"; - home.pictures = "/home/timmy/pics"; email = "tjkeller.xyz"; fullname = "Tim Keller"; + home = with userDetails; with home; { + root = "/home/${username}"; + downloads = "${root}/dls"; + documents = "${root}/docs"; + pictures = "${root}/pics"; + }; }; + homeStateVersion = "24.05"; # Lowest of systems is fine mkNixosConfiguration = hostname: nixpkgs.lib.nixosSystem { inherit system; specialArgs = { inherit inputs; + inherit hostname; inherit userDetails; }; modules = [ @@ -50,6 +52,7 @@ rec { users.${userDetails.username} = import ./modules/home; extraSpecialArgs = { inherit userDetails; + inherit homeStateVersion; }; sharedModules = [ inputs.arkenfox.hmModules.arkenfox @@ -60,11 +63,16 @@ rec { ]; }; in { - nixosConfigurations = { - T430 = mkNixosConfiguration "T430"; - T495 = mkNixosConfiguration "T495"; - hp-envy-office = mkNixosConfiguration "hp-envy-office"; - optiplex = mkNixosConfiguration "optiplex"; - }; + nixosConfigurations = builtins.listToAttrs (map (hostname: { + name = hostname; + value = mkNixosConfiguration hostname; + }) [ + # Configured system hostnames go here + "T430" + "T495" + "hp-envy-office" + "libreX60" + "optiplex" + ]); }; } diff --git a/modules/home/default.nix b/modules/home/default.nix index b44f360..8748fb9 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -1,12 +1,11 @@ -{ lib, userDetails, ... }: { +{ lib, userDetails, homeStateVersion, ... }: { home = { username = userDetails.username; homeDirectory = userDetails.home.root; - stateVersion = "24.05"; + stateVersion = homeStateVersion; }; imports = [ - ./alacritty.nix #./chrome.nix ./firefox.nix ./git.nix @@ -18,7 +17,6 @@ ./wallpapers.nix ]; - alacritty.enable = lib.mkDefault true; theme.mint.enable = lib.mkDefault true; wallpapers.enable = lib.mkDefault false; } diff --git a/modules/home/firefox.nix b/modules/home/firefox.nix index 5e015ff..9d4bb4e 100644 --- a/modules/home/firefox.nix +++ b/modules/home/firefox.nix @@ -1,29 +1,33 @@ { pkgs, userDetails, ... }: { programs.firefox = { - # TODO see if there is way to login to moz account in profile enable = true; - arkenfox = { - enable = true; - }; + arkenfox.enable = true; profiles = let search = { engines = { "Timmy Search" = { - urls = [{ template = "https://search.tjkeller.xyz/search?q={searchTerms}"; }]; # Don't know how to do w/ POST but I prefer GET anyways + urls = [{ + template = "https://search.tjkeller.xyz/search"; + params = [ { name = "q"; value = "{searchTerms}"; } ]; + }]; iconURI = "https://search.tjkeller.xyz/static/themes/simple/img/favicon.svg"; # TODO doesn't seem to work }; "Nix Packages" = { urls = [{ template = "https://search.nixos.org/packages"; - params = [ - { name = "type"; value = "packages"; } - { name = "query"; value = "{searchTerms}"; } - ]; + params = [ { name = "query"; value = "{searchTerms}"; } ]; }]; - icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; definedAliases = [ "@np" ]; }; + "NixOS Options" = { + urls = [{ + template = "https://search.nixos.org/options"; + params = [ { name = "query"; value = "{searchTerms}"; } ]; + }]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = [ "@no" ]; + }; }; default = "Timmy Search"; privateDefault = "Timmy Search"; @@ -46,7 +50,7 @@ "app.normandy.first_run" = false; "browser.aboutConfig.showWarning" = false; # arkenfox does - "browser.download.dir" = userDetails.home.downloads; # FF will create this dir if it doesn't exist + "browser.download.dir" = userDetails.home.downloads; "browser.newtabpage.activity-stream.feeds.section.topstories" = false; "browser.newtabpage.activity-stream.feeds.topsites" = false; "browser.urlbar.suggest.topsites" = false; @@ -54,7 +58,6 @@ "dom.push.enabled" = false; # "extensions.pocket.enabled" = false; "general.smoothScroll" = false; - #identity.fxaccounts.account.device.name = "timmy’s Firefox on nixos"; # HOSTNAME }; workSettings = settings // { "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org"; # Use builtin dark theme instead of system theme diff --git a/modules/home/gtk-bookmarks.nix b/modules/home/gtk-bookmarks.nix index 067543d..e6c1ec7 100644 --- a/modules/home/gtk-bookmarks.nix +++ b/modules/home/gtk-bookmarks.nix @@ -8,10 +8,10 @@ }; config = { - gtk.gtk3.bookmarks = with userDetails; [ - "file://${home.downloads} Downloads" - "file://${home.documents} Documents" - "file://${home.pictures} Pictures" + gtk.gtk3.bookmarks = with userDetails.home; [ + "file://${downloads} Downloads" + "file://${documents} Documents" + "file://${pictures} Pictures" ] ++ config.additional-gtk-bookmarks; }; } diff --git a/modules/home/initial-home-setup.nix b/modules/home/initial-home-setup.nix index 046f5a5..6aa6ac7 100644 --- a/modules/home/initial-home-setup.nix +++ b/modules/home/initial-home-setup.nix @@ -15,8 +15,8 @@ export PATH="$HOME/.local/bin/misc:$PATH" run mimewiz -i # already verbose ''; - createDirs = lib.hm.dag.entryAfter ["writeBoundary"] '' - run mkdir -p $VERBOSE_ARG "${userDetails.home.downloads}" + createDirs = with userDetails.home; lib.hm.dag.entryAfter ["writeBoundary"] '' + run mkdir -p $VERBOSE_ARG "${downloads}" "${documents}" "${pictures}" ''; }; } diff --git a/modules/home/resources/activation-scripts/clone-repos.sh b/modules/home/resources/activation-scripts/clone-repos.sh index 887968b..eaee4dc 100644 --- a/modules/home/resources/activation-scripts/clone-repos.sh +++ b/modules/home/resources/activation-scripts/clone-repos.sh @@ -3,8 +3,14 @@ server="https://git.tjkeller.xyz/" clonemissing() { + # pull and return if already existing + if [ -d "$2"/.git ]; then + run cd $VERBOSE_ARG "$2" + run git pull $VERBOSE_ARG || echo "$2: failed to pull from remote" + return + fi + # clone to $2 - [ -d "$2"/.git ] && return run mkdir -p $VERBOSE_ARG "$2" run git clone $VERBOSE_ARG "$server$1" "$2" diff --git a/modules/hosts/T430/configuration.nix b/modules/hosts/T430/configuration.nix index 282515d..7910275 100644 --- a/modules/hosts/T430/configuration.nix +++ b/modules/hosts/T430/configuration.nix @@ -1,6 +1,5 @@ { config, lib, pkgs, ... }: { imports = [ ./hardware-configuration.nix ]; - networking.hostName = "T430"; # TODO this does not function #boot.initrd.systemd.extraBin = { diff --git a/modules/hosts/T430/home.nix b/modules/hosts/T430/home.nix index 9885a06..15df79a 100644 --- a/modules/hosts/T430/home.nix +++ b/modules/hosts/T430/home.nix @@ -1,6 +1,5 @@ { ... }: { imports = [ ../../home ]; - alacritty.font.size = 9; wallpapers.enable = true; } diff --git a/modules/hosts/T495/configuration.nix b/modules/hosts/T495/configuration.nix index 526b7bb..6ee62e9 100644 --- a/modules/hosts/T495/configuration.nix +++ b/modules/hosts/T495/configuration.nix @@ -2,11 +2,9 @@ imports = [ ./hardware-configuration.nix ./games.nix - ./input-leap.nix + #./input-leap.nix ./wg.nix ]; - networking.hostName = "T495"; - bootloader.mode = "efi"; # Enable extra software pkgs @@ -27,10 +25,6 @@ nas.office.enable = true; nas.office.automount = false; - networking.hosts = { - "192.168.77.3" = [ "devel" ]; - }; - # Use amdgpu driver for x11 services.xserver.videoDrivers = [ "amdgpu" ]; diff --git a/modules/hosts/hp-envy-office/configuration.nix b/modules/hosts/hp-envy-office/configuration.nix index 9a7a43a..fdff4f0 100644 --- a/modules/hosts/hp-envy-office/configuration.nix +++ b/modules/hosts/hp-envy-office/configuration.nix @@ -1,8 +1,5 @@ { config, lib, pkgs, ... }: { - imports = [ - ./hardware-configuration.nix - ]; - networking.hostName = "hp-envy-office"; + imports = [ ./hardware-configuration.nix ]; # Enable extra software pkgs software.desktop = { diff --git a/modules/hosts/libreX60/configuration.nix b/modules/hosts/libreX60/configuration.nix index 942793d..38500a6 100644 --- a/modules/hosts/libreX60/configuration.nix +++ b/modules/hosts/libreX60/configuration.nix @@ -1,6 +1,5 @@ { config, lib, pkgs, ... }: { imports = [ ./hardware-configuration.nix ]; - networking.hostName = "libreX60"; # Enable extra software pkgs software.desktop = { diff --git a/modules/hosts/optiplex/configuration.nix b/modules/hosts/optiplex/configuration.nix index cbde612..d018c02 100644 --- a/modules/hosts/optiplex/configuration.nix +++ b/modules/hosts/optiplex/configuration.nix @@ -1,9 +1,5 @@ { config, lib, pkgs, ... }: { - imports = [ - ./hardware-configuration.nix - ]; - networking.hostName = "optiplex"; - + imports = [ ./hardware-configuration.nix ]; bootloader.mode = "efi"; # Allow unfree for nvidia + others @@ -32,10 +28,6 @@ # Disable wifi wifi.enable = false; - networking.hosts = { - "192.168.77.3" = [ "devel" ]; - }; - # Use nvidia driver services.xserver.videoDrivers = [ "nvidia" ]; hardware.nvidia = { @@ -46,5 +38,8 @@ package = config.boot.kernelPackages.nvidiaPackages.stable; # Still good for 1050 }; + # Disable suspend + suspend.enable = false; + system.stateVersion = "24.11"; } diff --git a/modules/root/bluetooth.nix b/modules/root/bluetooth.nix index d55eade..1f41c7e 100644 --- a/modules/root/bluetooth.nix +++ b/modules/root/bluetooth.nix @@ -3,7 +3,7 @@ bluetooth.enable = lib.mkEnableOption "enables bluetooth support"; }; - config = { + config = lib.mkIf config.bluetooth.enable { hardware.bluetooth.enable = true; services.blueman.enable = true; }; diff --git a/modules/root/default.nix b/modules/root/default.nix index e108318..5397ec4 100644 --- a/modules/root/default.nix +++ b/modules/root/default.nix @@ -17,6 +17,7 @@ ./printing.nix ./secrets.nix ./ssh.nix + ./suspend.nix ./tlp.nix ./wifi.nix ./x11.nix @@ -44,6 +45,7 @@ printing.enable = lib.mkDefault true; tlp.enable = lib.mkDefault true; scanning.enable = lib.mkDefault true; + suspend.enable = lib.mkDefault true; wifi.enable = lib.mkDefault true; xserver.enable = lib.mkDefault true; zsh.enable = lib.mkDefault true; diff --git a/modules/root/hosts.nix b/modules/root/hosts.nix index 14daaf1..b9f9d6e 100644 --- a/modules/root/hosts.nix +++ b/modules/root/hosts.nix @@ -1,10 +1,12 @@ -{ +{ hostname, ... }: { + networking.hostName = hostname; # From flake.nix networking.hosts = { "192.168.1.9" = [ "optiplex" ]; "192.168.1.30" = [ "localgit" ]; "192.168.1.11" = [ "truenas-home" ]; "192.168.77.11" = [ "truenas-office" ]; "192.168.77.8" = [ "publicgit" "tjkeller" ]; + "192.168.77.3" = [ "devel" ]; "173.9.253.3" = [ "git.tjkeller.xyz" "piped.tjkeller.xyz" diff --git a/modules/root/software/system.nix b/modules/root/software/system.nix index f0a31f2..4c81596 100644 --- a/modules/root/software/system.nix +++ b/modules/root/software/system.nix @@ -5,6 +5,7 @@ dash # TODO should be default /bin/sh exfat git # Needed for home-manager + ntfs3g python3 sops # Secrets ]; diff --git a/modules/root/software/utilities.nix b/modules/root/software/utilities.nix index dabf163..7622461 100644 --- a/modules/root/software/utilities.nix +++ b/modules/root/software/utilities.nix @@ -26,6 +26,7 @@ wireguard-tools xxHash yt-dlp + (callPackage ./derivations/crazydiskinfo {}) (callPackage ./derivations/lowbat {}) (callPackage ./derivations/pavolctld {}) ]; diff --git a/modules/root/suspend.nix b/modules/root/suspend.nix new file mode 100644 index 0000000..814ae95 --- /dev/null +++ b/modules/root/suspend.nix @@ -0,0 +1,16 @@ +{ lib, config, ... }: { + options = { + suspend.enable = lib.mkEnableOption "enables suspend"; + }; + + config = lib.mkIf (! config.suspend.enable) { + # Disable suspend targets + systemd.targets = builtins.listToAttrs (map (name: { + inherit name; + value = { + enable = false; + unitConfig.DefaultDependencies = "no"; + }; + }) ["sleep" "suspend" "hibernate" "hybrid-sleep"]); + }; +} |