From 801f878edcd830de1b42198ac177343560622fef Mon Sep 17 00:00:00 2001 From: Dave Gallant Date: Wed, 20 Jan 2021 21:31:47 -0500 Subject: [PATCH] Move overlays into their own dirs --- flake.nix | 5 +-- machines/hephaestus/configuration.nix | 17 +++++----- machines/hephaestus/hardware.nix | 10 +++--- main/kernel.nix | 2 +- main/packages.nix | 1 + modules/g810-led.nix | 4 +-- overlays/default.nix | 14 ++++---- overlays/g810-led/default.nix | 47 +++++++++++++++++++++++++++ overlays/lastpass.nix | 36 -------------------- overlays/lastpass/default.nix | 35 ++++++++++++++++++++ overlays/rfd.nix | 44 ------------------------- overlays/rfd/default.nix | 41 +++++++++++++++++++++++ overlays/srv.nix | 26 --------------- overlays/srv/default.nix | 22 +++++++++++++ overlays/vpngate.nix | 27 --------------- overlays/vpngate/default.nix | 24 ++++++++++++++ 16 files changed, 196 insertions(+), 159 deletions(-) create mode 100644 overlays/g810-led/default.nix delete mode 100644 overlays/lastpass.nix create mode 100644 overlays/lastpass/default.nix delete mode 100644 overlays/rfd.nix create mode 100644 overlays/rfd/default.nix delete mode 100644 overlays/srv.nix create mode 100644 overlays/srv/default.nix delete mode 100644 overlays/vpngate.nix create mode 100644 overlays/vpngate/default.nix diff --git a/flake.nix b/flake.nix index 068f381..39e1bb6 100644 --- a/flake.nix +++ b/flake.nix @@ -33,8 +33,9 @@ nixpkgs-unstable.flake = nixpkgs-unstable; }; - # nixpkgs.overlays = (import ./overlays); - nixpkgs.overlays = import ./overlays { inherit nixpkgs; }; + nixpkgs.overlays = [ + (import ./overlays) + ]; home-manager = { useGlobalPkgs = true; diff --git a/machines/hephaestus/configuration.nix b/machines/hephaestus/configuration.nix index 422a8a3..35dc15b 100644 --- a/machines/hephaestus/configuration.nix +++ b/machines/hephaestus/configuration.nix @@ -8,7 +8,6 @@ boot.loader.efi.canTouchEfiVariables = true; networking.hostName = "hephaestus"; # Define your hostname. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # The global useDHCP flag is deprecated, therefore explicitly set to false here. # Per-interface useDHCP will be mandatory in the future, so this generated config @@ -50,14 +49,14 @@ # Open ports in the firewall. networking.firewall.enable = true; - # systemd.services.g810-led = { - # description = "Set Logitech G810 Led Profile"; - # serviceConfig = { - # ExecStart = "${pkgs.g810-led}/bin/g810-led -p /etc/g610-led/profile"; - # Type = "oneshot"; - # }; - # wantedBy = [ "multi-user.target" ]; - # }; + systemd.services.g810-led = { + description = "Set Logitech G810 Led Profile"; + serviceConfig = { + ExecStart = "${pkgs.g810-led}/bin/g810-led -p /etc/g610-led/profile"; + Type = "oneshot"; + }; + wantedBy = [ "multi-user.target" ]; + }; } diff --git a/machines/hephaestus/hardware.nix b/machines/hephaestus/hardware.nix index 4f43a07..33bacc7 100644 --- a/machines/hephaestus/hardware.nix +++ b/machines/hephaestus/hardware.nix @@ -26,10 +26,10 @@ hardware.video.hidpi.enable = lib.mkDefault true; # Enable g810-led and set profile. - # hardware.g810-led.enable = true; - # hardware.g810-led.profile = builtins.toFile "g610-led-profile" '' - # a ff3000 # Set all keys to orange-red. - # c # Commit changes. - # ''; + hardware.g810-led.enable = true; + hardware.g810-led.profile = builtins.toFile "g610-led-profile" '' + a 000000 # Set all keys to orange-red. + c # Commit changes. + ''; } diff --git a/main/kernel.nix b/main/kernel.nix index cb193e9..4840bf3 100644 --- a/main/kernel.nix +++ b/main/kernel.nix @@ -1,7 +1,7 @@ { unstable, ... }: { - # Use the latest stable kernel + # Use the latest kernel boot.kernelPackages = unstable.linuxPackages_latest; # Enable support for additional filesystems diff --git a/main/packages.nix b/main/packages.nix index 3b94092..2917b78 100644 --- a/main/packages.nix +++ b/main/packages.nix @@ -159,6 +159,7 @@ rfd srv vpngate + g810-led ]; in common; diff --git a/modules/g810-led.nix b/modules/g810-led.nix index 6a019d2..d4a5e61 100644 --- a/modules/g810-led.nix +++ b/modules/g810-led.nix @@ -40,8 +40,8 @@ in { # Workaround mentioned here: # https://github.com/MatMoul/g810-led/blob/14e331ad2ab7c5ffb546e0c14dd6164b517ff9ca/PROFILES.md systemd.services.g810-led-workaround = mkIf cfg.enableFlashingWorkaround { - description = "Turn off all g810-led keys"; - script = "${pkgs.g810-led}/bin/g810-led -a 000000"; + description = "Turn off all leds"; + script = "${pkgs.g810-led}/bin/g610-led -a 000000"; serviceConfig.Type = "oneshot"; unitConfig.DefaultDependencies = false; diff --git a/overlays/default.nix b/overlays/default.nix index 13779cd..bea1cb8 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,9 +1,9 @@ -{ ... }: +final: prev: { -[ - (import ./lastpass.nix) - (import ./rfd.nix) - (import ./srv.nix) - (import ./vpngate.nix) -] + g810-led = prev.callPackage ./g810-led { }; + lpass = prev.callPackage ./lastpass { }; + rfd = prev.callPackage ./rfd { }; + srv = prev.callPackage ./srv { }; + vpngate = prev.callPackage ./vpngate { }; +} diff --git a/overlays/g810-led/default.nix b/overlays/g810-led/default.nix new file mode 100644 index 0000000..3cc1493 --- /dev/null +++ b/overlays/g810-led/default.nix @@ -0,0 +1,47 @@ +{ stdenv, lib, fetchFromGitHub, hidapi, profile ? "/etc/g810-led/profile" }: + +stdenv.mkDerivation rec { + pname = "g810-led"; + version = "0.4.2"; + + src = fetchFromGitHub { + owner = "MatMoul"; + repo = pname; + rev = "v${version}"; + hash = "sha256-FFaOGRLk9wCQ+Xkf/KacXF3rOrvg8xSyeDEwe+K5s/o="; + }; + + buildInputs = [ hidapi ]; + + installPhase = '' + runHook preInstall + + install -D bin/g810-led $out/bin/g810-led + ln -s \./g810-led $out/bin/g213-led + ln -s \./g810-led $out/bin/g410-led + ln -s \./g810-led $out/bin/g413-led + ln -s \./g810-led $out/bin/g512-led + ln -s \./g810-led $out/bin/g513-led + ln -s \./g810-led $out/bin/g610-led + ln -s \./g810-led $out/bin/g815-led + ln -s \./g810-led $out/bin/g910-led + ln -s \./g810-led $out/bin/gpro-led + + substituteInPlace udev/g810-led.rules \ + --replace "/usr" $out \ + --replace "/etc/g810-led/profile" "${profile}" + install -D udev/g810-led.rules $out/etc/udev/rules.d/90-g810-led.rules + + runHook postInstall + ''; + + meta = with lib; { + description = + "Linux LED controller for Logitech G213, G410, G413, G512, G513, G610, G810, G815, G910 and GPRO Keyboards"; + inherit (src.meta) homepage; + license = licenses.gpl3; + platforms = platforms.linux; + maintainers = with maintainers; [ samuelgrf ]; + }; +} + diff --git a/overlays/lastpass.nix b/overlays/lastpass.nix deleted file mode 100644 index 98ffc7e..0000000 --- a/overlays/lastpass.nix +++ /dev/null @@ -1,36 +0,0 @@ -self: super: rec { - - lpass = with self; - stdenv.mkDerivation rec { - pname = "lpass"; - version = "1.3.4-unreleased"; - - src = fetchFromGitHub { - owner = "lastpass"; - repo = "lastpass-cli"; - rev = "8767b5e53192ad4e72d1352db4aa9218e928cbe1"; - sha256 = "sha256:1d4m5h9byq5cccdg98m8d8457rbvp28q821d8rpglykgrfgnknwp"; - }; - - nativeBuildInputs = [ asciidoc cmake docbook_xsl pkgconfig ]; - - buildInputs = [ bash-completion curl openssl libxml2 libxslt ]; - - enableParallelBuilding = true; - - installTargets = [ "install" "install-doc" ]; - - postInstall = '' - install -Dm644 -T ../contrib/lpass_zsh_completion $out/share/zsh/site-functions/_lpass - install -Dm644 -T ../contrib/completions-lpass.fish $out/share/fish/vendor_completions.d/lpass.fish - ''; - - meta = with lib; { - description = - "Stores, retrieves, generates, and synchronizes passwords securely"; - homepage = "https://github.com/lastpass/lastpass-cli"; - license = licenses.gpl2Plus; - platforms = platforms.unix; - }; - }; -} diff --git a/overlays/lastpass/default.nix b/overlays/lastpass/default.nix new file mode 100644 index 0000000..d76a055 --- /dev/null +++ b/overlays/lastpass/default.nix @@ -0,0 +1,35 @@ +{ stdenv, lib, fetchFromGitHub, asciidoc, cmake, docbook_xsl, pkgconfig +, bash-completion, curl, openssl, libxml2, libxslt }: + +stdenv.mkDerivation rec { + pname = "lpass"; + version = "1.3.4-unreleased"; + + src = fetchFromGitHub { + owner = "lastpass"; + repo = "lastpass-cli"; + rev = "8767b5e53192ad4e72d1352db4aa9218e928cbe1"; + sha256 = "sha256:1d4m5h9byq5cccdg98m8d8457rbvp28q821d8rpglykgrfgnknwp"; + }; + + nativeBuildInputs = [ asciidoc cmake docbook_xsl pkgconfig ]; + + buildInputs = [ bash-completion curl openssl libxml2 libxslt ]; + + enableParallelBuilding = true; + + installTargets = [ "install" "install-doc" ]; + + postInstall = '' + install -Dm644 -T ../contrib/lpass_zsh_completion $out/share/zsh/site-functions/_lpass + install -Dm644 -T ../contrib/completions-lpass.fish $out/share/fish/vendor_completions.d/lpass.fish + ''; + + meta = with lib; { + description = + "Stores, retrieves, generates, and synchronizes passwords securely"; + homepage = "https://github.com/lastpass/lastpass-cli"; + license = licenses.gpl2Plus; + platforms = platforms.unix; + }; +} diff --git a/overlays/rfd.nix b/overlays/rfd.nix deleted file mode 100644 index 7bb38b0..0000000 --- a/overlays/rfd.nix +++ /dev/null @@ -1,44 +0,0 @@ -self: super: rec { - - python38 = with super; super.python38.override { }; - - pythonPackages = python38.pkgs; - - rfd = with self; - pythonPackages.buildPythonApplication rec { - pname = "rfd"; - version = "v0.6.0"; - - src = fetchFromGitHub { - owner = "davegallant"; - repo = "rfd"; - rev = version; - hash = "sha256:0cllhbca4dykl6j8snmml4kk6kzamlzhcrdf49f5v0zk7zljgkl1"; - }; - - postPatch = '' - substituteInPlace requirements.txt --replace "soupsieve<=2.0" "soupsieve" - substituteInPlace requirements.txt --replace "beautifulsoup4<=4.8.2" "beautifulsoup4" - ''; - - # No tests included - doCheck = false; - - propagatedBuildInputs = with pythonPackages; [ - beautifulsoup4 - click - colorama - requests - soupsieve - ]; - - passthru.python3 = python3; - - meta = with super.lib; { - homepage = "https://www.redflagdeals.com/"; - description = "View RedFlagDeals from the command line"; - license = licenses.asl20; - maintainers = [ ]; - }; - }; -} diff --git a/overlays/rfd/default.nix b/overlays/rfd/default.nix new file mode 100644 index 0000000..3b56218 --- /dev/null +++ b/overlays/rfd/default.nix @@ -0,0 +1,41 @@ +{ lib, fetchFromGitHub, python3, }: + +let py = python3.override { }; + +in with py.pkgs; +buildPythonApplication rec { + pname = "rfd"; + version = "v0.6.0"; + + src = fetchFromGitHub { + owner = "davegallant"; + repo = "rfd"; + rev = version; + hash = "sha256:0cllhbca4dykl6j8snmml4kk6kzamlzhcrdf49f5v0zk7zljgkl1"; + }; + + postPatch = '' + substituteInPlace requirements.txt --replace "soupsieve<=2.0" "soupsieve" + substituteInPlace requirements.txt --replace "beautifulsoup4<=4.8.2" "beautifulsoup4" + ''; + + # No tests included + doCheck = false; + + propagatedBuildInputs = with py.pkgs; [ + beautifulsoup4 + click + colorama + requests + soupsieve + ]; + + passthru.python3 = python3; + + meta = with lib; { + homepage = "https://www.redflagdeals.com/"; + description = "View RedFlagDeals from the command line"; + license = licenses.asl20; + maintainers = [ ]; + }; +} diff --git a/overlays/srv.nix b/overlays/srv.nix deleted file mode 100644 index 602d9fc..0000000 --- a/overlays/srv.nix +++ /dev/null @@ -1,26 +0,0 @@ -self: super: - -rec { - - srv = with self; - buildGoModule rec { - pname = "srv"; - version = "v0.1.2"; - - vendorSha256 = "sha256-ebumpo9hgr7A+Fsznga4ksYu4mcOIfaaKz0uJu2rivE="; - - src = fetchFromGitHub { - owner = "davegallant"; - repo = "srv"; - rev = version; - sha256 = "sha256-x5l/NFEbbRPMBY061g4qRHYV6QUShO7yHqSw+Hir9M0="; - }; - - meta = with super.lib; { - description = "a simple rss viewer"; - license = licenses.unlicense; - maintainers = with maintainers; [ davegallant ]; - platforms = platforms.linux ++ platforms.darwin; - }; - }; -} diff --git a/overlays/srv/default.nix b/overlays/srv/default.nix new file mode 100644 index 0000000..77e6d1c --- /dev/null +++ b/overlays/srv/default.nix @@ -0,0 +1,22 @@ +{ lib, fetchFromGitHub, buildGoModule }: + +buildGoModule rec { + pname = "srv"; + version = "v0.1.2"; + + vendorSha256 = "sha256-ebumpo9hgr7A+Fsznga4ksYu4mcOIfaaKz0uJu2rivE="; + + src = fetchFromGitHub { + owner = "davegallant"; + repo = "srv"; + rev = version; + sha256 = "sha256-x5l/NFEbbRPMBY061g4qRHYV6QUShO7yHqSw+Hir9M0="; + }; + + meta = with lib; { + description = "a simple rss viewer"; + license = licenses.unlicense; + maintainers = with maintainers; [ davegallant ]; + platforms = platforms.linux ++ platforms.darwin; + }; +} diff --git a/overlays/vpngate.nix b/overlays/vpngate.nix deleted file mode 100644 index 6e17ad9..0000000 --- a/overlays/vpngate.nix +++ /dev/null @@ -1,27 +0,0 @@ -self: super: - -rec { - - vpngate = with self; - buildGoModule rec { - pname = "vpngate"; - version = "v0.0.2"; - - vendorSha256 = "1ys2rvrbxgsrvmjdxqgpmxf0m9nlp905gnr2mrf3c7iaxm86wgf8"; - - src = fetchFromGitHub { - owner = "davegallant"; - repo = "vpngate"; - rev = version; - sha256 = "0ky3wd04xd4sb2zskrrlbgys2gw88yqhngg3bl0sjy8kr6099vfn"; - }; - - meta = with super.lib; { - homepage = "https://www.vpngate.net"; - description = "a client for vpngate.net"; - license = licenses.asl20; - maintainers = with maintainers; [ davegallant ]; - platforms = platforms.linux ++ platforms.darwin; - }; - }; -} diff --git a/overlays/vpngate/default.nix b/overlays/vpngate/default.nix new file mode 100644 index 0000000..89b6807 --- /dev/null +++ b/overlays/vpngate/default.nix @@ -0,0 +1,24 @@ +{ lib, fetchFromGitHub, buildGoModule }: + +buildGoModule rec { + + pname = "vpngate"; + version = "v0.0.2"; + + vendorSha256 = "1ys2rvrbxgsrvmjdxqgpmxf0m9nlp905gnr2mrf3c7iaxm86wgf8"; + + src = fetchFromGitHub { + owner = "davegallant"; + repo = "vpngate"; + rev = version; + sha256 = "0ky3wd04xd4sb2zskrrlbgys2gw88yqhngg3bl0sjy8kr6099vfn"; + }; + + meta = with lib; { + homepage = "https://www.vpngate.net"; + description = "a client for vpngate.net"; + license = licenses.asl20; + maintainers = with maintainers; [ davegallant ]; + platforms = platforms.linux ++ platforms.darwin; + }; +}