├── .gitignore ├── LICENSE ├── README.md ├── build.nix ├── default.nix ├── system76-acpi-dkms ├── default.nix └── generic.nix ├── system76-dkms ├── default.nix └── generic.nix ├── system76-driver ├── default.nix └── generic.nix ├── system76-firmware ├── default.nix └── generic.nix └── system76-io-dkms ├── default.nix └── generic.nix /.gitignore: -------------------------------------------------------------------------------- 1 | result* 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2019, Sam Stites 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # System76 nixos configurations 2 | 3 | Supported models 4 | 5 | | Model | Contributors | Status | 6 | | -------------------- | ----------------- | ------ | 7 | | `oryp4` | [stites][stites] | | 8 | | `darp6` | [khumba][khumba] | | 9 | 10 | [stites]: https://github.com/stites 11 | [khumba]: https://github.com/khumba 12 | 13 | 14 | This repo was/is an attempt to add nixos support to all system76-development repositories, attempting to reach parity with [system76-dev's stable PPA](https://launchpad.net/~system76-dev/+archive/ubuntu/stable). This _does_ mean that this repo may be opinionated about which kernels you can support. *I ([stites][stites]) am no longer maintaining this repository and am planning on pushing it up to https://github.com/NixOS/nixos-hardware -- feel free to initiate this effort* 15 | 16 | On oryp4 support: the only comprehensive discussion for a non-ubuntu build that I could find was [_Installing Archlinux on System76's 2018 Oryx Pro (oryp4)_](https://ebobby.org/2018/07/15/archlinux-on-oryp4/) ([permalink](https://perma.cc/JQ7V-2FGN)). 17 | 18 | Repositories tracked (as well as last known release and status): 19 | 20 | | Package | Last known release | Last release date | Last checked | Notes | 21 | | -------------------------------------------------------------------- | ------------------ | ----------------- | ------------ | ------ | 22 | | [system76-acpi-dkms](https://github.com/pop-os/system76-acpi-dkms) | 1.0.1 | 10/15/2019 | 03/22/2020 | incomplete | 23 | | [system76-dkms](https://github.com/pop-os/system76-dkms) | 1.0.6 | 06/06/2019 | 03/22/2020 | untested | 24 | | [system76-driver](https://github.com/pop-os/system76-driver) | 19.04.2 | 01/31/2019 | 02/06/2018 | incomplete | 25 | | [system76-io-dkms](https://github.com/pop-os/system76-io-dkms) | 1.0.1 | 06/04/2019 | 03/22/2020 | incomplete | 26 | | [system76-firmware](https://github.com/pop-os/system76-firmware) | 1.0.2 | 05/08/2019 | 02/06/2018 | untested | 27 | | [system76-power](https://github.com/pop-os/system76-power) | none | 02/06/2019 | 02/06/2018 | incomplete | 28 | | [hidpi-daemon](https://github.com/pop-os/hidpi-daemon) | 18.04.4 | 08/01/2018 | 02/06/2018 | incomplete | 29 | | [gtk-theme](https://github.com/pop-os/gtk-theme) | 4.0.0-b2 | 08/09/2018 | 02/06/2018 | incomplete, low priority | 30 | | [system76-wallpapers](https://github.com/pop-os/system76-wallpapers) | none | 02/06/2019 | 02/06/2018 | incomplete, low priority | 31 | | [system76-io-dkms](https://github.com/pop-os/system76-io-dkms) | 1.0.0 | 12/04/2018 | 02/06/2018 | incomplete, low priority, theilo only | 32 | 33 | 34 | ### Discovered kernel modules you should probably load (for all system76 models) 35 | 36 | See full list [system76-driver:system76driver/daemon.py](https://github.com/pop-os/system76-driver/blob/34c87f2a1ceb62fe95c1a0509bf2baf2949180c0/system76driver/daemon.py) for correct kernel modules which should be loaded. 37 | 38 | ### How to use 39 | 40 | clone this repo in your `/etc/nixos/` folder. Add this folder as an import in `/etc/nixos/configuration.nix` and **remember to allowUnfree software if you have a system76 laptop with GPU support**: 41 | 42 | ``` 43 | # in /etc/nixos/configuration.nix 44 | { 45 | hardware.system76.enable = true; 46 | 47 | # Supported options: generic (default), darp6 48 | # This controls which kernel modules are installed. 49 | #hardware.system76.model = "generic"; 50 | 51 | # for nvidia-supported laptops 52 | nixpkgs.config.allowUnfree = true; 53 | 54 | imports = 55 | [ ... 56 | 57 | # if you want to import defaults 58 | ./system76-nixos 59 | 60 | # I think this would also work? 61 | builtins.fetchGit { url="https://github.com/stites/system76-nixos"; ref="master"; }} 62 | 63 | # if you want something more granular 64 | "${builtins.fetchGit { url="https://github.com/stites/system76-nixos"; ref="master"; }}/if-you-want-a-specific-file.nix" 65 | ]; 66 | } 67 | ``` 68 | 69 | 70 | -------------------------------------------------------------------------------- /build.nix: -------------------------------------------------------------------------------- 1 | let 2 | config = { 3 | # allowUnfree = true; 4 | packageOverrides = pkgs: { 5 | linuxPackages = pkgs.linuxPackages.extend(self: super: { 6 | system76-acpi-dkms = self.callPackage ./system76-acpi-dkms {}; 7 | system76-dkms = self.callPackage ./system76-dkms {}; 8 | system76-io-dkms = self.callPackage ./system76-io-dkms {}; 9 | system76-firmware = self.callPackage ./system76-firmware {}; 10 | system76-driver = self.callPackage ./system76-driver {}; 11 | }); 12 | }; 13 | }; 14 | 15 | pkgs = import ((import {}).fetchFromGitHub { 16 | owner = "NixOS"; 17 | repo = "nixpkgs-channels"; 18 | rev = "2d6f84c1090ae39c58dcec8f35a3ca62a43ad38c"; 19 | sha256 = "0l8b51lwxlqc3h6gy59mbz8bsvgc0q6b3gf7p3ib1icvpmwqm773"; 20 | }) { inherit config; }; 21 | 22 | in with pkgs; { 23 | system76-acpi-dkms_beta = linuxPackages.system76-acpi-dkms.beta; 24 | system76-acpi-dkms_stable = linuxPackages.system76-acpi-dkms.stable; 25 | system76-dkms_beta = linuxPackages.system76-dkms.beta; 26 | system76-dkms_stable = linuxPackages.system76-dkms.stable; 27 | system76-dkms_legacy_1_0_1 = linuxPackages.system76-dkms.legacy_1_0_1; 28 | system76-dkms_legacy_1_0_0 = linuxPackages.system76-dkms.legacy_1_0_0; 29 | system76-io-dkms_beta = linuxPackages.system76-io-dkms.beta; 30 | system76-io-dkms_stable = linuxPackages.system76-io-dkms.stable; 31 | system76-firmware = linuxPackages.system76-firmware; 32 | system76-driver-v19_04_3 = linuxPackages.system76-driver.v19_04_3; 33 | system76-driver-v18_10_6 = linuxPackages.system76-driver.v18_10_6; 34 | system76-driver-v18_04_35 = linuxPackages.system76-driver.v18_04_35; 35 | } 36 | -------------------------------------------------------------------------------- /default.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, ... }: 2 | 3 | let 4 | cfg = config.hardware.system76; 5 | 6 | # Supported laptop models. Models for which the generic configuration isn't 7 | # specific can be added here. 8 | supportedModels = [ "generic" "darp6" ]; 9 | 10 | # darp6 needs system76-acpi-dkms, not system76-dkms: 11 | # 12 | # [1] https://github.com/pop-os/system76-dkms/issues/39 13 | # jackpot51> system76-acpi-dkms is the correct driver to use on the darp6 14 | # 15 | # system76-io-dkms also appears to be loaded on darp6 with Pop!_OS, and 16 | # system76-dkms does not. 17 | 18 | useAcpiDkms = builtins.elem cfg.model [ "darp6" ]; 19 | 20 | useIoDkms = builtins.elem cfg.model [ "darp6" ]; 21 | 22 | # In absense of more knowledge, we install system76-dkms for all other models. 23 | useDkms = !builtins.elem cfg.model [ "darp6" ]; 24 | 25 | kernelPackages = let inherit (config.boot.kernelPackages) callPackage; in { 26 | system76-acpi-dkms = (callPackage ./system76-acpi-dkms {}).${cfg.release}; 27 | system76-io-dkms = (callPackage ./system76-io-dkms {}).${cfg.release}; 28 | system76-dkms = (callPackage ./system76-dkms {}).${cfg.release}; 29 | }; 30 | in 31 | { 32 | options.hardware.system76 = { 33 | enable = lib.mkOption { 34 | type = lib.types.bool; 35 | default = false; 36 | example = true; 37 | description = '' 38 | Whether to enable support for System76 hardware. 39 | ''; 40 | }; 41 | 42 | model = lib.mkOption { 43 | type = lib.types.enum supportedModels; 44 | default = "generic"; 45 | description = '' 46 | The model of System76 laptop to configure for. This determines which 47 | kernel drivers will be used. If there is no specific support for your 48 | model, a generic configuration may be used. 49 | ''; 50 | }; 51 | 52 | release = lib.mkOption { 53 | type = lib.types.enum [ "beta" "stable" ]; 54 | default = "stable"; 55 | example = "beta"; 56 | description = '' 57 | Whether to use stable or beta versions of System76 software releases. 58 | ''; 59 | }; 60 | }; 61 | 62 | config = lib.mkIf cfg.enable { 63 | # This is required for system76-driver, I believe. Can I just add this to the nix script? 64 | boot.kernelParams = [ "ec_sys.write_support=1" ]; 65 | 66 | boot.extraModulePackages = 67 | lib.optional useAcpiDkms kernelPackages.system76-acpi-dkms ++ 68 | lib.optional useIoDkms kernelPackages.system76-io-dkms ++ 69 | lib.optional useDkms kernelPackages.system76-dkms; 70 | 71 | # system76_acpi automatically loads on darp6, but system76_io does not. 72 | # Explicitly load both for consistency. 73 | boot.kernelModules = 74 | lib.optional useAcpiDkms "system76_acpi" ++ 75 | lib.optional useIoDkms "system76_io" ++ 76 | # This line I think is not needed. Depends on when I'm supposed to load this 77 | []; # lib.optional useDkms "system76" 78 | }; 79 | } 80 | -------------------------------------------------------------------------------- /system76-acpi-dkms/default.nix: -------------------------------------------------------------------------------- 1 | { lib, callPackage }: 2 | 3 | let 4 | generic = args: callPackage (import ./generic.nix args) { }; 5 | in 6 | 7 | rec { 8 | beta = stable; 9 | stable = generic { 10 | version = "1.0.1"; 11 | sha = "0jmm9h607f7k20yassm6af9mh5l00yih5248wwv4i05bd68yw3p5"; 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /system76-acpi-dkms/generic.nix: -------------------------------------------------------------------------------- 1 | {version, rev ? version, sha}: { stdenv, fetchFromGitHub, fetchpatch, kernel }: 2 | 3 | stdenv.mkDerivation { 4 | name = "system76-acpi-dkms-${version}"; 5 | version = "${version}"; 6 | 7 | src = fetchFromGitHub { 8 | owner = "pop-os"; 9 | repo = "system76-acpi-dkms"; 10 | inherit rev; 11 | sha256 = "${sha}"; 12 | }; 13 | 14 | hardeningDisable = [ "pic" ]; 15 | dontStrip = true; 16 | dontPatchELF = true; 17 | 18 | kernel = kernel.dev; 19 | nativeBuildInputs = kernel.moduleBuildDependencies; 20 | 21 | preBuild = '' 22 | sed -e "s@/lib/modules/\$(.*)@${kernel.dev}/lib/modules/${kernel.modDirVersion}@" -i Makefile 23 | ''; 24 | 25 | outputs = [ "out" ]; 26 | installPhase = '' 27 | mkdir -p $out/lib/modules/${kernel.modDirVersion}/misc 28 | cp system76_acpi.ko $out/lib/modules/${kernel.modDirVersion}/misc 29 | 30 | # not sure if these are working 31 | mkdir -p $out/usr/share/initramfs-tools/hooks 32 | cp {$src,$out}/usr/share/initramfs-tools/hooks/system76-acpi-dkms 33 | 34 | mkdir -p $out/usr/share/initramfs-tools/modules.d 35 | cp {$src,$out}/usr/share/initramfs-tools/modules.d/system76-acpi-dkms.conf 36 | ''; 37 | 38 | meta = with stdenv.lib; { 39 | maintainers = [ maintainers.khumba ]; 40 | platforms = [ "i686-linux" "x86_64-linux" ]; 41 | description = "System76 ACPI Driver (DKMS)"; 42 | homepage = https://github.com/pop-os/system76-acpi-dkms; 43 | longDescription = '' 44 | This provides the system76_acpi in-tree driver for systems missing it. 45 | ''; 46 | }; 47 | } 48 | -------------------------------------------------------------------------------- /system76-dkms/default.nix: -------------------------------------------------------------------------------- 1 | { lib, callPackage }: 2 | 3 | let 4 | generic = args: callPackage (import ./generic.nix args) { }; 5 | in 6 | 7 | rec { 8 | beta = generic { 9 | version = "1.0.6"; 10 | sha = "0263aqm0aibnfhy1m99nj36c7p2327a3aqk5by2nm2mjm3sqr5zc"; 11 | }; 12 | stable = generic { 13 | version = "1.0.3"; 14 | sha = "0f6frbjjg8fap5n29j1khb5m5bbz36ycd9dzjrgs59bgkxmwfwmc"; 15 | }; 16 | # there is no 1_0_2 17 | legacy_1_0_1 = generic { 18 | version = "1.0.1"; 19 | sha = "1lwbz8irjjnvqbajg5s6fm7jzvvs60ral7k7wma1q233nj3ajsja"; 20 | }; 21 | legacy_1_0_0 = generic { 22 | version = "1.0.0"; 23 | sha = "1bjl6w5hnlprb1n3823g30wwfwxwq20bwr8lwj5sibcgyh1n443y"; 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /system76-dkms/generic.nix: -------------------------------------------------------------------------------- 1 | {version, sha}: { stdenv, fetchFromGitHub, fetchpatch, kernel }: 2 | 3 | stdenv.mkDerivation { 4 | name = "system76-dkms-${version}"; 5 | version = "${version}"; 6 | 7 | src = fetchFromGitHub { 8 | owner = "pop-os"; 9 | repo = "system76-dkms"; 10 | rev = "${version}"; 11 | sha256 = "${sha}"; 12 | }; 13 | 14 | hardeningDisable = [ "pic" ]; 15 | dontStrip = true; 16 | dontPatchELF = true; 17 | 18 | kernel = kernel.dev; 19 | nativeBuildInputs = kernel.moduleBuildDependencies; 20 | 21 | preBuild = '' 22 | sed -e "s@/lib/modules/\$(.*)@${kernel.dev}/lib/modules/${kernel.modDirVersion}@" -i Makefile 23 | ''; 24 | 25 | outputs = [ "out" ]; 26 | installPhase = '' 27 | mkdir -p $out/lib/modules/${kernel.modDirVersion}/misc 28 | cp system76.ko $out/lib/modules/${kernel.modDirVersion}/misc 29 | 30 | # not sure if these are working 31 | mkdir -p $out/usr/share/initramfs-tools/hooks 32 | cp {$src,$out}/usr/share/initramfs-tools/hooks/system76-dkms 33 | 34 | mkdir -p $out/usr/share/initramfs-tools/modules.d 35 | cp {$src,$out}/usr/share/initramfs-tools/modules.d/system76-dkms.conf 36 | ''; 37 | 38 | meta = with stdenv.lib; { 39 | maintainers = [ maintainers.stites ]; 40 | platforms = [ "i686-linux" "x86_64-linux" ]; 41 | description = "System76 DKMS driver"; 42 | homepage = https://github.com/pop-os/system76-dkms; 43 | longDescription = '' 44 | The System76 DKMS driver. On newer System76 laptops, this driver controls some of the hotkeys and allows for custom fan control. 45 | ''; 46 | }; 47 | } 48 | -------------------------------------------------------------------------------- /system76-driver/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, callPackage }: 2 | 3 | let 4 | python = pkgs.python36; 5 | python3Packages = pkgs.python36Packages; 6 | # 'python2.withPackages (ps: with ps; [ pygobject3 ])' --run "python -c \"import pygtkcompat; pygtkcompat.enable_gtk(version='3.0')\"" 7 | python3 = python.withPackages (pkgs: with pkgs; [ ]); 8 | generic = args: callPackage (import ./generic.nix args) { inherit python3Packages python3; }; # inherit (python.pkgs) buildPythonPackage; inherit python3; }; 9 | in 10 | 11 | rec { 12 | v19_04_3 = generic { 13 | version = "19.04.3"; 14 | sha = "1pqb22zy3sx3k8qhvzw4g45wbg73g81qvyx7vgh4g8w5ar52nyxc"; 15 | }; 16 | v18_10_6 = generic { 17 | version = "18.10.6"; 18 | sha = "12jgfd5mr0c25k299r6isfcbk6ydm8c26qglrfcdsnn4204hv2b2"; 19 | }; 20 | v18_04_35 = generic { 21 | version = "18.04.35"; 22 | sha = "01abk0sv5gvf7sfsasd42m0m6abaim1fca8m5v1xgb6iaydh4kcp"; 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /system76-driver/generic.nix: -------------------------------------------------------------------------------- 1 | { version, sha }: 2 | { stdenv, fetchFromGitHub, fetchpatch, kernel 3 | , python3Packages, python3 # pygobject3 4 | , dbus, systemd, gnome3, gobjectIntrospection, pango, pkgconfig, gcc #, lzma, openssl, gnumake, binutils, git 5 | }: 6 | let 7 | pversion = version; 8 | in 9 | python3Packages.buildPythonPackage rec { 10 | pname = "system76-driver-${version}"; 11 | version = "${pversion}"; 12 | 13 | src = fetchFromGitHub { 14 | owner = "pop-os"; 15 | repo = "system76-driver"; 16 | rev = "${version}"; 17 | sha256 = "${sha}"; 18 | }; 19 | 20 | nativeBuildInputs = kernel.moduleBuildDependencies ++ [ gobjectIntrospection systemd pango gnome3.gdk_pixbuf gnome3.gtk3 pkgconfig python3 ]; 21 | 22 | pythonPath = with python3Packages; [ pygobject3 dbus ]; 23 | propogatedBuildInputs = pythonPath; 24 | 25 | enableParallelBuilding = true; 26 | doCheck = false; 27 | outputs = [ "out" ]; 28 | 29 | meta = with stdenv.lib; { 30 | maintainers = [ maintainers.stites ]; 31 | platforms = [ "i686-linux" "x86_64-linux" ]; 32 | description = "System76 Driver"; 33 | homepage = https://github.com/pop-os/system76-driver; 34 | longDescription = '' 35 | This program installs drivers and provides restore functionality for System76 machines 36 | ''; 37 | }; 38 | } 39 | 40 | -------------------------------------------------------------------------------- /system76-firmware/default.nix: -------------------------------------------------------------------------------- 1 | { lib, callPackage }: 2 | 3 | let 4 | generic = args: callPackage (import ./generic.nix args) { }; 5 | in 6 | 7 | # { 8 | # ################################################################################################ 9 | # # The only recent changes since 1.0.2 seem to be changing the cli binary from 10 | # # `system-firmware` to `system-firmware-cli` and installing the system daemon. 11 | # # 12 | # # 1.0.2 was released on 05/08/2018 -- today (02/06/2019), there have been the following commits: 13 | # # - SSL Fix (for debian, I believe) 14 | # # - Rename cli binary to have -cli suffix (reflected in our current build-scripts) 15 | # # - install/uninstall the systemd unit with the daemon (reflected in our current build-scripts) 16 | # # - Update error message to reflect action taken (can wait till next release) 17 | # # - Create ISSUE_TEMPLATE.md (not nessecary here) 18 | # # 19 | # ################################################################################################ 20 | # # git = generic { 21 | # # version = "git"; 22 | # # rev = "e2f80e879aac7cefa3d19884d308aa929a018e77"; 23 | # # sha = "0b0n13k0k3w0pbxhdzisag0kp399g1yp9iq99dyw70z3bla7zp7b"; 24 | # # cargoSha = "0i8yvvahaabhayvmg8l8wm7s6ib5rcarff8c7sazj6cgqcj6q6bn"; 25 | # # }; 26 | # 27 | # stable = generic rec { 28 | # version = "1.0.2"; 29 | # rev = version; 30 | # sha = "0xsjrrwibrn0rmfhvkbjfyvk8dhxy8jagzgvbw3i8d4ff57agysy"; 31 | # cargoSha = "0i8yvvahaabhayvmg8l8wm7s6ib5rcarff8c7sazj6cgqcj6q6bn"; 32 | # }; 33 | # } 34 | 35 | generic rec { 36 | version = "1.0.2"; 37 | rev = version; 38 | sha = "0xsjrrwibrn0rmfhvkbjfyvk8dhxy8jagzgvbw3i8d4ff57agysy"; 39 | cargoSha = "0i8yvvahaabhayvmg8l8wm7s6ib5rcarff8c7sazj6cgqcj6q6bn"; 40 | } 41 | -------------------------------------------------------------------------------- /system76-firmware/generic.nix: -------------------------------------------------------------------------------- 1 | {version, rev, sha, cargoSha}: 2 | { stdenv, fetchFromGitHub, fetchpatch, kernel 3 | , rustPlatform, cargo, cargo-vendor 4 | , dbus, systemd, libsodium, pkgconfig, lzma, openssl, gnumake, gcc, binutils, git 5 | }: 6 | 7 | rustPlatform.buildRustPackage { 8 | name = "system76-firmware-${version}"; 9 | version = "${version}"; 10 | 11 | src = fetchFromGitHub { 12 | owner = "pop-os"; 13 | repo = "system76-firmware"; 14 | rev = "${rev}"; 15 | sha256 = "${sha}"; 16 | }; 17 | 18 | enableParallelBuilding = true; 19 | 20 | # FIXME: not sure what this does... can someone spotcheck this? 21 | hardeningDisable = [ "pic" ]; 22 | 23 | nativeBuildInputs = kernel.moduleBuildDependencies ++ [ 24 | dbus systemd libsodium pkgconfig lzma openssl gnumake gcc binutils 25 | cargo cargo-vendor git 26 | ]; 27 | 28 | buildInputs = [ cargo cargo-vendor git ]; 29 | 30 | cargoSha256 = "${cargoSha}"; 31 | 32 | outputs = [ "out" ]; 33 | 34 | ################################################################################################ 35 | # The only recent changes since 1.0.2 seem to be changing the cli binary from 36 | # `system-firmware` to `system-firmware-cli` and installing the system daemon. 37 | ################################################################################################ 38 | installPhase = let 39 | # Keep this in line with the Makefile? 40 | sysconfdir = "/etc"; 41 | PKG = "system76-firmware"; 42 | CLI = "${PKG}"; 43 | CLI_OUTPUT = "${CLI}-cli"; 44 | DAEMON = "${PKG}-daemon"; 45 | in '' 46 | mkdir $out 47 | 48 | # From Makefile 'install-cli' 49 | mkdir -p $out/bin/ 50 | install -D -m 0755 "target/release/${CLI}" "$out/bin/${CLI_OUTPUT}" 51 | 52 | # From Makefile 'install-daemon' 53 | mkdir -p $out/lib/${PKG} 54 | install -D -m 0755 "target/release/${DAEMON}" "$out/lib/${PKG}/${DAEMON}" 55 | mkdir -p $out/etc/dbus-1/system.d/ 56 | install -D -m 0644 "data/${DAEMON}.conf" "$out/etc/dbus-1/system.d/${DAEMON}.conf" 57 | mkdir -p $out/etc/systemd/system/ 58 | install -D -m 0644 "debian/${DAEMON}.service" "$out/etc/systemd/system/${DAEMON}.service" 59 | ''; 60 | 61 | meta = with stdenv.lib; { 62 | maintainers = [ maintainers.stites ]; 63 | platforms = [ "i686-linux" "x86_64-linux" ]; 64 | description = "System76 Firmware Tool and Daemon"; 65 | homepage = https://github.com/pop-os/system76-firmware; 66 | longDescription = '' 67 | The system76-firmware package has a CLI tool for installing firmware updates. 68 | Also included is the system76-firmware-daemon package, which has a systemd service 69 | that exposes a DBUS API for handling firmware updates. 70 | ''; 71 | }; 72 | } 73 | -------------------------------------------------------------------------------- /system76-io-dkms/default.nix: -------------------------------------------------------------------------------- 1 | { lib, callPackage }: 2 | 3 | let 4 | generic = args: callPackage (import ./generic.nix args) { }; 5 | in 6 | 7 | rec { 8 | beta = stable; 9 | stable = generic { 10 | version = "1.0.1"; 11 | sha = "0qkgkkjy1isv6ws6hrcal75dxjz98rpnvqbm7agdcc6yv0c17wwh"; 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /system76-io-dkms/generic.nix: -------------------------------------------------------------------------------- 1 | {version, rev ? version, sha}: { stdenv, fetchFromGitHub, fetchpatch, kernel }: 2 | 3 | stdenv.mkDerivation { 4 | name = "system76-io-dkms-${version}"; 5 | version = "${version}"; 6 | 7 | src = fetchFromGitHub { 8 | owner = "pop-os"; 9 | repo = "system76-io-dkms"; 10 | inherit rev; 11 | sha256 = "${sha}"; 12 | }; 13 | 14 | hardeningDisable = [ "pic" ]; 15 | dontStrip = true; 16 | dontPatchELF = true; 17 | 18 | kernel = kernel.dev; 19 | nativeBuildInputs = kernel.moduleBuildDependencies; 20 | 21 | preBuild = '' 22 | sed -e "s@/lib/modules/\$(.*)@${kernel.dev}/lib/modules/${kernel.modDirVersion}@" -i Makefile 23 | ''; 24 | 25 | outputs = [ "out" ]; 26 | installPhase = '' 27 | mkdir -p $out/lib/modules/${kernel.modDirVersion}/misc 28 | cp system76-io.ko $out/lib/modules/${kernel.modDirVersion}/misc 29 | 30 | # not sure if these are working 31 | mkdir -p $out/usr/share/initramfs-tools/hooks 32 | cp {$src,$out}/usr/share/initramfs-tools/hooks/system76-io-dkms 33 | 34 | mkdir -p $out/usr/share/initramfs-tools/modules.d 35 | cp {$src,$out}/usr/share/initramfs-tools/modules.d/system76-io-dkms.conf 36 | ''; 37 | 38 | meta = with stdenv.lib; { 39 | maintainers = [ maintainers.khumba ]; 40 | platforms = [ "i686-linux" "x86_64-linux" ]; 41 | description = "DKMS module for controlling System76 Io board"; 42 | homepage = https://github.com/pop-os/system76-io-dkms; 43 | }; 44 | } 45 | --------------------------------------------------------------------------------